diff options
| author | Ray <[email protected]> | 2023-12-23 11:26:23 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-12-23 11:26:23 +0100 |
| commit | 1792bce2924d2cfed9f63aa855dc56be449334f2 (patch) | |
| tree | 104cc314517fd169067d99bbfee5e16223e47747 | |
| parent | f914020d45f6e44b2de4e6ba6af8e5b60fe42731 (diff) | |
| download | raylib-1792bce2924d2cfed9f63aa855dc56be449334f2.tar.gz raylib-1792bce2924d2cfed9f63aa855dc56be449334f2.zip | |
REVIEWED: `LoadTextureCubemap()`, added `mipmaps` #3665
| -rw-r--r-- | src/rtextures.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rtextures.c b/src/rtextures.c index d42304c7..c53d30aa 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -3778,7 +3778,9 @@ 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; } } - } else { + } + 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; @@ -3795,6 +3797,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout) Image faces = { 0 }; // Vertical column image Rectangle faceRecs[6] = { 0 }; // Face source rectangles + for (int i = 0; i < 6; i++) faceRecs[i] = (Rectangle){ 0, 0, (float)size, (float)size }; if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL) @@ -3841,6 +3844,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout) // 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"); + else cubemap.mipmaps = 1; UnloadImage(faces); } |
