GSOC 26: specular, ambient, and shininess texture maps - #9066
Open
Nixxx19 wants to merge 4 commits into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
what
extends multi-material rendering to three more mtl texture maps, following the same per-part pattern
map_Kdalready uses: specular (map_Ks), ambient (map_Ka), and shininess (map_Ns). each is parsed, loaded, carried on the part state in p5's vocabulary, and bound in the phong shader, gated so untextured draws are unaffected.the pattern (same for all three)
map_Ks/map_Kaalready parsed; addedmap_Ns)loadMaterialTexturesloads it onto the material (now driven by a small map table)mtlToPartStatecopies it to the part state, defaulting the base colour to white (or shininess to 1) so a map with no matchingKs/Ka/Nsstill shows_applyPartStatebinds it into renderer state_setFillUniformsalways binds the sampler, with a bool that gates its usephong.fragsamples it and modulates the matching termper map
map_Ksmodulates the specular colour (inputs.specularMaterial)map_Kamodulates the ambient colour (inputs.ambientMaterial)map_Nsscales the shininess by the map's red channel (inputs.shininess)zero regression
each new sampler is always bound (to an empty texture when absent) and gated by a
uHas*Texbool that defaults false, so existing 3D draws render exactly as before. confirmed by the full visual + unit suite staying green.testing
mtlToPartStateunit tests for each map (path parsed, lands on part state, sensible base defaults)part of the gsoc multi-material .mtl work, follows #8879, #8955, and #9063.