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

@ -91,7 +91,7 @@
typedef enum { typedef enum {
CAMERA_PERSPECTIVE = 0, CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC CAMERA_ORTHOGRAPHIC
} CameraType; } CameraProjection;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -90,7 +90,7 @@
typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction; typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction;
// Gesture events // Gesture event
// NOTE: MAX_TOUCH_POINTS fixed to 4 // NOTE: MAX_TOUCH_POINTS fixed to 4
typedef struct { typedef struct {
int touchAction; int touchAction;
@ -115,7 +115,7 @@ void ProcessGestureEvent(GestureEvent event); // Process gesture event
void UpdateGestures(void); // Update gestures detected (must be called every frame) void UpdateGestures(void); // Update gestures detected (must be called every frame)
#if defined(GESTURES_STANDALONE) #if defined(GESTURES_STANDALONE)
void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
bool IsGestureDetected(int gesture); // Check if a gesture have been detected bool IsGestureDetected(int gesture); // Check if a gesture have been detected
int GetGestureDetected(void); // Get latest detected gesture int GetGestureDetected(void); // Get latest detected gesture
int GetTouchPointsCount(void); // Get touch points count int GetTouchPointsCount(void); // Get touch points count
@ -234,9 +234,9 @@ static double GetCurrentTime(void);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Enable only desired getures to be detected // Enable only desired getures to be detected
void SetGesturesEnabled(unsigned int gestureFlags) void SetGesturesEnabled(unsigned int flags)
{ {
GESTURES.enabledFlags = gestureFlags; GESTURES.enabledFlags = flags;
} }
// Check if a gesture have been detected // Check if a gesture have been detected

View file

@ -294,7 +294,7 @@ typedef enum {
LOG_ERROR, LOG_ERROR,
LOG_FATAL, LOG_FATAL,
LOG_NONE LOG_NONE
} TraceLogType; } TraceLogLevel;
#endif #endif
// NOTE: Different logic is used when feeding data to the playback device // NOTE: Different logic is used when feeding data to the playback device

View file

@ -248,7 +248,7 @@ typedef Texture TextureCubemap;
// RenderTexture type, for texture rendering // RenderTexture type, for texture rendering
typedef struct RenderTexture { typedef struct RenderTexture {
unsigned int id; // OpenGL Framebuffer Object (FBO) id unsigned int id; // OpenGL framebuffer object id
Texture texture; // Color buffer attachment texture Texture texture; // Color buffer attachment texture
Texture depth; // Depth buffer attachment texture Texture depth; // Depth buffer attachment texture
} RenderTexture; } RenderTexture;
@ -258,12 +258,12 @@ typedef RenderTexture RenderTexture2D;
// N-Patch layout info // N-Patch layout info
typedef struct NPatchInfo { typedef struct NPatchInfo {
Rectangle source; // Region in the texture Rectangle source; // Texture source rectangle
int left; // left border offset int left; // Left border offset
int top; // top border offset int top; // Top border offset
int right; // right border offset int right; // Right border offset
int bottom; // bottom border offset int bottom; // Bottom border offset
int type; // layout of the n-patch: 3x3, 1x3 or 3x1 int layout; // Layout of the n-patch: 3x3, 1x3 or 3x1
} NPatchInfo; } NPatchInfo;
// Font character info // Font character info
@ -293,7 +293,7 @@ typedef struct Camera3D {
Vector3 target; // Camera target it looks-at Vector3 target; // Camera target it looks-at
Vector3 up; // Camera up vector (rotation over its axis) Vector3 up; // Camera up vector (rotation over its axis)
float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
int type; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC int type; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
} Camera3D; } Camera3D;
typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
@ -482,9 +482,9 @@ typedef enum {
FLAG_WINDOW_HIGHDPI = 0x00002000, // Set to support HighDPI FLAG_WINDOW_HIGHDPI = 0x00002000, // Set to support HighDPI
FLAG_MSAA_4X_HINT = 0x00000020, // Set to try enabling MSAA 4X FLAG_MSAA_4X_HINT = 0x00000020, // Set to try enabling MSAA 4X
FLAG_INTERLACED_HINT = 0x00010000 // Set to try enabling interlaced video format (for V3D) FLAG_INTERLACED_HINT = 0x00010000 // Set to try enabling interlaced video format (for V3D)
} ConfigFlag; } ConfigFlags;
// Trace log type // Trace log level
typedef enum { typedef enum {
LOG_ALL = 0, // Display all logs LOG_ALL = 0, // Display all logs
LOG_TRACE, LOG_TRACE,
@ -494,7 +494,7 @@ typedef enum {
LOG_ERROR, LOG_ERROR,
LOG_FATAL, LOG_FATAL,
LOG_NONE // Disable logging LOG_NONE // Disable logging
} TraceLogType; } TraceLogLevel;
// Keyboard keys (US keyboard layout) // Keyboard keys (US keyboard layout)
// NOTE: Use GetKeyPressed() to allow redefining // NOTE: Use GetKeyPressed() to allow redefining
@ -609,16 +609,13 @@ typedef enum {
KEY_KP_SUBTRACT = 333, KEY_KP_SUBTRACT = 333,
KEY_KP_ADD = 334, KEY_KP_ADD = 334,
KEY_KP_ENTER = 335, KEY_KP_ENTER = 335,
KEY_KP_EQUAL = 336 KEY_KP_EQUAL = 336,
} KeyboardKey; // Android key buttons
// Android buttons
typedef enum {
KEY_BACK = 4, KEY_BACK = 4,
KEY_MENU = 82, KEY_MENU = 82,
KEY_VOLUME_UP = 24, KEY_VOLUME_UP = 24,
KEY_VOLUME_DOWN = 25 KEY_VOLUME_DOWN = 25
} AndroidButton; } KeyboardKey;
// Mouse buttons // Mouse buttons
typedef enum { typedef enum {
@ -627,7 +624,7 @@ typedef enum {
MOUSE_MIDDLE_BUTTON = 2 MOUSE_MIDDLE_BUTTON = 2
} MouseButton; } MouseButton;
// Mouse cursor types // Mouse cursor
typedef enum { typedef enum {
MOUSE_CURSOR_DEFAULT = 0, MOUSE_CURSOR_DEFAULT = 0,
MOUSE_CURSOR_ARROW = 1, MOUSE_CURSOR_ARROW = 1,
@ -701,7 +698,7 @@ typedef enum {
GAMEPAD_AXIS_RIGHT_TRIGGER = 5 // [1..-1] (pressure-level) GAMEPAD_AXIS_RIGHT_TRIGGER = 5 // [1..-1] (pressure-level)
} GamepadAxis; } GamepadAxis;
// Shader location points // Shader location index
typedef enum { typedef enum {
SHADER_LOC_VERTEX_POSITION = 0, SHADER_LOC_VERTEX_POSITION = 0,
SHADER_LOC_VERTEX_TEXCOORD01, SHADER_LOC_VERTEX_TEXCOORD01,
@ -733,7 +730,7 @@ typedef enum {
#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO #define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
#define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS #define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS
// Shader uniform data types // Shader uniform data type
typedef enum { typedef enum {
SHADER_UNIFORM_FLOAT = 0, SHADER_UNIFORM_FLOAT = 0,
SHADER_UNIFORM_VEC2, SHADER_UNIFORM_VEC2,
@ -746,7 +743,7 @@ typedef enum {
SHADER_UNIFORM_SAMPLER2D SHADER_UNIFORM_SAMPLER2D
} ShaderUniformDataType; } ShaderUniformDataType;
// Material maps // Material map index
typedef enum { typedef enum {
MATERIAL_MAP_ALBEDO = 0, // MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO = 0, // MATERIAL_MAP_DIFFUSE
MATERIAL_MAP_METALNESS = 1, // MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS = 1, // MATERIAL_MAP_SPECULAR
@ -759,7 +756,7 @@ typedef enum {
MATERIAL_MAP_CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP MATERIAL_MAP_CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MATERIAL_MAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP MATERIAL_MAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MATERIAL_MAP_PREFILTER // NOTE: Uses GL_TEXTURE_CUBE_MAP MATERIAL_MAP_PREFILTER // NOTE: Uses GL_TEXTURE_CUBE_MAP
} MaterialMapType; } MaterialMapIndex;
#define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO #define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO
#define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS #define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS
@ -800,7 +797,7 @@ typedef enum {
TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
} TextureFilterMode; } TextureFilter;
// Texture parameters: wrap mode // Texture parameters: wrap mode
typedef enum { typedef enum {
@ -808,7 +805,7 @@ typedef enum {
TEXTURE_WRAP_CLAMP, // Clamps texture to edge pixel 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_REPEAT, // Mirrors and repeats the texture in tiled mode
TEXTURE_WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode TEXTURE_WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode
} TextureWrapMode; } TextureWrap;
// Cubemap layouts // Cubemap layouts
typedef enum { typedef enum {
@ -818,7 +815,7 @@ typedef enum {
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces
CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirectangular map) CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirectangular map)
} CubemapLayoutType; } CubemapLayout;
// Font type, defines generation method // Font type, defines generation method
typedef enum { typedef enum {
@ -837,7 +834,7 @@ typedef enum {
BLEND_CUSTOM // Belnd textures using custom src/dst factors (use rlSetBlendMode()) BLEND_CUSTOM // Belnd textures using custom src/dst factors (use rlSetBlendMode())
} BlendMode; } BlendMode;
// Gestures type // Gestures
// NOTE: It could be used as flags to enable only some gestures // NOTE: It could be used as flags to enable only some gestures
typedef enum { typedef enum {
GESTURE_NONE = 0, GESTURE_NONE = 0,
@ -851,7 +848,7 @@ typedef enum {
GESTURE_SWIPE_DOWN = 128, GESTURE_SWIPE_DOWN = 128,
GESTURE_PINCH_IN = 256, GESTURE_PINCH_IN = 256,
GESTURE_PINCH_OUT = 512 GESTURE_PINCH_OUT = 512
} GestureType; } Gestures;
// Camera system modes // Camera system modes
typedef enum { typedef enum {
@ -862,22 +859,22 @@ typedef enum {
CAMERA_THIRD_PERSON CAMERA_THIRD_PERSON
} CameraMode; } CameraMode;
// Camera projection modes // Camera projection
typedef enum { typedef enum {
CAMERA_PERSPECTIVE = 0, CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC CAMERA_ORTHOGRAPHIC
} CameraType; } CameraProjection;
// N-patch types // N-patch layout
typedef enum { typedef enum {
NPATCH_NINE_PATCH = 0, // Npatch defined by 3x3 tiles NPATCH_NINE_PATCH = 0, // Npatch layout: 3x3 tiles
NPATCH_THREE_PATCH_VERTICAL, // Npatch defined by 1x3 tiles NPATCH_THREE_PATCH_VERTICAL, // Npatch layout: 1x3 tiles
NPATCH_THREE_PATCH_HORIZONTAL // Npatch defined by 3x1 tiles NPATCH_THREE_PATCH_HORIZONTAL // Npatch layout: 3x1 tiles
} NPatchType; } NPatchLayout;
// Callbacks to hook some internal functions // Callbacks to hook some internal functions
// WARNING: This callbacks are intended for advance users // WARNING: This callbacks are intended for advance users
typedef void (*TraceLogCallback)(int logType, const char *text, va_list args); // Logging: Redirect trace log messages typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); // FileIO: Load binary data typedef unsigned char* (*LoadFileDataCallback)(const char* fileName, unsigned int* bytesRead); // FileIO: Load binary data
typedef void (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data typedef void (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data
typedef char *(*LoadFileTextCallback)(const char* fileName); // FileIO: Load text data typedef char *(*LoadFileTextCallback)(const char* fileName); // FileIO: Load text data
@ -979,8 +976,8 @@ RLAPI int GetRandomValue(int min, int max); // Returns a r
RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format) RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS) RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR) RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
RLAPI void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
RLAPI void *MemAlloc(int size); // Internal memory allocator RLAPI void *MemAlloc(int size); // Internal memory allocator
RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator
RLAPI void MemFree(void *ptr); // Internal memory free RLAPI void MemFree(void *ptr); // Internal memory free
@ -1075,7 +1072,7 @@ RLAPI Vector2 GetTouchPosition(int index); // Returns touch p
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Gestures and Touch Handling Functions (Module: gestures) // Gestures and Touch Handling Functions (Module: gestures)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
RLAPI void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
RLAPI bool IsGestureDetected(int gesture); // Check if a gesture have been detected RLAPI bool IsGestureDetected(int gesture); // Check if a gesture have been detected
RLAPI int GetGestureDetected(void); // Get latest detected gesture RLAPI int GetGestureDetected(void); // Get latest detected gesture
RLAPI int GetTouchPointsCount(void); // Get touch points count RLAPI int GetTouchPointsCount(void); // Get touch points count
@ -1225,7 +1222,7 @@ RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 posi
// NOTE: These functions require GPU access // NOTE: These functions require GPU access
RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM) RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layoutType); // Load cubemap from image, multiple image cubemap layouts supported RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer) RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM) RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM) RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
@ -1236,8 +1233,8 @@ RLAPI Image GetScreenData(void);
// Texture configuration functions // Texture configuration functions
RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
RLAPI void SetTextureFilter(Texture2D texture, int filterMode); // Set texture scaling filter mode RLAPI void SetTextureFilter(Texture2D texture, int filter); // Set texture scaling filter mode
RLAPI void SetTextureWrap(Texture2D texture, int wrapMode); // Set texture wrapping mode RLAPI void SetTextureWrap(Texture2D texture, int wrap); // Set texture wrapping mode
// Texture drawing functions // Texture drawing functions
RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
@ -1429,10 +1426,10 @@ RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Def
// Shader configuration functions // Shader configuration functions
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
RLAPI void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType); // Set shader uniform value RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
RLAPI void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count); // Set shader uniform value vector RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4) RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
RLAPI void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture); // Set shader uniform value for texture RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
RLAPI Matrix GetMatrixModelview(void); // Get internal modelview matrix RLAPI Matrix GetMatrixModelview(void); // Get internal modelview matrix

View file

@ -360,7 +360,7 @@ typedef enum {
LOG_ERROR, LOG_ERROR,
LOG_FATAL, LOG_FATAL,
LOG_NONE LOG_NONE
} TraceLogType; } TraceLogLevel;
// Texture formats (support depends on OpenGL version) // Texture formats (support depends on OpenGL version)
typedef enum { typedef enum {
@ -397,7 +397,7 @@ typedef enum {
TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
} TextureFilterMode; } TextureFilter;
// Color blending modes (pre-defined) // Color blending modes (pre-defined)
typedef enum { typedef enum {
@ -467,7 +467,7 @@ typedef enum {
MATERIAL_MAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP MATERIAL_MAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MATERIAL_MAP_PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP MATERIAL_MAP_PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MATERIAL_MAP_BRDG MATERIAL_MAP_BRDG
} MaterialMapType; } MaterialMapIndex;
#define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO #define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO
#define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS #define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS
@ -599,9 +599,9 @@ RLAPI Rectangle GetShapesTextureRec(void); // Get
// Shader configuration functions // Shader configuration functions
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
RLAPI void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType); // Set shader uniform value RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
RLAPI void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count); // Set shader uniform value vector RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4) RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
RLAPI Matrix GetMatrixModelview(void); // Get internal modelview matrix RLAPI Matrix GetMatrixModelview(void); // Get internal modelview matrix
@ -3359,28 +3359,28 @@ int GetShaderLocationAttrib(Shader shader, const char *attribName)
} }
// Set shader uniform value // Set shader uniform value
void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType) void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType)
{ {
SetShaderValueV(shader, uniformLoc, value, uniformType, 1); SetShaderValueV(shader, locIndex, value, uniformType, 1);
} }
// Set shader uniform value vector // Set shader uniform value vector
void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count) void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
glUseProgram(shader.id); glUseProgram(shader.id);
switch (uniformType) switch (uniformType)
{ {
case SHADER_UNIFORM_FLOAT: glUniform1fv(uniformLoc, count, (float *)value); break; case SHADER_UNIFORM_FLOAT: glUniform1fv(locIndex, count, (float *)value); break;
case SHADER_UNIFORM_VEC2: glUniform2fv(uniformLoc, count, (float *)value); break; case SHADER_UNIFORM_VEC2: glUniform2fv(locIndex, count, (float *)value); break;
case SHADER_UNIFORM_VEC3: glUniform3fv(uniformLoc, count, (float *)value); break; case SHADER_UNIFORM_VEC3: glUniform3fv(locIndex, count, (float *)value); break;
case SHADER_UNIFORM_VEC4: glUniform4fv(uniformLoc, count, (float *)value); break; case SHADER_UNIFORM_VEC4: glUniform4fv(locIndex, count, (float *)value); break;
case SHADER_UNIFORM_INT: glUniform1iv(uniformLoc, count, (int *)value); break; case SHADER_UNIFORM_INT: glUniform1iv(locIndex, count, (int *)value); break;
case SHADER_UNIFORM_IVEC2: glUniform2iv(uniformLoc, count, (int *)value); break; case SHADER_UNIFORM_IVEC2: glUniform2iv(locIndex, count, (int *)value); break;
case SHADER_UNIFORM_IVEC3: glUniform3iv(uniformLoc, count, (int *)value); break; case SHADER_UNIFORM_IVEC3: glUniform3iv(locIndex, count, (int *)value); break;
case SHADER_UNIFORM_IVEC4: glUniform4iv(uniformLoc, count, (int *)value); break; case SHADER_UNIFORM_IVEC4: glUniform4iv(locIndex, count, (int *)value); break;
case SHADER_UNIFORM_SAMPLER2D: glUniform1iv(uniformLoc, count, (int *)value); break; case SHADER_UNIFORM_SAMPLER2D: glUniform1iv(locIndex, count, (int *)value); break;
default: TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to set uniform, data type not recognized", shader.id); default: TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to set uniform, data type not recognized", shader.id);
} }
@ -3390,19 +3390,19 @@ void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int unifo
// Set shader uniform value (matrix 4x4) // Set shader uniform value (matrix 4x4)
void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat) void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
glUseProgram(shader.id); glUseProgram(shader.id);
glUniformMatrix4fv(uniformLoc, 1, false, MatrixToFloat(mat)); glUniformMatrix4fv(locIndex, 1, false, MatrixToFloat(mat));
//glUseProgram(0); //glUseProgram(0);
#endif #endif
} }
// Set shader uniform value for texture // Set shader uniform value for texture
void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture) void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
glUseProgram(shader.id); glUseProgram(shader.id);
@ -3416,7 +3416,7 @@ void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture)
{ {
if (RLGL.State.activeTextureId[i] == 0) if (RLGL.State.activeTextureId[i] == 0)
{ {
glUniform1i(uniformLoc, 1 + i); // Activate new texture unit glUniform1i(locIndex, 1 + i); // Activate new texture unit
RLGL.State.activeTextureId[i] = texture.id; // Save texture id for binding on drawing RLGL.State.activeTextureId[i] = texture.id; // Save texture id for binding on drawing
break; break;
} }

View file

@ -2744,29 +2744,29 @@ Texture2D LoadTextureFromImage(Image image)
} }
// Load cubemap from image, multiple image cubemap layouts supported // Load cubemap from image, multiple image cubemap layouts supported
TextureCubemap LoadTextureCubemap(Image image, int layoutType) TextureCubemap LoadTextureCubemap(Image image, int layout)
{ {
TextureCubemap cubemap = { 0 }; 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 // Check image width/height to determine the type of cubemap provided
if (image.width > image.height) if (image.width > image.height)
{ {
if ((image.width/6) == image.height) { layoutType = CUBEMAP_LAYOUT_LINE_HORIZONTAL; cubemap.width = image.width/6; } if ((image.width/6) == image.height) { layout = 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/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)) { layoutType = CUBEMAP_LAYOUT_PANORAMA; 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) else if (image.height > image.width)
{ {
if ((image.height/6) == image.width) { layoutType = 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)) { layoutType = 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; }
} }
cubemap.height = cubemap.width; cubemap.height = cubemap.width;
} }
if (layoutType != CUBEMAP_LAYOUT_AUTO_DETECT) if (layout != CUBEMAP_LAYOUT_AUTO_DETECT)
{ {
int size = cubemap.width; int size = cubemap.width;
@ -2774,20 +2774,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_LAYOUT_LINE_VERTICAL) if (layout == 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_LAYOUT_PANORAMA) else if (layout == 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_LAYOUT_LINE_HORIZONTAL) for (int i = 0; i < 6; i++) faceRecs[i].x = (float)size*i; if (layout == 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) else if (layout == 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;
@ -2796,7 +2796,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_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[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;
@ -2962,9 +2962,9 @@ void GenTextureMipmaps(Texture2D *texture)
} }
// Set texture scaling filter mode // 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: case TEXTURE_FILTER_POINT:
{ {
@ -3028,9 +3028,9 @@ void SetTextureFilter(Texture2D texture, int filterMode)
} }
// Set texture wrapping mode // Set texture wrapping mode
void SetTextureWrap(Texture2D texture, int wrapMode) void SetTextureWrap(Texture2D texture, int wrap)
{ {
switch (wrapMode) switch (wrap)
{ {
case TEXTURE_WRAP_REPEAT: 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.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 == NPATCH_THREE_PATCH_HORIZONTAL) patchHeight = nPatchInfo.source.height; if (nPatchInfo.layout == 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_VERTICAL) patchWidth = nPatchInfo.source.width;
bool drawCenter = true; bool drawCenter = true;
bool drawMiddle = true; bool drawMiddle = true;
@ -3261,14 +3261,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 != NPATCH_THREE_PATCH_VERTICAL) if (patchWidth <= (leftBorder + rightBorder) && nPatchInfo.layout != 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 != NPATCH_THREE_PATCH_HORIZONTAL) if (patchHeight <= (topBorder + bottomBorder) && nPatchInfo.layout != NPATCH_THREE_PATCH_HORIZONTAL)
{ {
drawMiddle = false; drawMiddle = false;
topBorder = (topBorder/(topBorder + bottomBorder))*patchHeight; 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); 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 == NPATCH_NINE_PATCH) if (nPatchInfo.layout == NPATCH_NINE_PATCH)
{ {
// ------------------------------------------------------------ // ------------------------------------------------------------
// TOP-LEFT QUAD // 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(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 == NPATCH_THREE_PATCH_VERTICAL) else if (nPatchInfo.layout == NPATCH_THREE_PATCH_VERTICAL)
{ {
// TOP QUAD // 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(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 == NPATCH_THREE_PATCH_HORIZONTAL) else if (nPatchInfo.layout == NPATCH_THREE_PATCH_HORIZONTAL)
{ {
// LEFT QUAD // LEFT QUAD
// ----------------------------------------------------------- // -----------------------------------------------------------