You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's not possible to add additional maps to our default shader. To use additional maps, new uniform location points must be defined externally by user. Those map location points (new texture units) are also not considered by rlglDrawModel().
There is not an easy solution to this issue. One idea could be enabling a number of possible maps and keep track of the active ones:
typedefstructShader {
unsigned intid; // Shader program id// Variable attributesintvertexLoc; // Vertex attribute location point (vertex shader)inttexcoordLoc; // Texcoord attribute location point (vertex shader)intnormalLoc; // Normal attribute location point (vertex shader)intcolorLoc; // Color attibute location point (vertex shader)// UniformsintmvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)inttintColorLoc; // Color uniform location point (fragment shader)// Maps uniform locationsintmapLoc[MAX_MAP_LOCATIONS]; // Map texture uniform location point (fragment shader)intmapCounter; // Number of maps used (texture units)
} Shader;
This system has been redesigned and now maps usage is simpler. Still, there are three kind of maps and they are binded by default to fixed texture units:
diffuse -> binded to texture unit 0 (GL_TEXTURE0)
normal -> binded to texture unit 1 (GL_TEXTURE1)
specular -> binded to texture unit 2 (GL_TEXTURE2)
But now, depending on textures assigned to material and selected shader, they are internally binded on drawing or not:
// Default material loading exampleMaterialmaterial=LoadDefaultMaterial(); // Default shader assigned to material (supports only diffuse map)material.texDiffuse=LoadTexture("wood_diffuse.png"); // texture unit 0 activated (available in material shader)material.texSpecular=LoadTexture("wood_specular.png"); // texture unit 2 activated (available in material shader)// Standard material loading exampleMaterialmaterial=LoadStandardMaterial(); // Standard shader assigned to material (supports diffuse, normal and specular maps)material.texDiffuse=LoadTexture("wood_diffuse.png"); // texture unit 0 activated (available in material shader)material.texSpecular=LoadTexture("wood_specular.png"); // texture unit 2 NOT activated (not available in material shader)
By default, on shader loading, following fixed location names are expected for maps:
Right now shader maps are not generic; in our default shader we define uniform location points for three kind of maps:
Those maps can be set with the following (not generic) functions:
It's not possible to add additional maps to our default shader. To use additional maps, new uniform location points must be defined externally by user. Those map location points (new texture units) are also not considered by
rlglDrawModel()
.There is not an easy solution to this issue. One idea could be enabling a number of possible maps and keep track of the active ones:
One function to set custom maps could be added:
Obviously, the user should use them properly on the shader code.
A similar solution could also be applied to vertex attributes for custom attributes.
The text was updated successfully, but these errors were encountered: