summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2021-12-19 13:17:37 +0100
committerRay <[email protected]>2021-12-19 13:17:37 +0100
commit278c9fa5bd3f033a8e2438f820471affca62fc4b (patch)
treed78c3a699300f86a7d33b5e7611d9c3a1750470e /src
parent76daf6e364afbb088d90a7f07062514a29a4c4ce (diff)
downloadraylib-278c9fa5bd3f033a8e2438f820471affca62fc4b.tar.gz
raylib-278c9fa5bd3f033a8e2438f820471affca62fc4b.zip
REVIEWED: `LoadTextureCubemap()` #2224
Diffstat (limited to 'src')
-rw-r--r--src/rtextures.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rtextures.c b/src/rtextures.c
index 8786bedd..73769a90 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -2919,8 +2919,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL)
{
- faces = ImageCopy(image);
- for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i;
+ faces = ImageCopy(image); // Image data already follows expected convention
}
else if (layout == CUBEMAP_LAYOUT_PANORAMA)
{
@@ -2958,6 +2957,8 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
}
+ // NOTE: Cubemap data is expected to be provided as 6 images in a single data array,
+ // one after the other (that's a vertical image), following convention: +X, -X, +Y, -Y, +Z, -Z
cubemap.id = rlLoadTextureCubemap(faces.data, size, faces.format);
if (cubemap.id == 0) TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image");