mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-05 19:08:13 +00:00
[rmodels] Multiplication of colors in DrawModelEx
which can be simplified (#4002)
* simplifies color multiplication `DrawModelEx` * add explicit casts
This commit is contained in:
@@ -3546,10 +3546,10 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
|
||||
Color color = model.materials[model.meshMaterial[i]].maps[MATERIAL_MAP_DIFFUSE].color;
|
||||
|
||||
Color colorTint = WHITE;
|
||||
colorTint.r = (unsigned char)((((float)color.r/255.0f)*((float)tint.r/255.0f))*255.0f);
|
||||
colorTint.g = (unsigned char)((((float)color.g/255.0f)*((float)tint.g/255.0f))*255.0f);
|
||||
colorTint.b = (unsigned char)((((float)color.b/255.0f)*((float)tint.b/255.0f))*255.0f);
|
||||
colorTint.a = (unsigned char)((((float)color.a/255.0f)*((float)tint.a/255.0f))*255.0f);
|
||||
colorTint.r = (unsigned char)(((int)color.r*(int)tint.r)/255);
|
||||
colorTint.g = (unsigned char)(((int)color.g*(int)tint.g)/255);
|
||||
colorTint.b = (unsigned char)(((int)color.b*(int)tint.b)/255);
|
||||
colorTint.a = (unsigned char)(((int)color.a*(int)tint.a)/255);
|
||||
|
||||
model.materials[model.meshMaterial[i]].maps[MATERIAL_MAP_DIFFUSE].color = colorTint;
|
||||
DrawMesh(model.meshes[i], model.materials[model.meshMaterial[i]], model.transform);
|
||||
|
Reference in New Issue
Block a user