WARNING: BREAKING: RENAMED: enums values
RENAMED: TextureFilterMode values RENAMED: TextureWrapMode values
This commit is contained in:
parent
408f5aedb8
commit
dfe797060a
@ -754,7 +754,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
||||
{
|
||||
// Set default font texture filter for HighDPI (blurry)
|
||||
SetTextureFilter(GetFontDefault().texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(GetFontDefault().texture, TEXTURE_FILTER_BILINEAR);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
23
src/raylib.h
23
src/raylib.h
@ -157,7 +157,8 @@
|
||||
#define LoadText LoadFileText
|
||||
#define GetExtension GetFileExtension
|
||||
#define GetImageData LoadImageColors
|
||||
//#define Fade(c, a) ColorAlpha(c, a)
|
||||
#define FILTER_POINT TEXTURE_FILTER_POINT
|
||||
#define FILTER_BILINEAR TEXTURE_FILTER_BILINEAR
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Structures Definition
|
||||
@ -791,20 +792,20 @@ typedef enum {
|
||||
// NOTE 1: Filtering considers mipmaps if available in the texture
|
||||
// NOTE 2: Filter is accordingly set for minification and magnification
|
||||
typedef enum {
|
||||
FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||
FILTER_BILINEAR, // Linear filtering
|
||||
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||
FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
|
||||
FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
|
||||
FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
|
||||
TEXTURE_FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||
TEXTURE_FILTER_BILINEAR, // Linear filtering
|
||||
TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||
TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
|
||||
TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
|
||||
TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
|
||||
} TextureFilterMode;
|
||||
|
||||
// Texture parameters: wrap mode
|
||||
typedef enum {
|
||||
WRAP_REPEAT = 0, // Repeats texture in tiled mode
|
||||
WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode
|
||||
WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
|
||||
WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode
|
||||
TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode
|
||||
TEXTURE_WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode
|
||||
TEXTURE_WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
|
||||
TEXTURE_WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode
|
||||
} TextureWrapMode;
|
||||
|
||||
// Cubemap layouts
|
||||
|
39
src/rlgl.h
39
src/rlgl.h
@ -185,19 +185,19 @@
|
||||
#define RL_TEXTURE_WRAP_T 0x2803 // GL_TEXTURE_WRAP_T
|
||||
#define RL_TEXTURE_MAG_FILTER 0x2800 // GL_TEXTURE_MAG_FILTER
|
||||
#define RL_TEXTURE_MIN_FILTER 0x2801 // GL_TEXTURE_MIN_FILTER
|
||||
#define RL_TEXTURE_ANISOTROPIC_FILTER 0x3000 // Anisotropic filter (custom identifier)
|
||||
|
||||
#define RL_FILTER_NEAREST 0x2600 // GL_NEAREST
|
||||
#define RL_FILTER_LINEAR 0x2601 // GL_LINEAR
|
||||
#define RL_FILTER_MIP_NEAREST 0x2700 // GL_NEAREST_MIPMAP_NEAREST
|
||||
#define RL_FILTER_NEAREST_MIP_LINEAR 0x2702 // GL_NEAREST_MIPMAP_LINEAR
|
||||
#define RL_FILTER_LINEAR_MIP_NEAREST 0x2701 // GL_LINEAR_MIPMAP_NEAREST
|
||||
#define RL_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
||||
#define RL_TEXTURE_FILTER_NEAREST 0x2600 // GL_NEAREST
|
||||
#define RL_TEXTURE_FILTER_LINEAR 0x2601 // GL_LINEAR
|
||||
#define RL_TEXTURE_FILTER_MIP_NEAREST 0x2700 // GL_NEAREST_MIPMAP_NEAREST
|
||||
#define RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x2702 // GL_NEAREST_MIPMAP_LINEAR
|
||||
#define RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x2701 // GL_LINEAR_MIPMAP_NEAREST
|
||||
#define RL_TEXTURE_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
||||
#define RL_TEXTURE_FILTER_ANISOTROPIC 0x3000 // Anisotropic filter (custom identifier)
|
||||
|
||||
#define RL_WRAP_REPEAT 0x2901 // GL_REPEAT
|
||||
#define RL_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE
|
||||
#define RL_WRAP_MIRROR_REPEAT 0x8370 // GL_MIRRORED_REPEAT
|
||||
#define RL_WRAP_MIRROR_CLAMP 0x8742 // GL_MIRROR_CLAMP_EXT
|
||||
#define RL_TEXTURE_WRAP_REPEAT 0x2901 // GL_REPEAT
|
||||
#define RL_TEXTURE_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE
|
||||
#define RL_TEXTURE_WRAP_MIRROR_REPEAT 0x8370 // GL_MIRRORED_REPEAT
|
||||
#define RL_TEXTURE_WRAP_MIRROR_CLAMP 0x8742 // GL_MIRROR_CLAMP_EXT
|
||||
|
||||
// Matrix modes (equivalent to OpenGL)
|
||||
#define RL_MODELVIEW 0x1700 // GL_MODELVIEW
|
||||
@ -391,12 +391,12 @@ typedef enum {
|
||||
// NOTE 1: Filtering considers mipmaps if available in the texture
|
||||
// NOTE 2: Filter is accordingly set for minification and magnification
|
||||
typedef enum {
|
||||
FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||
FILTER_BILINEAR, // Linear filtering
|
||||
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||
FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
|
||||
FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
|
||||
FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
|
||||
TEXTURE_FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||
TEXTURE_FILTER_BILINEAR, // Linear filtering
|
||||
TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||
TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
|
||||
TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
|
||||
TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
|
||||
} TextureFilterMode;
|
||||
|
||||
// Color blending modes (pre-defined)
|
||||
@ -1383,6 +1383,7 @@ void rlTextureParameters(unsigned int id, int param, int value)
|
||||
case RL_TEXTURE_WRAP_T:
|
||||
{
|
||||
if (value == RL_WRAP_MIRROR_CLAMP)
|
||||
if (value == RL_TEXTURE_WRAP_MIRROR_CLAMP)
|
||||
{
|
||||
#if !defined(GRAPHICS_API_OPENGL_11)
|
||||
if (RLGL.ExtSupported.texMirrorClamp) glTexParameteri(GL_TEXTURE_2D, param, value);
|
||||
@ -1394,7 +1395,7 @@ void rlTextureParameters(unsigned int id, int param, int value)
|
||||
} break;
|
||||
case RL_TEXTURE_MAG_FILTER:
|
||||
case RL_TEXTURE_MIN_FILTER: glTexParameteri(GL_TEXTURE_2D, param, value); break;
|
||||
case RL_TEXTURE_ANISOTROPIC_FILTER:
|
||||
case RL_TEXTURE_FILTER_ANISOTROPIC:
|
||||
{
|
||||
#if !defined(GRAPHICS_API_OPENGL_11)
|
||||
if (value <= RLGL.ExtSupported.maxAnisotropicLevel) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value);
|
||||
@ -3633,7 +3634,7 @@ TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int si
|
||||
//------------------------------------------------------------------------------------------
|
||||
unsigned int rbo = rlLoadTextureDepth(size, size, true);
|
||||
prefilter.id = rlLoadTextureCubemap(NULL, size, UNCOMPRESSED_R32G32B32);
|
||||
rlTextureParameters(prefilter.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_MIP_LINEAR);
|
||||
rlTextureParameters(prefilter.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_MIP_LINEAR);
|
||||
|
||||
unsigned int fbo = rlLoadFramebuffer(size, size);
|
||||
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER);
|
||||
|
@ -328,7 +328,7 @@ Font LoadFont(const char *fileName)
|
||||
TRACELOG(LOG_WARNING, "FONT: [%s] Failed to load font texture -> Using default font", fileName);
|
||||
font = GetFontDefault();
|
||||
}
|
||||
else SetTextureFilter(font.texture, FILTER_POINT); // By default we set point filter (best performance)
|
||||
else SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default we set point filter (best performance)
|
||||
|
||||
return font;
|
||||
}
|
||||
@ -432,7 +432,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||
}
|
||||
|
||||
// NOTE: We need to remove key color borders from image to avoid weird
|
||||
// artifacts on texture scaling when using FILTER_BILINEAR or FILTER_TRILINEAR
|
||||
// artifacts on texture scaling when using TEXTURE_FILTER_BILINEAR or TEXTURE_FILTER_TRILINEAR
|
||||
for (int i = 0; i < image.height*image.width; i++) if (COLOR_EQUAL(pixels[i], key)) pixels[i] = BLANK;
|
||||
|
||||
// Create a new image with the processed color data (key color replaced by BLANK)
|
||||
|
@ -2967,63 +2967,63 @@ void SetTextureFilter(Texture2D texture, int filterMode)
|
||||
{
|
||||
switch (filterMode)
|
||||
{
|
||||
case FILTER_POINT:
|
||||
case TEXTURE_FILTER_POINT:
|
||||
{
|
||||
if (texture.mipmaps > 1)
|
||||
{
|
||||
// RL_FILTER_MIP_NEAREST - tex filter: POINT, mipmaps filter: POINT (sharp switching between mipmaps)
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_MIP_NEAREST);
|
||||
// RL_TEXTURE_FILTER_MIP_NEAREST - tex filter: POINT, mipmaps filter: POINT (sharp switching between mipmaps)
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_MIP_NEAREST);
|
||||
|
||||
// RL_FILTER_NEAREST - tex filter: POINT (no filter), no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_FILTER_NEAREST);
|
||||
// RL_TEXTURE_FILTER_NEAREST - tex filter: POINT (no filter), no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
||||
}
|
||||
else
|
||||
{
|
||||
// RL_FILTER_NEAREST - tex filter: POINT (no filter), no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_NEAREST);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_FILTER_NEAREST);
|
||||
// RL_TEXTURE_FILTER_NEAREST - tex filter: POINT (no filter), no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_NEAREST);
|
||||
}
|
||||
} break;
|
||||
case FILTER_BILINEAR:
|
||||
case TEXTURE_FILTER_BILINEAR:
|
||||
{
|
||||
if (texture.mipmaps > 1)
|
||||
{
|
||||
// RL_FILTER_LINEAR_MIP_NEAREST - tex filter: BILINEAR, mipmaps filter: POINT (sharp switching between mipmaps)
|
||||
// Alternative: RL_FILTER_NEAREST_MIP_LINEAR - tex filter: POINT, mipmaps filter: BILINEAR (smooth transition between mipmaps)
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_LINEAR_MIP_NEAREST);
|
||||
// RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST - tex filter: BILINEAR, mipmaps filter: POINT (sharp switching between mipmaps)
|
||||
// Alternative: RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR - tex filter: POINT, mipmaps filter: BILINEAR (smooth transition between mipmaps)
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST);
|
||||
|
||||
// RL_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_FILTER_LINEAR);
|
||||
// RL_TEXTURE_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// RL_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_LINEAR);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_FILTER_LINEAR);
|
||||
// RL_TEXTURE_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||
}
|
||||
} break;
|
||||
case FILTER_TRILINEAR:
|
||||
case TEXTURE_FILTER_TRILINEAR:
|
||||
{
|
||||
if (texture.mipmaps > 1)
|
||||
{
|
||||
// RL_FILTER_MIP_LINEAR - tex filter: BILINEAR, mipmaps filter: BILINEAR (smooth transition between mipmaps)
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_MIP_LINEAR);
|
||||
// RL_TEXTURE_FILTER_MIP_LINEAR - tex filter: BILINEAR, mipmaps filter: BILINEAR (smooth transition between mipmaps)
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_MIP_LINEAR);
|
||||
|
||||
// RL_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_FILTER_LINEAR);
|
||||
// RL_TEXTURE_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "TEXTURE: [ID %i] No mipmaps available for TRILINEAR texture filtering", texture.id);
|
||||
|
||||
// RL_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_LINEAR);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_FILTER_LINEAR);
|
||||
// RL_TEXTURE_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MAG_FILTER, RL_TEXTURE_FILTER_LINEAR);
|
||||
}
|
||||
} break;
|
||||
case FILTER_ANISOTROPIC_4X: rlTextureParameters(texture.id, RL_TEXTURE_ANISOTROPIC_FILTER, 4); break;
|
||||
case FILTER_ANISOTROPIC_8X: rlTextureParameters(texture.id, RL_TEXTURE_ANISOTROPIC_FILTER, 8); break;
|
||||
case FILTER_ANISOTROPIC_16X: rlTextureParameters(texture.id, RL_TEXTURE_ANISOTROPIC_FILTER, 16); break;
|
||||
case TEXTURE_FILTER_ANISOTROPIC_4X: rlTextureParameters(texture.id, RL_TEXTURE_FILTER_ANISOTROPIC, 4); break;
|
||||
case TEXTURE_FILTER_ANISOTROPIC_8X: rlTextureParameters(texture.id, RL_TEXTURE_FILTER_ANISOTROPIC, 8); break;
|
||||
case TEXTURE_FILTER_ANISOTROPIC_16X: rlTextureParameters(texture.id, RL_TEXTURE_FILTER_ANISOTROPIC, 16); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@ -3033,25 +3033,25 @@ void SetTextureWrap(Texture2D texture, int wrapMode)
|
||||
{
|
||||
switch (wrapMode)
|
||||
{
|
||||
case WRAP_REPEAT:
|
||||
case TEXTURE_WRAP_REPEAT:
|
||||
{
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_S, RL_WRAP_REPEAT);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_T, RL_WRAP_REPEAT);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_S, RL_TEXTURE_WRAP_REPEAT);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_T, RL_TEXTURE_WRAP_REPEAT);
|
||||
} break;
|
||||
case WRAP_CLAMP:
|
||||
case TEXTURE_WRAP_CLAMP:
|
||||
{
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_S, RL_WRAP_CLAMP);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_T, RL_WRAP_CLAMP);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_S, RL_TEXTURE_WRAP_CLAMP);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_T, RL_TEXTURE_WRAP_CLAMP);
|
||||
} break;
|
||||
case WRAP_MIRROR_REPEAT:
|
||||
case TEXTURE_WRAP_MIRROR_REPEAT:
|
||||
{
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_S, RL_WRAP_MIRROR_REPEAT);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_T, RL_WRAP_MIRROR_REPEAT);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_S, RL_TEXTURE_WRAP_MIRROR_REPEAT);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_T, RL_TEXTURE_WRAP_MIRROR_REPEAT);
|
||||
} break;
|
||||
case WRAP_MIRROR_CLAMP:
|
||||
case TEXTURE_WRAP_MIRROR_CLAMP:
|
||||
{
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_S, RL_WRAP_MIRROR_CLAMP);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_WRAP_T, RL_WRAP_MIRROR_CLAMP);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_S, RL_TEXTURE_WRAP_MIRROR_CLAMP);
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_TEXTURE_WRAP_T, RL_TEXTURE_WRAP_MIRROR_CLAMP);
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user