summaryrefslogtreecommitdiffhomepage
path: root/src/models.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-04-10 19:26:36 +0200
committerraysan5 <[email protected]>2020-04-10 19:26:36 +0200
commitcc816345bf24c8da911e080589b5653a52b8404e (patch)
tree5d858a1691a06d0940d771a57fbf2c97f83f25fe /src/models.c
parentb132da0ac2b0777cc965238fc3b011b1fa9b1fe5 (diff)
downloadraylib-cc816345bf24c8da911e080589b5653a52b8404e.tar.gz
raylib-cc816345bf24c8da911e080589b5653a52b8404e.zip
WARNING: API BREAK: Removed LoadImagePro()
Actually this function is useless and potentially dangerous, internally, a shallow copy of data was done. Same could be accomplished accesing image.data directly.
Diffstat (limited to 'src/models.c')
-rw-r--r--src/models.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/models.c b/src/models.c
index 69d78560..2629ea70 100644
--- a/src/models.c
+++ b/src/models.c
@@ -3430,13 +3430,18 @@ static Image LoadImageFromCgltfImage(cgltf_image *image, const char *texPath, Co
if (image->uri[i] == 0) TRACELOG(LOG_WARNING, "IMAGE: glTF data URI is not a valid image");
else
{
- int size;
+ int size = 0;
unsigned char *data = DecodeBase64(image->uri + i + 1, &size);
- int w, h;
- unsigned char *raw = stbi_load_from_memory(data, size, &w, &h, NULL, 4);
+ int width, height;
+ unsigned char *raw = stbi_load_from_memory(data, size, &width, &height, NULL, 4);
+ free(data);
- rimage = LoadImagePro(raw, w, h, UNCOMPRESSED_R8G8B8A8);
+ rimage.data = raw;
+ rimage.width = width;
+ rimage.height = height;
+ rimage.format = UNCOMPRESSED_R8G8B8A8;
+ rimage.mipmaps = 1;
// TODO: Tint shouldn't be applied here!
ImageColorTint(&rimage, tint);
@@ -3462,20 +3467,20 @@ static Image LoadImageFromCgltfImage(cgltf_image *image, const char *texPath, Co
n += stride;
}
- int w, h;
- unsigned char *raw = stbi_load_from_memory(data, image->buffer_view->size, &w, &h, NULL, 4);
+ int width, height;
+ unsigned char *raw = stbi_load_from_memory(data, image->buffer_view->size, &width, &height, NULL, 4);
free(data);
- rimage = LoadImagePro(raw, w, h, UNCOMPRESSED_R8G8B8A8);
- free(raw);
+ rimage.data = raw;
+ rimage.width = width;
+ rimage.height = height;
+ rimage.format = UNCOMPRESSED_R8G8B8A8;
+ rimage.mipmaps = 1;
// TODO: Tint shouldn't be applied here!
ImageColorTint(&rimage, tint);
}
- else
- {
- rimage = LoadImageEx(&tint, 1, 1);
- }
+ else rimage = GenImageColor(1, 1, tint);
return rimage;
}