WARNING: BREAKING: REVIEWED some enums naming

Now enum names are more consistent between them.
This commit is contained in:
Ray 2021-03-19 13:19:54 +01:00
parent 664fbb87f5
commit a1d9987e7c
6 changed files with 96 additions and 99 deletions

View file

@ -2744,29 +2744,29 @@ Texture2D LoadTextureFromImage(Image image)
}
// Load cubemap from image, multiple image cubemap layouts supported
TextureCubemap LoadTextureCubemap(Image image, int layoutType)
TextureCubemap LoadTextureCubemap(Image image, int layout)
{
TextureCubemap cubemap = { 0 };
if (layoutType == CUBEMAP_LAYOUT_AUTO_DETECT) // Try to automatically guess layout type
if (layout == CUBEMAP_LAYOUT_AUTO_DETECT) // Try to automatically guess layout type
{
// Check image width/height to determine the type of cubemap provided
if (image.width > image.height)
{
if ((image.width/6) == image.height) { layoutType = CUBEMAP_LAYOUT_LINE_HORIZONTAL; cubemap.width = image.width/6; }
else if ((image.width/4) == (image.height/3)) { layoutType = CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE; cubemap.width = image.width/4; }
else if (image.width >= (int)((float)image.height*1.85f)) { layoutType = CUBEMAP_LAYOUT_PANORAMA; cubemap.width = image.width/4; }
if ((image.width/6) == image.height) { layout = CUBEMAP_LAYOUT_LINE_HORIZONTAL; cubemap.width = image.width/6; }
else if ((image.width/4) == (image.height/3)) { layout = CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE; cubemap.width = image.width/4; }
else if (image.width >= (int)((float)image.height*1.85f)) { layout = CUBEMAP_LAYOUT_PANORAMA; cubemap.width = image.width/4; }
}
else if (image.height > image.width)
{
if ((image.height/6) == image.width) { layoutType = CUBEMAP_LAYOUT_LINE_VERTICAL; cubemap.width = image.height/6; }
else if ((image.width/3) == (image.height/4)) { layoutType = CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR; cubemap.width = image.width/3; }
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;
}
if (layoutType != CUBEMAP_LAYOUT_AUTO_DETECT)
if (layout != CUBEMAP_LAYOUT_AUTO_DETECT)
{
int size = cubemap.width;
@ -2774,20 +2774,20 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
Rectangle faceRecs[6] = { 0 }; // Face source rectangles
for (int i = 0; i < 6; i++) faceRecs[i] = (Rectangle){ 0, 0, (float)size, (float)size };
if (layoutType == CUBEMAP_LAYOUT_LINE_VERTICAL)
if (layout == CUBEMAP_LAYOUT_LINE_VERTICAL)
{
faces = image;
for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i;
}
else if (layoutType == CUBEMAP_LAYOUT_PANORAMA)
else if (layout == CUBEMAP_LAYOUT_PANORAMA)
{
// TODO: Convert panorama image to square faces...
// Ref: https://github.com/denivip/panorama/blob/master/panorama.cpp
}
else
{
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)
if (layout == CUBEMAP_LAYOUT_LINE_HORIZONTAL) for (int i = 0; i < 6; i++) faceRecs[i].x = (float)size*i;
else if (layout == CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR)
{
faceRecs[0].x = (float)size; faceRecs[0].y = (float)size;
faceRecs[1].x = (float)size; faceRecs[1].y = (float)size*3;
@ -2796,7 +2796,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
faceRecs[4].x = 0; faceRecs[4].y = (float)size;
faceRecs[5].x = (float)size*2; faceRecs[5].y = (float)size;
}
else if (layoutType == CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE)
else if (layout == CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE)
{
faceRecs[0].x = (float)size*2; faceRecs[0].y = (float)size;
faceRecs[1].x = 0; faceRecs[1].y = (float)size;
@ -2962,9 +2962,9 @@ void GenTextureMipmaps(Texture2D *texture)
}
// Set texture scaling filter mode
void SetTextureFilter(Texture2D texture, int filterMode)
void SetTextureFilter(Texture2D texture, int filter)
{
switch (filterMode)
switch (filter)
{
case TEXTURE_FILTER_POINT:
{
@ -3028,9 +3028,9 @@ void SetTextureFilter(Texture2D texture, int filterMode)
}
// Set texture wrapping mode
void SetTextureWrap(Texture2D texture, int wrapMode)
void SetTextureWrap(Texture2D texture, int wrap)
{
switch (wrapMode)
switch (wrap)
{
case TEXTURE_WRAP_REPEAT:
{
@ -3250,8 +3250,8 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
if (nPatchInfo.source.width < 0) nPatchInfo.source.x -= nPatchInfo.source.width;
if (nPatchInfo.source.height < 0) nPatchInfo.source.y -= nPatchInfo.source.height;
if (nPatchInfo.type == NPATCH_THREE_PATCH_HORIZONTAL) patchHeight = nPatchInfo.source.height;
if (nPatchInfo.type == NPATCH_THREE_PATCH_VERTICAL) patchWidth = nPatchInfo.source.width;
if (nPatchInfo.layout == NPATCH_THREE_PATCH_HORIZONTAL) patchHeight = nPatchInfo.source.height;
if (nPatchInfo.layout == NPATCH_THREE_PATCH_VERTICAL) patchWidth = nPatchInfo.source.width;
bool drawCenter = true;
bool drawMiddle = true;
@ -3261,14 +3261,14 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
float bottomBorder = (float)nPatchInfo.bottom;
// adjust the lateral (left and right) border widths in case patchWidth < texture.width
if (patchWidth <= (leftBorder + rightBorder) && nPatchInfo.type != NPATCH_THREE_PATCH_VERTICAL)
if (patchWidth <= (leftBorder + rightBorder) && nPatchInfo.layout != NPATCH_THREE_PATCH_VERTICAL)
{
drawCenter = false;
leftBorder = (leftBorder/(leftBorder + rightBorder))*patchWidth;
rightBorder = patchWidth - leftBorder;
}
// adjust the lateral (top and bottom) border heights in case patchHeight < texture.height
if (patchHeight <= (topBorder + bottomBorder) && nPatchInfo.type != NPATCH_THREE_PATCH_HORIZONTAL)
if (patchHeight <= (topBorder + bottomBorder) && nPatchInfo.layout != NPATCH_THREE_PATCH_HORIZONTAL)
{
drawMiddle = false;
topBorder = (topBorder/(topBorder + bottomBorder))*patchHeight;
@ -3306,7 +3306,7 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
rlNormal3f(0.0f, 0.0f, 1.0f); // Normal vector pointing towards viewer
if (nPatchInfo.type == NPATCH_NINE_PATCH)
if (nPatchInfo.layout == NPATCH_NINE_PATCH)
{
// ------------------------------------------------------------
// TOP-LEFT QUAD
@ -3372,7 +3372,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(coordC.x, coordC.y); rlVertex2f(vertC.x, vertC.y); // Top-left corner for texture and quad
}
else if (nPatchInfo.type == NPATCH_THREE_PATCH_VERTICAL)
else if (nPatchInfo.layout == NPATCH_THREE_PATCH_VERTICAL)
{
// TOP QUAD
// -----------------------------------------------------------
@ -3399,7 +3399,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(coordA.x, coordC.y); rlVertex2f(vertA.x, vertC.y); // Top-left corner for texture and quad
}
else if (nPatchInfo.type == NPATCH_THREE_PATCH_HORIZONTAL)
else if (nPatchInfo.layout == NPATCH_THREE_PATCH_HORIZONTAL)
{
// LEFT QUAD
// -----------------------------------------------------------