-
Notifications
You must be signed in to change notification settings - Fork 408
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
Better default material #596
Conversation
Codecov Report
@@ Coverage Diff @@
## master #596 +/- ##
=======================================
Coverage 56.55% 56.55%
=======================================
Files 128 128
Lines 5621 5621
Branches 84 84
=======================================
Hits 3179 3179
Misses 2442 2442
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aclegg3 for the rapid PR. So it was indeed a default material configuration issue that was causing the lack of shading!
A comment unrelated to the content of the changes: the use of naked new
makes loud alarm bells ring in my head whenever I see it outside the innards of class construction/destruction logic that is neatly paired up. 😅I assume this is safe because the ShaderManager
takes responsibility to free the memory eventually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of tangent to the PR, but in line with what was stated above : Since a PhongMaterialData has pointers to textures, and only a default destructor, is this not a possible source of memory leaking?
These textures live in the |
That is a valid concern. In this case we don't remove any materials once added and as a member of @mosra I see the reference counting and freeing functionality in |
Sorry, missed the comments above.
Yes to both. This API originates in early C++11 times and it was only updated to take r-value references and smart pointers quite recently (it was waiting for a lighter-weight unique pointer implementation), and most of existing code, docs and examples still uses the discouraged "naked new" way. The PR doesn't touch the relevant part anymore, but what could be done to hide the raw shaderManager_.set<gfx::MaterialData>(DEFAULT_MATERIAL_KEY,
gfx::PhongMaterialData{}); shaderManager_.set<gfx::MaterialData>(DEFAULT_MATERIAL_KEY,
Cr::Containers::pointer<gfx::PhongMaterialData>()); or, using the standard unique pointers #include <Corrade/Containers/PointerStl.h>
shaderManager_.set<gfx::MaterialData>(DEFAULT_MATERIAL_KEY,
std::make_unique<gfx::PhongMaterialData>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change of specular to 0.2
also makes everything less extremely shiny, right? :)
* Modify default material to display geometry by reducing ambient, diffuse, and specular color.
* Version change from 0.1.6 to 0.1.7 * Made flake8 happy
Motivation and Context
The
DEFAULT_MATERIAL
was initialized with full white ambient and diffuse light, causing objects to appear flat shaded. These values have been modified for a subjectively better appearance.How Has This Been Tested
Original:
![image](https://user-images.githubusercontent.com/1445143/79928863-fdb75500-83f8-11ea-868c-8b8f21d51737.png)
New:
![image](https://user-images.githubusercontent.com/1445143/79928707-8386d080-83f8-11ea-86e3-f2eab837332c.png)
Types of changes
Checklist