-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Material: Appearance Updates 2 #13792
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What's the reason for adding image/texture path to the Material class? And why are there two strings?
Material and image/texture handling are two separate things and this is an example of breaking the SRP.
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.
This is to support textures as part of materials. It's not used yet, but will be once textures are supported.
It can be removed for now but will only be added back later
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.
Image is a base64 image, image path is a path to an image file. Only one will be used
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.
And what is SRP?
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.
"Single responsibility principle" -- though I'm not really sure how it's applicable here, to be honest. Maybe Werner can clarify? It seems to me that the displayed texture (and its file) are pretty central to rendering a material, at least once that feature is implemented.
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 Material class basically is to store the four colours, transparency and shininess. This information is applied to the SoMaterial node of the OpenInventor (OI) library. The SoMaterial class doesn't know anything about images or textures.
In OI textures are basically handled by SoTexture2 and SoTexture3 and images by SoImage.
For advanced handling of textures OI has around 20 further classes to control coordinates, transformations, reflections, mapping and many more things.
Sooner or later some of the additional options will be needed to fine-tune the rendering of textures.
The result by having all texture related parameters in the Material class is that all other classes in FC that set or get them will have methods to either only handle the colour parts or the texture parts but not both. So, these methods can be divided into two parts with no cohesion which IMO can be considered as breaking the SRP.
To avoid this situation material and texture handling should be kept strictly separated.