warp-lang 1.10.0__py3-none-macosx_11_0_arm64.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 +334 -0
- warp/__init__.pyi +5856 -0
- warp/_src/__init__.py +14 -0
- warp/_src/autograd.py +1077 -0
- warp/_src/build.py +620 -0
- warp/_src/build_dll.py +642 -0
- warp/_src/builtins.py +10555 -0
- warp/_src/codegen.py +4361 -0
- warp/_src/config.py +178 -0
- warp/_src/constants.py +59 -0
- warp/_src/context.py +8352 -0
- warp/_src/dlpack.py +464 -0
- warp/_src/fabric.py +362 -0
- warp/_src/fem/__init__.py +14 -0
- warp/_src/fem/adaptivity.py +510 -0
- warp/_src/fem/cache.py +689 -0
- warp/_src/fem/dirichlet.py +190 -0
- warp/_src/fem/domain.py +553 -0
- warp/_src/fem/field/__init__.py +131 -0
- warp/_src/fem/field/field.py +703 -0
- warp/_src/fem/field/nodal_field.py +403 -0
- warp/_src/fem/field/restriction.py +39 -0
- warp/_src/fem/field/virtual.py +1021 -0
- warp/_src/fem/geometry/__init__.py +32 -0
- warp/_src/fem/geometry/adaptive_nanogrid.py +782 -0
- warp/_src/fem/geometry/closest_point.py +99 -0
- warp/_src/fem/geometry/deformed_geometry.py +277 -0
- warp/_src/fem/geometry/element.py +854 -0
- warp/_src/fem/geometry/geometry.py +693 -0
- warp/_src/fem/geometry/grid_2d.py +478 -0
- warp/_src/fem/geometry/grid_3d.py +539 -0
- warp/_src/fem/geometry/hexmesh.py +956 -0
- warp/_src/fem/geometry/nanogrid.py +660 -0
- warp/_src/fem/geometry/partition.py +483 -0
- warp/_src/fem/geometry/quadmesh.py +597 -0
- warp/_src/fem/geometry/tetmesh.py +762 -0
- warp/_src/fem/geometry/trimesh.py +588 -0
- warp/_src/fem/integrate.py +2507 -0
- warp/_src/fem/linalg.py +385 -0
- warp/_src/fem/operator.py +398 -0
- warp/_src/fem/polynomial.py +231 -0
- warp/_src/fem/quadrature/__init__.py +17 -0
- warp/_src/fem/quadrature/pic_quadrature.py +318 -0
- warp/_src/fem/quadrature/quadrature.py +665 -0
- warp/_src/fem/space/__init__.py +248 -0
- warp/_src/fem/space/basis_function_space.py +499 -0
- warp/_src/fem/space/basis_space.py +681 -0
- warp/_src/fem/space/dof_mapper.py +253 -0
- warp/_src/fem/space/function_space.py +312 -0
- warp/_src/fem/space/grid_2d_function_space.py +179 -0
- warp/_src/fem/space/grid_3d_function_space.py +229 -0
- warp/_src/fem/space/hexmesh_function_space.py +255 -0
- warp/_src/fem/space/nanogrid_function_space.py +199 -0
- warp/_src/fem/space/partition.py +435 -0
- warp/_src/fem/space/quadmesh_function_space.py +222 -0
- warp/_src/fem/space/restriction.py +221 -0
- warp/_src/fem/space/shape/__init__.py +152 -0
- warp/_src/fem/space/shape/cube_shape_function.py +1107 -0
- warp/_src/fem/space/shape/shape_function.py +134 -0
- warp/_src/fem/space/shape/square_shape_function.py +928 -0
- warp/_src/fem/space/shape/tet_shape_function.py +829 -0
- warp/_src/fem/space/shape/triangle_shape_function.py +674 -0
- warp/_src/fem/space/tetmesh_function_space.py +270 -0
- warp/_src/fem/space/topology.py +461 -0
- warp/_src/fem/space/trimesh_function_space.py +193 -0
- warp/_src/fem/types.py +114 -0
- warp/_src/fem/utils.py +488 -0
- warp/_src/jax.py +188 -0
- warp/_src/jax_experimental/__init__.py +14 -0
- warp/_src/jax_experimental/custom_call.py +389 -0
- warp/_src/jax_experimental/ffi.py +1286 -0
- warp/_src/jax_experimental/xla_ffi.py +658 -0
- warp/_src/marching_cubes.py +710 -0
- warp/_src/math.py +416 -0
- warp/_src/optim/__init__.py +14 -0
- warp/_src/optim/adam.py +165 -0
- warp/_src/optim/linear.py +1608 -0
- warp/_src/optim/sgd.py +114 -0
- warp/_src/paddle.py +408 -0
- warp/_src/render/__init__.py +14 -0
- warp/_src/render/imgui_manager.py +291 -0
- warp/_src/render/render_opengl.py +3638 -0
- warp/_src/render/render_usd.py +939 -0
- warp/_src/render/utils.py +162 -0
- warp/_src/sparse.py +2718 -0
- warp/_src/tape.py +1208 -0
- warp/_src/thirdparty/__init__.py +0 -0
- warp/_src/thirdparty/appdirs.py +598 -0
- warp/_src/thirdparty/dlpack.py +145 -0
- warp/_src/thirdparty/unittest_parallel.py +676 -0
- warp/_src/torch.py +393 -0
- warp/_src/types.py +5888 -0
- warp/_src/utils.py +1695 -0
- warp/autograd.py +33 -0
- warp/bin/libwarp-clang.dylib +0 -0
- warp/bin/libwarp.dylib +0 -0
- warp/build.py +29 -0
- warp/build_dll.py +24 -0
- warp/codegen.py +24 -0
- warp/constants.py +24 -0
- warp/context.py +33 -0
- warp/dlpack.py +24 -0
- warp/examples/__init__.py +24 -0
- warp/examples/assets/bear.usd +0 -0
- warp/examples/assets/bunny.usd +0 -0
- warp/examples/assets/cube.usd +0 -0
- warp/examples/assets/nonuniform.usd +0 -0
- warp/examples/assets/nvidia_logo.png +0 -0
- warp/examples/assets/pixel.jpg +0 -0
- warp/examples/assets/rocks.nvdb +0 -0
- warp/examples/assets/rocks.usd +0 -0
- warp/examples/assets/sphere.usd +0 -0
- warp/examples/assets/square_cloth.usd +0 -0
- warp/examples/benchmarks/benchmark_api.py +389 -0
- warp/examples/benchmarks/benchmark_cloth.py +296 -0
- warp/examples/benchmarks/benchmark_cloth_cupy.py +96 -0
- warp/examples/benchmarks/benchmark_cloth_jax.py +105 -0
- warp/examples/benchmarks/benchmark_cloth_numba.py +161 -0
- warp/examples/benchmarks/benchmark_cloth_numpy.py +85 -0
- warp/examples/benchmarks/benchmark_cloth_paddle.py +94 -0
- warp/examples/benchmarks/benchmark_cloth_pytorch.py +94 -0
- warp/examples/benchmarks/benchmark_cloth_taichi.py +120 -0
- warp/examples/benchmarks/benchmark_cloth_warp.py +153 -0
- warp/examples/benchmarks/benchmark_gemm.py +164 -0
- warp/examples/benchmarks/benchmark_interop_paddle.py +166 -0
- warp/examples/benchmarks/benchmark_interop_torch.py +166 -0
- warp/examples/benchmarks/benchmark_launches.py +301 -0
- warp/examples/benchmarks/benchmark_tile_load_store.py +103 -0
- warp/examples/benchmarks/benchmark_tile_sort.py +155 -0
- warp/examples/browse.py +37 -0
- warp/examples/core/example_cupy.py +86 -0
- warp/examples/core/example_dem.py +241 -0
- warp/examples/core/example_fluid.py +299 -0
- warp/examples/core/example_graph_capture.py +150 -0
- warp/examples/core/example_marching_cubes.py +195 -0
- warp/examples/core/example_mesh.py +180 -0
- warp/examples/core/example_mesh_intersect.py +211 -0
- warp/examples/core/example_nvdb.py +182 -0
- warp/examples/core/example_raycast.py +111 -0
- warp/examples/core/example_raymarch.py +205 -0
- warp/examples/core/example_render_opengl.py +290 -0
- warp/examples/core/example_sample_mesh.py +300 -0
- warp/examples/core/example_sph.py +411 -0
- warp/examples/core/example_spin_lock.py +93 -0
- warp/examples/core/example_torch.py +211 -0
- warp/examples/core/example_wave.py +269 -0
- warp/examples/core/example_work_queue.py +118 -0
- warp/examples/distributed/example_jacobi_mpi.py +506 -0
- warp/examples/fem/example_adaptive_grid.py +286 -0
- warp/examples/fem/example_apic_fluid.py +469 -0
- warp/examples/fem/example_burgers.py +261 -0
- warp/examples/fem/example_convection_diffusion.py +181 -0
- warp/examples/fem/example_convection_diffusion_dg.py +225 -0
- warp/examples/fem/example_darcy_ls_optimization.py +489 -0
- warp/examples/fem/example_deformed_geometry.py +172 -0
- warp/examples/fem/example_diffusion.py +196 -0
- warp/examples/fem/example_diffusion_3d.py +225 -0
- warp/examples/fem/example_diffusion_mgpu.py +225 -0
- warp/examples/fem/example_distortion_energy.py +228 -0
- warp/examples/fem/example_elastic_shape_optimization.py +387 -0
- warp/examples/fem/example_magnetostatics.py +242 -0
- warp/examples/fem/example_mixed_elasticity.py +293 -0
- warp/examples/fem/example_navier_stokes.py +263 -0
- warp/examples/fem/example_nonconforming_contact.py +300 -0
- warp/examples/fem/example_stokes.py +213 -0
- warp/examples/fem/example_stokes_transfer.py +262 -0
- warp/examples/fem/example_streamlines.py +357 -0
- warp/examples/fem/utils.py +1047 -0
- warp/examples/interop/example_jax_callable.py +146 -0
- warp/examples/interop/example_jax_ffi_callback.py +132 -0
- warp/examples/interop/example_jax_kernel.py +232 -0
- warp/examples/optim/example_diffray.py +561 -0
- warp/examples/optim/example_fluid_checkpoint.py +497 -0
- warp/examples/tile/example_tile_block_cholesky.py +502 -0
- warp/examples/tile/example_tile_cholesky.py +88 -0
- warp/examples/tile/example_tile_convolution.py +66 -0
- warp/examples/tile/example_tile_fft.py +55 -0
- warp/examples/tile/example_tile_filtering.py +113 -0
- warp/examples/tile/example_tile_matmul.py +85 -0
- warp/examples/tile/example_tile_mcgp.py +191 -0
- warp/examples/tile/example_tile_mlp.py +385 -0
- warp/examples/tile/example_tile_nbody.py +199 -0
- warp/fabric.py +24 -0
- warp/fem/__init__.py +173 -0
- warp/fem/adaptivity.py +26 -0
- warp/fem/cache.py +30 -0
- warp/fem/dirichlet.py +24 -0
- warp/fem/field/__init__.py +24 -0
- warp/fem/field/field.py +26 -0
- warp/fem/geometry/__init__.py +21 -0
- warp/fem/geometry/closest_point.py +31 -0
- warp/fem/linalg.py +38 -0
- warp/fem/operator.py +32 -0
- warp/fem/polynomial.py +29 -0
- warp/fem/space/__init__.py +22 -0
- warp/fem/space/basis_space.py +24 -0
- warp/fem/space/shape/__init__.py +68 -0
- warp/fem/space/topology.py +24 -0
- warp/fem/types.py +24 -0
- warp/fem/utils.py +32 -0
- warp/jax.py +29 -0
- warp/jax_experimental/__init__.py +29 -0
- warp/jax_experimental/custom_call.py +29 -0
- warp/jax_experimental/ffi.py +39 -0
- warp/jax_experimental/xla_ffi.py +24 -0
- warp/marching_cubes.py +24 -0
- warp/math.py +37 -0
- warp/native/array.h +1687 -0
- warp/native/builtin.h +2327 -0
- warp/native/bvh.cpp +562 -0
- warp/native/bvh.cu +826 -0
- warp/native/bvh.h +555 -0
- warp/native/clang/clang.cpp +541 -0
- warp/native/coloring.cpp +622 -0
- warp/native/crt.cpp +51 -0
- warp/native/crt.h +568 -0
- warp/native/cuda_crt.h +1058 -0
- warp/native/cuda_util.cpp +677 -0
- warp/native/cuda_util.h +313 -0
- warp/native/error.cpp +77 -0
- warp/native/error.h +36 -0
- warp/native/exports.h +2023 -0
- warp/native/fabric.h +246 -0
- warp/native/hashgrid.cpp +311 -0
- warp/native/hashgrid.cu +89 -0
- warp/native/hashgrid.h +240 -0
- warp/native/initializer_array.h +41 -0
- warp/native/intersect.h +1253 -0
- warp/native/intersect_adj.h +375 -0
- warp/native/intersect_tri.h +348 -0
- warp/native/mat.h +5189 -0
- warp/native/mathdx.cpp +93 -0
- warp/native/matnn.h +221 -0
- warp/native/mesh.cpp +266 -0
- warp/native/mesh.cu +406 -0
- warp/native/mesh.h +2097 -0
- warp/native/nanovdb/GridHandle.h +533 -0
- warp/native/nanovdb/HostBuffer.h +591 -0
- warp/native/nanovdb/NanoVDB.h +6246 -0
- warp/native/nanovdb/NodeManager.h +323 -0
- warp/native/nanovdb/PNanoVDB.h +3390 -0
- warp/native/noise.h +859 -0
- warp/native/quat.h +1664 -0
- warp/native/rand.h +342 -0
- warp/native/range.h +145 -0
- warp/native/reduce.cpp +174 -0
- warp/native/reduce.cu +363 -0
- warp/native/runlength_encode.cpp +79 -0
- warp/native/runlength_encode.cu +61 -0
- warp/native/scan.cpp +47 -0
- warp/native/scan.cu +55 -0
- warp/native/scan.h +23 -0
- warp/native/solid_angle.h +466 -0
- warp/native/sort.cpp +251 -0
- warp/native/sort.cu +286 -0
- warp/native/sort.h +35 -0
- warp/native/sparse.cpp +241 -0
- warp/native/sparse.cu +435 -0
- warp/native/spatial.h +1306 -0
- warp/native/svd.h +727 -0
- warp/native/temp_buffer.h +46 -0
- warp/native/tile.h +4124 -0
- warp/native/tile_radix_sort.h +1112 -0
- warp/native/tile_reduce.h +838 -0
- warp/native/tile_scan.h +240 -0
- warp/native/tuple.h +189 -0
- warp/native/vec.h +2199 -0
- warp/native/version.h +23 -0
- warp/native/volume.cpp +501 -0
- warp/native/volume.cu +68 -0
- warp/native/volume.h +970 -0
- warp/native/volume_builder.cu +483 -0
- warp/native/volume_builder.h +52 -0
- warp/native/volume_impl.h +70 -0
- warp/native/warp.cpp +1143 -0
- warp/native/warp.cu +4604 -0
- warp/native/warp.h +358 -0
- warp/optim/__init__.py +20 -0
- warp/optim/adam.py +24 -0
- warp/optim/linear.py +35 -0
- warp/optim/sgd.py +24 -0
- warp/paddle.py +24 -0
- warp/py.typed +0 -0
- warp/render/__init__.py +22 -0
- warp/render/imgui_manager.py +29 -0
- warp/render/render_opengl.py +24 -0
- warp/render/render_usd.py +24 -0
- warp/render/utils.py +24 -0
- warp/sparse.py +51 -0
- warp/tape.py +24 -0
- warp/tests/__init__.py +1 -0
- warp/tests/__main__.py +4 -0
- warp/tests/assets/curlnoise_golden.npy +0 -0
- warp/tests/assets/mlp_golden.npy +0 -0
- warp/tests/assets/pixel.npy +0 -0
- warp/tests/assets/pnoise_golden.npy +0 -0
- warp/tests/assets/spiky.usd +0 -0
- warp/tests/assets/test_grid.nvdb +0 -0
- warp/tests/assets/test_index_grid.nvdb +0 -0
- warp/tests/assets/test_int32_grid.nvdb +0 -0
- warp/tests/assets/test_vec_grid.nvdb +0 -0
- warp/tests/assets/torus.nvdb +0 -0
- warp/tests/assets/torus.usda +105 -0
- warp/tests/aux_test_class_kernel.py +34 -0
- warp/tests/aux_test_compile_consts_dummy.py +18 -0
- warp/tests/aux_test_conditional_unequal_types_kernels.py +29 -0
- warp/tests/aux_test_dependent.py +29 -0
- warp/tests/aux_test_grad_customs.py +29 -0
- warp/tests/aux_test_instancing_gc.py +26 -0
- warp/tests/aux_test_module_aot.py +7 -0
- warp/tests/aux_test_module_unload.py +23 -0
- warp/tests/aux_test_name_clash1.py +40 -0
- warp/tests/aux_test_name_clash2.py +40 -0
- warp/tests/aux_test_reference.py +9 -0
- warp/tests/aux_test_reference_reference.py +8 -0
- warp/tests/aux_test_square.py +16 -0
- warp/tests/aux_test_unresolved_func.py +22 -0
- warp/tests/aux_test_unresolved_symbol.py +22 -0
- warp/tests/cuda/__init__.py +0 -0
- warp/tests/cuda/test_async.py +676 -0
- warp/tests/cuda/test_conditional_captures.py +1147 -0
- warp/tests/cuda/test_ipc.py +124 -0
- warp/tests/cuda/test_mempool.py +233 -0
- warp/tests/cuda/test_multigpu.py +169 -0
- warp/tests/cuda/test_peer.py +139 -0
- warp/tests/cuda/test_pinned.py +84 -0
- warp/tests/cuda/test_streams.py +691 -0
- warp/tests/geometry/__init__.py +0 -0
- warp/tests/geometry/test_bvh.py +335 -0
- warp/tests/geometry/test_hash_grid.py +259 -0
- warp/tests/geometry/test_marching_cubes.py +294 -0
- warp/tests/geometry/test_mesh.py +318 -0
- warp/tests/geometry/test_mesh_query_aabb.py +392 -0
- warp/tests/geometry/test_mesh_query_point.py +935 -0
- warp/tests/geometry/test_mesh_query_ray.py +323 -0
- warp/tests/geometry/test_volume.py +1103 -0
- warp/tests/geometry/test_volume_write.py +346 -0
- warp/tests/interop/__init__.py +0 -0
- warp/tests/interop/test_dlpack.py +730 -0
- warp/tests/interop/test_jax.py +1673 -0
- warp/tests/interop/test_paddle.py +800 -0
- warp/tests/interop/test_torch.py +1001 -0
- warp/tests/run_coverage_serial.py +39 -0
- warp/tests/test_adam.py +162 -0
- warp/tests/test_arithmetic.py +1096 -0
- warp/tests/test_array.py +3756 -0
- warp/tests/test_array_reduce.py +156 -0
- warp/tests/test_assert.py +303 -0
- warp/tests/test_atomic.py +336 -0
- warp/tests/test_atomic_bitwise.py +209 -0
- warp/tests/test_atomic_cas.py +312 -0
- warp/tests/test_bool.py +220 -0
- warp/tests/test_builtins_resolution.py +732 -0
- warp/tests/test_closest_point_edge_edge.py +327 -0
- warp/tests/test_codegen.py +974 -0
- warp/tests/test_codegen_instancing.py +1495 -0
- warp/tests/test_compile_consts.py +215 -0
- warp/tests/test_conditional.py +298 -0
- warp/tests/test_context.py +35 -0
- warp/tests/test_copy.py +319 -0
- warp/tests/test_ctypes.py +618 -0
- warp/tests/test_dense.py +73 -0
- warp/tests/test_devices.py +127 -0
- warp/tests/test_enum.py +136 -0
- warp/tests/test_examples.py +424 -0
- warp/tests/test_fabricarray.py +998 -0
- warp/tests/test_fast_math.py +72 -0
- warp/tests/test_fem.py +2204 -0
- warp/tests/test_fixedarray.py +229 -0
- warp/tests/test_fp16.py +136 -0
- warp/tests/test_func.py +501 -0
- warp/tests/test_future_annotations.py +100 -0
- warp/tests/test_generics.py +656 -0
- warp/tests/test_grad.py +893 -0
- warp/tests/test_grad_customs.py +339 -0
- warp/tests/test_grad_debug.py +341 -0
- warp/tests/test_implicit_init.py +411 -0
- warp/tests/test_import.py +45 -0
- warp/tests/test_indexedarray.py +1140 -0
- warp/tests/test_intersect.py +103 -0
- warp/tests/test_iter.py +76 -0
- warp/tests/test_large.py +177 -0
- warp/tests/test_launch.py +411 -0
- warp/tests/test_lerp.py +151 -0
- warp/tests/test_linear_solvers.py +223 -0
- warp/tests/test_lvalue.py +427 -0
- warp/tests/test_map.py +526 -0
- warp/tests/test_mat.py +3515 -0
- warp/tests/test_mat_assign_copy.py +178 -0
- warp/tests/test_mat_constructors.py +573 -0
- warp/tests/test_mat_lite.py +122 -0
- warp/tests/test_mat_scalar_ops.py +2913 -0
- warp/tests/test_math.py +212 -0
- warp/tests/test_module_aot.py +287 -0
- warp/tests/test_module_hashing.py +258 -0
- warp/tests/test_modules_lite.py +70 -0
- warp/tests/test_noise.py +252 -0
- warp/tests/test_operators.py +299 -0
- warp/tests/test_options.py +129 -0
- warp/tests/test_overwrite.py +551 -0
- warp/tests/test_print.py +408 -0
- warp/tests/test_quat.py +2653 -0
- warp/tests/test_quat_assign_copy.py +145 -0
- warp/tests/test_rand.py +339 -0
- warp/tests/test_reload.py +303 -0
- warp/tests/test_rounding.py +157 -0
- warp/tests/test_runlength_encode.py +196 -0
- warp/tests/test_scalar_ops.py +133 -0
- warp/tests/test_smoothstep.py +108 -0
- warp/tests/test_snippet.py +318 -0
- warp/tests/test_sparse.py +845 -0
- warp/tests/test_spatial.py +2859 -0
- warp/tests/test_spatial_assign_copy.py +160 -0
- warp/tests/test_special_values.py +361 -0
- warp/tests/test_static.py +640 -0
- warp/tests/test_struct.py +901 -0
- warp/tests/test_tape.py +242 -0
- warp/tests/test_transient_module.py +93 -0
- warp/tests/test_triangle_closest_point.py +192 -0
- warp/tests/test_tuple.py +361 -0
- warp/tests/test_types.py +615 -0
- warp/tests/test_utils.py +594 -0
- warp/tests/test_vec.py +1408 -0
- warp/tests/test_vec_assign_copy.py +143 -0
- warp/tests/test_vec_constructors.py +325 -0
- warp/tests/test_vec_lite.py +80 -0
- warp/tests/test_vec_scalar_ops.py +2327 -0
- warp/tests/test_verify_fp.py +100 -0
- warp/tests/test_version.py +75 -0
- warp/tests/tile/__init__.py +0 -0
- warp/tests/tile/test_tile.py +1519 -0
- warp/tests/tile/test_tile_atomic_bitwise.py +403 -0
- warp/tests/tile/test_tile_cholesky.py +608 -0
- warp/tests/tile/test_tile_load.py +724 -0
- warp/tests/tile/test_tile_mathdx.py +156 -0
- warp/tests/tile/test_tile_matmul.py +179 -0
- warp/tests/tile/test_tile_mlp.py +400 -0
- warp/tests/tile/test_tile_reduce.py +950 -0
- warp/tests/tile/test_tile_shared_memory.py +376 -0
- warp/tests/tile/test_tile_sort.py +121 -0
- warp/tests/tile/test_tile_view.py +173 -0
- warp/tests/unittest_serial.py +47 -0
- warp/tests/unittest_suites.py +430 -0
- warp/tests/unittest_utils.py +469 -0
- warp/tests/walkthrough_debug.py +95 -0
- warp/torch.py +24 -0
- warp/types.py +51 -0
- warp/utils.py +31 -0
- warp_lang-1.10.0.dist-info/METADATA +459 -0
- warp_lang-1.10.0.dist-info/RECORD +468 -0
- warp_lang-1.10.0.dist-info/WHEEL +5 -0
- warp_lang-1.10.0.dist-info/licenses/LICENSE.md +176 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/Gaia-LICENSE.txt +6 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/appdirs-LICENSE.txt +22 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/asset_pixel_jpg-LICENSE.txt +3 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/cuda-LICENSE.txt +1582 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/dlpack-LICENSE.txt +201 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/fp16-LICENSE.txt +28 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/libmathdx-LICENSE.txt +220 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/llvm-LICENSE.txt +279 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/moller-LICENSE.txt +16 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/nanovdb-LICENSE.txt +2 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/nvrtc-LICENSE.txt +1592 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/svd-LICENSE.txt +23 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/unittest_parallel-LICENSE.txt +21 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/usd-LICENSE.txt +213 -0
- warp_lang-1.10.0.dist-info/licenses/licenses/windingnumber-LICENSE.txt +21 -0
- warp_lang-1.10.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
###########################################################################
|
|
17
|
+
# Example Ray March
|
|
18
|
+
#
|
|
19
|
+
# Shows how to implement an SDF ray marching based renderer. Please see
|
|
20
|
+
# https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
|
|
21
|
+
# for reference on different distance functions.
|
|
22
|
+
#
|
|
23
|
+
###########################################################################
|
|
24
|
+
|
|
25
|
+
import warp as wp
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@wp.func
|
|
29
|
+
def sdf_sphere(p: wp.vec3, r: float):
|
|
30
|
+
return wp.length(p) - r
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@wp.func
|
|
34
|
+
def sdf_box(upper: wp.vec3, p: wp.vec3):
|
|
35
|
+
qx = wp.abs(p[0]) - upper[0]
|
|
36
|
+
qy = wp.abs(p[1]) - upper[1]
|
|
37
|
+
qz = wp.abs(p[2]) - upper[2]
|
|
38
|
+
|
|
39
|
+
e = wp.vec3(wp.max(qx, 0.0), wp.max(qy, 0.0), wp.max(qz, 0.0))
|
|
40
|
+
|
|
41
|
+
return wp.length(e) + wp.min(wp.max(qx, wp.max(qy, qz)), 0.0)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@wp.func
|
|
45
|
+
def sdf_plane(p: wp.vec3, plane: wp.vec4):
|
|
46
|
+
return plane[0] * p[0] + plane[1] * p[1] + plane[2] * p[2] + plane[3]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@wp.func
|
|
50
|
+
def op_union(d1: float, d2: float):
|
|
51
|
+
return wp.min(d1, d2)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@wp.func
|
|
55
|
+
def op_subtract(d1: float, d2: float):
|
|
56
|
+
return wp.max(-d1, d2)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@wp.func
|
|
60
|
+
def op_intersect(d1: float, d2: float):
|
|
61
|
+
return wp.max(d1, d2)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# simple scene
|
|
65
|
+
@wp.func
|
|
66
|
+
def sdf(p: wp.vec3):
|
|
67
|
+
sphere_1 = wp.vec3(0.0, 0.75, 0.0)
|
|
68
|
+
|
|
69
|
+
d = op_subtract(sdf_sphere(p - sphere_1, 0.75), sdf_box(wp.vec3(1.0, 0.5, 0.5), p))
|
|
70
|
+
|
|
71
|
+
# ground plane
|
|
72
|
+
d = op_union(d, sdf_plane(p, wp.vec4(0.0, 1.0, 0.0, 1.0)))
|
|
73
|
+
|
|
74
|
+
return d
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@wp.func
|
|
78
|
+
def normal(p: wp.vec3):
|
|
79
|
+
eps = 1.0e-5
|
|
80
|
+
|
|
81
|
+
# compute gradient of the SDF using finite differences
|
|
82
|
+
dx = sdf(p + wp.vec3(eps, 0.0, 0.0)) - sdf(p - wp.vec3(eps, 0.0, 0.0))
|
|
83
|
+
dy = sdf(p + wp.vec3(0.0, eps, 0.0)) - sdf(p - wp.vec3(0.0, eps, 0.0))
|
|
84
|
+
dz = sdf(p + wp.vec3(0.0, 0.0, eps)) - sdf(p - wp.vec3(0.0, 0.0, eps))
|
|
85
|
+
|
|
86
|
+
return wp.normalize(wp.vec3(dx, dy, dz))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@wp.func
|
|
90
|
+
def shadow(ro: wp.vec3, rd: wp.vec3):
|
|
91
|
+
t = float(0.0)
|
|
92
|
+
s = float(1.0)
|
|
93
|
+
|
|
94
|
+
for _ in range(64):
|
|
95
|
+
d = sdf(ro + t * rd)
|
|
96
|
+
t = t + wp.clamp(d, 0.0001, 2.0)
|
|
97
|
+
|
|
98
|
+
h = wp.clamp(4.0 * d / t, 0.0, 1.0)
|
|
99
|
+
s = wp.min(s, h * h * (3.0 - 2.0 * h))
|
|
100
|
+
|
|
101
|
+
if t > 8.0:
|
|
102
|
+
return 1.0
|
|
103
|
+
|
|
104
|
+
return s
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@wp.kernel
|
|
108
|
+
def draw(cam_pos: wp.vec3, cam_rot: wp.quat, width: int, height: int, pixels: wp.array(dtype=wp.vec3)):
|
|
109
|
+
tid = wp.tid()
|
|
110
|
+
|
|
111
|
+
x = tid % width
|
|
112
|
+
y = tid // width
|
|
113
|
+
|
|
114
|
+
# compute pixel coordinates
|
|
115
|
+
sx = (2.0 * float(x) - float(width)) / float(height)
|
|
116
|
+
sy = (2.0 * float(y) - float(height)) / float(height)
|
|
117
|
+
|
|
118
|
+
# compute view ray
|
|
119
|
+
ro = cam_pos
|
|
120
|
+
rd = wp.quat_rotate(cam_rot, wp.normalize(wp.vec3(sx, sy, -2.0)))
|
|
121
|
+
|
|
122
|
+
t = float(0.0)
|
|
123
|
+
|
|
124
|
+
# ray march
|
|
125
|
+
for _ in range(128):
|
|
126
|
+
d = sdf(ro + rd * t)
|
|
127
|
+
t = t + d
|
|
128
|
+
|
|
129
|
+
if d < 0.01:
|
|
130
|
+
p = ro + rd * t
|
|
131
|
+
n = normal(p)
|
|
132
|
+
l = wp.normalize(wp.vec3(0.6, 0.4, 0.5))
|
|
133
|
+
|
|
134
|
+
# half-vector
|
|
135
|
+
h = wp.normalize(l - rd)
|
|
136
|
+
|
|
137
|
+
diffuse = wp.dot(n, l)
|
|
138
|
+
specular = wp.clamp(wp.dot(n, h), 0.0, 1.0) ** 80.0
|
|
139
|
+
fresnel = 0.04 + 0.96 * wp.clamp(1.0 - wp.dot(h, l), 0.0, 1.0) ** 5.0
|
|
140
|
+
|
|
141
|
+
intensity = 2.0
|
|
142
|
+
result = (
|
|
143
|
+
wp.vec3(0.85, 0.9, 0.95)
|
|
144
|
+
* (diffuse * (1.0 - fresnel) + specular * fresnel * 10.0)
|
|
145
|
+
* shadow(p, l)
|
|
146
|
+
* intensity
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# gamma
|
|
150
|
+
pixels[tid] = wp.vec3(
|
|
151
|
+
wp.clamp(result[0] ** 2.2, 0.0, 1.0),
|
|
152
|
+
wp.clamp(result[1] ** 2.2, 0.0, 1.0),
|
|
153
|
+
wp.clamp(result[2] ** 2.2, 0.0, 1.0),
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
else:
|
|
157
|
+
pixels[tid] = wp.vec3(0.4, 0.45, 0.5) * 1.5
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class Example:
|
|
161
|
+
def __init__(self, height=1024, width=2048):
|
|
162
|
+
self.width = width
|
|
163
|
+
self.height = height
|
|
164
|
+
self.cam_pos = (-1.25, 1.0, 2.0)
|
|
165
|
+
self.cam_rot = wp.quat_rpy(-0.5, -0.5, 0.0)
|
|
166
|
+
|
|
167
|
+
self.pixels = wp.zeros(self.width * self.height, dtype=wp.vec3)
|
|
168
|
+
|
|
169
|
+
def render(self):
|
|
170
|
+
with wp.ScopedTimer("render"):
|
|
171
|
+
wp.launch(
|
|
172
|
+
kernel=draw,
|
|
173
|
+
dim=self.width * self.height,
|
|
174
|
+
inputs=[self.cam_pos, self.cam_rot, self.width, self.height, self.pixels],
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
if __name__ == "__main__":
|
|
179
|
+
import argparse
|
|
180
|
+
|
|
181
|
+
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
182
|
+
parser.add_argument("--device", type=str, default=None, help="Override the default Warp device.")
|
|
183
|
+
parser.add_argument(
|
|
184
|
+
"--headless",
|
|
185
|
+
action="store_true",
|
|
186
|
+
help="Run in headless mode, suppressing the opening of any graphical windows.",
|
|
187
|
+
)
|
|
188
|
+
parser.add_argument("--width", type=int, default=2048, help="Output image width in pixels.")
|
|
189
|
+
parser.add_argument("--height", type=int, default=1024, help="Output image height in pixels.")
|
|
190
|
+
|
|
191
|
+
args = parser.parse_known_args()[0]
|
|
192
|
+
|
|
193
|
+
with wp.ScopedDevice(args.device):
|
|
194
|
+
example = Example(height=args.height, width=args.width)
|
|
195
|
+
example.render()
|
|
196
|
+
|
|
197
|
+
if not args.headless:
|
|
198
|
+
import matplotlib.pyplot as plt
|
|
199
|
+
|
|
200
|
+
plt.imshow(
|
|
201
|
+
example.pixels.numpy().reshape((example.height, example.width, 3)),
|
|
202
|
+
origin="lower",
|
|
203
|
+
interpolation="antialiased",
|
|
204
|
+
)
|
|
205
|
+
plt.show()
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
###########################################################################
|
|
17
|
+
# OpenGL renderer example
|
|
18
|
+
#
|
|
19
|
+
# Demonstrates how to set up tiled rendering and retrieves the pixels from
|
|
20
|
+
# OpenGLRenderer as a Warp array while keeping all memory on the GPU.
|
|
21
|
+
# It also shows how to add an ImGui UI to the renderer.
|
|
22
|
+
#
|
|
23
|
+
###########################################################################
|
|
24
|
+
|
|
25
|
+
import numpy as np
|
|
26
|
+
|
|
27
|
+
import warp as wp
|
|
28
|
+
import warp.render
|
|
29
|
+
from warp.render.imgui_manager import ImGuiManager
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ExampleImGuiManager(ImGuiManager):
|
|
33
|
+
"""An example ImGui manager that displays a few float values."""
|
|
34
|
+
|
|
35
|
+
def __init__(self, renderer, window_pos=(10, 10), window_size=(300, 400)):
|
|
36
|
+
super().__init__(renderer)
|
|
37
|
+
if not self.is_available:
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
# UI properties
|
|
41
|
+
self.window_pos = window_pos
|
|
42
|
+
self.window_size = window_size
|
|
43
|
+
|
|
44
|
+
# Values to display in the UI
|
|
45
|
+
self.some_float = 123.456
|
|
46
|
+
self.editable_float1 = 10.0
|
|
47
|
+
self.editable_float2 = 20.0
|
|
48
|
+
self.editable_float3 = 30.0
|
|
49
|
+
self.editable_vec2 = wp.vec2(0.5, 1.2)
|
|
50
|
+
self.editable_vec3 = wp.vec3(2.1, 3.4, 4.7)
|
|
51
|
+
self.editable_vec4 = wp.vec4(1.5, 3.2, 4.8, 6.1)
|
|
52
|
+
self.warp_array_float = wp.array([0.7, 1.4, 2.8], dtype=float)
|
|
53
|
+
self.warp_array_vec2 = wp.array([wp.vec2(1.1, 2.3), wp.vec2(3.4, 4.2), wp.vec2(5.6, 6.9)], dtype=wp.vec2)
|
|
54
|
+
self.warp_array_vec3 = wp.array(
|
|
55
|
+
[wp.vec3(0.5, 1.7, 2.9), wp.vec3(3.2, 4.8, 5.1), wp.vec3(6.4, 7.6, 8.3)], dtype=wp.vec3
|
|
56
|
+
)
|
|
57
|
+
self.warp_array_vec4 = wp.array([wp.vec4(1.2, 2.4, 3.6, 4.8), wp.vec4(5.1, 6.3, 7.5, 8.7)], dtype=wp.vec4)
|
|
58
|
+
|
|
59
|
+
def draw_ui(self):
|
|
60
|
+
# set window position and size once
|
|
61
|
+
self.imgui.set_next_window_size(self.window_size[0], self.window_size[1], self.imgui.ONCE)
|
|
62
|
+
self.imgui.set_next_window_position(self.window_pos[0], self.window_pos[1], self.imgui.ONCE)
|
|
63
|
+
|
|
64
|
+
self.imgui.begin("Warp Float Values")
|
|
65
|
+
|
|
66
|
+
self.imgui.text(f"A read-only float: {self.some_float}")
|
|
67
|
+
self.imgui.separator()
|
|
68
|
+
|
|
69
|
+
self.imgui.text("Editable floats:")
|
|
70
|
+
changed1, self.editable_float1 = self.imgui.slider_float("Slider", self.editable_float1, 0.0, 100.0)
|
|
71
|
+
changed2, self.editable_float2 = self.imgui.drag_float("Drag", self.editable_float2, 0.1, 0.0, 100.0)
|
|
72
|
+
changed3, self.editable_float3 = self.imgui.input_float("Input", self.editable_float3)
|
|
73
|
+
|
|
74
|
+
changed, self.editable_vec2 = self.drag_vec2("Vec2", self.editable_vec2)
|
|
75
|
+
changed, self.editable_vec3 = self.drag_vec3("Vec3", self.editable_vec3)
|
|
76
|
+
changed, self.editable_vec4 = self.drag_vec4("Vec4", self.editable_vec4)
|
|
77
|
+
|
|
78
|
+
changed, self.warp_array_float = self.drag_float_list("Float", self.warp_array_float)
|
|
79
|
+
changed, self.warp_array_vec2 = self.drag_vec2_list("Vec2", self.warp_array_vec2)
|
|
80
|
+
changed, self.warp_array_vec3 = self.drag_vec3_list("Vec3", self.warp_array_vec3)
|
|
81
|
+
changed, self.warp_array_vec4 = self.drag_vec4_list("Vec4", self.warp_array_vec4)
|
|
82
|
+
|
|
83
|
+
self.imgui.separator()
|
|
84
|
+
self.imgui.text("File Dialog Examples:")
|
|
85
|
+
|
|
86
|
+
if self.imgui.button("Open File"):
|
|
87
|
+
file_path = self.open_load_file_dialog(
|
|
88
|
+
title="Select a File", filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
|
|
89
|
+
)
|
|
90
|
+
if file_path:
|
|
91
|
+
print(f"Selected file to open: {file_path}")
|
|
92
|
+
|
|
93
|
+
if self.imgui.button("Save File"):
|
|
94
|
+
file_path = self.open_save_file_dialog(
|
|
95
|
+
title="Save As", defaultextension=".txt", filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
|
|
96
|
+
)
|
|
97
|
+
if file_path:
|
|
98
|
+
print(f"Selected file to save: {file_path}")
|
|
99
|
+
|
|
100
|
+
self.imgui.end()
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Example:
|
|
104
|
+
def __init__(self, num_tiles=4, custom_tile_arrangement=False, use_imgui=True):
|
|
105
|
+
if num_tiles < 1:
|
|
106
|
+
raise ValueError("num_tiles must be greater than or equal to 1.")
|
|
107
|
+
|
|
108
|
+
self.renderer = wp.render.OpenGLRenderer(vsync=False)
|
|
109
|
+
self.use_imgui = use_imgui
|
|
110
|
+
|
|
111
|
+
if self.use_imgui:
|
|
112
|
+
self.imgui_manager = ExampleImGuiManager(self.renderer)
|
|
113
|
+
if self.imgui_manager.is_available:
|
|
114
|
+
self.renderer.render_2d_callbacks.append(self.imgui_manager.render_frame)
|
|
115
|
+
else:
|
|
116
|
+
self.use_imgui = False
|
|
117
|
+
|
|
118
|
+
instance_ids = []
|
|
119
|
+
|
|
120
|
+
if custom_tile_arrangement:
|
|
121
|
+
positions = []
|
|
122
|
+
sizes = []
|
|
123
|
+
else:
|
|
124
|
+
positions = None
|
|
125
|
+
sizes = None
|
|
126
|
+
|
|
127
|
+
# set up instances to hide one of the capsules in each tile
|
|
128
|
+
for i in range(num_tiles):
|
|
129
|
+
instances = [j for j in np.arange(13) if j != i + 2]
|
|
130
|
+
instance_ids.append(instances)
|
|
131
|
+
if custom_tile_arrangement:
|
|
132
|
+
angle = np.pi * 2.0 / num_tiles * i
|
|
133
|
+
positions.append((int(np.cos(angle) * 150 + 250), int(np.sin(angle) * 150 + 250)))
|
|
134
|
+
sizes.append((150, 150))
|
|
135
|
+
self.renderer.setup_tiled_rendering(instance_ids, tile_positions=positions, tile_sizes=sizes)
|
|
136
|
+
|
|
137
|
+
self.renderer.render_ground()
|
|
138
|
+
|
|
139
|
+
def render(self):
|
|
140
|
+
time = self.renderer.clock_time
|
|
141
|
+
self.renderer.begin_frame(time)
|
|
142
|
+
for i in range(10):
|
|
143
|
+
self.renderer.render_capsule(
|
|
144
|
+
f"capsule_{i}",
|
|
145
|
+
[i - 5.0, np.sin(time + i * 0.2), -3.0],
|
|
146
|
+
[0.0, 0.0, 0.0, 1.0],
|
|
147
|
+
radius=0.5,
|
|
148
|
+
half_height=0.8,
|
|
149
|
+
)
|
|
150
|
+
self.renderer.render_cylinder(
|
|
151
|
+
"cylinder",
|
|
152
|
+
[3.2, 1.0, np.sin(time + 0.5)],
|
|
153
|
+
np.array(wp.quat_from_axis_angle(wp.vec3(1.0, 0.0, 0.0), wp.sin(time + 0.5))),
|
|
154
|
+
radius=0.5,
|
|
155
|
+
half_height=0.8,
|
|
156
|
+
)
|
|
157
|
+
self.renderer.render_cone(
|
|
158
|
+
"cone",
|
|
159
|
+
[-1.2, 1.0, 0.0],
|
|
160
|
+
np.array(wp.quat_from_axis_angle(wp.vec3(0.707, 0.707, 0.0), time)),
|
|
161
|
+
radius=0.5,
|
|
162
|
+
half_height=0.8,
|
|
163
|
+
)
|
|
164
|
+
self.renderer.end_frame()
|
|
165
|
+
|
|
166
|
+
def clear(self):
|
|
167
|
+
if self.use_imgui:
|
|
168
|
+
self.imgui_manager.shutdown()
|
|
169
|
+
self.renderer.clear()
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if __name__ == "__main__":
|
|
173
|
+
import argparse
|
|
174
|
+
import distutils.util
|
|
175
|
+
|
|
176
|
+
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
177
|
+
parser.add_argument("--device", type=str, default=None, help="Override the default Warp device.")
|
|
178
|
+
parser.add_argument("--num_tiles", type=int, default=4, help="Number of viewports to render in a single frame.")
|
|
179
|
+
parser.add_argument(
|
|
180
|
+
"--show_plot",
|
|
181
|
+
type=lambda x: bool(distutils.util.strtobool(x.strip())),
|
|
182
|
+
default=True,
|
|
183
|
+
help="Display the pixels in an additional matplotlib figure.",
|
|
184
|
+
)
|
|
185
|
+
parser.add_argument("--render_mode", type=str, choices=("depth", "rgb"), default="depth", help="")
|
|
186
|
+
parser.add_argument(
|
|
187
|
+
"--split_up_tiles",
|
|
188
|
+
type=lambda x: bool(distutils.util.strtobool(x.strip())),
|
|
189
|
+
default=True,
|
|
190
|
+
help="Whether to split tiles into subplots when --show_plot is True.",
|
|
191
|
+
)
|
|
192
|
+
parser.add_argument("--custom_tile_arrangement", action="store_true", help="Apply custom tile arrangement.")
|
|
193
|
+
parser.add_argument(
|
|
194
|
+
"--use_imgui",
|
|
195
|
+
type=lambda x: bool(distutils.util.strtobool(x.strip())),
|
|
196
|
+
default=True,
|
|
197
|
+
help="Enable or disable the ImGui window.",
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
args = parser.parse_known_args()[0]
|
|
201
|
+
|
|
202
|
+
with wp.ScopedDevice(args.device):
|
|
203
|
+
example = Example(
|
|
204
|
+
num_tiles=args.num_tiles,
|
|
205
|
+
custom_tile_arrangement=args.custom_tile_arrangement,
|
|
206
|
+
use_imgui=args.use_imgui,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
channels = 1 if args.render_mode == "depth" else 3
|
|
210
|
+
|
|
211
|
+
if args.show_plot:
|
|
212
|
+
import matplotlib.pyplot as plt
|
|
213
|
+
|
|
214
|
+
if args.split_up_tiles:
|
|
215
|
+
pixels = wp.zeros(
|
|
216
|
+
(args.num_tiles, example.renderer.tile_height, example.renderer.tile_width, channels),
|
|
217
|
+
dtype=wp.float32,
|
|
218
|
+
)
|
|
219
|
+
ncols = int(np.ceil(np.sqrt(args.num_tiles)))
|
|
220
|
+
nrows = int(np.ceil(args.num_tiles / float(ncols)))
|
|
221
|
+
img_plots = []
|
|
222
|
+
aspect_ratio = example.renderer.tile_height / example.renderer.tile_width
|
|
223
|
+
fig, axes = plt.subplots(
|
|
224
|
+
ncols=ncols,
|
|
225
|
+
nrows=nrows,
|
|
226
|
+
constrained_layout=True,
|
|
227
|
+
figsize=(ncols * 3.5, nrows * 3.5 * aspect_ratio),
|
|
228
|
+
squeeze=False,
|
|
229
|
+
sharex=True,
|
|
230
|
+
sharey=True,
|
|
231
|
+
num=1,
|
|
232
|
+
)
|
|
233
|
+
tile_temp = np.zeros(
|
|
234
|
+
(example.renderer.tile_height, example.renderer.tile_width, channels), dtype=np.float32
|
|
235
|
+
)
|
|
236
|
+
for dim in range(ncols * nrows):
|
|
237
|
+
ax = axes[dim // ncols, dim % ncols]
|
|
238
|
+
if dim >= args.num_tiles:
|
|
239
|
+
ax.axis("off")
|
|
240
|
+
continue
|
|
241
|
+
if args.render_mode == "depth":
|
|
242
|
+
img_plots.append(
|
|
243
|
+
ax.imshow(
|
|
244
|
+
tile_temp,
|
|
245
|
+
vmin=example.renderer.camera_near_plane,
|
|
246
|
+
vmax=example.renderer.camera_far_plane,
|
|
247
|
+
)
|
|
248
|
+
)
|
|
249
|
+
else:
|
|
250
|
+
img_plots.append(ax.imshow(tile_temp))
|
|
251
|
+
else:
|
|
252
|
+
fig = plt.figure(1)
|
|
253
|
+
pixels = wp.zeros(
|
|
254
|
+
(example.renderer.screen_height, example.renderer.screen_width, channels), dtype=wp.float32
|
|
255
|
+
)
|
|
256
|
+
if args.render_mode == "depth":
|
|
257
|
+
img_plot = plt.imshow(
|
|
258
|
+
pixels.numpy(), vmin=example.renderer.camera_near_plane, vmax=example.renderer.camera_far_plane
|
|
259
|
+
)
|
|
260
|
+
else:
|
|
261
|
+
img_plot = plt.imshow(pixels.numpy())
|
|
262
|
+
|
|
263
|
+
plt.ion()
|
|
264
|
+
plt.show()
|
|
265
|
+
|
|
266
|
+
while example.renderer.is_running():
|
|
267
|
+
example.render()
|
|
268
|
+
|
|
269
|
+
if args.show_plot and plt.fignum_exists(1):
|
|
270
|
+
if args.split_up_tiles:
|
|
271
|
+
pixel_shape = (args.num_tiles, example.renderer.tile_height, example.renderer.tile_width, channels)
|
|
272
|
+
else:
|
|
273
|
+
pixel_shape = (example.renderer.screen_height, example.renderer.screen_width, channels)
|
|
274
|
+
|
|
275
|
+
if pixel_shape != pixels.shape:
|
|
276
|
+
# make sure we resize the pixels array to the right dimensions if the user resizes the window
|
|
277
|
+
pixels = wp.zeros(pixel_shape, dtype=wp.float32)
|
|
278
|
+
|
|
279
|
+
example.renderer.get_pixels(pixels, split_up_tiles=args.split_up_tiles, mode=args.render_mode)
|
|
280
|
+
|
|
281
|
+
if args.split_up_tiles:
|
|
282
|
+
pixels_np = pixels.numpy()
|
|
283
|
+
for i, img_plot in enumerate(img_plots):
|
|
284
|
+
img_plot.set_data(pixels_np[i])
|
|
285
|
+
else:
|
|
286
|
+
img_plot.set_data(pixels.numpy())
|
|
287
|
+
fig.canvas.draw()
|
|
288
|
+
fig.canvas.flush_events()
|
|
289
|
+
|
|
290
|
+
example.clear()
|