From 9a1346d59b174ac45a062c4891ae4bf677cbae64 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 12 Jul 2023 18:01:53 -0400 Subject: [PATCH] Add constant for -1 tilesetId --- src/core/include/cesium/omniverse/FabricUtil.h | 3 +++ src/core/src/FabricGeometry.cpp | 2 +- src/core/src/FabricMaterial.cpp | 2 +- src/core/src/FabricUtil.cpp | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/include/cesium/omniverse/FabricUtil.h b/src/core/include/cesium/omniverse/FabricUtil.h index 161870e88..82fd32e8e 100644 --- a/src/core/include/cesium/omniverse/FabricUtil.h +++ b/src/core/include/cesium/omniverse/FabricUtil.h @@ -20,6 +20,9 @@ struct FabricStatistics { uint64_t trianglesRendered{0}; }; +// -1 means the prim is not yet associated with a tileset +const auto NO_TILESET_ID = int64_t(-1); + } // namespace cesium::omniverse namespace cesium::omniverse::FabricUtil { diff --git a/src/core/src/FabricGeometry.cpp b/src/core/src/FabricGeometry.cpp index 39a864eea..fe05f47a4 100644 --- a/src/core/src/FabricGeometry.cpp +++ b/src/core/src/FabricGeometry.cpp @@ -213,7 +213,7 @@ void FabricGeometry::reset() { displayColorFabric[0] = DEFAULT_VERTEX_COLOR; displayOpacityFabric[0] = DEFAULT_VERTEX_OPACITY; - FabricUtil::setTilesetId(_pathFabric, -1); + FabricUtil::setTilesetId(_pathFabric, NO_TILESET_ID); srw.setArrayAttributeSize(_pathFabric, FabricTokens::material_binding, 0); srw.setArrayAttributeSize(_pathFabric, FabricTokens::faceVertexCounts, 0); diff --git a/src/core/src/FabricMaterial.cpp b/src/core/src/FabricMaterial.cpp index 9ab33fc81..e85dbf5a2 100644 --- a/src/core/src/FabricMaterial.cpp +++ b/src/core/src/FabricMaterial.cpp @@ -217,7 +217,7 @@ void FabricMaterial::reset() { auto srw = UsdUtil::getFabricStageReaderWriter(); setMaterialValues(GltfUtil::getDefaultMaterialInfo()); - setTilesetId(-1); + setTilesetId(NO_TILESET_ID); if (_materialDefinition.hasBaseColorTexture()) { clearBaseColorTexture(); diff --git a/src/core/src/FabricUtil.cpp b/src/core/src/FabricUtil.cpp index fb1d279a4..05e79df3d 100644 --- a/src/core/src/FabricUtil.cpp +++ b/src/core/src/FabricUtil.cpp @@ -545,7 +545,7 @@ FabricStatistics getStatistics() { statistics.geometriesCapacity += paths.size(); for (size_t i = 0; i < paths.size(); i++) { - if (tilesetIdFabric[i] == -1) { + if (tilesetIdFabric[i] == NO_TILESET_ID) { continue; } @@ -571,7 +571,7 @@ FabricStatistics getStatistics() { statistics.materialsCapacity += paths.size(); for (size_t i = 0; i < paths.size(); i++) { - if (tilesetIdFabric[i] == -1) { + if (tilesetIdFabric[i] == NO_TILESET_ID) { continue; }