Set serialized material parameters for a list of materials. * \param materialIDsBuffer Buffer containing material IDs * \param paramsBuffer Buffer containing material parameters */
| 4218 | * \param paramsBuffer Buffer containing material parameters |
| 4219 | */ |
| 4220 | inline void setMaterialParamsPython(Scene& scene, ref<Buffer> materialIDsBuffer, ref<Buffer> paramsBuffer) |
| 4221 | { |
| 4222 | // Get material IDs buffer. |
| 4223 | FALCOR_CHECK(materialIDsBuffer->getStructSize() == sizeof(uint32_t), "Material IDs buffer must contain uint32_t elements."); |
| 4224 | std::vector<uint32_t> materialIDs = materialIDsBuffer->getElements<uint32_t>(); |
| 4225 | |
| 4226 | // Get material parameters from buffer. |
| 4227 | std::vector<float> params = paramsBuffer->getElements<float>(0, materialIDs.size() * SerializedMaterialParams::kParamCount); |
| 4228 | |
| 4229 | // Update material parameters. |
| 4230 | size_t ofs = 0; |
| 4231 | SerializedMaterialParams tmpParams; |
| 4232 | for (uint32_t materialID : materialIDs) |
| 4233 | { |
| 4234 | std::copy(params.begin() + ofs, params.begin() + ofs + SerializedMaterialParams::kParamCount, tmpParams.begin()); |
| 4235 | scene.getMaterial(MaterialID(materialID))->deserializeParams(tmpParams); |
| 4236 | ofs += SerializedMaterialParams::kParamCount; |
| 4237 | } |
| 4238 | |
| 4239 | // Need to update scene explicitly without calling `testbed.frame()`. |
| 4240 | scene.updateForInverseRendering(scene.getDevice()->getRenderContext(), true, false); |
| 4241 | #if FALCOR_HAS_CUDA |
| 4242 | scene.getDevice()->getRenderContext()->waitForFalcor(); |
| 4243 | #endif |
| 4244 | } |
| 4245 | |
| 4246 | inline void getMeshVerticesAndIndicesPython(Scene& scene, MeshID meshID, const pybind11::dict& dict) |
| 4247 | { |
nothing calls this directly
no test coverage detected