hyperverse 0.0.1__py3-none-any.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.
- hyperdrone/__init__.py +31 -0
- hyperdrone/_native/cmake/hyperdrone_jit.cmake +65 -0
- hyperdrone/_native/common/bindings.h +39 -0
- hyperdrone/_native/common/cuda_staging.h +75 -0
- hyperdrone/_native/common/jit_host.h +69 -0
- hyperdrone/_native/common/models.h +24 -0
- hyperdrone/_native/dynamics/CMakeLists.txt +61 -0
- hyperdrone/_native/dynamics/host.cpp +193 -0
- hyperdrone/_native/dynamics/iface.h +76 -0
- hyperdrone/_native/dynamics/impl.cpp +608 -0
- hyperdrone/_native/env/CMakeLists.txt +71 -0
- hyperdrone/_native/env/environment.cpp +124 -0
- hyperdrone/_native/env/environment.h +407 -0
- hyperdrone/_native/env/rotorcraft_bindings.cpp +51 -0
- hyperdrone/_native/render/CMakeLists.txt +94 -0
- hyperdrone/_native/render/renderer.cpp +962 -0
- hyperdrone/_native/render/rig_bindings.h +151 -0
- hyperdrone/_native/render/scene_bindings.cpp +466 -0
- hyperdrone/_vendor/rl-tools/CMakeLists.txt +205 -0
- hyperdrone/_vendor/rl-tools/LICENSE +21 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/all.cmake +34 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-diff.cmake +100 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/git-hash.cmake +24 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/summary.cmake +64 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier0-compiler.cmake +18 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier1-blas.cmake +51 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier2-json-hdf5-zlib.cmake +81 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier3-tensorboard.cmake +25 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier4-cuda.cmake +42 -0
- hyperdrone/_vendor/rl-tools/cmake/autodetect/tier5-cli11.cmake +24 -0
- hyperdrone/_vendor/rl-tools/cmake/dependencies/assimp.cmake +19 -0
- hyperdrone/_vendor/rl-tools/cmake/legacy_flags.cmake +33 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/assimp.cmake +30 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/googletest.cmake +20 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/metal.cmake +25 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/mujoco.cmake +89 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/optix.cmake +25 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/raytracing.cmake +105 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/raytracing_generic.cmake +2 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/vulkan.cmake +4 -0
- hyperdrone/_vendor/rl-tools/cmake/optional/webgpu.cmake +24 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/embed_text.cmake +7 -0
- hyperdrone/_vendor/rl-tools/cmake/scripts/generate-git-snapshot.cmake +138 -0
- hyperdrone/_vendor/rl-tools/include/conta/conta.h +1161 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/matrix.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_arm.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu.h +314 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_accelerate.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_blas.h +67 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_mkl.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_openblas.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cuda.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_dummy.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_esp32.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_generic.h +944 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_wasm32.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/persist_code.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_arm.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu.h +94 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_accelerate.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_blas.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_mkl.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_openblas.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cuda.h +713 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_generic.h +1356 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/persist_code.h +130 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/tensor.h +490 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/arm.h +91 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu.h +209 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_accelerate.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_blas.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_mkl.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_openblas.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_tensorboard.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda.h +415 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/devices.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/dummy.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/esp32.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/generic.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/devices/wasm32.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/model.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/operations_generic.h +769 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/persist.h +278 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter.h +100 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter_persist.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/tensor_operations_generic.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_backend.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_interface.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/l2f.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_dyn.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_generic.h +268 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_backend.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_interface.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_backend.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_interface.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/executor.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/helper.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/operations_generic.h +219 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arduino.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arm.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu_tensorboard.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cuda.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_dummy.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_wasm32.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_arm.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cpu.h +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cuda.h +380 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_dummy.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_esp32.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_generic.h +295 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_wasm32.h +230 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/mode/mode.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/activation_functions.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/capability.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/persist_code.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/group.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_cuda.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_generic.h +186 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/persist.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/layer.h +300 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cpu_mkl.h +590 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cuda.h +809 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_generic.h +1219 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist_code.h +170 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/layer.h +145 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/dsp.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/opt.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_accelerate.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_blas.h +282 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_mkl.h +66 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_openblas.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cuda.h +519 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/dsp.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/opt.h +167 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_generic.h +429 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_code.h +178 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_common.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/layer.h +188 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_cuda.h +356 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_generic.h +536 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/persist.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/layer.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/operations_generic.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/persist.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/layer.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/operations_generic.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_cuda.h +602 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_generic.h +251 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/layer.h +206 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/operations_generic.h +889 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist_code.h +199 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/layers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/layer.h +143 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_cuda.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_generic.h +216 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_mkl.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cuda.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/layer.h +223 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_cuda.h +138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_generic.h +446 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/persist.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/layer.h +154 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_cuda.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_generic.h +502 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist_code.h +173 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/layer.h +116 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_cuda.h +156 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_generic.h +295 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist.h +83 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist_code.h +163 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/layer.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/operations_generic.h +272 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist_code.h +164 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/layer.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_cuda.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_generic.h +160 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist_code.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/layer.h +132 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_cuda.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_generic.h +230 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/categorical_cross_entropy/operations_generic.h +102 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_cuda.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_generic.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/nn.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_blas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mux.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_openblas.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cuda.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_generic.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/adam.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_cuda.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_generic.h +150 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist_code.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_cuda.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_generic.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/instance/operations_generic.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/lamb.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/operations_generic.h +68 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/optimizers.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_cuda.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_generic.h +140 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist_code.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_cuda.h +49 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_generic.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/sgd.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/update.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_cuda.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_generic.h +98 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/parameters.h +79 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist.h +34 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist_code.h +136 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist_code.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/behaviors/skip_parameter_gradients.h +65 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/README.md +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/model.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/group/persist_code.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/network.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_cuda.h +10 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_dummy.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_generic.h +407 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist_code.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/network.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/operations_generic.h +86 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist_code.h +142 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/models.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/model.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/operations_generic.h +288 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist_code.h +71 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cpu.h +0 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cuda.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_dummy.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_generic.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/model.h +290 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_cuda.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_generic.h +623 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist_code.h +200 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist_code.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/model.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/operations_generic.h +73 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/resnet/resnet.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/model.h +270 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/operations_generic.h +625 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist.h +99 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist_code.h +115 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/bf16.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/categories.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/persist_code.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/policy.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_2.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_3.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_1.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_1.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mux.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_3.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_1.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_1.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_3.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_1.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_2.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_3.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/hdf5.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/operations_cpu.h +419 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/io.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_cpu.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_generic.h +620 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_posix.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/tar.h +74 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/persist/code.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_arm.h +39 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cpu.h +81 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cuda.h +169 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_dummy.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_esp32.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic.h +133 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic_array.h +73 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_wasm32.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/random/persist.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/camera.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/cache.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/free_space.h +60 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/annotations/operations_cpu.h +408 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/glb/operations_cpu.h +1313 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/operations_cpu.h +96 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/conversion.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/operations_cpu.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/datasets/procthor/procthor.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_cpu.h +733 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_generic.h +1299 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/context.h +198 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/device_source.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/operations_cpu.h +1140 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device.h +233 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device_impl.h +1084 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h +1808 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/overlay_accel.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/specialization.h +38 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/context.h +248 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/device_source.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/operations_cpu.h +2056 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/bvh_sah.h +182 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/context.h +303 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/device_source.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/webgpu/operations_cpu.h +1455 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_common.h +916 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_mux.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_post.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/renderer.h +478 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/save_cpu.h +315 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/transforms_generic.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/types.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/operations_cpu.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/operations_generic.h +121 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/rig/rig.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/scene.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/segmentation_cpu.h +145 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/transforms.h +204 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/types.h +55 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/algorithms.h +6 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_generic.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/config.h +243 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_cuda.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_generic.h +205 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/persist.h +109 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/state.h +51 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/mixed_imitation.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_cuda.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic.h +332 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic_mixed_imitation.h +81 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/persist.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/ppo.h +105 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_gru.h +84 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_mlp.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/config.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/operations_generic.h +193 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/state.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cuda.h +131 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_generic.h +580 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/sac.h +151 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_gru.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_mlp.h +54 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/config.h +107 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/operations_generic.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/state.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_accelerate.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mkl.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mux.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cuda.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_generic.h +359 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/td3.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/components.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/off_policy_runner.h +225 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu.h +95 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_accelerate.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_mkl.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cuda.h +237 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic.h +498 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic_per_env.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/collection.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/on_policy_runner.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_accelerate.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mkl.h +8 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mux.h +12 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cuda.h +183 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic.h +366 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_common.h +74 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/persist.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_accelerate.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_mkl.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_generic.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_cpu.h +9 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_generic.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/persist.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/replay_buffer.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/operations_generic.h +76 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/persist.h +31 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/running_normalizer.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/operations_generic.h +58 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/operations_generic.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/wrapper.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/wrappers.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/acrobot.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_cpu.h +152 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/environment.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_cuda.h +204 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_generic.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/operations_generic_common.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/batch/persist.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/car.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_cpu.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_generic.h +206 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_json.h +59 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/track.h +23 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/ui.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/environments.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/environment.h +87 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_cpu.h +212 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_generic.h +215 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/observation.h +75 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/operations_cpu.h +938 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/operations_cuda.h +380 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/pose.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/presets.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/operations_cpu.h +189 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/operations_generic.h +32 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/rig/rig.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/moving_gate.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/operations_cpu.h +262 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/moving_gate/operations_cuda.h +254 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_cpu.h +224 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_cuda.h +218 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/operations_generic_position_hold.h +128 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/position_hold.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/target_frame/target_frame.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/autopilot.h +61 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/baseline.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/calibration.h +62 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/metrics.h +101 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/operations_cpu.h +389 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/tasks/visual_inertial_localization/visual_inertial_localization.h +123 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/hyperdrone/world.h +318 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/inertial_velocity.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/metrics.h +266 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/multirotor.h +1138 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cpu.h +2246 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/05_state_is_nan.h +148 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/10_sample_initial_parameters.h +228 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/20_initial_state.h +208 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/30_sample_initial_state.h +300 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/35_get_desired_state.h +63 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/40_observe.h +637 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/50_state_algebra.h +57 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/60_dynamics.h +134 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/70_post_integration.h +368 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/80_abs_diff.h +312 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic.h +367 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic_inertial_velocity.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_helper_generic.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic.h +70 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic_forward.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/default.h +209 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/arpl.h +112 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie.h +127 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie_openmv.h +119 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/flightmare.h +111 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/fs.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/mrs.h +110 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft.h +117 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft_rigid.h +118 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_real.h +88 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_sim.h +114 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/init/default.h +56 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/registry.h +96 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/default.h +64 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/reward_functions.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/operations_generic.h +202 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/squared.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/termination/default.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/lissajous.h +72 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/trajectory.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist_code.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/quaternion_helper.h +103 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/ui.h +180 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/environment.h +69 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_cpu.h +46 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_generic.h +78 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/README.MD +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ant.h +77 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/model.h +415 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/operations_cpu.h +162 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/persist.h +86 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ui.h +141 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/mujoco.h +1 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/bottleneck.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_cpu.h +289 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_generic.h +495 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/environments.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/observation.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_cpu.h +2 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_generic.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_cpu.h +146 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_generic.h +262 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/pendulum.h +197 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui.h +97 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui_xeus.h +124 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_cpu.h +426 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_generic.h +424 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/reacher.h +137 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/loop.h +15 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/config.h +28 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/operations_cpu.h +233 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/state.h +21 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/config.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/operations_generic.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/state.h +17 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/config.h +47 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/operations_generic.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/persist.h +40 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/state.h +36 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/config.h +22 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/operations_cpu.h +44 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/state.h +26 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/config.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/operations_cpu.h +113 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/state.h +24 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/config.h +43 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/operations_cpu.h +190 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/persist.h +30 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/state.h +37 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/steps.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/config.h +27 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/operations_cpu.h +52 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/persist.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/state.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/operations_generic.h +3 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/rl.h +5 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/evaluation.h +106 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_cpu.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_generic.h +275 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation.h +269 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation_analysis.h +85 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/rl_tools.h +80 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/client.h +50 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_boost.h +92 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_cpu.h +174 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_websocket.h +208 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/server.h +448 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/universe.h +4 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu.h +13 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_arm.h +29 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu.h +25 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cuda.h +33 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_dummy.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_esp32.h +20 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_generic.h +19 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_wasm32.h +18 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_cpu.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_generic.h +14 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/extrack.h +129 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/operations_cpu.h +588 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/integrators.h +103 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/memcpy.h +16 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/operations_generic.h +48 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/tuple.h +147 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/typing.h +122 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/vector_operations.h +172 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_cuda.h +53 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_generic.h +93 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/string/operations_generic.h +201 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/utils/zlib/operations_cpu.h +45 -0
- hyperdrone/_vendor/rl-tools/include/rl_tools/version.h +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/CMakeLists.txt +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/README.md +193 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/CMakeLists.txt +11 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/CMakeLists.txt +17 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/freestanding_check.cpp +135 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/CMakeLists.txt +31 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/device.metal +953 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/metal_cpp_impl.cpp +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/CMakeLists.txt +51 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/device.cu +1 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/overlay_accel.cu +311 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/CMakeLists.txt +37 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device.comp +1013 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device_spirv.cpp +44 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/webgpu/CMakeLists.txt +31 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/webgpu/device.wgsl +1448 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/CMakeLists.txt +110 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/README.md +55 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark.cpp +180 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark_dynamic.cpp +491 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/rig.cpp +119 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.cpp +1130 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_config.h.in +13 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/camera_orbit.h +51 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/CMakeLists.txt +199 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/antialiasing.cpp +214 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone.cpp +320 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone_device.cu +359 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/environment.h +96 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/operations_cpu.h +263 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/example.cpp +273 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/fixed_pose.cpp +221 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/flow.cpp +120 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/interactive.cpp +1015 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/make_drone_glb.py +172 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/minimal.cpp +82 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/minimal_overlay.cpp +137 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/motion_blur.cpp +232 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace.cpp +1829 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace_motion_blur.cpp +647 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/web/assimp/CMakeLists.txt +8 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/web/build.sh +80 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/web/drone_web.cpp +234 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/CMakeLists.txt +147 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/README.md +15 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/job.sbatch +28 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model.h +260 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_config.h +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_forward_cuda.h +397 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_operations.h +418 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_persist.h +45 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_student.h +70 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.cpp +222 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.h +68 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.gitignore +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/CMakeLists.txt +4 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info.plist +24 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info_ios.plist +36 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/CameraManager.swift +120 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/ContentView.swift +703 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/DatasetRecorder.swift +285 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/YawPredictorApp.swift +25 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/YawPredictor.entitlements +8 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build.sh +66 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build_ios.sh +133 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/generate.sh +6 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/h5_to_tar.cpp +82 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.cpp +166 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.h +26 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/project.yml +30 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/test_tar_vs_hdf5.cpp +173 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_cuda.cu +699 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_dataset_overlay.cpp +475 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_distill_cuda.cu +995 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_eval.cu +457 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_real_world_eval.cpp +660 -0
- hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_viewer.cu +443 -0
- hyperdrone/cuda/__init__.py +78 -0
- hyperdrone/dynamics/__init__.py +22 -0
- hyperdrone/dynamics/_component.py +35 -0
- hyperdrone/dynamics/_config.py +48 -0
- hyperdrone/dynamics/_sim.py +195 -0
- hyperdrone/env/__init__.py +17 -0
- hyperdrone/env/_multi_environment.py +407 -0
- hyperdrone/env/_rotorcraft.py +31 -0
- hyperdrone/examples/.gitignore +2 -0
- hyperdrone/examples/Benchmark.ipynb +102 -0
- hyperdrone/examples/HyperDrone.ipynb +514 -0
- hyperdrone/examples/Orbiter.ipynb +462 -0
- hyperdrone/examples/Renderer.ipynb +173 -0
- hyperdrone/examples/__init__.py +16 -0
- hyperdrone/examples/articulation.py +55 -0
- hyperdrone/examples/benchmark.py +236 -0
- hyperdrone/examples/benchmark_minimal.py +65 -0
- hyperdrone/examples/data.py +70 -0
- hyperdrone/examples/drone_flythrough.py +169 -0
- hyperdrone/examples/hyperdrone_videos/my_world_preview.h +17 -0
- hyperdrone/examples/my_world.h +17 -0
- hyperdrone/examples/render_procthor.py +41 -0
- hyperdrone/examples/visual_inertial_localization.py +159 -0
- hyperdrone/gym/__init__.py +63 -0
- hyperdrone/jit/__init__.py +129 -0
- hyperdrone/jit/_build.py +113 -0
- hyperdrone/jit/_lock.py +23 -0
- hyperdrone/jit/_patches.py +99 -0
- hyperdrone/jit/_toolchain.py +17 -0
- hyperdrone/jit/_workspace.py +68 -0
- hyperdrone/render/__init__.py +53 -0
- hyperdrone/render/_component.py +51 -0
- hyperdrone/render/_config.py +92 -0
- hyperdrone/render/_renderer.py +447 -0
- hyperdrone/render/_rig.py +136 -0
- hyperdrone/render/_sampling.py +69 -0
- hyperdrone/render/_scene.py +36 -0
- hyperverse-0.0.1.dist-info/METADATA +370 -0
- hyperverse-0.0.1.dist-info/RECORD +746 -0
- hyperverse-0.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1299 @@
|
|
|
1
|
+
#include "../../../../version.h"
|
|
2
|
+
#include "../../../../rl_tools.h"
|
|
3
|
+
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_RENDERING_RAYTRACING_BACKENDS_GENERIC_OPERATIONS_GENERIC_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
|
|
4
|
+
#pragma once
|
|
5
|
+
#define RL_TOOLS_RENDERING_RAYTRACING_BACKENDS_GENERIC_OPERATIONS_GENERIC_H
|
|
6
|
+
|
|
7
|
+
// Freestanding software raytracing kernels. This file is a mirror of the device programs in
|
|
8
|
+
// backends/optix/device_impl.h and backends/metal/device.metal — keep the shading logic in sync;
|
|
9
|
+
// the cross-backend parity comparison is the drift detector. SPEC is duck-typed (this header must
|
|
10
|
+
// not include renderer.h, which is not freestanding); the host adapter in operations_cpu.h passes
|
|
11
|
+
// rendering::raytracing::Specification.
|
|
12
|
+
#include "../../types.h"
|
|
13
|
+
#include "../../../../utils/generic/typing.h"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
RL_TOOLS_NAMESPACE_WRAPPER_START
|
|
17
|
+
namespace rl_tools {
|
|
18
|
+
namespace rendering::raytracing::backends::generic{
|
|
19
|
+
template <typename T>
|
|
20
|
+
struct Vec3{
|
|
21
|
+
T x, y, z;
|
|
22
|
+
};
|
|
23
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> operator+(Vec3<T> a, Vec3<T> b){ return {a.x + b.x, a.y + b.y, a.z + b.z}; }
|
|
24
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> operator-(Vec3<T> a, Vec3<T> b){ return {a.x - b.x, a.y - b.y, a.z - b.z}; }
|
|
25
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> operator*(Vec3<T> a, Vec3<T> b){ return {a.x * b.x, a.y * b.y, a.z * b.z}; }
|
|
26
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> operator*(T s, Vec3<T> v){ return {s * v.x, s * v.y, s * v.z}; }
|
|
27
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> operator*(Vec3<T> v, T s){ return {v.x * s, v.y * s, v.z * s}; }
|
|
28
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> operator-(Vec3<T> v){ return {-v.x, -v.y, -v.z}; }
|
|
29
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT T dot(Vec3<T> a, Vec3<T> b){ return a.x * b.x + a.y * b.y + a.z * b.z; }
|
|
30
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> cross(Vec3<T> a, Vec3<T> b){
|
|
31
|
+
return {a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x};
|
|
32
|
+
}
|
|
33
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> to_vec3(const T v[3]){ return {v[0], v[1], v[2]}; }
|
|
34
|
+
template <typename MATH, typename T> RL_TOOLS_FUNCTION_PLACEMENT T length(const MATH& math_device, Vec3<T> v){
|
|
35
|
+
return math::sqrt(math_device, dot(v, v));
|
|
36
|
+
}
|
|
37
|
+
template <typename MATH, typename T> RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> normalize(const MATH& math_device, Vec3<T> v){
|
|
38
|
+
const T inv_length = (T)1 / math::sqrt(math_device, dot(v, v));
|
|
39
|
+
return v * inv_length;
|
|
40
|
+
}
|
|
41
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT T clamp01(T x){ return x < (T)0 ? (T)0 : (x > (T)1 ? (T)1 : x); }
|
|
42
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT T minimum(T a, T b){ return a < b ? a : b; }
|
|
43
|
+
template <typename T> RL_TOOLS_FUNCTION_PLACEMENT T maximum(T a, T b){ return a > b ? a : b; }
|
|
44
|
+
|
|
45
|
+
template <typename TI>
|
|
46
|
+
struct TextureView{
|
|
47
|
+
const unsigned char* pixels = nullptr; // RGBA8; nullptr => absent
|
|
48
|
+
TI width = 0;
|
|
49
|
+
TI height = 0;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
template <typename T, typename TI>
|
|
53
|
+
struct MeshView{
|
|
54
|
+
const int* indices = nullptr; // 3 per triangle
|
|
55
|
+
const T* vertices = nullptr; // 3 per vertex
|
|
56
|
+
const T* tex_coords = nullptr; // 2 per vertex (nullptr if absent)
|
|
57
|
+
const T* normals = nullptr; // 3 per vertex (nullptr if absent)
|
|
58
|
+
TextureView<TI> texture;
|
|
59
|
+
TextureView<TI> normal_map;
|
|
60
|
+
TextureView<TI> metallic_roughness_map;
|
|
61
|
+
TextureView<TI> emissive_map;
|
|
62
|
+
TextureView<TI> occlusion_map;
|
|
63
|
+
T color[3] = {0, 0, 0};
|
|
64
|
+
T emissive[3] = {0, 0, 0};
|
|
65
|
+
T metallic = 0;
|
|
66
|
+
T roughness = 1;
|
|
67
|
+
T opacity = 1;
|
|
68
|
+
T alpha_cutoff = (T)0.5;
|
|
69
|
+
int alpha_mode = 0;
|
|
70
|
+
bool unlit = false;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
template <typename T, typename TI>
|
|
74
|
+
struct BVHNode{
|
|
75
|
+
T bounds_min[3];
|
|
76
|
+
T bounds_max[3];
|
|
77
|
+
TI left_or_first; // count == 0: index of left child (right = left + 1); count > 0: first index into primitives
|
|
78
|
+
TI count;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// BLAS of one object: a BVH over a contiguous range of scene-global triangle ids
|
|
82
|
+
template <typename T, typename TI>
|
|
83
|
+
struct ObjectView{
|
|
84
|
+
const BVHNode<T, TI>* nodes = nullptr;
|
|
85
|
+
const TI* primitives = nullptr; // leaf permutation of scene-global triangle indices
|
|
86
|
+
TI num_nodes = 0;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
template <typename T, typename TI>
|
|
90
|
+
struct InstanceView{
|
|
91
|
+
TI object = 0;
|
|
92
|
+
T object_to_world[12]; // 3x4 row-major [R|t]
|
|
93
|
+
T world_to_object[12];
|
|
94
|
+
bool identity = true;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// dynamic overlay: a tiny TLAS whose leaf primitives are GLOBAL instance indices into
|
|
98
|
+
// SceneView::instances, so BLAS traversal and shading work on overlays verbatim
|
|
99
|
+
template <typename T, typename TI>
|
|
100
|
+
struct OverlayView{
|
|
101
|
+
const BVHNode<T, TI>* tlas_nodes = nullptr;
|
|
102
|
+
const TI* tlas_primitives = nullptr;
|
|
103
|
+
TI num_tlas_nodes = 0;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
template <typename T, typename TI>
|
|
107
|
+
struct SceneView{
|
|
108
|
+
const MeshView<T, TI>* meshes = nullptr;
|
|
109
|
+
TI num_meshes = 0;
|
|
110
|
+
const TI* triangle_mesh = nullptr; // global triangle -> mesh index
|
|
111
|
+
const TI* triangle_local = nullptr; // global triangle -> local primitive index within the mesh
|
|
112
|
+
TI num_triangles = 0;
|
|
113
|
+
const ObjectView<T, TI>* objects = nullptr;
|
|
114
|
+
TI num_objects = 0;
|
|
115
|
+
const InstanceView<T, TI>* instances = nullptr;
|
|
116
|
+
TI num_instances = 0;
|
|
117
|
+
const BVHNode<T, TI>* tlas_nodes = nullptr;
|
|
118
|
+
const TI* tlas_primitives = nullptr; // TLAS leaf permutation of instance indices
|
|
119
|
+
TI num_tlas_nodes = 0;
|
|
120
|
+
const OverlayView<T, TI>* overlays = nullptr;
|
|
121
|
+
TI num_overlays = 0;
|
|
122
|
+
const TI* attachments = nullptr; // NUM_CAMERAS * MAX_OVERLAYS_PER_CAMERA, ~0 = empty
|
|
123
|
+
const SceneLight* lights = nullptr;
|
|
124
|
+
TI num_lights = 0;
|
|
125
|
+
const T* probe_directions = nullptr; // 3 per probe
|
|
126
|
+
T ambient_color[3] = {0, 0, 0};
|
|
127
|
+
T miss_color_0[3] = {0, 0, 0};
|
|
128
|
+
T miss_color_1[3] = {0, 0, 0};
|
|
129
|
+
T max_depth = 0;
|
|
130
|
+
T max_dist = 0;
|
|
131
|
+
const Camera<T>* cameras_close = nullptr;
|
|
132
|
+
const Camera<T>* cameras_open = nullptr;
|
|
133
|
+
const Camera<T>* cameras_previous = nullptr; // flow: the previous instant's cameras
|
|
134
|
+
const OverlayView<T, TI>* overlays_previous = nullptr; // flow: the previous instant's overlay TLASes (leaves index the shifted id range [first_overlay_instance + SLOTS, ...))
|
|
135
|
+
unsigned int* frame_buffer = nullptr;
|
|
136
|
+
float* depth_buffer = nullptr;
|
|
137
|
+
unsigned int* segmentation_buffer = nullptr;
|
|
138
|
+
float* normals_buffer = nullptr; // 3 per pixel, world-frame unit normal or zero on miss
|
|
139
|
+
float* flow_buffer = nullptr; // 2 per pixel on the current grid: p_previous - p_current in pixels
|
|
140
|
+
unsigned int* flow_status_buffer = nullptr; // FlowStatus per current pixel
|
|
141
|
+
float* flow_forward_buffer = nullptr; // 2 per pixel on the previous grid: q_current - q_previous in pixels
|
|
142
|
+
unsigned int* flow_forward_status_buffer = nullptr;
|
|
143
|
+
const float* flow_deltas = nullptr; // [2][SLOTS][12]: slab 0 carries a current-instant point to the previous instant, slab 1 the inverse
|
|
144
|
+
TI first_overlay_instance = 0; // global instance ids >= this index the flow-delta table
|
|
145
|
+
TI num_overlay_slots = 0; // NUM_OVERLAYS * MAX_OVERLAY_INSTANCES: delta slab stride and the previous-instant id shift
|
|
146
|
+
const unsigned int* instance_classes = nullptr; // indexed by global instance id
|
|
147
|
+
CollisionResult* collision_results = nullptr;
|
|
148
|
+
float* observation = nullptr; // 3 per pixel, written pre-quantization when set
|
|
149
|
+
float* rgb_accumulation = nullptr; // 3 per pixel, linear radiance summed across dynamic-motion-blur passes
|
|
150
|
+
float* depth_accumulation = nullptr; // 1 per pixel
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
namespace constants{
|
|
154
|
+
template <typename TI> constexpr TI LEAF_SIZE = 4;
|
|
155
|
+
template <typename TI> constexpr TI BUILD_STACK_SIZE = 256;
|
|
156
|
+
template <typename TI> constexpr TI TRAVERSAL_STACK_SIZE = 96;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
template <typename T>
|
|
160
|
+
RL_TOOLS_FUNCTION_PLACEMENT unsigned int make_8bit(T f){
|
|
161
|
+
const int value = (int)(f * (T)256);
|
|
162
|
+
return (unsigned int)(value < 0 ? 0 : (value > 255 ? 255 : value));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
template <typename T>
|
|
166
|
+
RL_TOOLS_FUNCTION_PLACEMENT unsigned int make_rgba(Vec3<T> color){
|
|
167
|
+
return (make_8bit(color.x) << 0) | (make_8bit(color.y) << 8) | (make_8bit(color.z) << 16) | (0xffu << 24);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
template <typename MATH, typename T>
|
|
171
|
+
RL_TOOLS_FUNCTION_PLACEMENT T linear_to_srgb(const MATH& math_device, T x){
|
|
172
|
+
if (x <= (T)0.0031308) return (T)12.92 * x;
|
|
173
|
+
return (T)1.055 * math::pow(math_device, x, (T)1 / (T)2.4) - (T)0.055;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
template <typename MATH, typename T>
|
|
177
|
+
RL_TOOLS_FUNCTION_PLACEMENT unsigned int make_srgb_rgba_from_linear(const MATH& math_device, Vec3<T> color){
|
|
178
|
+
color.x = linear_to_srgb(math_device, clamp01(color.x));
|
|
179
|
+
color.y = linear_to_srgb(math_device, clamp01(color.y));
|
|
180
|
+
color.z = linear_to_srgb(math_device, clamp01(color.z));
|
|
181
|
+
return make_rgba(color);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
template <typename T>
|
|
185
|
+
RL_TOOLS_FUNCTION_PLACEMENT unsigned int make_linear_rgba_from_linear(Vec3<T> color){
|
|
186
|
+
color.x = clamp01(color.x);
|
|
187
|
+
color.y = clamp01(color.y);
|
|
188
|
+
color.z = clamp01(color.z);
|
|
189
|
+
return make_rgba(color);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
template <typename MATH, typename T>
|
|
193
|
+
RL_TOOLS_FUNCTION_PLACEMENT T srgb_texel_to_linear(const MATH& math_device, unsigned char value){
|
|
194
|
+
const T x = (T)value / (T)255;
|
|
195
|
+
return x <= (T)0.04045 ? x / (T)12.92 : math::pow(math_device, (x + (T)0.055) / (T)1.055, (T)2.4);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// GPU-style normalized-coordinate bilinear sampling with repeat wrap; sRGB decode happens
|
|
199
|
+
// per texel before filtering (matching the texture units of the other backends).
|
|
200
|
+
template <typename MATH, typename T, typename TI>
|
|
201
|
+
RL_TOOLS_FUNCTION_PLACEMENT void sample_texture(const MATH& math_device, const TextureView<TI>& texture, T u, T v, bool srgb, T out[4]){
|
|
202
|
+
const int width = (int)texture.width;
|
|
203
|
+
const int height = (int)texture.height;
|
|
204
|
+
const T x = u * (T)width - (T)0.5;
|
|
205
|
+
const T y = v * (T)height - (T)0.5;
|
|
206
|
+
int x0 = (int)x; if((T)x0 > x) x0--;
|
|
207
|
+
int y0 = (int)y; if((T)y0 > y) y0--;
|
|
208
|
+
const T fx = x - (T)x0;
|
|
209
|
+
const T fy = y - (T)y0;
|
|
210
|
+
const int x0_wrapped = ((x0 % width) + width) % width;
|
|
211
|
+
const int x1_wrapped = (((x0 + 1) % width) + width) % width;
|
|
212
|
+
const int y0_wrapped = ((y0 % height) + height) % height;
|
|
213
|
+
const int y1_wrapped = (((y0 + 1) % height) + height) % height;
|
|
214
|
+
const unsigned char* texel_00 = &texture.pixels[((TI)y0_wrapped * (TI)width + (TI)x0_wrapped) * 4];
|
|
215
|
+
const unsigned char* texel_10 = &texture.pixels[((TI)y0_wrapped * (TI)width + (TI)x1_wrapped) * 4];
|
|
216
|
+
const unsigned char* texel_01 = &texture.pixels[((TI)y1_wrapped * (TI)width + (TI)x0_wrapped) * 4];
|
|
217
|
+
const unsigned char* texel_11 = &texture.pixels[((TI)y1_wrapped * (TI)width + (TI)x1_wrapped) * 4];
|
|
218
|
+
for(int channel = 0; channel < 4; channel++){
|
|
219
|
+
const bool decode = srgb && channel < 3;
|
|
220
|
+
const T value_00 = decode ? srgb_texel_to_linear<MATH, T>(math_device, texel_00[channel]) : (T)texel_00[channel] / (T)255;
|
|
221
|
+
const T value_10 = decode ? srgb_texel_to_linear<MATH, T>(math_device, texel_10[channel]) : (T)texel_10[channel] / (T)255;
|
|
222
|
+
const T value_01 = decode ? srgb_texel_to_linear<MATH, T>(math_device, texel_01[channel]) : (T)texel_01[channel] / (T)255;
|
|
223
|
+
const T value_11 = decode ? srgb_texel_to_linear<MATH, T>(math_device, texel_11[channel]) : (T)texel_11[channel] / (T)255;
|
|
224
|
+
const T top = value_00 + fx * (value_10 - value_00);
|
|
225
|
+
const T bottom = value_01 + fx * (value_11 - value_01);
|
|
226
|
+
out[channel] = top + fy * (bottom - top);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
template <typename T, typename TI>
|
|
231
|
+
struct Hit{
|
|
232
|
+
T t;
|
|
233
|
+
T u;
|
|
234
|
+
T v;
|
|
235
|
+
TI triangle;
|
|
236
|
+
TI instance;
|
|
237
|
+
bool valid;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// the transform element type deduces independently of T: the flow-delta table is float
|
|
241
|
+
// even when the scene is instantiated with T = double
|
|
242
|
+
template <typename T_TRANSFORM, typename T>
|
|
243
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> transform_point(const T_TRANSFORM transform[12], Vec3<T> point){
|
|
244
|
+
return Vec3<T>{
|
|
245
|
+
(T)transform[0] * point.x + (T)transform[1] * point.y + (T)transform[2] * point.z + (T)transform[3],
|
|
246
|
+
(T)transform[4] * point.x + (T)transform[5] * point.y + (T)transform[6] * point.z + (T)transform[7],
|
|
247
|
+
(T)transform[8] * point.x + (T)transform[9] * point.y + (T)transform[10] * point.z + (T)transform[11]
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
template <typename T>
|
|
252
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> transform_vector(const T transform[12], Vec3<T> vector){
|
|
253
|
+
return Vec3<T>{
|
|
254
|
+
transform[0] * vector.x + transform[1] * vector.y + transform[2] * vector.z,
|
|
255
|
+
transform[4] * vector.x + transform[5] * vector.y + transform[6] * vector.z,
|
|
256
|
+
transform[8] * vector.x + transform[9] * vector.y + transform[10] * vector.z
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// normals transform with the inverse-transpose: multiply by the world_to_object columns
|
|
261
|
+
template <typename T>
|
|
262
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> transform_normal(const T world_to_object[12], Vec3<T> normal){
|
|
263
|
+
return Vec3<T>{
|
|
264
|
+
world_to_object[0] * normal.x + world_to_object[4] * normal.y + world_to_object[8] * normal.z,
|
|
265
|
+
world_to_object[1] * normal.x + world_to_object[5] * normal.y + world_to_object[9] * normal.z,
|
|
266
|
+
world_to_object[2] * normal.x + world_to_object[6] * normal.y + world_to_object[10] * normal.z
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
template <typename T, typename TI>
|
|
271
|
+
RL_TOOLS_FUNCTION_PLACEMENT void triangle_vertices(const SceneView<T, TI>& scene, TI triangle, Vec3<T>& vertex_a, Vec3<T>& vertex_b, Vec3<T>& vertex_c){
|
|
272
|
+
const MeshView<T, TI>& mesh = scene.meshes[scene.triangle_mesh[triangle]];
|
|
273
|
+
const int* index = &mesh.indices[3 * scene.triangle_local[triangle]];
|
|
274
|
+
vertex_a = to_vec3(&mesh.vertices[3 * (TI)index[0]]);
|
|
275
|
+
vertex_b = to_vec3(&mesh.vertices[3 * (TI)index[1]]);
|
|
276
|
+
vertex_c = to_vec3(&mesh.vertices[3 * (TI)index[2]]);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Moeller-Trumbore, no culling; barycentric convention matches the GPU backends
|
|
280
|
+
// (u on the second vertex, v on the third, w0 = 1 - u - v on the first).
|
|
281
|
+
template <typename T, typename TI>
|
|
282
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool intersect_triangle(const SceneView<T, TI>& scene, TI triangle, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max, Hit<T, TI>& hit){
|
|
283
|
+
Vec3<T> vertex_a, vertex_b, vertex_c;
|
|
284
|
+
triangle_vertices(scene, triangle, vertex_a, vertex_b, vertex_c);
|
|
285
|
+
const Vec3<T> edge1 = vertex_b - vertex_a;
|
|
286
|
+
const Vec3<T> edge2 = vertex_c - vertex_a;
|
|
287
|
+
const Vec3<T> pvec = cross(direction, edge2);
|
|
288
|
+
const T det = dot(edge1, pvec);
|
|
289
|
+
if(det > (T)-1e-9 && det < (T)1e-9) return false;
|
|
290
|
+
const T inv_det = (T)1 / det;
|
|
291
|
+
const Vec3<T> tvec = origin - vertex_a;
|
|
292
|
+
const T u = dot(tvec, pvec) * inv_det;
|
|
293
|
+
if(u < (T)0 || u > (T)1) return false;
|
|
294
|
+
const Vec3<T> qvec = cross(tvec, edge1);
|
|
295
|
+
const T v = dot(direction, qvec) * inv_det;
|
|
296
|
+
if(v < (T)0 || u + v > (T)1) return false;
|
|
297
|
+
const T t = dot(edge2, qvec) * inv_det;
|
|
298
|
+
if(t <= t_min || t >= t_max) return false;
|
|
299
|
+
hit.t = t;
|
|
300
|
+
hit.u = u;
|
|
301
|
+
hit.v = v;
|
|
302
|
+
hit.triangle = triangle;
|
|
303
|
+
hit.valid = true;
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Branchy slab test: avoids 1/0 = inf, which is undefined behavior under fast-math.
|
|
308
|
+
template <typename T, typename TI>
|
|
309
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool intersect_aabb(const BVHNode<T, TI>& node, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
310
|
+
const T origin_array[3] = {origin.x, origin.y, origin.z};
|
|
311
|
+
const T direction_array[3] = {direction.x, direction.y, direction.z};
|
|
312
|
+
for(int axis = 0; axis < 3; axis++){
|
|
313
|
+
const T d = direction_array[axis];
|
|
314
|
+
const T o = origin_array[axis];
|
|
315
|
+
if(d > (T)-1e-12 && d < (T)1e-12){
|
|
316
|
+
if(o < node.bounds_min[axis] || o > node.bounds_max[axis]) return false;
|
|
317
|
+
}
|
|
318
|
+
else{
|
|
319
|
+
const T inv = (T)1 / d;
|
|
320
|
+
T t1 = (node.bounds_min[axis] - o) * inv;
|
|
321
|
+
T t2 = (node.bounds_max[axis] - o) * inv;
|
|
322
|
+
if(t1 > t2){ const T tmp = t1; t1 = t2; t2 = tmp; }
|
|
323
|
+
t_min = maximum(t_min, t1);
|
|
324
|
+
t_max = minimum(t_max, t2);
|
|
325
|
+
if(t_min > t_max) return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// BLAS traversal against one instance; the ray is transformed into object space with an
|
|
332
|
+
// unnormalized direction, so hit.t stays parameterized in world units and is comparable
|
|
333
|
+
// across instances.
|
|
334
|
+
template <typename T, typename TI>
|
|
335
|
+
RL_TOOLS_FUNCTION_PLACEMENT void intersect_blas_closest(const SceneView<T, TI>& scene, TI instance_index, Vec3<T> origin, Vec3<T> direction, T t_min, Hit<T, TI>& best){
|
|
336
|
+
const InstanceView<T, TI>& instance = scene.instances[instance_index];
|
|
337
|
+
const ObjectView<T, TI>& object = scene.objects[instance.object];
|
|
338
|
+
if(object.num_nodes == 0) return;
|
|
339
|
+
if(!instance.identity){
|
|
340
|
+
origin = transform_point(instance.world_to_object, origin);
|
|
341
|
+
direction = transform_vector(instance.world_to_object, direction);
|
|
342
|
+
}
|
|
343
|
+
TI stack[constants::TRAVERSAL_STACK_SIZE<TI>];
|
|
344
|
+
TI stack_pointer = 0;
|
|
345
|
+
stack[stack_pointer++] = 0;
|
|
346
|
+
while(stack_pointer > 0){
|
|
347
|
+
const BVHNode<T, TI>& node = object.nodes[stack[--stack_pointer]];
|
|
348
|
+
if(!intersect_aabb(node, origin, direction, t_min, best.t)) continue;
|
|
349
|
+
if(node.count > 0){
|
|
350
|
+
for(TI i = 0; i < node.count; i++){
|
|
351
|
+
const TI triangle = object.primitives[node.left_or_first + i];
|
|
352
|
+
if(intersect_triangle(scene, triangle, origin, direction, t_min, best.t, best)){
|
|
353
|
+
best.instance = instance_index;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else{
|
|
358
|
+
if(stack_pointer + 2 <= constants::TRAVERSAL_STACK_SIZE<TI>){
|
|
359
|
+
stack[stack_pointer++] = node.left_or_first + 1;
|
|
360
|
+
stack[stack_pointer++] = node.left_or_first;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
template <typename T, typename TI>
|
|
367
|
+
RL_TOOLS_FUNCTION_PLACEMENT void traverse_tlas_closest(const SceneView<T, TI>& scene, const BVHNode<T, TI>* tlas_nodes, const TI* tlas_primitives, TI num_tlas_nodes, Vec3<T> origin, Vec3<T> direction, T t_min, Hit<T, TI>& best){
|
|
368
|
+
if(num_tlas_nodes == 0) return;
|
|
369
|
+
TI stack[constants::TRAVERSAL_STACK_SIZE<TI>];
|
|
370
|
+
TI stack_pointer = 0;
|
|
371
|
+
stack[stack_pointer++] = 0;
|
|
372
|
+
while(stack_pointer > 0){
|
|
373
|
+
const BVHNode<T, TI>& node = tlas_nodes[stack[--stack_pointer]];
|
|
374
|
+
if(!intersect_aabb(node, origin, direction, t_min, best.t)) continue;
|
|
375
|
+
if(node.count > 0){
|
|
376
|
+
for(TI i = 0; i < node.count; i++){
|
|
377
|
+
const TI instance_index = tlas_primitives[node.left_or_first + i];
|
|
378
|
+
intersect_blas_closest(scene, instance_index, origin, direction, t_min, best);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
else{
|
|
382
|
+
if(stack_pointer + 2 <= constants::TRAVERSAL_STACK_SIZE<TI>){
|
|
383
|
+
stack[stack_pointer++] = node.left_or_first + 1;
|
|
384
|
+
stack[stack_pointer++] = node.left_or_first;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
template <typename T, typename TI>
|
|
391
|
+
RL_TOOLS_FUNCTION_PLACEMENT Hit<T, TI> trace_closest(const SceneView<T, TI>& scene, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
392
|
+
Hit<T, TI> best;
|
|
393
|
+
best.t = t_max;
|
|
394
|
+
best.u = 0;
|
|
395
|
+
best.v = 0;
|
|
396
|
+
best.triangle = 0;
|
|
397
|
+
best.instance = 0;
|
|
398
|
+
best.valid = false;
|
|
399
|
+
traverse_tlas_closest(scene, scene.tlas_nodes, scene.tlas_primitives, scene.num_tlas_nodes, origin, direction, t_min, best);
|
|
400
|
+
return best;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
template <typename T, typename TI>
|
|
404
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool intersect_blas_any(const SceneView<T, TI>& scene, TI instance_index, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
405
|
+
const InstanceView<T, TI>& instance = scene.instances[instance_index];
|
|
406
|
+
const ObjectView<T, TI>& object = scene.objects[instance.object];
|
|
407
|
+
if(object.num_nodes == 0) return false;
|
|
408
|
+
if(!instance.identity){
|
|
409
|
+
origin = transform_point(instance.world_to_object, origin);
|
|
410
|
+
direction = transform_vector(instance.world_to_object, direction);
|
|
411
|
+
}
|
|
412
|
+
TI stack[constants::TRAVERSAL_STACK_SIZE<TI>];
|
|
413
|
+
TI stack_pointer = 0;
|
|
414
|
+
stack[stack_pointer++] = 0;
|
|
415
|
+
Hit<T, TI> hit;
|
|
416
|
+
hit.valid = false;
|
|
417
|
+
while(stack_pointer > 0){
|
|
418
|
+
const BVHNode<T, TI>& node = object.nodes[stack[--stack_pointer]];
|
|
419
|
+
if(!intersect_aabb(node, origin, direction, t_min, t_max)) continue;
|
|
420
|
+
if(node.count > 0){
|
|
421
|
+
for(TI i = 0; i < node.count; i++){
|
|
422
|
+
const TI triangle = object.primitives[node.left_or_first + i];
|
|
423
|
+
if(intersect_triangle(scene, triangle, origin, direction, t_min, t_max, hit)) return true;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
else{
|
|
427
|
+
if(stack_pointer + 2 <= constants::TRAVERSAL_STACK_SIZE<TI>){
|
|
428
|
+
stack[stack_pointer++] = node.left_or_first + 1;
|
|
429
|
+
stack[stack_pointer++] = node.left_or_first;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
template <typename T, typename TI>
|
|
437
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool traverse_tlas_any(const SceneView<T, TI>& scene, const BVHNode<T, TI>* tlas_nodes, const TI* tlas_primitives, TI num_tlas_nodes, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
438
|
+
if(num_tlas_nodes == 0) return false;
|
|
439
|
+
TI stack[constants::TRAVERSAL_STACK_SIZE<TI>];
|
|
440
|
+
TI stack_pointer = 0;
|
|
441
|
+
stack[stack_pointer++] = 0;
|
|
442
|
+
while(stack_pointer > 0){
|
|
443
|
+
const BVHNode<T, TI>& node = tlas_nodes[stack[--stack_pointer]];
|
|
444
|
+
if(!intersect_aabb(node, origin, direction, t_min, t_max)) continue;
|
|
445
|
+
if(node.count > 0){
|
|
446
|
+
for(TI i = 0; i < node.count; i++){
|
|
447
|
+
const TI instance_index = tlas_primitives[node.left_or_first + i];
|
|
448
|
+
if(intersect_blas_any(scene, instance_index, origin, direction, t_min, t_max)) return true;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
else{
|
|
452
|
+
if(stack_pointer + 2 <= constants::TRAVERSAL_STACK_SIZE<TI>){
|
|
453
|
+
stack[stack_pointer++] = node.left_or_first + 1;
|
|
454
|
+
stack[stack_pointer++] = node.left_or_first;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
template <typename T, typename TI>
|
|
462
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool trace_any(const SceneView<T, TI>& scene, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
463
|
+
return traverse_tlas_any(scene, scene.tlas_nodes, scene.tlas_primitives, scene.num_tlas_nodes, origin, direction, t_min, t_max);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
template <typename T, typename TI>
|
|
467
|
+
RL_TOOLS_FUNCTION_PLACEMENT T trace_depth_distance(const SceneView<T, TI>& scene, Vec3<T> origin, Vec3<T> direction, T max_depth){
|
|
468
|
+
const Hit<T, TI> hit = trace_closest(scene, origin, direction, (T)0, max_depth);
|
|
469
|
+
return hit.valid ? hit.t : max_depth;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
template <typename SPEC>
|
|
473
|
+
RL_TOOLS_FUNCTION_PLACEMENT typename SPEC::TI camera_from_pixel(typename SPEC::TI pixel_x, typename SPEC::TI pixel_y){
|
|
474
|
+
return (pixel_y / SPEC::CAM_HEIGHT) * SPEC::GRID_COLS + pixel_x / SPEC::CAM_WIDTH;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// composed tracing: the shared world plus the overlays attached to the ray's camera, taken
|
|
478
|
+
// from the given overlay set (the current instant's scene.overlays, or the previous
|
|
479
|
+
// instant's scene.overlays_previous for the flow visibility rays). K = 0 compiles down to
|
|
480
|
+
// the raw single-structure trace.
|
|
481
|
+
template <typename SPEC, typename T, typename TI>
|
|
482
|
+
RL_TOOLS_FUNCTION_PLACEMENT Hit<T, TI> trace_closest_composed(const SceneView<T, TI>& scene, const OverlayView<T, TI>* overlays, TI camera, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
483
|
+
Hit<T, TI> best = trace_closest(scene, origin, direction, t_min, t_max);
|
|
484
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
485
|
+
for(TI attachment = 0; attachment < SPEC::MAX_OVERLAYS_PER_CAMERA; attachment++){
|
|
486
|
+
const TI overlay = scene.attachments[camera * SPEC::MAX_OVERLAYS_PER_CAMERA + attachment];
|
|
487
|
+
if(overlay == ~(TI)0) continue;
|
|
488
|
+
const OverlayView<T, TI>& view = overlays[overlay];
|
|
489
|
+
traverse_tlas_closest(scene, view.tlas_nodes, view.tlas_primitives, view.num_tlas_nodes, origin, direction, t_min, best);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return best;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
template <typename SPEC, typename T, typename TI>
|
|
496
|
+
RL_TOOLS_FUNCTION_PLACEMENT Hit<T, TI> trace_closest_composed(const SceneView<T, TI>& scene, TI camera, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
497
|
+
return trace_closest_composed<SPEC>(scene, scene.overlays, camera, origin, direction, t_min, t_max);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
template <typename SPEC, typename T, typename TI>
|
|
501
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool trace_any_composed(const SceneView<T, TI>& scene, const OverlayView<T, TI>* overlays, TI camera, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
502
|
+
if(trace_any(scene, origin, direction, t_min, t_max)) return true;
|
|
503
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
504
|
+
for(TI attachment = 0; attachment < SPEC::MAX_OVERLAYS_PER_CAMERA; attachment++){
|
|
505
|
+
const TI overlay = scene.attachments[camera * SPEC::MAX_OVERLAYS_PER_CAMERA + attachment];
|
|
506
|
+
if(overlay == ~(TI)0) continue;
|
|
507
|
+
const OverlayView<T, TI>& view = overlays[overlay];
|
|
508
|
+
if(traverse_tlas_any(scene, view.tlas_nodes, view.tlas_primitives, view.num_tlas_nodes, origin, direction, t_min, t_max)) return true;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
template <typename SPEC, typename T, typename TI>
|
|
515
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool trace_any_composed(const SceneView<T, TI>& scene, TI camera, Vec3<T> origin, Vec3<T> direction, T t_min, T t_max){
|
|
516
|
+
return trace_any_composed<SPEC>(scene, scene.overlays, camera, origin, direction, t_min, t_max);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
template <typename SPEC, typename T, typename TI>
|
|
520
|
+
RL_TOOLS_FUNCTION_PLACEMENT T trace_depth_distance_composed(const SceneView<T, TI>& scene, TI camera, Vec3<T> origin, Vec3<T> direction, T max_depth){
|
|
521
|
+
const Hit<T, TI> hit = trace_closest_composed<SPEC>(scene, camera, origin, direction, (T)0, max_depth);
|
|
522
|
+
return hit.valid ? hit.t : max_depth;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
template <typename T, typename TI>
|
|
526
|
+
RL_TOOLS_FUNCTION_PLACEMENT void expand_triangle_bounds(const SceneView<T, TI>& scene, TI triangle, T bounds_min[3], T bounds_max[3]){
|
|
527
|
+
Vec3<T> vertex_a, vertex_b, vertex_c;
|
|
528
|
+
triangle_vertices(scene, triangle, vertex_a, vertex_b, vertex_c);
|
|
529
|
+
const T vertices[3][3] = {{vertex_a.x, vertex_a.y, vertex_a.z}, {vertex_b.x, vertex_b.y, vertex_b.z}, {vertex_c.x, vertex_c.y, vertex_c.z}};
|
|
530
|
+
for(int vertex_i = 0; vertex_i < 3; vertex_i++){
|
|
531
|
+
for(int axis = 0; axis < 3; axis++){
|
|
532
|
+
bounds_min[axis] = minimum(bounds_min[axis], vertices[vertex_i][axis]);
|
|
533
|
+
bounds_max[axis] = maximum(bounds_max[axis], vertices[vertex_i][axis]);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
template <typename TI>
|
|
539
|
+
struct BVHBuildEntry{
|
|
540
|
+
TI node;
|
|
541
|
+
TI start;
|
|
542
|
+
TI count;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
// Median split on the largest centroid-bounds axis; the two-pass partition through
|
|
546
|
+
// temp_primitives preserves relative order, so the build is deterministic. Serves both
|
|
547
|
+
// BLAS (primitives = global triangle ids) and TLAS (primitives = instance indices);
|
|
548
|
+
// bounds/centroid arrays are indexed by primitive value. Returns the node count.
|
|
549
|
+
template <typename T, typename TI>
|
|
550
|
+
RL_TOOLS_FUNCTION_PLACEMENT TI build_bvh_nodes(BVHNode<T, TI>* nodes, TI* primitives, TI* temp_primitives, const T* primitive_bounds_min, const T* primitive_bounds_max, const T* centroids, TI count){
|
|
551
|
+
if(count == 0){
|
|
552
|
+
return 0;
|
|
553
|
+
}
|
|
554
|
+
TI node_count = 1;
|
|
555
|
+
BVHBuildEntry<TI> stack[constants::BUILD_STACK_SIZE<TI>];
|
|
556
|
+
TI stack_pointer = 0;
|
|
557
|
+
stack[stack_pointer++] = {0, 0, count};
|
|
558
|
+
while(stack_pointer > 0){
|
|
559
|
+
const BVHBuildEntry<TI> entry = stack[--stack_pointer];
|
|
560
|
+
BVHNode<T, TI>& node = nodes[entry.node];
|
|
561
|
+
for(int axis = 0; axis < 3; axis++){
|
|
562
|
+
node.bounds_min[axis] = (T)1e30;
|
|
563
|
+
node.bounds_max[axis] = (T)-1e30;
|
|
564
|
+
}
|
|
565
|
+
T centroid_min[3] = {(T)1e30, (T)1e30, (T)1e30};
|
|
566
|
+
T centroid_max[3] = {(T)-1e30, (T)-1e30, (T)-1e30};
|
|
567
|
+
for(TI i = 0; i < entry.count; i++){
|
|
568
|
+
const TI primitive = primitives[entry.start + i];
|
|
569
|
+
for(int axis = 0; axis < 3; axis++){
|
|
570
|
+
node.bounds_min[axis] = minimum(node.bounds_min[axis], primitive_bounds_min[3 * primitive + axis]);
|
|
571
|
+
node.bounds_max[axis] = maximum(node.bounds_max[axis], primitive_bounds_max[3 * primitive + axis]);
|
|
572
|
+
centroid_min[axis] = minimum(centroid_min[axis], centroids[3 * primitive + axis]);
|
|
573
|
+
centroid_max[axis] = maximum(centroid_max[axis], centroids[3 * primitive + axis]);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
bool leaf = entry.count <= constants::LEAF_SIZE<TI> || stack_pointer + 2 > constants::BUILD_STACK_SIZE<TI>;
|
|
577
|
+
int split_axis = 0;
|
|
578
|
+
if(!leaf){
|
|
579
|
+
T max_extent = (T)0;
|
|
580
|
+
for(int axis = 0; axis < 3; axis++){
|
|
581
|
+
const T extent = centroid_max[axis] - centroid_min[axis];
|
|
582
|
+
if(extent > max_extent){
|
|
583
|
+
max_extent = extent;
|
|
584
|
+
split_axis = axis;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if(max_extent <= (T)0) leaf = true;
|
|
588
|
+
}
|
|
589
|
+
if(leaf){
|
|
590
|
+
node.left_or_first = entry.start;
|
|
591
|
+
node.count = entry.count;
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
const T split = (centroid_min[split_axis] + centroid_max[split_axis]) * (T)0.5;
|
|
595
|
+
TI num_left = 0;
|
|
596
|
+
for(TI i = 0; i < entry.count; i++){
|
|
597
|
+
const TI primitive = primitives[entry.start + i];
|
|
598
|
+
if(centroids[3 * primitive + split_axis] < split) temp_primitives[num_left++] = primitive;
|
|
599
|
+
}
|
|
600
|
+
TI num_total = num_left;
|
|
601
|
+
for(TI i = 0; i < entry.count; i++){
|
|
602
|
+
const TI primitive = primitives[entry.start + i];
|
|
603
|
+
if(!(centroids[3 * primitive + split_axis] < split)) temp_primitives[num_total++] = primitive;
|
|
604
|
+
}
|
|
605
|
+
if(num_left == 0 || num_left == entry.count){
|
|
606
|
+
num_left = entry.count / 2; // degenerate split: halve in the current (deterministic) order
|
|
607
|
+
}
|
|
608
|
+
else{
|
|
609
|
+
for(TI i = 0; i < entry.count; i++){
|
|
610
|
+
primitives[entry.start + i] = temp_primitives[i];
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
const TI left_child = node_count++;
|
|
614
|
+
const TI right_child = node_count++;
|
|
615
|
+
node.left_or_first = left_child;
|
|
616
|
+
node.count = 0;
|
|
617
|
+
stack[stack_pointer++] = {right_child, entry.start + num_left, entry.count - num_left};
|
|
618
|
+
stack[stack_pointer++] = {left_child, entry.start, num_left};
|
|
619
|
+
}
|
|
620
|
+
return node_count;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
template <typename SPEC, typename T, typename TI>
|
|
624
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<T> miss_color(const SceneView<T, TI>& scene, TI pixel_x, TI pixel_y){
|
|
625
|
+
if constexpr (SPEC::SHADING::CHECKER_BACKGROUND){
|
|
626
|
+
const int checker_pattern = ((int)pixel_x / 8) ^ ((int)pixel_y / 8);
|
|
627
|
+
return (checker_pattern & 1) ? to_vec3(scene.miss_color_1) : to_vec3(scene.miss_color_0);
|
|
628
|
+
}
|
|
629
|
+
return to_vec3(scene.miss_color_0);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
template <typename DEVICE, typename SPEC, int DEPTH>
|
|
633
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<typename SPEC::T> trace_rgb(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene, typename SPEC::TI pixel_x, typename SPEC::TI pixel_y, Vec3<typename SPEC::T> origin, Vec3<typename SPEC::T> direction, typename SPEC::T t_min, typename SPEC::T t_max);
|
|
634
|
+
|
|
635
|
+
template <typename DEVICE, typename SPEC, int DEPTH>
|
|
636
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<typename SPEC::T> shade_basic(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene, typename SPEC::TI pixel_x, typename SPEC::TI pixel_y, Vec3<typename SPEC::T> origin, Vec3<typename SPEC::T> ray_direction, const Hit<typename SPEC::T, typename SPEC::TI>& hit){
|
|
637
|
+
using T = typename SPEC::T;
|
|
638
|
+
using TI = typename SPEC::TI;
|
|
639
|
+
const auto& math_device = device.math;
|
|
640
|
+
const MeshView<T, TI>& self = scene.meshes[scene.triangle_mesh[hit.triangle]];
|
|
641
|
+
const TI local = scene.triangle_local[hit.triangle];
|
|
642
|
+
|
|
643
|
+
Vec3<T> base_color = to_vec3(self.color);
|
|
644
|
+
Vec3<T> normal_geometric = {0, 0, 1};
|
|
645
|
+
Vec3<T> ray_dir = {0, 0, 0};
|
|
646
|
+
|
|
647
|
+
if constexpr (SPEC::SHADING::LOAD_TEXTURES || SPEC::SHADING::NORMAL_SHADING || SPEC::SHADING::METALLIC_REFLECTIONS){
|
|
648
|
+
const int* index = &self.indices[3 * local];
|
|
649
|
+
|
|
650
|
+
if constexpr (SPEC::SHADING::NORMAL_SHADING || SPEC::SHADING::METALLIC_REFLECTIONS){
|
|
651
|
+
Vec3<T> vertex_a = to_vec3(&self.vertices[3 * (TI)index[0]]);
|
|
652
|
+
Vec3<T> vertex_b = to_vec3(&self.vertices[3 * (TI)index[1]]);
|
|
653
|
+
Vec3<T> vertex_c = to_vec3(&self.vertices[3 * (TI)index[2]]);
|
|
654
|
+
const InstanceView<T, TI>& instance = scene.instances[hit.instance];
|
|
655
|
+
if(!instance.identity){
|
|
656
|
+
vertex_a = transform_point(instance.object_to_world, vertex_a);
|
|
657
|
+
vertex_b = transform_point(instance.object_to_world, vertex_b);
|
|
658
|
+
vertex_c = transform_point(instance.object_to_world, vertex_c);
|
|
659
|
+
}
|
|
660
|
+
normal_geometric = normalize(math_device, cross(vertex_b - vertex_a, vertex_c - vertex_a));
|
|
661
|
+
ray_dir = ray_direction;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
if constexpr (SPEC::SHADING::LOAD_TEXTURES){
|
|
665
|
+
if(self.texture.pixels != nullptr && self.tex_coords != nullptr){
|
|
666
|
+
const T w0 = (T)1 - hit.u - hit.v;
|
|
667
|
+
const T tc_x = w0 * self.tex_coords[2 * (TI)index[0] + 0] + hit.u * self.tex_coords[2 * (TI)index[1] + 0] + hit.v * self.tex_coords[2 * (TI)index[2] + 0];
|
|
668
|
+
const T tc_y = w0 * self.tex_coords[2 * (TI)index[0] + 1] + hit.u * self.tex_coords[2 * (TI)index[1] + 1] + hit.v * self.tex_coords[2 * (TI)index[2] + 1];
|
|
669
|
+
T tex_color[4];
|
|
670
|
+
sample_texture(math_device, self.texture, tc_x, tc_y, true, tex_color);
|
|
671
|
+
base_color = Vec3<T>{tex_color[0], tex_color[1], tex_color[2]} * to_vec3(self.color);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
if(self.unlit){
|
|
677
|
+
return base_color;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
Vec3<T> direct = base_color;
|
|
681
|
+
if constexpr (SPEC::SHADING::NORMAL_SHADING){
|
|
682
|
+
const T cosine = dot(ray_dir, normal_geometric);
|
|
683
|
+
direct = ((T)0.2 + (T)0.8 * (cosine < 0 ? -cosine : cosine)) * base_color;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
if constexpr (SPEC::SHADING::METALLIC_REFLECTIONS){
|
|
687
|
+
if constexpr (DEPTH < 1){
|
|
688
|
+
if(self.metallic > (T)0){
|
|
689
|
+
const Vec3<T> hit_point = origin + ray_dir * hit.t;
|
|
690
|
+
const Vec3<T> n = dot(ray_dir, normal_geometric) > (T)0 ? -normal_geometric : normal_geometric;
|
|
691
|
+
const Vec3<T> reflect_dir = ray_dir - (T)2 * dot(ray_dir, n) * n;
|
|
692
|
+
|
|
693
|
+
const Vec3<T> reflected_color = trace_rgb<DEVICE, SPEC, DEPTH + 1>(device, scene, pixel_x, pixel_y, hit_point, reflect_dir, (T)1e-3, (T)1e20);
|
|
694
|
+
|
|
695
|
+
const T cosine = dot(ray_dir, n);
|
|
696
|
+
const T cos_theta = cosine < 0 ? -cosine : cosine;
|
|
697
|
+
const T fresnel = self.metallic * ((T)0.04 + (T)0.96 * math::pow(math_device, (T)1 - cos_theta, (T)5));
|
|
698
|
+
const Vec3<T> reflect_mix = Vec3<T>{(T)1 - fresnel, (T)1 - fresnel, (T)1 - fresnel} + fresnel * reflected_color;
|
|
699
|
+
return direct * reflect_mix;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return direct;
|
|
703
|
+
}
|
|
704
|
+
return direct;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
template <typename DEVICE, typename SPEC, int DEPTH>
|
|
708
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<typename SPEC::T> shade_pbr(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene, typename SPEC::TI pixel_x, typename SPEC::TI pixel_y, Vec3<typename SPEC::T> origin, Vec3<typename SPEC::T> ray_dir, const Hit<typename SPEC::T, typename SPEC::TI>& hit){
|
|
709
|
+
using T = typename SPEC::T;
|
|
710
|
+
using TI = typename SPEC::TI;
|
|
711
|
+
const auto& math_device = device.math;
|
|
712
|
+
const MeshView<T, TI>& self = scene.meshes[scene.triangle_mesh[hit.triangle]];
|
|
713
|
+
const TI local = scene.triangle_local[hit.triangle];
|
|
714
|
+
const int* index = &self.indices[3 * local];
|
|
715
|
+
|
|
716
|
+
Vec3<T> vertex_a = to_vec3(&self.vertices[3 * (TI)index[0]]);
|
|
717
|
+
Vec3<T> vertex_b = to_vec3(&self.vertices[3 * (TI)index[1]]);
|
|
718
|
+
Vec3<T> vertex_c = to_vec3(&self.vertices[3 * (TI)index[2]]);
|
|
719
|
+
const InstanceView<T, TI>& hit_instance = scene.instances[hit.instance];
|
|
720
|
+
if(!hit_instance.identity){
|
|
721
|
+
vertex_a = transform_point(hit_instance.object_to_world, vertex_a);
|
|
722
|
+
vertex_b = transform_point(hit_instance.object_to_world, vertex_b);
|
|
723
|
+
vertex_c = transform_point(hit_instance.object_to_world, vertex_c);
|
|
724
|
+
}
|
|
725
|
+
const T w0 = (T)1 - hit.u - hit.v;
|
|
726
|
+
|
|
727
|
+
const Vec3<T> edge1 = vertex_b - vertex_a;
|
|
728
|
+
const Vec3<T> edge2 = vertex_c - vertex_a;
|
|
729
|
+
const Vec3<T> normal_geometric = normalize(math_device, cross(edge1, edge2));
|
|
730
|
+
|
|
731
|
+
Vec3<T> N;
|
|
732
|
+
if(self.normals != nullptr){
|
|
733
|
+
Vec3<T> normal_interpolated = w0 * to_vec3(&self.normals[3 * (TI)index[0]]) + hit.u * to_vec3(&self.normals[3 * (TI)index[1]]) + hit.v * to_vec3(&self.normals[3 * (TI)index[2]]);
|
|
734
|
+
if(!hit_instance.identity){
|
|
735
|
+
normal_interpolated = transform_normal(hit_instance.world_to_object, normal_interpolated);
|
|
736
|
+
}
|
|
737
|
+
N = normalize(math_device, normal_interpolated);
|
|
738
|
+
}
|
|
739
|
+
else{
|
|
740
|
+
N = normal_geometric;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if(dot(ray_dir, N) > (T)0) N = -N;
|
|
744
|
+
|
|
745
|
+
T tc_x = 0, tc_y = 0;
|
|
746
|
+
if(self.tex_coords != nullptr){
|
|
747
|
+
tc_x = w0 * self.tex_coords[2 * (TI)index[0] + 0] + hit.u * self.tex_coords[2 * (TI)index[1] + 0] + hit.v * self.tex_coords[2 * (TI)index[2] + 0];
|
|
748
|
+
tc_y = w0 * self.tex_coords[2 * (TI)index[0] + 1] + hit.u * self.tex_coords[2 * (TI)index[1] + 1] + hit.v * self.tex_coords[2 * (TI)index[2] + 1];
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
Vec3<T> base_color = to_vec3(self.color);
|
|
752
|
+
T alpha = self.opacity;
|
|
753
|
+
if(self.texture.pixels != nullptr && self.tex_coords != nullptr){
|
|
754
|
+
T tex_color[4];
|
|
755
|
+
sample_texture(math_device, self.texture, tc_x, tc_y, true, tex_color);
|
|
756
|
+
base_color = Vec3<T>{tex_color[0], tex_color[1], tex_color[2]} * to_vec3(self.color);
|
|
757
|
+
alpha *= tex_color[3];
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
const Vec3<T> hit_point = origin + ray_dir * hit.t;
|
|
761
|
+
|
|
762
|
+
Vec3<T> color = base_color;
|
|
763
|
+
if(!self.unlit){
|
|
764
|
+
T metallic = self.metallic;
|
|
765
|
+
T roughness = self.roughness;
|
|
766
|
+
if(self.metallic_roughness_map.pixels != nullptr && self.tex_coords != nullptr){
|
|
767
|
+
T mr_sample[4];
|
|
768
|
+
sample_texture(math_device, self.metallic_roughness_map, tc_x, tc_y, false, mr_sample);
|
|
769
|
+
roughness = mr_sample[1] * self.roughness;
|
|
770
|
+
metallic = mr_sample[2] * self.metallic;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
if(self.normal_map.pixels != nullptr && self.tex_coords != nullptr){
|
|
774
|
+
const T tc0_x = self.tex_coords[2 * (TI)index[0] + 0], tc0_y = self.tex_coords[2 * (TI)index[0] + 1];
|
|
775
|
+
const T tc1_x = self.tex_coords[2 * (TI)index[1] + 0], tc1_y = self.tex_coords[2 * (TI)index[1] + 1];
|
|
776
|
+
const T tc2_x = self.tex_coords[2 * (TI)index[2] + 0], tc2_y = self.tex_coords[2 * (TI)index[2] + 1];
|
|
777
|
+
const T duv1_x = tc1_x - tc0_x, duv1_y = tc1_y - tc0_y;
|
|
778
|
+
const T duv2_x = tc2_x - tc0_x, duv2_y = tc2_y - tc0_y;
|
|
779
|
+
const T det = duv1_x * duv2_y - duv2_x * duv1_y;
|
|
780
|
+
if((det < 0 ? -det : det) > (T)1e-8){
|
|
781
|
+
const T inv_det = (T)1 / det;
|
|
782
|
+
Vec3<T> tangent = normalize(math_device, inv_det * (duv2_y * edge1 - duv1_y * edge2));
|
|
783
|
+
tangent = normalize(math_device, tangent - dot(tangent, N) * N);
|
|
784
|
+
const Vec3<T> bitangent = cross(N, tangent);
|
|
785
|
+
T nm_sample[4];
|
|
786
|
+
sample_texture(math_device, self.normal_map, w0 * tc0_x + hit.u * tc1_x + hit.v * tc2_x, w0 * tc0_y + hit.u * tc1_y + hit.v * tc2_y, false, nm_sample);
|
|
787
|
+
const Vec3<T> n_tangent = {nm_sample[0] * (T)2 - (T)1, -(nm_sample[1] * (T)2 - (T)1), nm_sample[2] * (T)2 - (T)1};
|
|
788
|
+
N = normalize(math_device, tangent * n_tangent.x + bitangent * n_tangent.y + N * n_tangent.z);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
roughness = maximum(roughness, (T)0.04);
|
|
793
|
+
const T roughness_alpha = roughness * roughness;
|
|
794
|
+
const T alpha2 = roughness_alpha * roughness_alpha;
|
|
795
|
+
const T k = (roughness + (T)1) * (roughness + (T)1) / (T)8;
|
|
796
|
+
|
|
797
|
+
const Vec3<T> V = -ray_dir;
|
|
798
|
+
const T NdotV = maximum(dot(N, V), (T)1e-4);
|
|
799
|
+
const Vec3<T> F0 = Vec3<T>{(T)0.04, (T)0.04, (T)0.04} * ((T)1 - metallic) + base_color * metallic;
|
|
800
|
+
|
|
801
|
+
Vec3<T> Lo = {0, 0, 0};
|
|
802
|
+
for(TI light_i = 0; light_i < scene.num_lights; light_i++){
|
|
803
|
+
const SceneLight& light = scene.lights[light_i];
|
|
804
|
+
const Vec3<T> Lc = {(T)light.color[0], (T)light.color[1], (T)light.color[2]};
|
|
805
|
+
Vec3<T> L;
|
|
806
|
+
T attenuation = 1;
|
|
807
|
+
T light_distance = (T)1e20;
|
|
808
|
+
|
|
809
|
+
if(light.type == 0){
|
|
810
|
+
L = {(T)light.direction[0], (T)light.direction[1], (T)light.direction[2]};
|
|
811
|
+
}
|
|
812
|
+
else{
|
|
813
|
+
const Vec3<T> to_light = Vec3<T>{(T)light.position[0], (T)light.position[1], (T)light.position[2]} - hit_point;
|
|
814
|
+
const T dist = length(math_device, to_light);
|
|
815
|
+
light_distance = maximum(dist - (T)1e-3, (T)0);
|
|
816
|
+
L = to_light * ((T)1 / maximum(dist, (T)1e-6));
|
|
817
|
+
attenuation = (T)1 / ((T)light.attenuation_constant + (T)light.attenuation_linear * dist + (T)light.attenuation_quadratic * dist * dist);
|
|
818
|
+
if(light.type == 2){
|
|
819
|
+
const Vec3<T> spot_dir = {(T)light.direction[0], (T)light.direction[1], (T)light.direction[2]};
|
|
820
|
+
const T cos_angle = dot(-L, spot_dir);
|
|
821
|
+
const T denom = (T)light.cos_inner_cone - (T)light.cos_outer_cone;
|
|
822
|
+
const T denom_abs = denom < 0 ? -denom : denom;
|
|
823
|
+
const T spot_t = (cos_angle - (T)light.cos_outer_cone) / (denom_abs > (T)1e-6 ? denom : (T)1e-6);
|
|
824
|
+
attenuation *= maximum(minimum(spot_t, (T)1), (T)0);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const T NdotL = maximum(dot(N, L), (T)0);
|
|
829
|
+
if(NdotL <= (T)0) continue;
|
|
830
|
+
if constexpr (SPEC::SHADING::PUNCTUAL_LIGHT_SHADOWS){
|
|
831
|
+
if(light.type != 0 && trace_any_composed<SPEC>(scene, camera_from_pixel<SPEC>(pixel_x, pixel_y), hit_point + N * (T)2e-3, L, (T)1e-3, light_distance)) continue;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const Vec3<T> H = normalize(math_device, V + L);
|
|
835
|
+
const T NdotH = maximum(dot(N, H), (T)0);
|
|
836
|
+
const T VdotH = maximum(dot(V, H), (T)0);
|
|
837
|
+
|
|
838
|
+
const T denom_D = NdotH * NdotH * (alpha2 - (T)1) + (T)1;
|
|
839
|
+
const T D = alpha2 / ((T)3.14159265 * denom_D * denom_D);
|
|
840
|
+
|
|
841
|
+
const T G1_V = NdotV / (NdotV * ((T)1 - k) + k);
|
|
842
|
+
const T G1_L = NdotL / (NdotL * ((T)1 - k) + k);
|
|
843
|
+
const T G = G1_V * G1_L;
|
|
844
|
+
|
|
845
|
+
const T pow5 = math::pow(math_device, (T)1 - VdotH, (T)5);
|
|
846
|
+
const Vec3<T> F = F0 + (Vec3<T>{1, 1, 1} - F0) * pow5;
|
|
847
|
+
|
|
848
|
+
const Vec3<T> specular = F * (D * G * ((T)1 / ((T)4 * NdotV * NdotL + (T)1e-4)));
|
|
849
|
+
const Vec3<T> kd = (Vec3<T>{1, 1, 1} - F) * ((T)1 - metallic);
|
|
850
|
+
const Vec3<T> diffuse = kd * base_color * ((T)1 / (T)3.14159265);
|
|
851
|
+
|
|
852
|
+
Lo = Lo + (diffuse + specular) * Lc * (attenuation * NdotL);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
T occlusion = 1;
|
|
856
|
+
if(self.occlusion_map.pixels != nullptr && self.tex_coords != nullptr){
|
|
857
|
+
T ao_sample[4];
|
|
858
|
+
sample_texture(math_device, self.occlusion_map, tc_x, tc_y, false, ao_sample);
|
|
859
|
+
occlusion = ao_sample[0];
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
Vec3<T> emissive_color;
|
|
863
|
+
if(self.emissive_map.pixels != nullptr && self.tex_coords != nullptr){
|
|
864
|
+
T em_sample[4];
|
|
865
|
+
sample_texture(math_device, self.emissive_map, tc_x, tc_y, true, em_sample);
|
|
866
|
+
emissive_color = Vec3<T>{em_sample[0], em_sample[1], em_sample[2]} * to_vec3(self.emissive);
|
|
867
|
+
}
|
|
868
|
+
else{
|
|
869
|
+
emissive_color = to_vec3(self.emissive);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
const Vec3<T> ambient = to_vec3(scene.ambient_color) * base_color * (((T)1 - metallic) * occlusion);
|
|
873
|
+
color = ambient + Lo + emissive_color;
|
|
874
|
+
|
|
875
|
+
if constexpr (DEPTH < 1){
|
|
876
|
+
if(metallic > (T)0.1){
|
|
877
|
+
const Vec3<T> reflect_dir = ray_dir - (T)2 * dot(ray_dir, N) * N;
|
|
878
|
+
|
|
879
|
+
const Vec3<T> reflected_color = trace_rgb<DEVICE, SPEC, DEPTH + 1>(device, scene, pixel_x, pixel_y, hit_point, reflect_dir, (T)1e-3, (T)1e20);
|
|
880
|
+
|
|
881
|
+
const T fresnel_refl = F0.x + ((T)1 - F0.x) * math::pow(math_device, (T)1 - maximum(dot(V, N), (T)0), (T)5);
|
|
882
|
+
const T reflection_weight = fresnel_refl * ((T)1 - roughness);
|
|
883
|
+
color = color * ((T)1 - reflection_weight) + reflected_color * reflection_weight;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
if constexpr (DEPTH < 1){
|
|
889
|
+
const bool transparent = (self.alpha_mode == 2 && alpha < (T)0.99) || (self.alpha_mode == 1 && alpha < self.alpha_cutoff);
|
|
890
|
+
if(transparent){
|
|
891
|
+
const Vec3<T> behind_color = trace_rgb<DEVICE, SPEC, DEPTH + 1>(device, scene, pixel_x, pixel_y, hit_point, ray_dir, (T)1e-5, (T)1e20);
|
|
892
|
+
|
|
893
|
+
if(self.alpha_mode == 1){
|
|
894
|
+
color = behind_color;
|
|
895
|
+
}
|
|
896
|
+
else{
|
|
897
|
+
color = color * alpha + behind_color * ((T)1 - alpha);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
return color;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
template <typename DEVICE, typename SPEC, int DEPTH>
|
|
906
|
+
RL_TOOLS_FUNCTION_PLACEMENT Vec3<typename SPEC::T> trace_rgb(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene, typename SPEC::TI pixel_x, typename SPEC::TI pixel_y, Vec3<typename SPEC::T> origin, Vec3<typename SPEC::T> direction, typename SPEC::T t_min, typename SPEC::T t_max){
|
|
907
|
+
using T = typename SPEC::T;
|
|
908
|
+
using TI = typename SPEC::TI;
|
|
909
|
+
const Hit<T, TI> hit = trace_closest_composed<SPEC>(scene, camera_from_pixel<SPEC>(pixel_x, pixel_y), origin, direction, t_min, t_max);
|
|
910
|
+
if(!hit.valid){
|
|
911
|
+
return miss_color<SPEC>(scene, pixel_x, pixel_y);
|
|
912
|
+
}
|
|
913
|
+
if constexpr (SPEC::SHADING::PBR_SHADING){
|
|
914
|
+
return shade_pbr<DEVICE, SPEC, DEPTH>(device, scene, pixel_x, pixel_y, origin, direction, hit);
|
|
915
|
+
}
|
|
916
|
+
else{
|
|
917
|
+
return shade_basic<DEVICE, SPEC, DEPTH>(device, scene, pixel_x, pixel_y, origin, direction, hit);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
struct OutputRGB{};
|
|
922
|
+
struct OutputDepth{};
|
|
923
|
+
|
|
924
|
+
template <typename DEVICE, typename SPEC, typename OUTPUT>
|
|
925
|
+
RL_TOOLS_FUNCTION_PLACEMENT void render_frame(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene){
|
|
926
|
+
using T = typename SPEC::T;
|
|
927
|
+
using TI = typename SPEC::TI;
|
|
928
|
+
const auto& math_device = device.math;
|
|
929
|
+
constexpr TI MOTION_SAMPLES = SPEC::ENABLE_MOTION_BLUR ? SPEC::MOTION_BLUR_SAMPLES : 1;
|
|
930
|
+
constexpr TI AA_GRID = SPEC::ENABLE_ANTI_ALIASING ? SPEC::ANTI_ALIASING_GRID_SIZE : 1;
|
|
931
|
+
const T inv_aa_grid = (T)1 / (T)AA_GRID;
|
|
932
|
+
for(TI camera_i = 0; camera_i < SPEC::NUM_CAMERAS; camera_i++){
|
|
933
|
+
const TI tile_x = (camera_i % SPEC::GRID_COLS) * SPEC::CAM_WIDTH;
|
|
934
|
+
const TI tile_y = (camera_i / SPEC::GRID_COLS) * SPEC::CAM_HEIGHT;
|
|
935
|
+
for(TI y = 0; y < SPEC::CAM_HEIGHT; y++){
|
|
936
|
+
for(TI x = 0; x < SPEC::CAM_WIDTH; x++){
|
|
937
|
+
const TI pixel_x = tile_x + x;
|
|
938
|
+
const TI pixel_y = tile_y + y;
|
|
939
|
+
const TI fb_offset = camera_i * SPEC::CAM_PIXELS + y * SPEC::CAM_WIDTH + x;
|
|
940
|
+
Vec3<T> accumulated_rgb = {0, 0, 0};
|
|
941
|
+
T accumulated_depth = 0;
|
|
942
|
+
for(TI motion_i = 0; motion_i < MOTION_SAMPLES; motion_i++){
|
|
943
|
+
Vec3<T> pos, dir_00, dir_du, dir_dv;
|
|
944
|
+
if constexpr (SPEC::ENABLE_MOTION_BLUR){
|
|
945
|
+
const Camera<T>& cam_open = scene.cameras_open[camera_i];
|
|
946
|
+
const Camera<T>& cam_close = scene.cameras_close[camera_i];
|
|
947
|
+
const T shutter_t = ((T)motion_i + (T)0.5) * ((T)1 / (T)MOTION_SAMPLES);
|
|
948
|
+
pos = ((T)1 - shutter_t) * to_vec3(cam_open.pos) + shutter_t * to_vec3(cam_close.pos);
|
|
949
|
+
dir_00 = ((T)1 - shutter_t) * to_vec3(cam_open.dir_00) + shutter_t * to_vec3(cam_close.dir_00);
|
|
950
|
+
dir_du = ((T)1 - shutter_t) * to_vec3(cam_open.dir_du) + shutter_t * to_vec3(cam_close.dir_du);
|
|
951
|
+
dir_dv = ((T)1 - shutter_t) * to_vec3(cam_open.dir_dv) + shutter_t * to_vec3(cam_close.dir_dv);
|
|
952
|
+
}
|
|
953
|
+
else{
|
|
954
|
+
const Camera<T>& cam = scene.cameras_close[camera_i];
|
|
955
|
+
pos = to_vec3(cam.pos);
|
|
956
|
+
dir_00 = to_vec3(cam.dir_00);
|
|
957
|
+
dir_du = to_vec3(cam.dir_du);
|
|
958
|
+
dir_dv = to_vec3(cam.dir_dv);
|
|
959
|
+
}
|
|
960
|
+
for(TI aa_y = 0; aa_y < AA_GRID; aa_y++){
|
|
961
|
+
for(TI aa_x = 0; aa_x < AA_GRID; aa_x++){
|
|
962
|
+
const T screen_x = ((T)x + ((T)aa_x + (T)0.5) * inv_aa_grid) / (T)SPEC::CAM_WIDTH;
|
|
963
|
+
const T screen_y = ((T)y + ((T)aa_y + (T)0.5) * inv_aa_grid) / (T)SPEC::CAM_HEIGHT;
|
|
964
|
+
const Vec3<T> direction = normalize(math_device, dir_00 + screen_x * dir_du + screen_y * dir_dv);
|
|
965
|
+
if constexpr (utils::typing::is_same_v<OUTPUT, OutputRGB>){
|
|
966
|
+
accumulated_rgb = accumulated_rgb + trace_rgb<DEVICE, SPEC, 0>(device, scene, pixel_x, pixel_y, pos, direction, (T)0, (T)1e30);
|
|
967
|
+
}
|
|
968
|
+
else{
|
|
969
|
+
accumulated_depth += trace_depth_distance_composed<SPEC>(scene, camera_i, pos, direction, scene.max_depth);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
constexpr TI SAMPLES = MOTION_SAMPLES * AA_GRID * AA_GRID;
|
|
975
|
+
if constexpr (utils::typing::is_same_v<OUTPUT, OutputRGB>){
|
|
976
|
+
const Vec3<T> color = accumulated_rgb * ((T)1 / (T)SAMPLES);
|
|
977
|
+
if(scene.observation != nullptr){
|
|
978
|
+
// the observation is the frame-buffer color before 8-bit
|
|
979
|
+
// quantization — same transfer curve, full float precision
|
|
980
|
+
float* observation = scene.observation + fb_offset * 3;
|
|
981
|
+
if constexpr (SPEC::SHADING::SRGB_OUTPUT){
|
|
982
|
+
observation[0] = (float)linear_to_srgb(math_device, clamp01(color.x));
|
|
983
|
+
observation[1] = (float)linear_to_srgb(math_device, clamp01(color.y));
|
|
984
|
+
observation[2] = (float)linear_to_srgb(math_device, clamp01(color.z));
|
|
985
|
+
}
|
|
986
|
+
else{
|
|
987
|
+
observation[0] = (float)clamp01(color.x);
|
|
988
|
+
observation[1] = (float)clamp01(color.y);
|
|
989
|
+
observation[2] = (float)clamp01(color.z);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
if constexpr (SPEC::SHADING::SRGB_OUTPUT){
|
|
993
|
+
scene.frame_buffer[fb_offset] = make_srgb_rgba_from_linear(math_device, color);
|
|
994
|
+
}
|
|
995
|
+
else{
|
|
996
|
+
scene.frame_buffer[fb_offset] = make_linear_rgba_from_linear(color);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
else{
|
|
1000
|
+
scene.depth_buffer[fb_offset] = (float)(accumulated_depth * ((T)1 / (T)SAMPLES));
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// one dynamic-motion-blur pass: camera lerped at the caller's shutter time, overlay
|
|
1008
|
+
// geometry already rebuilt for this sample by the caller; adds this pass's linear mean
|
|
1009
|
+
// into the accumulation buffer. Each iteration owns its pixel — no atomics.
|
|
1010
|
+
template <typename DEVICE, typename SPEC, typename OUTPUT>
|
|
1011
|
+
RL_TOOLS_FUNCTION_PLACEMENT void render_frame_accumulate(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene, typename SPEC::T shutter_t){
|
|
1012
|
+
using T = typename SPEC::T;
|
|
1013
|
+
using TI = typename SPEC::TI;
|
|
1014
|
+
const auto& math_device = device.math;
|
|
1015
|
+
constexpr TI AA_GRID = SPEC::ENABLE_ANTI_ALIASING ? SPEC::ANTI_ALIASING_GRID_SIZE : 1;
|
|
1016
|
+
const T inv_aa_grid = (T)1 / (T)AA_GRID;
|
|
1017
|
+
for(TI camera_i = 0; camera_i < SPEC::NUM_CAMERAS; camera_i++){
|
|
1018
|
+
const Camera<T>& cam_open = scene.cameras_open[camera_i];
|
|
1019
|
+
const Camera<T>& cam_close = scene.cameras_close[camera_i];
|
|
1020
|
+
const Vec3<T> pos = ((T)1 - shutter_t) * to_vec3(cam_open.pos) + shutter_t * to_vec3(cam_close.pos);
|
|
1021
|
+
const Vec3<T> dir_00 = ((T)1 - shutter_t) * to_vec3(cam_open.dir_00) + shutter_t * to_vec3(cam_close.dir_00);
|
|
1022
|
+
const Vec3<T> dir_du = ((T)1 - shutter_t) * to_vec3(cam_open.dir_du) + shutter_t * to_vec3(cam_close.dir_du);
|
|
1023
|
+
const Vec3<T> dir_dv = ((T)1 - shutter_t) * to_vec3(cam_open.dir_dv) + shutter_t * to_vec3(cam_close.dir_dv);
|
|
1024
|
+
const TI tile_x = (camera_i % SPEC::GRID_COLS) * SPEC::CAM_WIDTH;
|
|
1025
|
+
const TI tile_y = (camera_i / SPEC::GRID_COLS) * SPEC::CAM_HEIGHT;
|
|
1026
|
+
for(TI y = 0; y < SPEC::CAM_HEIGHT; y++){
|
|
1027
|
+
for(TI x = 0; x < SPEC::CAM_WIDTH; x++){
|
|
1028
|
+
const TI pixel_x = tile_x + x;
|
|
1029
|
+
const TI pixel_y = tile_y + y;
|
|
1030
|
+
const TI fb_offset = camera_i * SPEC::CAM_PIXELS + y * SPEC::CAM_WIDTH + x;
|
|
1031
|
+
Vec3<T> accumulated_rgb = {0, 0, 0};
|
|
1032
|
+
T accumulated_depth = 0;
|
|
1033
|
+
for(TI aa_y = 0; aa_y < AA_GRID; aa_y++){
|
|
1034
|
+
for(TI aa_x = 0; aa_x < AA_GRID; aa_x++){
|
|
1035
|
+
const T screen_x = ((T)x + ((T)aa_x + (T)0.5) * inv_aa_grid) / (T)SPEC::CAM_WIDTH;
|
|
1036
|
+
const T screen_y = ((T)y + ((T)aa_y + (T)0.5) * inv_aa_grid) / (T)SPEC::CAM_HEIGHT;
|
|
1037
|
+
const Vec3<T> direction = normalize(math_device, dir_00 + screen_x * dir_du + screen_y * dir_dv);
|
|
1038
|
+
if constexpr (utils::typing::is_same_v<OUTPUT, OutputRGB>){
|
|
1039
|
+
accumulated_rgb = accumulated_rgb + trace_rgb<DEVICE, SPEC, 0>(device, scene, pixel_x, pixel_y, pos, direction, (T)0, (T)1e30);
|
|
1040
|
+
}
|
|
1041
|
+
else{
|
|
1042
|
+
accumulated_depth += trace_depth_distance_composed<SPEC>(scene, camera_i, pos, direction, scene.max_depth);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
constexpr TI SAMPLES = AA_GRID * AA_GRID;
|
|
1047
|
+
if constexpr (utils::typing::is_same_v<OUTPUT, OutputRGB>){
|
|
1048
|
+
const Vec3<T> color = accumulated_rgb * ((T)1 / (T)SAMPLES);
|
|
1049
|
+
scene.rgb_accumulation[fb_offset * 3 + 0] += (float)color.x;
|
|
1050
|
+
scene.rgb_accumulation[fb_offset * 3 + 1] += (float)color.y;
|
|
1051
|
+
scene.rgb_accumulation[fb_offset * 3 + 2] += (float)color.z;
|
|
1052
|
+
}
|
|
1053
|
+
else{
|
|
1054
|
+
scene.depth_accumulation[fb_offset] += (float)(accumulated_depth * ((T)1 / (T)SAMPLES));
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// divides the accumulated linear radiance by the pass count and writes the declared
|
|
1062
|
+
// outputs with the same transfer curve + quantization as the single-launch path
|
|
1063
|
+
template <typename DEVICE, typename SPEC, typename OUTPUT>
|
|
1064
|
+
RL_TOOLS_FUNCTION_PLACEMENT void resolve_frame(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene){
|
|
1065
|
+
using T = typename SPEC::T;
|
|
1066
|
+
using TI = typename SPEC::TI;
|
|
1067
|
+
const auto& math_device = device.math;
|
|
1068
|
+
const T inv_samples = (T)1 / (T)SPEC::MOTION_BLUR_SAMPLES;
|
|
1069
|
+
for(TI fb_offset = 0; fb_offset < SPEC::NUM_CAMERAS * SPEC::CAM_PIXELS; fb_offset++){
|
|
1070
|
+
if constexpr (utils::typing::is_same_v<OUTPUT, OutputRGB>){
|
|
1071
|
+
const Vec3<T> color = {
|
|
1072
|
+
(T)scene.rgb_accumulation[fb_offset * 3 + 0] * inv_samples,
|
|
1073
|
+
(T)scene.rgb_accumulation[fb_offset * 3 + 1] * inv_samples,
|
|
1074
|
+
(T)scene.rgb_accumulation[fb_offset * 3 + 2] * inv_samples
|
|
1075
|
+
};
|
|
1076
|
+
if(scene.observation != nullptr){
|
|
1077
|
+
float* observation = scene.observation + fb_offset * 3;
|
|
1078
|
+
if constexpr (SPEC::SHADING::SRGB_OUTPUT){
|
|
1079
|
+
observation[0] = (float)linear_to_srgb(math_device, clamp01(color.x));
|
|
1080
|
+
observation[1] = (float)linear_to_srgb(math_device, clamp01(color.y));
|
|
1081
|
+
observation[2] = (float)linear_to_srgb(math_device, clamp01(color.z));
|
|
1082
|
+
}
|
|
1083
|
+
else{
|
|
1084
|
+
observation[0] = (float)clamp01(color.x);
|
|
1085
|
+
observation[1] = (float)clamp01(color.y);
|
|
1086
|
+
observation[2] = (float)clamp01(color.z);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
if constexpr (SPEC::SHADING::SRGB_OUTPUT){
|
|
1090
|
+
scene.frame_buffer[fb_offset] = make_srgb_rgba_from_linear(math_device, color);
|
|
1091
|
+
}
|
|
1092
|
+
else{
|
|
1093
|
+
scene.frame_buffer[fb_offset] = make_linear_rgba_from_linear(color);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
else{
|
|
1097
|
+
scene.depth_buffer[fb_offset] = (float)((T)scene.depth_accumulation[fb_offset] * inv_samples);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// single-sample by design: instance labels cannot be averaged, so anti-aliasing and
|
|
1103
|
+
// motion blur do not apply (shutter-close camera, pixel-center ray)
|
|
1104
|
+
template <typename DEVICE, typename SPEC>
|
|
1105
|
+
RL_TOOLS_FUNCTION_PLACEMENT void render_segmentation_frame(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene){
|
|
1106
|
+
using T = typename SPEC::T;
|
|
1107
|
+
using TI = typename SPEC::TI;
|
|
1108
|
+
const auto& math_device = device.math;
|
|
1109
|
+
for(TI camera_i = 0; camera_i < SPEC::NUM_CAMERAS; camera_i++){
|
|
1110
|
+
const Camera<T>& cam = scene.cameras_close[camera_i];
|
|
1111
|
+
const Vec3<T> pos = to_vec3(cam.pos);
|
|
1112
|
+
const Vec3<T> dir_00 = to_vec3(cam.dir_00);
|
|
1113
|
+
const Vec3<T> dir_du = to_vec3(cam.dir_du);
|
|
1114
|
+
const Vec3<T> dir_dv = to_vec3(cam.dir_dv);
|
|
1115
|
+
for(TI y = 0; y < SPEC::CAM_HEIGHT; y++){
|
|
1116
|
+
for(TI x = 0; x < SPEC::CAM_WIDTH; x++){
|
|
1117
|
+
const TI fb_offset = camera_i * SPEC::CAM_PIXELS + y * SPEC::CAM_WIDTH + x;
|
|
1118
|
+
const T screen_x = ((T)x + (T)0.5) / (T)SPEC::CAM_WIDTH;
|
|
1119
|
+
const T screen_y = ((T)y + (T)0.5) / (T)SPEC::CAM_HEIGHT;
|
|
1120
|
+
const Vec3<T> direction = normalize(math_device, dir_00 + screen_x * dir_du + screen_y * dir_dv);
|
|
1121
|
+
const Hit<T, TI> hit = trace_closest_composed<SPEC>(scene, camera_i, pos, direction, (T)0, (T)1e30);
|
|
1122
|
+
scene.segmentation_buffer[fb_offset] = hit.valid ? (SPEC::SEMANTIC_SEGMENTATION ? scene.instance_classes[hit.instance] : (unsigned int)hit.instance) : 0xFFFFFFFFu;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// world point → screen fraction through the linear camera model: solves
|
|
1129
|
+
// dir_00 + screen_x·dir_du + screen_y·dir_dv = lambda·(point − pos) by Cramer's rule;
|
|
1130
|
+
// returns false for a degenerate basis or a point at/behind the camera (lambda <= 0)
|
|
1131
|
+
template <typename T>
|
|
1132
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool project_camera(const Camera<T>& cam, Vec3<T> point, T& screen_x, T& screen_y){
|
|
1133
|
+
const Vec3<T> direction = point - to_vec3(cam.pos);
|
|
1134
|
+
const Vec3<T> dir_du = to_vec3(cam.dir_du);
|
|
1135
|
+
const Vec3<T> dir_dv = to_vec3(cam.dir_dv);
|
|
1136
|
+
const Vec3<T> negative_direction = -direction;
|
|
1137
|
+
const Vec3<T> cross_dv_negative_direction = cross(dir_dv, negative_direction);
|
|
1138
|
+
const T det = dot(dir_du, cross_dv_negative_direction);
|
|
1139
|
+
if(det > (T)-1e-12 && det < (T)1e-12){
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
const T inv_det = (T)1 / det;
|
|
1143
|
+
const Vec3<T> b = -to_vec3(cam.dir_00);
|
|
1144
|
+
screen_x = dot(b, cross_dv_negative_direction) * inv_det;
|
|
1145
|
+
screen_y = dot(dir_du, cross(b, negative_direction)) * inv_det;
|
|
1146
|
+
const T lambda = dot(dir_du, cross(dir_dv, b)) * inv_det;
|
|
1147
|
+
return lambda > (T)0;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
// two-instant flow, single-sample from pixel centres (like segmentation): the pass is
|
|
1151
|
+
// parameterised on its direction — backward traces the current instant and lands on the
|
|
1152
|
+
// previous one, forward the reverse. The source hit point is carried to the target
|
|
1153
|
+
// instant by its instance's rigid motion (identity for the static world), projected
|
|
1154
|
+
// through the target camera, and tested for visibility against the target instant's
|
|
1155
|
+
// scene by a ray from the target camera to the carried point (distance test, so
|
|
1156
|
+
// self-occlusion counts). Status priority: MISS, BEHIND, OUT_OF_FRAME, OCCLUDED, VALID;
|
|
1157
|
+
// the flow vector is p_target - p_source in pixels, zero for MISS and BEHIND, retained
|
|
1158
|
+
// (the geometric flow) for OUT_OF_FRAME and OCCLUDED.
|
|
1159
|
+
template <typename DEVICE, typename SPEC, bool FORWARD>
|
|
1160
|
+
RL_TOOLS_FUNCTION_PLACEMENT void render_flow_frame(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene){
|
|
1161
|
+
using T = typename SPEC::T;
|
|
1162
|
+
using TI = typename SPEC::TI;
|
|
1163
|
+
const auto& math_device = device.math;
|
|
1164
|
+
const TI SLOTS = scene.num_overlay_slots;
|
|
1165
|
+
const Camera<T>* cameras_source = FORWARD ? scene.cameras_previous : scene.cameras_close;
|
|
1166
|
+
const Camera<T>* cameras_target = FORWARD ? scene.cameras_close : scene.cameras_previous;
|
|
1167
|
+
const OverlayView<T, TI>* overlays_source = FORWARD ? scene.overlays_previous : scene.overlays;
|
|
1168
|
+
const OverlayView<T, TI>* overlays_target = FORWARD ? scene.overlays : scene.overlays_previous;
|
|
1169
|
+
const float* deltas = SPEC::ENABLE_OVERLAYS ? scene.flow_deltas + (FORWARD ? SLOTS * 12 : 0) : nullptr;
|
|
1170
|
+
const TI source_first_overlay_instance = scene.first_overlay_instance + (FORWARD ? SLOTS : 0);
|
|
1171
|
+
float* flow_buffer = FORWARD ? scene.flow_forward_buffer : scene.flow_buffer;
|
|
1172
|
+
unsigned int* status_buffer = FORWARD ? scene.flow_forward_status_buffer : scene.flow_status_buffer;
|
|
1173
|
+
for(TI camera_i = 0; camera_i < SPEC::NUM_CAMERAS; camera_i++){
|
|
1174
|
+
const Camera<T>& cam = cameras_source[camera_i];
|
|
1175
|
+
const Camera<T>& cam_target = cameras_target[camera_i];
|
|
1176
|
+
const Vec3<T> pos = to_vec3(cam.pos);
|
|
1177
|
+
const Vec3<T> dir_00 = to_vec3(cam.dir_00);
|
|
1178
|
+
const Vec3<T> dir_du = to_vec3(cam.dir_du);
|
|
1179
|
+
const Vec3<T> dir_dv = to_vec3(cam.dir_dv);
|
|
1180
|
+
const Vec3<T> target_pos = to_vec3(cam_target.pos);
|
|
1181
|
+
for(TI y = 0; y < SPEC::CAM_HEIGHT; y++){
|
|
1182
|
+
for(TI x = 0; x < SPEC::CAM_WIDTH; x++){
|
|
1183
|
+
const TI fb_offset = camera_i * SPEC::CAM_PIXELS + y * SPEC::CAM_WIDTH + x;
|
|
1184
|
+
const T screen_x = ((T)x + (T)0.5) / (T)SPEC::CAM_WIDTH;
|
|
1185
|
+
const T screen_y = ((T)y + (T)0.5) / (T)SPEC::CAM_HEIGHT;
|
|
1186
|
+
const Vec3<T> direction = normalize(math_device, dir_00 + screen_x * dir_du + screen_y * dir_dv);
|
|
1187
|
+
const Hit<T, TI> hit = trace_closest_composed<SPEC>(scene, overlays_source, camera_i, pos, direction, (T)0, (T)1e30);
|
|
1188
|
+
T flow_u = 0, flow_v = 0;
|
|
1189
|
+
unsigned int status = FlowStatus::MISS;
|
|
1190
|
+
if(hit.valid){
|
|
1191
|
+
Vec3<T> point = pos + direction * hit.t;
|
|
1192
|
+
if constexpr (SPEC::ENABLE_OVERLAYS){
|
|
1193
|
+
if(hit.instance >= source_first_overlay_instance){
|
|
1194
|
+
point = transform_point(&deltas[(TI)(hit.instance - source_first_overlay_instance) * 12], point);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
T target_x, target_y;
|
|
1198
|
+
if(!project_camera(cam_target, point, target_x, target_y)){
|
|
1199
|
+
status = FlowStatus::BEHIND;
|
|
1200
|
+
}
|
|
1201
|
+
else{
|
|
1202
|
+
flow_u = target_x * (T)SPEC::CAM_WIDTH - ((T)x + (T)0.5);
|
|
1203
|
+
flow_v = target_y * (T)SPEC::CAM_HEIGHT - ((T)y + (T)0.5);
|
|
1204
|
+
if(target_x < (T)0 || target_x >= (T)1 || target_y < (T)0 || target_y >= (T)1){
|
|
1205
|
+
status = FlowStatus::OUT_OF_FRAME;
|
|
1206
|
+
}
|
|
1207
|
+
else{
|
|
1208
|
+
const Vec3<T> to_point = point - target_pos;
|
|
1209
|
+
const T length = math::sqrt(math_device, dot(to_point, to_point));
|
|
1210
|
+
const Vec3<T> visibility_direction = to_point * ((T)1 / length);
|
|
1211
|
+
const bool occluded = trace_any_composed<SPEC>(scene, overlays_target, camera_i, target_pos, visibility_direction, (T)0, length * ((T)1 - FLOW_VISIBILITY_EPSILON<T>));
|
|
1212
|
+
status = occluded ? FlowStatus::OCCLUDED : FlowStatus::VALID;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
flow_buffer[fb_offset * 2 + 0] = (float)flow_u;
|
|
1217
|
+
flow_buffer[fb_offset * 2 + 1] = (float)flow_v;
|
|
1218
|
+
status_buffer[fb_offset] = status;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// single-sample by design: unit normals cannot be averaged, so anti-aliasing and motion
|
|
1225
|
+
// blur do not apply (shutter-close camera, pixel-center ray); the geometric normal is
|
|
1226
|
+
// world-frame (FLU), oriented against the ray, zero on miss
|
|
1227
|
+
template <typename DEVICE, typename SPEC>
|
|
1228
|
+
RL_TOOLS_FUNCTION_PLACEMENT void render_normals_frame(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene){
|
|
1229
|
+
using T = typename SPEC::T;
|
|
1230
|
+
using TI = typename SPEC::TI;
|
|
1231
|
+
const auto& math_device = device.math;
|
|
1232
|
+
for(TI camera_i = 0; camera_i < SPEC::NUM_CAMERAS; camera_i++){
|
|
1233
|
+
const Camera<T>& cam = scene.cameras_close[camera_i];
|
|
1234
|
+
const Vec3<T> pos = to_vec3(cam.pos);
|
|
1235
|
+
const Vec3<T> dir_00 = to_vec3(cam.dir_00);
|
|
1236
|
+
const Vec3<T> dir_du = to_vec3(cam.dir_du);
|
|
1237
|
+
const Vec3<T> dir_dv = to_vec3(cam.dir_dv);
|
|
1238
|
+
for(TI y = 0; y < SPEC::CAM_HEIGHT; y++){
|
|
1239
|
+
for(TI x = 0; x < SPEC::CAM_WIDTH; x++){
|
|
1240
|
+
const TI fb_offset = camera_i * SPEC::CAM_PIXELS + y * SPEC::CAM_WIDTH + x;
|
|
1241
|
+
const T screen_x = ((T)x + (T)0.5) / (T)SPEC::CAM_WIDTH;
|
|
1242
|
+
const T screen_y = ((T)y + (T)0.5) / (T)SPEC::CAM_HEIGHT;
|
|
1243
|
+
const Vec3<T> direction = normalize(math_device, dir_00 + screen_x * dir_du + screen_y * dir_dv);
|
|
1244
|
+
const Hit<T, TI> hit = trace_closest_composed<SPEC>(scene, camera_i, pos, direction, (T)0, (T)1e30);
|
|
1245
|
+
Vec3<T> normal = {0, 0, 0};
|
|
1246
|
+
if(hit.valid){
|
|
1247
|
+
Vec3<T> vertex_a, vertex_b, vertex_c;
|
|
1248
|
+
triangle_vertices(scene, hit.triangle, vertex_a, vertex_b, vertex_c);
|
|
1249
|
+
const InstanceView<T, TI>& instance = scene.instances[hit.instance];
|
|
1250
|
+
if(!instance.identity){
|
|
1251
|
+
vertex_a = transform_point(instance.object_to_world, vertex_a);
|
|
1252
|
+
vertex_b = transform_point(instance.object_to_world, vertex_b);
|
|
1253
|
+
vertex_c = transform_point(instance.object_to_world, vertex_c);
|
|
1254
|
+
}
|
|
1255
|
+
normal = normalize(math_device, cross(vertex_b - vertex_a, vertex_c - vertex_a));
|
|
1256
|
+
if(dot(direction, normal) > (T)0) normal = -normal;
|
|
1257
|
+
}
|
|
1258
|
+
scene.normals_buffer[fb_offset * 3 + 0] = (float)normal.x;
|
|
1259
|
+
scene.normals_buffer[fb_offset * 3 + 1] = (float)normal.y;
|
|
1260
|
+
scene.normals_buffer[fb_offset * 3 + 2] = (float)normal.z;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
template <typename DEVICE, typename SPEC>
|
|
1267
|
+
RL_TOOLS_FUNCTION_PLACEMENT void render_collision(DEVICE& device, const SceneView<typename SPEC::T, typename SPEC::TI>& scene){
|
|
1268
|
+
using T = typename SPEC::T;
|
|
1269
|
+
using TI = typename SPEC::TI;
|
|
1270
|
+
const auto& math_device = device.math;
|
|
1271
|
+
for(TI camera_i = 0; camera_i < SPEC::NUM_CAMERAS; camera_i++){
|
|
1272
|
+
const Camera<T>& cam = scene.cameras_close[camera_i];
|
|
1273
|
+
for(TI probe_i = 0; probe_i < SPEC::NUM_PROBES; probe_i++){
|
|
1274
|
+
Vec3<T> direction;
|
|
1275
|
+
if(probe_i == 0){
|
|
1276
|
+
direction = normalize(math_device, to_vec3(cam.dir_00) + (T)0.5 * to_vec3(cam.dir_du) + (T)0.5 * to_vec3(cam.dir_dv));
|
|
1277
|
+
}
|
|
1278
|
+
else{
|
|
1279
|
+
direction = to_vec3(&scene.probe_directions[3 * probe_i]);
|
|
1280
|
+
}
|
|
1281
|
+
const Hit<T, TI> hit = trace_closest_composed<SPEC>(scene, camera_i, to_vec3(cam.pos), direction, (T)1e-3, scene.max_dist);
|
|
1282
|
+
CollisionResult result;
|
|
1283
|
+
if(!hit.valid){
|
|
1284
|
+
result.distance = (float)scene.max_dist;
|
|
1285
|
+
result.hit = 0;
|
|
1286
|
+
}
|
|
1287
|
+
else{
|
|
1288
|
+
result.distance = (float)hit.t;
|
|
1289
|
+
result.hit = 1;
|
|
1290
|
+
}
|
|
1291
|
+
scene.collision_results[camera_i * SPEC::NUM_PROBES + probe_i] = result;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
RL_TOOLS_NAMESPACE_WRAPPER_END
|
|
1298
|
+
|
|
1299
|
+
#endif
|