summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNikolas <[email protected]>2023-07-27 22:41:43 +0200
committerGitHub <[email protected]>2023-07-27 22:41:43 +0200
commit5d28bad0adf2a85a48f6ce4644ce728ec9868208 (patch)
treea73369f345da08a80c1c5089be91eba6f2022925 /src
parentac6f889dfcaf4c195c13abed09522ecebd03b0f9 (diff)
downloadraylib-5d28bad0adf2a85a48f6ce4644ce728ec9868208.tar.gz
raylib-5d28bad0adf2a85a48f6ce4644ce728ec9868208.zip
Fix LoadTextureCubemap for manual layouts (#3204)
Diffstat (limited to 'src')
-rw-r--r--src/rtextures.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rtextures.c b/src/rtextures.c
index ca341bc8..c13e331c 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -3369,10 +3369,16 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
if ((image.height/6) == image.width) { layout = CUBEMAP_LAYOUT_LINE_VERTICAL; cubemap.width = image.height/6; }
else if ((image.width/3) == (image.height/4)) { layout = CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR; cubemap.width = image.width/3; }
}
-
- cubemap.height = cubemap.width;
+ } else {
+ if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL) cubemap.width = image.height/6;
+ if (layout == CUBEMAP_LAYOUT_LINE_HORIZONTAL) cubemap.width = image.width/6;
+ if (layout == CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR) cubemap.width = image.width/3;
+ if (layout == CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE) cubemap.width = image.width/4;
+ if (layout == CUBEMAP_LAYOUT_PANORAMA) cubemap.width = image.width/4;
}
+ cubemap.height = cubemap.width;
+
// Layout provided or already auto-detected
if (layout != CUBEMAP_LAYOUT_AUTO_DETECT)
{