warp-lang 1.7.2__py3-none-win_amd64.whl → 1.8.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +3 -1
- warp/__init__.pyi +3489 -1
- warp/autograd.py +45 -122
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +241 -252
- warp/build_dll.py +125 -26
- warp/builtins.py +1907 -384
- warp/codegen.py +257 -101
- warp/config.py +12 -1
- warp/constants.py +1 -1
- warp/context.py +657 -223
- warp/dlpack.py +1 -1
- warp/examples/benchmarks/benchmark_cloth.py +2 -2
- warp/examples/benchmarks/benchmark_tile_sort.py +155 -0
- warp/examples/core/example_sample_mesh.py +1 -1
- warp/examples/core/example_spin_lock.py +93 -0
- warp/examples/core/example_work_queue.py +118 -0
- warp/examples/fem/example_adaptive_grid.py +5 -5
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_burgers.py +1 -1
- warp/examples/fem/example_convection_diffusion.py +9 -6
- warp/examples/fem/example_darcy_ls_optimization.py +489 -0
- warp/examples/fem/example_deformed_geometry.py +1 -1
- warp/examples/fem/example_diffusion.py +2 -2
- warp/examples/fem/example_diffusion_3d.py +1 -1
- warp/examples/fem/example_distortion_energy.py +1 -1
- warp/examples/fem/example_elastic_shape_optimization.py +387 -0
- warp/examples/fem/example_magnetostatics.py +5 -3
- warp/examples/fem/example_mixed_elasticity.py +5 -3
- warp/examples/fem/example_navier_stokes.py +11 -9
- warp/examples/fem/example_nonconforming_contact.py +5 -3
- warp/examples/fem/example_streamlines.py +8 -3
- warp/examples/fem/utils.py +9 -8
- warp/examples/interop/example_jax_ffi_callback.py +2 -2
- warp/examples/optim/example_drone.py +1 -1
- warp/examples/sim/example_cloth.py +1 -1
- warp/examples/sim/example_cloth_self_contact.py +48 -54
- warp/examples/tile/example_tile_block_cholesky.py +502 -0
- warp/examples/tile/example_tile_cholesky.py +2 -1
- warp/examples/tile/example_tile_convolution.py +1 -1
- warp/examples/tile/example_tile_filtering.py +1 -1
- warp/examples/tile/example_tile_matmul.py +1 -1
- warp/examples/tile/example_tile_mlp.py +2 -0
- warp/fabric.py +7 -7
- warp/fem/__init__.py +5 -0
- warp/fem/adaptivity.py +1 -1
- warp/fem/cache.py +152 -63
- warp/fem/dirichlet.py +2 -2
- warp/fem/domain.py +136 -6
- warp/fem/field/field.py +141 -99
- warp/fem/field/nodal_field.py +85 -39
- warp/fem/field/virtual.py +97 -52
- warp/fem/geometry/adaptive_nanogrid.py +91 -86
- warp/fem/geometry/closest_point.py +13 -0
- warp/fem/geometry/deformed_geometry.py +102 -40
- warp/fem/geometry/element.py +56 -2
- warp/fem/geometry/geometry.py +323 -22
- warp/fem/geometry/grid_2d.py +157 -62
- warp/fem/geometry/grid_3d.py +116 -20
- warp/fem/geometry/hexmesh.py +86 -20
- warp/fem/geometry/nanogrid.py +166 -86
- warp/fem/geometry/partition.py +59 -25
- warp/fem/geometry/quadmesh.py +86 -135
- warp/fem/geometry/tetmesh.py +47 -119
- warp/fem/geometry/trimesh.py +77 -270
- warp/fem/integrate.py +107 -52
- warp/fem/linalg.py +25 -58
- warp/fem/operator.py +124 -27
- warp/fem/quadrature/pic_quadrature.py +36 -14
- warp/fem/quadrature/quadrature.py +40 -16
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/basis_function_space.py +66 -46
- warp/fem/space/basis_space.py +17 -4
- warp/fem/space/dof_mapper.py +1 -1
- warp/fem/space/function_space.py +2 -2
- warp/fem/space/grid_2d_function_space.py +4 -1
- warp/fem/space/hexmesh_function_space.py +4 -2
- warp/fem/space/nanogrid_function_space.py +3 -1
- warp/fem/space/partition.py +11 -2
- warp/fem/space/quadmesh_function_space.py +4 -1
- warp/fem/space/restriction.py +5 -2
- warp/fem/space/shape/__init__.py +10 -8
- warp/fem/space/tetmesh_function_space.py +4 -1
- warp/fem/space/topology.py +52 -21
- warp/fem/space/trimesh_function_space.py +4 -1
- warp/fem/utils.py +53 -8
- warp/jax.py +1 -2
- warp/jax_experimental/ffi.py +12 -17
- warp/jax_experimental/xla_ffi.py +37 -24
- warp/math.py +171 -1
- warp/native/array.h +99 -0
- warp/native/builtin.h +174 -31
- warp/native/coloring.cpp +1 -1
- warp/native/exports.h +118 -63
- warp/native/intersect.h +3 -3
- warp/native/mat.h +5 -10
- warp/native/mathdx.cpp +11 -5
- warp/native/matnn.h +1 -123
- warp/native/quat.h +28 -4
- warp/native/sparse.cpp +121 -258
- warp/native/sparse.cu +181 -274
- warp/native/spatial.h +305 -17
- warp/native/tile.h +583 -72
- warp/native/tile_radix_sort.h +1108 -0
- warp/native/tile_reduce.h +237 -2
- warp/native/tile_scan.h +240 -0
- warp/native/tuple.h +189 -0
- warp/native/vec.h +6 -16
- warp/native/warp.cpp +36 -4
- warp/native/warp.cu +574 -51
- warp/native/warp.h +47 -74
- warp/optim/linear.py +5 -1
- warp/paddle.py +7 -8
- warp/py.typed +0 -0
- warp/render/render_opengl.py +58 -29
- warp/render/render_usd.py +124 -61
- warp/sim/__init__.py +9 -0
- warp/sim/collide.py +252 -78
- warp/sim/graph_coloring.py +8 -1
- warp/sim/import_mjcf.py +4 -3
- warp/sim/import_usd.py +11 -7
- warp/sim/integrator.py +5 -2
- warp/sim/integrator_euler.py +1 -1
- warp/sim/integrator_featherstone.py +1 -1
- warp/sim/integrator_vbd.py +751 -320
- warp/sim/integrator_xpbd.py +1 -1
- warp/sim/model.py +265 -260
- warp/sim/utils.py +10 -7
- warp/sparse.py +303 -166
- warp/tape.py +52 -51
- warp/tests/cuda/test_conditional_captures.py +1046 -0
- warp/tests/cuda/test_streams.py +1 -1
- warp/tests/geometry/test_volume.py +2 -2
- warp/tests/interop/test_dlpack.py +9 -9
- warp/tests/interop/test_jax.py +0 -1
- warp/tests/run_coverage_serial.py +1 -1
- warp/tests/sim/disabled_kinematics.py +2 -2
- warp/tests/sim/{test_vbd.py → test_cloth.py} +296 -113
- warp/tests/sim/test_collision.py +159 -51
- warp/tests/sim/test_coloring.py +15 -1
- warp/tests/test_array.py +254 -2
- warp/tests/test_array_reduce.py +2 -2
- warp/tests/test_atomic_cas.py +299 -0
- warp/tests/test_codegen.py +142 -19
- warp/tests/test_conditional.py +47 -1
- warp/tests/test_ctypes.py +0 -20
- warp/tests/test_devices.py +8 -0
- warp/tests/test_fabricarray.py +4 -2
- warp/tests/test_fem.py +58 -25
- warp/tests/test_func.py +42 -1
- warp/tests/test_grad.py +1 -1
- warp/tests/test_lerp.py +1 -3
- warp/tests/test_map.py +481 -0
- warp/tests/test_mat.py +1 -24
- warp/tests/test_quat.py +6 -15
- warp/tests/test_rounding.py +10 -38
- warp/tests/test_runlength_encode.py +7 -7
- warp/tests/test_smoothstep.py +1 -1
- warp/tests/test_sparse.py +51 -2
- warp/tests/test_spatial.py +507 -1
- warp/tests/test_struct.py +2 -2
- warp/tests/test_tuple.py +265 -0
- warp/tests/test_types.py +2 -2
- warp/tests/test_utils.py +24 -18
- warp/tests/tile/test_tile.py +420 -1
- warp/tests/tile/test_tile_mathdx.py +518 -14
- warp/tests/tile/test_tile_reduce.py +213 -0
- warp/tests/tile/test_tile_shared_memory.py +130 -1
- warp/tests/tile/test_tile_sort.py +117 -0
- warp/tests/unittest_suites.py +4 -6
- warp/types.py +462 -308
- warp/utils.py +647 -86
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/METADATA +20 -6
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/RECORD +178 -166
- warp/stubs.py +0 -3381
- warp/tests/sim/test_xpbd.py +0 -399
- warp/tests/test_mlp.py +0 -282
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/WHEEL +0 -0
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/licenses/LICENSE.md +0 -0
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/top_level.txt +0 -0
warp/render/render_usd.py
CHANGED
|
@@ -80,7 +80,7 @@ class UsdRenderer:
|
|
|
80
80
|
"""A USD renderer"""
|
|
81
81
|
|
|
82
82
|
def __init__(self, stage, up_axis="Y", fps=60, scaling=1.0):
|
|
83
|
-
"""Construct a UsdRenderer object
|
|
83
|
+
"""Construct a UsdRenderer object.
|
|
84
84
|
|
|
85
85
|
Args:
|
|
86
86
|
model: A simulation model
|
|
@@ -173,12 +173,13 @@ class UsdRenderer:
|
|
|
173
173
|
def add_shape_instance(
|
|
174
174
|
self,
|
|
175
175
|
name: str,
|
|
176
|
-
shape,
|
|
176
|
+
shape: int,
|
|
177
177
|
body,
|
|
178
178
|
pos: tuple,
|
|
179
179
|
rot: tuple,
|
|
180
180
|
scale: tuple = (1.0, 1.0, 1.0),
|
|
181
|
-
|
|
181
|
+
color1=None,
|
|
182
|
+
color2=None,
|
|
182
183
|
custom_index: int = -1,
|
|
183
184
|
visible: bool = True,
|
|
184
185
|
):
|
|
@@ -201,12 +202,15 @@ class UsdRenderer:
|
|
|
201
202
|
rot: tuple,
|
|
202
203
|
width: float,
|
|
203
204
|
length: float,
|
|
204
|
-
color: tuple =
|
|
205
|
-
|
|
205
|
+
color: tuple[float, float, float] = (1.0, 1.0, 1.0),
|
|
206
|
+
color2=None,
|
|
207
|
+
parent_body: str | None = None,
|
|
206
208
|
is_template: bool = False,
|
|
209
|
+
u_scaling: float = 1.0,
|
|
210
|
+
v_scaling: float = 1.0,
|
|
211
|
+
visible: bool = True,
|
|
207
212
|
):
|
|
208
|
-
"""
|
|
209
|
-
Render a plane with the given dimensions.
|
|
213
|
+
"""Render a plane with the given dimensions.
|
|
210
214
|
|
|
211
215
|
Args:
|
|
212
216
|
name: Name of the plane
|
|
@@ -254,6 +258,7 @@ class UsdRenderer:
|
|
|
254
258
|
if not is_template:
|
|
255
259
|
_usd_set_xform(plane, pos, rot, (1.0, 1.0, 1.0), 0.0)
|
|
256
260
|
|
|
261
|
+
plane.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
257
262
|
return prim_path
|
|
258
263
|
|
|
259
264
|
def render_ground(self, size: float = 100.0, plane=None):
|
|
@@ -302,9 +307,10 @@ class UsdRenderer:
|
|
|
302
307
|
pos: tuple,
|
|
303
308
|
rot: tuple,
|
|
304
309
|
radius: float,
|
|
305
|
-
parent_body: str = None,
|
|
310
|
+
parent_body: str | None = None,
|
|
306
311
|
is_template: bool = False,
|
|
307
|
-
color: tuple = None,
|
|
312
|
+
color: tuple[float, float, float] | None = None,
|
|
313
|
+
visible: bool = True,
|
|
308
314
|
):
|
|
309
315
|
"""Debug helper to add a sphere for visualization
|
|
310
316
|
|
|
@@ -343,6 +349,7 @@ class UsdRenderer:
|
|
|
343
349
|
if not is_template:
|
|
344
350
|
_usd_set_xform(sphere, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
345
351
|
|
|
352
|
+
sphere.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
346
353
|
return prim_path
|
|
347
354
|
|
|
348
355
|
def render_capsule(
|
|
@@ -352,12 +359,13 @@ class UsdRenderer:
|
|
|
352
359
|
rot: tuple,
|
|
353
360
|
radius: float,
|
|
354
361
|
half_height: float,
|
|
355
|
-
parent_body: str = None,
|
|
362
|
+
parent_body: str | None = None,
|
|
356
363
|
is_template: bool = False,
|
|
357
|
-
|
|
364
|
+
up_axis: int = 1,
|
|
365
|
+
color: tuple[float, float, float] | None = None,
|
|
366
|
+
visible: bool = True,
|
|
358
367
|
):
|
|
359
|
-
"""
|
|
360
|
-
Debug helper to add a capsule for visualization
|
|
368
|
+
"""Debug helper to add a capsule for visualization
|
|
361
369
|
|
|
362
370
|
Args:
|
|
363
371
|
pos: The position of the capsule
|
|
@@ -387,7 +395,7 @@ class UsdRenderer:
|
|
|
387
395
|
|
|
388
396
|
capsule.GetRadiusAttr().Set(float(radius))
|
|
389
397
|
capsule.GetHeightAttr().Set(float(half_height * 2.0))
|
|
390
|
-
capsule.GetAxisAttr().Set(
|
|
398
|
+
capsule.GetAxisAttr().Set(UP_AXIS_TOKEN[up_axis])
|
|
391
399
|
|
|
392
400
|
if color is not None:
|
|
393
401
|
capsule.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
@@ -397,6 +405,7 @@ class UsdRenderer:
|
|
|
397
405
|
if not is_template:
|
|
398
406
|
_usd_set_xform(capsule, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
399
407
|
|
|
408
|
+
capsule.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
400
409
|
return prim_path
|
|
401
410
|
|
|
402
411
|
def render_cylinder(
|
|
@@ -406,12 +415,13 @@ class UsdRenderer:
|
|
|
406
415
|
rot: tuple,
|
|
407
416
|
radius: float,
|
|
408
417
|
half_height: float,
|
|
409
|
-
parent_body: str = None,
|
|
418
|
+
parent_body: str | None = None,
|
|
410
419
|
is_template: bool = False,
|
|
411
|
-
|
|
420
|
+
up_axis: int = 1,
|
|
421
|
+
color: tuple[float, float, float] | None = None,
|
|
422
|
+
visible: bool = True,
|
|
412
423
|
):
|
|
413
|
-
"""
|
|
414
|
-
Debug helper to add a cylinder for visualization
|
|
424
|
+
"""Debug helper to add a cylinder for visualization
|
|
415
425
|
|
|
416
426
|
Args:
|
|
417
427
|
pos: The position of the cylinder
|
|
@@ -441,7 +451,7 @@ class UsdRenderer:
|
|
|
441
451
|
|
|
442
452
|
cylinder.GetRadiusAttr().Set(float(radius))
|
|
443
453
|
cylinder.GetHeightAttr().Set(float(half_height * 2.0))
|
|
444
|
-
cylinder.GetAxisAttr().Set(
|
|
454
|
+
cylinder.GetAxisAttr().Set(UP_AXIS_TOKEN[up_axis])
|
|
445
455
|
|
|
446
456
|
if color is not None:
|
|
447
457
|
cylinder.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
@@ -451,6 +461,7 @@ class UsdRenderer:
|
|
|
451
461
|
if not is_template:
|
|
452
462
|
_usd_set_xform(cylinder, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
453
463
|
|
|
464
|
+
cylinder.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
454
465
|
return prim_path
|
|
455
466
|
|
|
456
467
|
def render_cone(
|
|
@@ -460,12 +471,13 @@ class UsdRenderer:
|
|
|
460
471
|
rot: tuple,
|
|
461
472
|
radius: float,
|
|
462
473
|
half_height: float,
|
|
463
|
-
parent_body: str = None,
|
|
474
|
+
parent_body: str | None = None,
|
|
464
475
|
is_template: bool = False,
|
|
465
|
-
|
|
476
|
+
up_axis: int = 1,
|
|
477
|
+
color: tuple[float, float, float] | None = None,
|
|
478
|
+
visible: bool = True,
|
|
466
479
|
):
|
|
467
|
-
"""
|
|
468
|
-
Debug helper to add a cone for visualization
|
|
480
|
+
"""Debug helper to add a cone for visualization
|
|
469
481
|
|
|
470
482
|
Args:
|
|
471
483
|
pos: The position of the cone
|
|
@@ -495,7 +507,7 @@ class UsdRenderer:
|
|
|
495
507
|
|
|
496
508
|
cone.GetRadiusAttr().Set(float(radius))
|
|
497
509
|
cone.GetHeightAttr().Set(float(half_height * 2.0))
|
|
498
|
-
cone.GetAxisAttr().Set(
|
|
510
|
+
cone.GetAxisAttr().Set(UP_AXIS_TOKEN[up_axis])
|
|
499
511
|
|
|
500
512
|
if color is not None:
|
|
501
513
|
cone.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
@@ -505,6 +517,7 @@ class UsdRenderer:
|
|
|
505
517
|
if not is_template:
|
|
506
518
|
_usd_set_xform(cone, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
507
519
|
|
|
520
|
+
cone.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
508
521
|
return prim_path
|
|
509
522
|
|
|
510
523
|
def render_box(
|
|
@@ -513,9 +526,10 @@ class UsdRenderer:
|
|
|
513
526
|
pos: tuple,
|
|
514
527
|
rot: tuple,
|
|
515
528
|
extents: tuple,
|
|
516
|
-
parent_body: str = None,
|
|
529
|
+
parent_body: str | None = None,
|
|
517
530
|
is_template: bool = False,
|
|
518
|
-
color: tuple = None,
|
|
531
|
+
color: tuple[float, float, float] | None = None,
|
|
532
|
+
visible: bool = True,
|
|
519
533
|
):
|
|
520
534
|
"""Debug helper to add a box for visualization
|
|
521
535
|
|
|
@@ -553,9 +567,10 @@ class UsdRenderer:
|
|
|
553
567
|
if not is_template:
|
|
554
568
|
_usd_set_xform(cube, pos, rot, extents, self.time)
|
|
555
569
|
|
|
570
|
+
cube.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
556
571
|
return prim_path
|
|
557
572
|
|
|
558
|
-
def render_ref(self, name: str, path: str, pos: tuple, rot: tuple, scale: tuple, color: tuple = None):
|
|
573
|
+
def render_ref(self, name: str, path: str, pos: tuple, rot: tuple, scale: tuple, color: tuple | None = None):
|
|
559
574
|
from pxr import Gf, Usd, UsdGeom
|
|
560
575
|
|
|
561
576
|
ref_path = "/root/" + name
|
|
@@ -586,8 +601,10 @@ class UsdRenderer:
|
|
|
586
601
|
rot=(0.0, 0.0, 0.0, 1.0),
|
|
587
602
|
scale=(1.0, 1.0, 1.0),
|
|
588
603
|
update_topology=False,
|
|
589
|
-
parent_body: str = None,
|
|
604
|
+
parent_body: str | None = None,
|
|
590
605
|
is_template: bool = False,
|
|
606
|
+
smooth_shading: bool = True,
|
|
607
|
+
visible: bool = True,
|
|
591
608
|
):
|
|
592
609
|
from pxr import Sdf, UsdGeom
|
|
593
610
|
|
|
@@ -635,6 +652,7 @@ class UsdRenderer:
|
|
|
635
652
|
if not is_template:
|
|
636
653
|
_usd_set_xform(mesh, pos, rot, scale, self.time)
|
|
637
654
|
|
|
655
|
+
mesh.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
638
656
|
return prim_path
|
|
639
657
|
|
|
640
658
|
def render_arrow(
|
|
@@ -644,12 +662,12 @@ class UsdRenderer:
|
|
|
644
662
|
rot: tuple,
|
|
645
663
|
base_radius: float,
|
|
646
664
|
base_height: float,
|
|
647
|
-
cap_radius: float = None,
|
|
648
|
-
cap_height: float = None,
|
|
649
|
-
parent_body: str = None,
|
|
665
|
+
cap_radius: float | None = None,
|
|
666
|
+
cap_height: float | None = None,
|
|
667
|
+
parent_body: str | None = None,
|
|
650
668
|
is_template: bool = False,
|
|
651
669
|
up_axis: int = 1,
|
|
652
|
-
color: tuple[float, float, float] = None,
|
|
670
|
+
color: tuple[float, float, float] | None = None,
|
|
653
671
|
visible: bool = True,
|
|
654
672
|
):
|
|
655
673
|
from pxr import Gf, Sdf, UsdGeom
|
|
@@ -709,7 +727,7 @@ class UsdRenderer:
|
|
|
709
727
|
name: str,
|
|
710
728
|
vertices,
|
|
711
729
|
indices,
|
|
712
|
-
color: tuple = None,
|
|
730
|
+
color: tuple[float, float, float] | None = None,
|
|
713
731
|
radius: float = 0.01,
|
|
714
732
|
visible: bool = True,
|
|
715
733
|
):
|
|
@@ -762,9 +780,18 @@ class UsdRenderer:
|
|
|
762
780
|
instancer.GetScalesAttr().Set(line_scales, self.time)
|
|
763
781
|
instancer.GetProtoIndicesAttr().Set([0] * num_lines, self.time)
|
|
764
782
|
|
|
765
|
-
|
|
783
|
+
# instancer.GetPrimvar("displayColor").Set(line_colors, time)
|
|
784
|
+
|
|
785
|
+
instancer.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
766
786
|
|
|
767
|
-
def render_line_strip(
|
|
787
|
+
def render_line_strip(
|
|
788
|
+
self,
|
|
789
|
+
name: str,
|
|
790
|
+
vertices,
|
|
791
|
+
color: tuple[float, float, float] | None = None,
|
|
792
|
+
radius: float = 0.01,
|
|
793
|
+
visible: bool = True,
|
|
794
|
+
):
|
|
768
795
|
from pxr import Gf, UsdGeom
|
|
769
796
|
|
|
770
797
|
num_lines = int(len(vertices) - 1)
|
|
@@ -807,44 +834,80 @@ class UsdRenderer:
|
|
|
807
834
|
instancer_capsule = UsdGeom.Capsule.Get(self.stage, instancer.GetPath().AppendChild("capsule"))
|
|
808
835
|
instancer_capsule.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
809
836
|
|
|
837
|
+
instancer.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
838
|
+
|
|
810
839
|
def render_points(self, name: str, points, radius, colors=None, as_spheres: bool = True, visible: bool = True):
|
|
811
|
-
from pxr import
|
|
840
|
+
from pxr import Sdf, UsdGeom, Vt
|
|
812
841
|
|
|
813
|
-
instancer_path = self.
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
842
|
+
instancer_path = self._resolve_path(name)
|
|
843
|
+
|
|
844
|
+
if np.isscalar(radius):
|
|
845
|
+
radius_interp = "constant"
|
|
846
|
+
else:
|
|
847
|
+
radius_interp = "vertex"
|
|
848
|
+
|
|
849
|
+
if colors is None:
|
|
850
|
+
color_interp = "constant"
|
|
851
|
+
elif len(colors) == 3 and all(np.isscalar(x) for x in colors):
|
|
852
|
+
color_interp = "constant"
|
|
853
|
+
is_single_color = True
|
|
854
|
+
else:
|
|
855
|
+
color_interp = "vertex"
|
|
856
|
+
is_single_color = False
|
|
857
|
+
|
|
858
|
+
if as_spheres:
|
|
859
|
+
instancer = UsdGeom.PointInstancer.Get(self.stage, instancer_path)
|
|
860
|
+
if not instancer:
|
|
818
861
|
instancer = UsdGeom.PointInstancer.Define(self.stage, instancer_path)
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
instancer.GetScalesAttr().Set(np.tile(radius, (3, 1)).T)
|
|
862
|
+
sphere = UsdGeom.Sphere.Define(self.stage, instancer.GetPath().AppendChild("sphere"))
|
|
863
|
+
primvar_api = UsdGeom.PrimvarsAPI(instancer)
|
|
864
|
+
|
|
865
|
+
instancer.CreatePrototypesRel().SetTargets((sphere.GetPath(),))
|
|
866
|
+
instancer.CreateProtoIndicesAttr().Set(Vt.IntArray((0,) * len(points)))
|
|
825
867
|
|
|
826
868
|
if colors is not None:
|
|
827
|
-
|
|
869
|
+
primvar_api.CreatePrimvar("displayColor", Sdf.ValueTypeNames.Color3fArray, color_interp, 1)
|
|
828
870
|
|
|
829
|
-
|
|
830
|
-
instancer.CreateProtoIndicesAttr().Set(Vt.IntArray((0,) * len(points)))
|
|
871
|
+
instancer.GetPositionsAttr().Set(points, self.time)
|
|
831
872
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
instancer.GetOrientationsAttr().Set(quats, self.time)
|
|
873
|
+
if radius_interp == "constant":
|
|
874
|
+
radius = np.tile(radius, (3, len(points))).T
|
|
835
875
|
else:
|
|
836
|
-
|
|
876
|
+
radius = np.tile(radius, (3, 1)).T
|
|
837
877
|
|
|
838
|
-
|
|
839
|
-
instancer.GetWidthsAttr().Set([radius * 2.0] * len(points))
|
|
840
|
-
else:
|
|
841
|
-
instancer.GetWidthsAttr().Set(radius * 2.0)
|
|
878
|
+
instancer.GetScalesAttr().Set(radius, self.time)
|
|
842
879
|
|
|
843
|
-
|
|
844
|
-
|
|
880
|
+
if colors is not None:
|
|
881
|
+
if is_single_color:
|
|
882
|
+
colors = (colors,)
|
|
883
|
+
|
|
884
|
+
primvar_api = UsdGeom.PrimvarsAPI(instancer)
|
|
885
|
+
primvar_api.GetPrimvar("displayColor").Set(colors, self.time)
|
|
845
886
|
else:
|
|
887
|
+
instancer = UsdGeom.Points.Get(self.stage, instancer_path)
|
|
888
|
+
if not instancer:
|
|
889
|
+
instancer = UsdGeom.Points.Define(self.stage, instancer_path)
|
|
890
|
+
|
|
891
|
+
UsdGeom.Primvar(instancer.GetWidthsAttr()).SetInterpolation(radius_interp)
|
|
892
|
+
UsdGeom.Primvar(instancer.GetDisplayColorAttr()).SetInterpolation(color_interp)
|
|
893
|
+
|
|
846
894
|
instancer.GetPointsAttr().Set(points, self.time)
|
|
847
|
-
|
|
895
|
+
|
|
896
|
+
if np.isscalar(radius):
|
|
897
|
+
widths = (radius * 2.0,)
|
|
898
|
+
else:
|
|
899
|
+
widths = np.array(radius) * 2.0
|
|
900
|
+
|
|
901
|
+
instancer.GetWidthsAttr().Set(widths, self.time)
|
|
902
|
+
|
|
903
|
+
if colors is not None:
|
|
904
|
+
if len(colors) == 3:
|
|
905
|
+
colors = (colors,)
|
|
906
|
+
|
|
907
|
+
instancer.GetDisplayColorAttr().Set(colors, self.time)
|
|
908
|
+
|
|
909
|
+
instancer.GetVisibilityAttr().Set("inherited" if visible else "invisible", self.time)
|
|
910
|
+
return instancer.GetPath()
|
|
848
911
|
|
|
849
912
|
def update_body_transforms(self, body_q):
|
|
850
913
|
from pxr import Sdf, UsdGeom
|
warp/sim/__init__.py
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
from warp.utils import warn
|
|
17
|
+
|
|
16
18
|
from .articulation import eval_fk, eval_ik
|
|
17
19
|
from .collide import collide
|
|
18
20
|
from .import_mjcf import parse_mjcf
|
|
@@ -63,3 +65,10 @@ from .utils import (
|
|
|
63
65
|
quat_to_euler,
|
|
64
66
|
velocity_at_point,
|
|
65
67
|
)
|
|
68
|
+
|
|
69
|
+
warn(
|
|
70
|
+
"The `warp.sim` module is deprecated and will be removed in v1.10. "
|
|
71
|
+
"Please transition to using the forthcoming Newton library instead.",
|
|
72
|
+
DeprecationWarning,
|
|
73
|
+
stacklevel=2,
|
|
74
|
+
)
|