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

Fix Default constructed Material has wrong emissiveFactor #459 #460

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

ptc-tgamper
Copy link
Contributor

tiny_gltf.h - properly initialise emissiveFactor;
tests/tester.cc - add test case

tiny_gltf.h - properly initialise emissiveFactor; tests/tester.cc - add test case
@syoyo
Copy link
Owner

syoyo commented Nov 22, 2023

Awesome!

It'd be better to use member initialization instead of initialize members in the constructor. Its more C++11 or later friendly

    std::vector<double> emissiveFactor{{0.0, 0.0, 0.0}};  // length 3. default [0, 0, 0]
    std::string alphaMode{"OPAQUE"};               // default "OPAQUE"
    double alphaCutoff{0.5};             // default 0.5
    bool doubleSided{false};             // default false;

   Material() = default;

There are some ancient code in tinygltf which initialize member variables in the constructor to support C++03 compiler(and gcc-4.8), but tinygltf now drops supporting C++03.

tiny_gltf.h - use member initialization
@syoyo syoyo merged commit f32475c into syoyo:release Nov 22, 2023
8 checks passed
@syoyo
Copy link
Owner

syoyo commented Nov 22, 2023

Awesome! Thanks! Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants