|
@@ -2749,7 +2749,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
|
|
{
|
|
{
|
|
TextureCubemap cubemap = { 0 };
|
|
TextureCubemap cubemap = { 0 };
|
|
|
|
|
|
- if (layoutType == CUBEMAP_AUTO_DETECT) // Try to automatically guess layout type
|
|
|
|
|
|
+ if (layoutType == CUBEMAP_LAYOUT_AUTO_DETECT) // Try to automatically guess layout type
|
|
{
|
|
{
|
|
// Check image width/height to determine the type of cubemap provided
|
|
// Check image width/height to determine the type of cubemap provided
|
|
if (image.width > image.height)
|
|
if (image.width > image.height)
|
|
@@ -2767,7 +2767,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
|
|
cubemap.height = cubemap.width;
|
|
cubemap.height = cubemap.width;
|
|
}
|
|
}
|
|
|
|
|
|
- if (layoutType != CUBEMAP_AUTO_DETECT)
|
|
|
|
|
|
+ if (layoutType != CUBEMAP_LAYOUT_AUTO_DETECT)
|
|
{
|
|
{
|
|
int size = cubemap.width;
|
|
int size = cubemap.width;
|
|
|
|
|
|
@@ -2775,20 +2775,20 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
|
|
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 (layoutType == CUBEMAP_LINE_VERTICAL)
|
|
|
|
|
|
+ if (layoutType == CUBEMAP_LAYOUT_LINE_VERTICAL)
|
|
{
|
|
{
|
|
faces = image;
|
|
faces = image;
|
|
for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i;
|
|
for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i;
|
|
}
|
|
}
|
|
- else if (layoutType == CUBEMAP_PANORAMA)
|
|
|
|
|
|
+ else if (layoutType == CUBEMAP_LAYOUT_PANORAMA)
|
|
{
|
|
{
|
|
// TODO: Convert panorama image to square faces...
|
|
// TODO: Convert panorama image to square faces...
|
|
// Ref: https://github.com/denivip/panorama/blob/master/panorama.cpp
|
|
// Ref: https://github.com/denivip/panorama/blob/master/panorama.cpp
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if (layoutType == CUBEMAP_LINE_HORIZONTAL) for (int i = 0; i < 6; i++) faceRecs[i].x = (float)size*i;
|
|
|
|
- else if (layoutType == CUBEMAP_CROSS_THREE_BY_FOUR)
|
|
|
|
|
|
+ if (layoutType == CUBEMAP_LAYOUT_LINE_HORIZONTAL) for (int i = 0; i < 6; i++) faceRecs[i].x = (float)size*i;
|
|
|
|
+ else if (layoutType == CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR)
|
|
{
|
|
{
|
|
faceRecs[0].x = (float)size; faceRecs[0].y = (float)size;
|
|
faceRecs[0].x = (float)size; faceRecs[0].y = (float)size;
|
|
faceRecs[1].x = (float)size; faceRecs[1].y = (float)size*3;
|
|
faceRecs[1].x = (float)size; faceRecs[1].y = (float)size*3;
|
|
@@ -2797,7 +2797,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
|
|
faceRecs[4].x = 0; faceRecs[4].y = (float)size;
|
|
faceRecs[4].x = 0; faceRecs[4].y = (float)size;
|
|
faceRecs[5].x = (float)size*2; faceRecs[5].y = (float)size;
|
|
faceRecs[5].x = (float)size*2; faceRecs[5].y = (float)size;
|
|
}
|
|
}
|
|
- else if (layoutType == CUBEMAP_CROSS_FOUR_BY_THREE)
|
|
|
|
|
|
+ else if (layoutType == CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE)
|
|
{
|
|
{
|
|
faceRecs[0].x = (float)size*2; faceRecs[0].y = (float)size;
|
|
faceRecs[0].x = (float)size*2; faceRecs[0].y = (float)size;
|
|
faceRecs[1].x = 0; faceRecs[1].y = (float)size;
|
|
faceRecs[1].x = 0; faceRecs[1].y = (float)size;
|
|
@@ -3251,8 +3251,8 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
|
|
|
|
|
if (nPatchInfo.source.width < 0) nPatchInfo.source.x -= nPatchInfo.source.width;
|
|
if (nPatchInfo.source.width < 0) nPatchInfo.source.x -= nPatchInfo.source.width;
|
|
if (nPatchInfo.source.height < 0) nPatchInfo.source.y -= nPatchInfo.source.height;
|
|
if (nPatchInfo.source.height < 0) nPatchInfo.source.y -= nPatchInfo.source.height;
|
|
- if (nPatchInfo.type == NPT_3PATCH_HORIZONTAL) patchHeight = nPatchInfo.source.height;
|
|
|
|
- if (nPatchInfo.type == NPT_3PATCH_VERTICAL) patchWidth = nPatchInfo.source.width;
|
|
|
|
|
|
+ if (nPatchInfo.type == NPATCH_THREE_PATCH_HORIZONTAL) patchHeight = nPatchInfo.source.height;
|
|
|
|
+ if (nPatchInfo.type == NPATCH_THREE_PATCH_VERTICAL) patchWidth = nPatchInfo.source.width;
|
|
|
|
|
|
bool drawCenter = true;
|
|
bool drawCenter = true;
|
|
bool drawMiddle = true;
|
|
bool drawMiddle = true;
|
|
@@ -3262,14 +3262,14 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
|
float bottomBorder = (float)nPatchInfo.bottom;
|
|
float bottomBorder = (float)nPatchInfo.bottom;
|
|
|
|
|
|
// adjust the lateral (left and right) border widths in case patchWidth < texture.width
|
|
// adjust the lateral (left and right) border widths in case patchWidth < texture.width
|
|
- if (patchWidth <= (leftBorder + rightBorder) && nPatchInfo.type != NPT_3PATCH_VERTICAL)
|
|
|
|
|
|
+ if (patchWidth <= (leftBorder + rightBorder) && nPatchInfo.type != NPATCH_THREE_PATCH_VERTICAL)
|
|
{
|
|
{
|
|
drawCenter = false;
|
|
drawCenter = false;
|
|
leftBorder = (leftBorder/(leftBorder + rightBorder))*patchWidth;
|
|
leftBorder = (leftBorder/(leftBorder + rightBorder))*patchWidth;
|
|
rightBorder = patchWidth - leftBorder;
|
|
rightBorder = patchWidth - leftBorder;
|
|
}
|
|
}
|
|
// adjust the lateral (top and bottom) border heights in case patchHeight < texture.height
|
|
// adjust the lateral (top and bottom) border heights in case patchHeight < texture.height
|
|
- if (patchHeight <= (topBorder + bottomBorder) && nPatchInfo.type != NPT_3PATCH_HORIZONTAL)
|
|
|
|
|
|
+ if (patchHeight <= (topBorder + bottomBorder) && nPatchInfo.type != NPATCH_THREE_PATCH_HORIZONTAL)
|
|
{
|
|
{
|
|
drawMiddle = false;
|
|
drawMiddle = false;
|
|
topBorder = (topBorder/(topBorder + bottomBorder))*patchHeight;
|
|
topBorder = (topBorder/(topBorder + bottomBorder))*patchHeight;
|
|
@@ -3307,7 +3307,7 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
|
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
|
|
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
|
|
rlNormal3f(0.0f, 0.0f, 1.0f); // Normal vector pointing towards viewer
|
|
rlNormal3f(0.0f, 0.0f, 1.0f); // Normal vector pointing towards viewer
|
|
|
|
|
|
- if (nPatchInfo.type == NPT_9PATCH)
|
|
|
|
|
|
+ if (nPatchInfo.type == NPATCH_NINE_PATCH)
|
|
{
|
|
{
|
|
// ------------------------------------------------------------
|
|
// ------------------------------------------------------------
|
|
// TOP-LEFT QUAD
|
|
// TOP-LEFT QUAD
|
|
@@ -3373,7 +3373,7 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
|
rlTexCoord2f(coordD.x, coordC.y); rlVertex2f(vertD.x, vertC.y); // Top-right corner for texture and quad
|
|
rlTexCoord2f(coordD.x, coordC.y); rlVertex2f(vertD.x, vertC.y); // Top-right corner for texture and quad
|
|
rlTexCoord2f(coordC.x, coordC.y); rlVertex2f(vertC.x, vertC.y); // Top-left corner for texture and quad
|
|
rlTexCoord2f(coordC.x, coordC.y); rlVertex2f(vertC.x, vertC.y); // Top-left corner for texture and quad
|
|
}
|
|
}
|
|
- else if (nPatchInfo.type == NPT_3PATCH_VERTICAL)
|
|
|
|
|
|
+ else if (nPatchInfo.type == NPATCH_THREE_PATCH_VERTICAL)
|
|
{
|
|
{
|
|
// TOP QUAD
|
|
// TOP QUAD
|
|
// -----------------------------------------------------------
|
|
// -----------------------------------------------------------
|
|
@@ -3400,7 +3400,7 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
|
rlTexCoord2f(coordD.x, coordC.y); rlVertex2f(vertD.x, vertC.y); // Top-right corner for texture and quad
|
|
rlTexCoord2f(coordD.x, coordC.y); rlVertex2f(vertD.x, vertC.y); // Top-right corner for texture and quad
|
|
rlTexCoord2f(coordA.x, coordC.y); rlVertex2f(vertA.x, vertC.y); // Top-left corner for texture and quad
|
|
rlTexCoord2f(coordA.x, coordC.y); rlVertex2f(vertA.x, vertC.y); // Top-left corner for texture and quad
|
|
}
|
|
}
|
|
- else if (nPatchInfo.type == NPT_3PATCH_HORIZONTAL)
|
|
|
|
|
|
+ else if (nPatchInfo.type == NPATCH_THREE_PATCH_HORIZONTAL)
|
|
{
|
|
{
|
|
// LEFT QUAD
|
|
// LEFT QUAD
|
|
// -----------------------------------------------------------
|
|
// -----------------------------------------------------------
|