REVIEWED: LoadTextureCubemap()
, added mipmaps
#3665
This commit is contained in:
parent
f914020d45
commit
1792bce292
1 changed files with 5 additions and 1 deletions
|
@ -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; }
|
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 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_VERTICAL) cubemap.width = image.height/6;
|
||||||
if (layout == CUBEMAP_LAYOUT_LINE_HORIZONTAL) cubemap.width = image.width/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_THREE_BY_FOUR) cubemap.width = image.width/3;
|
||||||
|
@ -3795,6 +3797,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
||||||
|
|
||||||
Image faces = { 0 }; // Vertical column image
|
Image faces = { 0 }; // Vertical column image
|
||||||
Rectangle faceRecs[6] = { 0 }; // Face source rectangles
|
Rectangle faceRecs[6] = { 0 }; // Face source rectangles
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) faceRecs[i] = (Rectangle){ 0, 0, (float)size, (float)size };
|
for (int i = 0; i < 6; i++) faceRecs[i] = (Rectangle){ 0, 0, (float)size, (float)size };
|
||||||
|
|
||||||
if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL)
|
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
|
// 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);
|
cubemap.id = rlLoadTextureCubemap(faces.data, size, faces.format);
|
||||||
if (cubemap.id == 0) TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image");
|
if (cubemap.id == 0) TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image");
|
||||||
|
else cubemap.mipmaps = 1;
|
||||||
|
|
||||||
UnloadImage(faces);
|
UnloadImage(faces);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue