| 1220 | if (m_Resources == nullptr || uint(geometry.globalGeometryIndex) >= m_Resources->geometryData.size() ) |
| 1221 | return nullptr; |
| 1222 | |
| 1223 | return &m_Resources->geometryData[geometry.globalGeometryIndex]; |
| 1224 | } |
| 1225 | |
| 1226 | |
| 1227 | void Scene::UpdateInstance(const std::shared_ptr<MeshInstance>& instance) |
| 1228 | { |
| 1229 | SceneGraphNode* node = instance->GetNode(); |
| 1230 | if (!node) |
| 1231 | return; |
| 1232 | |
| 1233 | InstanceData& idata = m_Resources->instanceData[instance->GetInstanceIndex()]; |
| 1234 | affineToColumnMajor(node->GetLocalToWorldTransformFloat(), idata.transform); |
| 1235 | affineToColumnMajor(node->GetPrevLocalToWorldTransformFloat(), idata.prevTransform); |
| 1236 | |
| 1237 | const auto& mesh = instance->GetMesh(); |
| 1238 | idata.firstGeometryInstanceIndex = instance->GetGeometryInstanceIndex(); |
| 1239 | idata.numGeometries = uint32_t(mesh->geometries.size()); |
| 1240 | idata.firstGeometryIndex = idata.numGeometries > 0 ? mesh->geometries[0]->globalGeometryIndex : -1; |
| 1241 | idata.flags = 0u; |
| 1242 | |
| 1243 | if (mesh->type == MeshType::CurveDisjointOrthogonalTriangleStrips) |
| 1244 | { |
| 1245 | idata.flags |= InstanceFlags_CurveDisjointOrthogonalTriangleStrips; |
| 1246 | } |
| 1247 | else if (mesh->type == MeshType::CurveLinearSweptSpheres) |
| 1248 | { |
| 1249 | // NVAPI does not support Vulkan, so NvRtIsLssHit() cannot be used to detect LSS hits. |
| 1250 | // Instead, we explicitly mark each LSS instance with a flag and check this flag during hit processing. |
| 1251 | // For consistency and completeness, this flag is also set for DX12. |
| 1252 | idata.flags |= InstanceFlags_CurveLinearSweptSpheres; |
nothing calls this directly
no test coverage detected