Skip to content

Commit

Permalink
Formatting review
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Feb 2, 2025
1 parent cfe9693 commit cceabf6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/rmodels.c
Original file line number Diff line number Diff line change
Expand Up @@ -3879,10 +3879,10 @@ void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector
}

Vector2 texcoords[4];
texcoords[0] = (Vector2) { (float)source.x/texture.width, (float)(source.y + source.height)/texture.height };
texcoords[1] = (Vector2) { (float)(source.x + source.width)/texture.width, (float)(source.y + source.height)/texture.height };
texcoords[2] = (Vector2) { (float)(source.x + source.width)/texture.width, (float)source.y/texture.height };
texcoords[3] = (Vector2) { (float)source.x/texture.width, (float)source.y/texture.height };
texcoords[0] = (Vector2){ (float)source.x/texture.width, (float)(source.y + source.height)/texture.height };
texcoords[1] = (Vector2){ (float)(source.x + source.width)/texture.width, (float)(source.y + source.height)/texture.height };
texcoords[2] = (Vector2){ (float)(source.x + source.width)/texture.width, (float)source.y/texture.height };
texcoords[3] = (Vector2){ (float)source.x/texture.width, (float)source.y/texture.height };

rlSetTexture(texture.id);
rlBegin(RL_QUADS);
Expand Down Expand Up @@ -5141,7 +5141,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
image = LoadImage(TextFormat("%s/%s", texPath, cgltfImage->uri));
}
}
else if (cgltfImage->buffer_view != NULL && cgltfImage->buffer_view->buffer->data != NULL) // Check if image is provided as data buffer
else if ((cgltfImage->buffer_view != NULL) && (cgltfImage->buffer_view->buffer->data != NULL)) // Check if image is provided as data buffer
{
unsigned char *data = RL_MALLOC(cgltfImage->buffer_view->size);
int offset = (int)cgltfImage->buffer_view->offset;
Expand All @@ -5156,10 +5156,14 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat

// Check mime_type for image: (cgltfImage->mime_type == "image/png")
// NOTE: Detected that some models define mime_type as "image\\/png"
if ((strcmp(cgltfImage->mime_type, "image\\/png") == 0) ||
(strcmp(cgltfImage->mime_type, "image/png") == 0)) image = LoadImageFromMemory(".png", data, (int)cgltfImage->buffer_view->size);
else if ((strcmp(cgltfImage->mime_type, "image\\/jpeg") == 0) ||
(strcmp(cgltfImage->mime_type, "image/jpeg") == 0)) image = LoadImageFromMemory(".jpg", data, (int)cgltfImage->buffer_view->size);
if ((strcmp(cgltfImage->mime_type, "image\\/png") == 0) || (strcmp(cgltfImage->mime_type, "image/png") == 0))
{
image = LoadImageFromMemory(".png", data, (int)cgltfImage->buffer_view->size);
}
else if ((strcmp(cgltfImage->mime_type, "image\\/jpeg") == 0) || (strcmp(cgltfImage->mime_type, "image/jpeg") == 0))
{
image = LoadImageFromMemory(".jpg", data, (int)cgltfImage->buffer_view->size);
}
else TRACELOG(LOG_WARNING, "MODEL: glTF image data MIME type not recognized", TextFormat("%s/%s", texPath, cgltfImage->uri));

RL_FREE(data);
Expand Down

0 comments on commit cceabf6

Please sign in to comment.