Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename OPAQUE to OPAQUE_ENUM to deconflict with define in wingdi.h #796

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions Cesium3DTilesContent/test/TestPntsToGltfConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExtensionKhrMaterialsUnlit>());

REQUIRE(gltf.accessors.size() == expectedAttributeCount);
Expand Down Expand Up @@ -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<ExtensionKhrMaterialsUnlit>());

REQUIRE(gltf.accessors.size() == expectedAttributeCount);
Expand Down
4 changes: 2 additions & 2 deletions CesiumGltf/generated/include/CesiumGltf/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CesiumGltfWriter/generated/src/ModelJsonWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions tools/generate-classes/cppReservedWords.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const cppReservedWords = [
"while",
"xor",
"xor_eq",
"OPAQUE" // defined in wingdi.h
];

module.exports = cppReservedWords;
4 changes: 3 additions & 1 deletion tools/generate-classes/resolveProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down