diff --git a/CHANGES.md b/CHANGES.md index 2107d1928..59dfbfb0a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ ##### Breaking Changes :mega: - `IndicesForFaceFromAccessor` now propertly supports `TRIANGLE_STRIP` and `TRIANGLE_FAN` modes. This requires the struct to be initialized with the correct primitive mode. +- `CesiumGltf::Material::AlphaMode::OPAQUE` has been renamed to `OPAQUE_ENUM` to deconflict with the `OPAQUE` define in `wingdi.h`. ##### Additions :tada: diff --git a/Cesium3DTilesContent/test/TestPntsToGltfConverter.cpp b/Cesium3DTilesContent/test/TestPntsToGltfConverter.cpp index 05f2646a9..7abcd7b5b 100644 --- a/Cesium3DTilesContent/test/TestPntsToGltfConverter.cpp +++ b/Cesium3DTilesContent/test/TestPntsToGltfConverter.cpp @@ -308,7 +308,7 @@ TEST_CASE("Converts point cloud with RGB to glTF") { REQUIRE(gltf.materials.size() == 1); Material& material = gltf.materials[0]; - CHECK(material.alphaMode == Material::AlphaMode::OPAQUE); + CHECK(material.alphaMode == Material::AlphaMode::OPAQUE_ENUM); CHECK(material.hasExtension()); REQUIRE(gltf.accessors.size() == expectedAttributeCount); @@ -368,7 +368,7 @@ TEST_CASE("Converts point cloud with RGB565 to glTF") { REQUIRE(gltf.materials.size() == 1); Material& material = gltf.materials[0]; - CHECK(material.alphaMode == Material::AlphaMode::OPAQUE); + CHECK(material.alphaMode == Material::AlphaMode::OPAQUE_ENUM); CHECK(material.hasExtension()); REQUIRE(gltf.accessors.size() == expectedAttributeCount); diff --git a/CesiumGltf/generated/include/CesiumGltf/Material.h b/CesiumGltf/generated/include/CesiumGltf/Material.h index 6936bbff0..8b98b981b 100644 --- a/CesiumGltf/generated/include/CesiumGltf/Material.h +++ b/CesiumGltf/generated/include/CesiumGltf/Material.h @@ -24,7 +24,7 @@ struct CESIUMGLTF_API Material final : public CesiumGltf::NamedObject { * @brief Known values for The alpha rendering mode of the material. */ struct AlphaMode { - inline static const std::string OPAQUE = "OPAQUE"; + inline static const std::string OPAQUE_ENUM = "OPAQUE"; inline static const std::string MASK = "MASK"; @@ -90,7 +90,7 @@ struct CESIUMGLTF_API Material final : public CesiumGltf::NamedObject { * The material's alpha rendering mode enumeration specifying the * interpretation of the alpha value of the base color. */ - std::string alphaMode = AlphaMode::OPAQUE; + std::string alphaMode = AlphaMode::OPAQUE_ENUM; /** * @brief The alpha cutoff value of the material. diff --git a/CesiumGltfWriter/generated/src/ModelJsonWriter.cpp b/CesiumGltfWriter/generated/src/ModelJsonWriter.cpp index 2d2e38fc2..a1e720e10 100644 --- a/CesiumGltfWriter/generated/src/ModelJsonWriter.cpp +++ b/CesiumGltfWriter/generated/src/ModelJsonWriter.cpp @@ -2441,7 +2441,7 @@ void writeJson( writeJson(obj.emissiveFactor, jsonWriter, context); } - if (obj.alphaMode != CesiumGltf::Material::AlphaMode::OPAQUE) { + if (obj.alphaMode != CesiumGltf::Material::AlphaMode::OPAQUE_ENUM) { jsonWriter.Key("alphaMode"); writeJson(obj.alphaMode, jsonWriter, context); } diff --git a/tools/generate-classes/cppReservedWords.js b/tools/generate-classes/cppReservedWords.js index 5357f388a..6f480a30d 100644 --- a/tools/generate-classes/cppReservedWords.js +++ b/tools/generate-classes/cppReservedWords.js @@ -98,6 +98,7 @@ const cppReservedWords = [ "while", "xor", "xor_eq", + "OPAQUE" // defined in wingdi.h ]; module.exports = cppReservedWords; diff --git a/tools/generate-classes/resolveProperty.js b/tools/generate-classes/resolveProperty.js index 66e70f776..5376f2c94 100644 --- a/tools/generate-classes/resolveProperty.js +++ b/tools/generate-classes/resolveProperty.js @@ -734,7 +734,9 @@ function makeNameIntoValidIdentifier(name) { } function makeNameIntoValidEnumIdentifier(name) { - // May use this in the future to deconflict glTF enums from system header defines + if (cppReservedWords.indexOf(name) >= 0) { + name += "_ENUM"; + } return name; }