mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-20 02:08:14 +00:00
REVIEWED: Formatting #4739
This commit is contained in:
@@ -5347,7 +5347,8 @@ static Model LoadGLTF(const char *fileName)
|
|||||||
Image imMetallicRoughness = LoadImageFromCgltfImage(data->materials[i].pbr_metallic_roughness.metallic_roughness_texture.texture->image, texPath);
|
Image imMetallicRoughness = LoadImageFromCgltfImage(data->materials[i].pbr_metallic_roughness.metallic_roughness_texture.texture->image, texPath);
|
||||||
if (imMetallicRoughness.data != NULL)
|
if (imMetallicRoughness.data != NULL)
|
||||||
{
|
{
|
||||||
Image imMetallic, imRoughness;
|
Image imMetallic = { 0 };
|
||||||
|
Image imRoughness = { 0 };
|
||||||
|
|
||||||
imMetallic.data = RL_MALLOC(imMetallicRoughness.width*imMetallicRoughness.height);
|
imMetallic.data = RL_MALLOC(imMetallicRoughness.width*imMetallicRoughness.height);
|
||||||
imRoughness.data = RL_MALLOC(imMetallicRoughness.width*imMetallicRoughness.height);
|
imRoughness.data = RL_MALLOC(imMetallicRoughness.width*imMetallicRoughness.height);
|
||||||
@@ -5358,17 +5359,17 @@ static Model LoadGLTF(const char *fileName)
|
|||||||
imMetallic.format = imRoughness.format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE;
|
imMetallic.format = imRoughness.format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE;
|
||||||
imMetallic.mipmaps = imRoughness.mipmaps = 1;
|
imMetallic.mipmaps = imRoughness.mipmaps = 1;
|
||||||
|
|
||||||
for (int x = 0; x < imRoughness.width; x++) {
|
for (int x = 0; x < imRoughness.width; x++)
|
||||||
for (int y = 0; y < imRoughness.height; y++) {
|
{
|
||||||
|
for (int y = 0; y < imRoughness.height; y++)
|
||||||
|
{
|
||||||
Color color = GetImageColor(imMetallicRoughness, x, y);
|
Color color = GetImageColor(imMetallicRoughness, x, y);
|
||||||
|
|
||||||
Color roughness = (Color) {color.g};
|
((unsigned char *)imRoughness.data)[y*imRoughness.width + x] = color.g; // Roughness color channel
|
||||||
Color metallic = (Color) {color.b};
|
((unsigned char *)imMetallic.data)[y*imMetallic.width + x] = color.b; // Metallic color channel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
((unsigned char *)imRoughness.data)[y*imRoughness.width + x] = color.g;
|
|
||||||
((unsigned char *)imMetallic.data)[y*imMetallic.width + x] = color.b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model.materials[j].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTextureFromImage(imRoughness);
|
model.materials[j].maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTextureFromImage(imRoughness);
|
||||||
model.materials[j].maps[MATERIAL_MAP_METALNESS].texture = LoadTextureFromImage(imMetallic);
|
model.materials[j].maps[MATERIAL_MAP_METALNESS].texture = LoadTextureFromImage(imMetallic);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user