Added tint color attribute to material data type
It tints all fragments, ignores lighting. Useful for some features like feedback (damage color, ...).
This commit is contained in:
parent
f2d61d4043
commit
b0a0c5d431
4 changed files with 7 additions and 1 deletions
|
@ -751,6 +751,7 @@ Material LoadDefaultMaterial(void)
|
||||||
//material.texNormal; // NOTE: By default, not set
|
//material.texNormal; // NOTE: By default, not set
|
||||||
//material.texSpecular; // NOTE: By default, not set
|
//material.texSpecular; // NOTE: By default, not set
|
||||||
|
|
||||||
|
material.colTint = WHITE; // Tint color
|
||||||
material.colDiffuse = WHITE; // Diffuse color
|
material.colDiffuse = WHITE; // Diffuse color
|
||||||
material.colAmbient = WHITE; // Ambient color
|
material.colAmbient = WHITE; // Ambient color
|
||||||
material.colSpecular = WHITE; // Specular color
|
material.colSpecular = WHITE; // Specular color
|
||||||
|
@ -1268,7 +1269,7 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
|
||||||
//Matrix matModel = MatrixMultiply(model.transform, matTransform); // Transform to world-space coordinates
|
//Matrix matModel = MatrixMultiply(model.transform, matTransform); // Transform to world-space coordinates
|
||||||
|
|
||||||
model.transform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation);
|
model.transform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation);
|
||||||
// model.material.colDiffuse = tint;
|
model.material.colTint = tint;
|
||||||
|
|
||||||
rlglDrawMesh(model.mesh, model.material, model.transform);
|
rlglDrawMesh(model.mesh, model.material, model.transform);
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,6 +414,7 @@ typedef struct Material {
|
||||||
Texture2D texNormal; // Normal texture (binded to shader mapTexture1Loc)
|
Texture2D texNormal; // Normal texture (binded to shader mapTexture1Loc)
|
||||||
Texture2D texSpecular; // Specular texture (binded to shader mapTexture2Loc)
|
Texture2D texSpecular; // Specular texture (binded to shader mapTexture2Loc)
|
||||||
|
|
||||||
|
Color colTint; // Tint color
|
||||||
Color colDiffuse; // Diffuse color
|
Color colDiffuse; // Diffuse color
|
||||||
Color colAmbient; // Ambient color
|
Color colAmbient; // Ambient color
|
||||||
Color colSpecular; // Specular color
|
Color colSpecular; // Specular color
|
||||||
|
|
|
@ -1793,6 +1793,9 @@ void rlglDrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
// Setup shader uniforms for lights
|
// Setup shader uniforms for lights
|
||||||
SetShaderLights(material.shader);
|
SetShaderLights(material.shader);
|
||||||
|
|
||||||
|
// Upload to shader material.colSpecular
|
||||||
|
glUniform4f(glGetUniformLocation(material.shader.id, "colTint"), (float)material.colTint.r/255, (float)material.colTint.g/255, (float)material.colTint.b/255, (float)material.colTint.a/255);
|
||||||
|
|
||||||
// Upload to shader material.colAmbient
|
// Upload to shader material.colAmbient
|
||||||
glUniform4f(glGetUniformLocation(material.shader.id, "colAmbient"), (float)material.colAmbient.r/255, (float)material.colAmbient.g/255, (float)material.colAmbient.b/255, (float)material.colAmbient.a/255);
|
glUniform4f(glGetUniformLocation(material.shader.id, "colAmbient"), (float)material.colAmbient.r/255, (float)material.colAmbient.g/255, (float)material.colAmbient.b/255, (float)material.colAmbient.a/255);
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,7 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
|
||||||
Texture2D texNormal; // Normal texture
|
Texture2D texNormal; // Normal texture
|
||||||
Texture2D texSpecular; // Specular texture
|
Texture2D texSpecular; // Specular texture
|
||||||
|
|
||||||
|
Color colTint; // Tint color
|
||||||
Color colDiffuse; // Diffuse color
|
Color colDiffuse; // Diffuse color
|
||||||
Color colAmbient; // Ambient color
|
Color colAmbient; // Ambient color
|
||||||
Color colSpecular; // Specular color
|
Color colSpecular; // Specular color
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue