Fixing USD pipeline after copybara changes
This commit is contained in:
@@ -392,8 +392,14 @@ class USDPrimitiveMesh(USDObject):
|
|||||||
if self.geom.size[1] > 0:
|
if self.geom.size[1] > 0:
|
||||||
t_scale *= self.geom.size[1]
|
t_scale *= self.geom.size[1]
|
||||||
|
|
||||||
mesh_texcoord[:, 0] *= s_scale / (self.geom.size[0] * 2)
|
s_size, t_size = self.geom.size[:2]
|
||||||
mesh_texcoord[:, 1] *= t_scale / (self.geom.size[1] * 2)
|
if self.geom.type == mujoco.mjtGeom.mjGEOM_PLANE:
|
||||||
|
s_size = s_size if s_size > 0 else 1
|
||||||
|
t_size = t_size if t_size > 0 else 1
|
||||||
|
|
||||||
|
if self.model.mat_texuniform[self.geom.matid]:
|
||||||
|
mesh_texcoord[:, 0] *= s_scale / (s_size * 2)
|
||||||
|
mesh_texcoord[:, 1] *= t_scale / (t_size * 2)
|
||||||
|
|
||||||
return mesh_texcoord, mesh_facetexcoord.flatten()
|
return mesh_texcoord, mesh_facetexcoord.flatten()
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ def get_triangle_uvs(
|
|||||||
texture_type: Optional[mujoco.mjtTexture]
|
texture_type: Optional[mujoco.mjtTexture]
|
||||||
):
|
):
|
||||||
"""Returns UV coordinates for a given mesh."""
|
"""Returns UV coordinates for a given mesh."""
|
||||||
if not texture_type:
|
if texture_type is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
triangle_uvs = []
|
triangle_uvs = []
|
||||||
@@ -110,7 +110,7 @@ class TriangleMesh:
|
|||||||
height: float,
|
height: float,
|
||||||
depth: float,
|
depth: float,
|
||||||
texture_type: Optional[mujoco.mjtTexture]
|
texture_type: Optional[mujoco.mjtTexture]
|
||||||
) -> TriangleMesh:
|
) -> "TriangleMesh":
|
||||||
"""Creates a box."""
|
"""Creates a box."""
|
||||||
vertices = np.array([[0.0, 0.0, 0.0],
|
vertices = np.array([[0.0, 0.0, 0.0],
|
||||||
[width, 0.0, 0.0],
|
[width, 0.0, 0.0],
|
||||||
@@ -144,7 +144,7 @@ class TriangleMesh:
|
|||||||
radius: float,
|
radius: float,
|
||||||
texture_type: Optional[mujoco.mjtTexture],
|
texture_type: Optional[mujoco.mjtTexture],
|
||||||
resolution: int
|
resolution: int
|
||||||
) -> TriangleMesh:
|
) -> "TriangleMesh":
|
||||||
"""Creates a sphere."""
|
"""Creates a sphere."""
|
||||||
vertices = []
|
vertices = []
|
||||||
triangles = []
|
triangles = []
|
||||||
@@ -178,7 +178,7 @@ class TriangleMesh:
|
|||||||
radius: float,
|
radius: float,
|
||||||
texture_type: Optional[mujoco.mjtTexture],
|
texture_type: Optional[mujoco.mjtTexture],
|
||||||
resolution: int,
|
resolution: int,
|
||||||
) -> TriangleMesh:
|
) -> "TriangleMesh":
|
||||||
"""Creates a hemisphere."""
|
"""Creates a hemisphere."""
|
||||||
vertices = []
|
vertices = []
|
||||||
triangles = []
|
triangles = []
|
||||||
@@ -218,7 +218,7 @@ class TriangleMesh:
|
|||||||
height: float,
|
height: float,
|
||||||
texture_type: Optional[mujoco.mjtTexture],
|
texture_type: Optional[mujoco.mjtTexture],
|
||||||
resolution: int
|
resolution: int
|
||||||
) -> TriangleMesh:
|
) -> "TriangleMesh":
|
||||||
"""Creates a cylinder."""
|
"""Creates a cylinder."""
|
||||||
vertices = []
|
vertices = []
|
||||||
triangles = []
|
triangles = []
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
"""Utility functions for USD exporter."""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user