Skip to content

Commit a50b1ee

Browse files
committed
change checking code converted gltf is i3dm or not
1 parent 4357618 commit a50b1ee

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

native~/Runtime/src/UnityPrepareRendererResources.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,17 +1521,19 @@ void ExtractInstanceDataFromExtMeshGpuInstancing(
15211521
}
15221522
}
15231523

1524+
bool CheckForExtMeshGpuInstancing(
1525+
const CesiumGltf::Model& gltf,
1526+
const CesiumGltf::Node& node) {
1527+
// Check if the EXT_mesh_gpu_instancing extension is present
1528+
return node.getExtension<CesiumGltf::ExtensionExtMeshGpuInstancing>() !=
1529+
nullptr;
1530+
}
1531+
15241532
void ExtractInstanceDataFromGltfModel(
15251533
const CesiumGltf::Model& gltf,
15261534
const glm::dmat4& tileTransform,
15271535
std::vector<InstanceData>& outInstanceData) {
15281536

1529-
// check i3dm extras
1530-
auto i3dmIt = gltf.extras.find("i3dm");
1531-
if (i3dmIt == gltf.extras.end()) {
1532-
return;
1533-
}
1534-
15351537
// Extracting EXT_mesh_gpu_instancing data from a model converted by I3dmToGltfConverter
15361538
gltf.forEachPrimitiveInScene(
15371539
-1,
@@ -1707,8 +1709,7 @@ void* UnityPrepareRendererResources::prepareInMainThread(
17071709
primitiveGameObject.layer(tilesetLayer);
17081710

17091711
//check i3dm
1710-
auto i3dmIt = gltf.extras.find("i3dm");
1711-
bool isI3dmType = i3dmIt != gltf.extras.end();
1712+
bool isI3dmType = CheckForExtMeshGpuInstancing(gltf,node);
17121713

17131714
std::vector<InstanceData> instanceData;
17141715
std::vector<UnityEngine::GameObject> intanceObjects;

0 commit comments

Comments
 (0)