Remove trailing spaces
This commit is contained in:
parent
b4975619ed
commit
aed0fee2ca
8 changed files with 60 additions and 60 deletions
14
src/core.c
14
src/core.c
|
@ -2032,7 +2032,7 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName)
|
||||||
|
|
||||||
if (vShaderStr != NULL) RL_FREE(vShaderStr);
|
if (vShaderStr != NULL) RL_FREE(vShaderStr);
|
||||||
if (fShaderStr != NULL) RL_FREE(fShaderStr);
|
if (fShaderStr != NULL) RL_FREE(fShaderStr);
|
||||||
|
|
||||||
// After shader loading, we TRY to set default location names
|
// After shader loading, we TRY to set default location names
|
||||||
if (shader.id > 0)
|
if (shader.id > 0)
|
||||||
{
|
{
|
||||||
|
@ -2043,7 +2043,7 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName)
|
||||||
// vertex color location = 3
|
// vertex color location = 3
|
||||||
// vertex tangent location = 4
|
// vertex tangent location = 4
|
||||||
// vertex texcoord2 location = 5
|
// vertex texcoord2 location = 5
|
||||||
|
|
||||||
// NOTE: If any location is not found, loc point becomes -1
|
// NOTE: If any location is not found, loc point becomes -1
|
||||||
|
|
||||||
// Get handles to GLSL input attibute locations
|
// Get handles to GLSL input attibute locations
|
||||||
|
@ -2075,9 +2075,9 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||||
{
|
{
|
||||||
Shader shader = { 0 };
|
Shader shader = { 0 };
|
||||||
shader.locs = (int *)RL_CALLOC(MAX_SHADER_LOCATIONS, sizeof(int));
|
shader.locs = (int *)RL_CALLOC(MAX_SHADER_LOCATIONS, sizeof(int));
|
||||||
|
|
||||||
shader.id = rlLoadShaderCode(vsCode, fsCode);
|
shader.id = rlLoadShaderCode(vsCode, fsCode);
|
||||||
|
|
||||||
// After shader loading, we TRY to set default location names
|
// After shader loading, we TRY to set default location names
|
||||||
if (shader.id > 0)
|
if (shader.id > 0)
|
||||||
{
|
{
|
||||||
|
@ -2088,7 +2088,7 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||||
// vertex color location = 3
|
// vertex color location = 3
|
||||||
// vertex tangent location = 4
|
// vertex tangent location = 4
|
||||||
// vertex texcoord2 location = 5
|
// vertex texcoord2 location = 5
|
||||||
|
|
||||||
// NOTE: If any location is not found, loc point becomes -1
|
// NOTE: If any location is not found, loc point becomes -1
|
||||||
|
|
||||||
// Get handles to GLSL input attibute locations
|
// Get handles to GLSL input attibute locations
|
||||||
|
@ -4406,7 +4406,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
|
|
||||||
// Screen scaling matrix is required in case desired screen area is different than display area
|
// Screen scaling matrix is required in case desired screen area is different than display area
|
||||||
CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f);
|
CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f);
|
||||||
|
|
||||||
// Mouse input scaling for the new screen size
|
// Mouse input scaling for the new screen size
|
||||||
SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight);
|
SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4443,7 +4443,7 @@ static void SetupViewport(int width, int height)
|
||||||
float xScale = 1.0f, yScale = 1.0f;
|
float xScale = 1.0f, yScale = 1.0f;
|
||||||
glfwGetWindowContentScale(CORE.Window.handle, &xScale, &yScale);
|
glfwGetWindowContentScale(CORE.Window.handle, &xScale, &yScale);
|
||||||
rlViewport(CORE.Window.renderOffset.x/2*xScale, CORE.Window.renderOffset.y/2*yScale, (CORE.Window.render.width - CORE.Window.renderOffset.x)*xScale, (CORE.Window.render.height - CORE.Window.renderOffset.y)*yScale);
|
rlViewport(CORE.Window.renderOffset.x/2*xScale, CORE.Window.renderOffset.y/2*yScale, (CORE.Window.render.width - CORE.Window.renderOffset.x)*xScale, (CORE.Window.render.height - CORE.Window.renderOffset.y)*yScale);
|
||||||
#else
|
#else
|
||||||
rlViewport(CORE.Window.renderOffset.x/2, CORE.Window.renderOffset.y/2, CORE.Window.render.width - CORE.Window.renderOffset.x, CORE.Window.render.height - CORE.Window.renderOffset.y);
|
rlViewport(CORE.Window.renderOffset.x/2, CORE.Window.renderOffset.y/2, CORE.Window.render.width - CORE.Window.renderOffset.x, CORE.Window.render.height - CORE.Window.renderOffset.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
44
src/models.c
44
src/models.c
|
@ -738,7 +738,7 @@ Model LoadModel(const char *fileName)
|
||||||
|
|
||||||
if (model.meshMaterial == NULL) model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
|
if (model.meshMaterial == NULL) model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
rlEnableVertexArray(mesh->vaoId);
|
rlEnableVertexArray(mesh->vaoId);
|
||||||
|
|
||||||
// NOTE: Attributes must be uploaded considering default locations points
|
// NOTE: Attributes must be uploaded considering default locations points
|
||||||
|
|
||||||
// Enable vertex attributes: position (shader-location = 0)
|
// Enable vertex attributes: position (shader-location = 0)
|
||||||
mesh->vboId[0] = rlLoadVertexBuffer(mesh->vertices, mesh->vertexCount*3*sizeof(float), dynamic);
|
mesh->vboId[0] = rlLoadVertexBuffer(mesh->vertices, mesh->vertexCount*3*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(0, 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(0, 3, RL_FLOAT, 0, 0, 0);
|
||||||
|
@ -917,7 +917,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
|
|
||||||
if (mesh->vaoId > 0) TRACELOG(LOG_INFO, "VAO: [ID %i] Mesh uploaded successfully to VRAM (GPU)", mesh->vaoId);
|
if (mesh->vaoId > 0) TRACELOG(LOG_INFO, "VAO: [ID %i] Mesh uploaded successfully to VRAM (GPU)", mesh->vaoId);
|
||||||
else TRACELOG(LOG_INFO, "VBO: Mesh uploaded successfully to VRAM (GPU)");
|
else TRACELOG(LOG_INFO, "VBO: Mesh uploaded successfully to VRAM (GPU)");
|
||||||
|
|
||||||
rlDisableVertexArray();
|
rlDisableVertexArray();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -943,12 +943,12 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
rlEnableStatePointer(GL_TEXTURE_COORD_ARRAY, mesh.texcoords);
|
rlEnableStatePointer(GL_TEXTURE_COORD_ARRAY, mesh.texcoords);
|
||||||
rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals);
|
rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals);
|
||||||
rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors);
|
rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors);
|
||||||
|
|
||||||
rlPushMatrix();
|
rlPushMatrix();
|
||||||
rlMultMatrixf(MatrixToFloat(transforms[0]));
|
rlMultMatrixf(MatrixToFloat(transforms[0]));
|
||||||
rlColor4ub(material.maps[MATERIAL_MAP_DIFFUSE].color.r,
|
rlColor4ub(material.maps[MATERIAL_MAP_DIFFUSE].color.r,
|
||||||
material.maps[MATERIAL_MAP_DIFFUSE].color.g,
|
material.maps[MATERIAL_MAP_DIFFUSE].color.g,
|
||||||
material.maps[MATERIAL_MAP_DIFFUSE].color.b,
|
material.maps[MATERIAL_MAP_DIFFUSE].color.b,
|
||||||
material.maps[MATERIAL_MAP_DIFFUSE].color.a);
|
material.maps[MATERIAL_MAP_DIFFUSE].color.a);
|
||||||
|
|
||||||
if (mesh.indices != NULL) rlDrawVertexArrayElements(0, mesh.triangleCount*3, mesh.indices);
|
if (mesh.indices != NULL) rlDrawVertexArrayElements(0, mesh.triangleCount*3, mesh.indices);
|
||||||
|
@ -970,7 +970,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
else if (instances > 1) instancing = true;
|
else if (instances > 1) instancing = true;
|
||||||
float16 *instanceTransforms = NULL;
|
float16 *instanceTransforms = NULL;
|
||||||
unsigned int instancesVboId = 0;
|
unsigned int instancesVboId = 0;
|
||||||
|
|
||||||
// Bind shader program
|
// Bind shader program
|
||||||
rlEnableShader(material.shader.id);
|
rlEnableShader(material.shader.id);
|
||||||
|
|
||||||
|
@ -983,9 +983,9 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.r/255.0f,
|
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.r/255.0f,
|
||||||
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.g/255.0f,
|
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.g/255.0f,
|
||||||
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.b/255.0f,
|
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.b/255.0f,
|
||||||
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.a/255.0f
|
(float)material.maps[MATERIAL_MAP_DIFFUSE].color.a/255.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
rlSetUniform(material.shader.locs[SHADER_LOC_COLOR_DIFFUSE], values, SHADER_UNIFORM_VEC4, 1);
|
rlSetUniform(material.shader.locs[SHADER_LOC_COLOR_DIFFUSE], values, SHADER_UNIFORM_VEC4, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,9 +996,9 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.r/255.0f,
|
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.r/255.0f,
|
||||||
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.g/255.0f,
|
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.g/255.0f,
|
||||||
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.b/255.0f,
|
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.b/255.0f,
|
||||||
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.a/255.0f
|
(float)material.maps[SHADER_LOC_COLOR_SPECULAR].color.a/255.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
rlSetUniform(material.shader.locs[SHADER_LOC_COLOR_SPECULAR], values, SHADER_UNIFORM_VEC4, 1);
|
rlSetUniform(material.shader.locs[SHADER_LOC_COLOR_SPECULAR], values, SHADER_UNIFORM_VEC4, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1028,7 +1028,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
|
|
||||||
// This could alternatively use a static VBO and either glMapBuffer() or glBufferSubData().
|
// This could alternatively use a static VBO and either glMapBuffer() or glBufferSubData().
|
||||||
// It isn't clear which would be reliably faster in all cases and on all platforms,
|
// It isn't clear which would be reliably faster in all cases and on all platforms,
|
||||||
// anecdotally glMapBuffer() seems very slow (syncs) while glBufferSubData() seems
|
// anecdotally glMapBuffer() seems very slow (syncs) while glBufferSubData() seems
|
||||||
// no faster, since we're transferring all the transform matrices anyway
|
// no faster, since we're transferring all the transform matrices anyway
|
||||||
instancesVboId = rlLoadVertexBuffer(instanceTransforms, instances*sizeof(float16), false);
|
instancesVboId = rlLoadVertexBuffer(instanceTransforms, instances*sizeof(float16), false);
|
||||||
|
|
||||||
|
@ -1042,7 +1042,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
|
|
||||||
rlDisableVertexBuffer();
|
rlDisableVertexBuffer();
|
||||||
rlDisableVertexArray();
|
rlDisableVertexArray();
|
||||||
|
|
||||||
// Accumulate internal matrix transform (push/pop) and view matrix
|
// Accumulate internal matrix transform (push/pop) and view matrix
|
||||||
// NOTE: In this case, model instance transformation must be computed in the shader
|
// NOTE: In this case, model instance transformation must be computed in the shader
|
||||||
matModelView = MatrixMultiply(rlGetMatrixTransform(), matView);
|
matModelView = MatrixMultiply(rlGetMatrixTransform(), matView);
|
||||||
|
@ -1058,7 +1058,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
// transform: function parameter transformation
|
// transform: function parameter transformation
|
||||||
matModelView = MatrixMultiply(transforms[0], MatrixMultiply(rlGetMatrixTransform(), matView));
|
matModelView = MatrixMultiply(transforms[0], MatrixMultiply(rlGetMatrixTransform(), matView));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload model normal matrix (if locations available)
|
// Upload model normal matrix (if locations available)
|
||||||
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModelView)));
|
if (material.shader.locs[SHADER_LOC_MATRIX_NORMAL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_NORMAL], MatrixTranspose(MatrixInvert(matModelView)));
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
@ -1070,10 +1070,10 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
{
|
{
|
||||||
// Select current shader texture slot
|
// Select current shader texture slot
|
||||||
rlActiveTextureSlot(i);
|
rlActiveTextureSlot(i);
|
||||||
|
|
||||||
// Enable texture for active slot
|
// Enable texture for active slot
|
||||||
if ((i == MATERIAL_MAP_IRRADIANCE) ||
|
if ((i == MATERIAL_MAP_IRRADIANCE) ||
|
||||||
(i == MATERIAL_MAP_PREFILTER) ||
|
(i == MATERIAL_MAP_PREFILTER) ||
|
||||||
(i == MATERIAL_MAP_CUBEMAP)) rlEnableTextureCubemap(material.maps[i].texture.id);
|
(i == MATERIAL_MAP_CUBEMAP)) rlEnableTextureCubemap(material.maps[i].texture.id);
|
||||||
else rlEnableTexture(material.maps[i].texture.id);
|
else rlEnableTexture(material.maps[i].texture.id);
|
||||||
|
|
||||||
|
@ -1089,7 +1089,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
rlEnableVertexBuffer(mesh.vboId[0]);
|
rlEnableVertexBuffer(mesh.vboId[0]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
||||||
|
|
||||||
rlEnableVertexBuffer(mesh.vboId[0]);
|
rlEnableVertexBuffer(mesh.vboId[0]);
|
||||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
|
||||||
|
@ -1180,10 +1180,10 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
|
||||||
{
|
{
|
||||||
// Select current shader texture slot
|
// Select current shader texture slot
|
||||||
rlActiveTextureSlot(i);
|
rlActiveTextureSlot(i);
|
||||||
|
|
||||||
// Disable texture for active slot
|
// Disable texture for active slot
|
||||||
if ((i == MATERIAL_MAP_IRRADIANCE) ||
|
if ((i == MATERIAL_MAP_IRRADIANCE) ||
|
||||||
(i == MATERIAL_MAP_PREFILTER) ||
|
(i == MATERIAL_MAP_PREFILTER) ||
|
||||||
(i == MATERIAL_MAP_CUBEMAP)) rlDisableTextureCubemap();
|
(i == MATERIAL_MAP_CUBEMAP)) rlDisableTextureCubemap();
|
||||||
else rlDisableTexture();
|
else rlDisableTexture();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1313,7 +1313,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
|
||||||
else if (TextIsEqual(fileExtLower, ".wav"))
|
else if (TextIsEqual(fileExtLower, ".wav"))
|
||||||
{
|
{
|
||||||
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
||||||
|
|
||||||
bool success = drwav_init_memory(ctxWav, (const void*)data, dataSize, NULL);
|
bool success = drwav_init_memory(ctxWav, (const void*)data, dataSize, NULL);
|
||||||
|
|
||||||
music.ctxType = MUSIC_AUDIO_WAV;
|
music.ctxType = MUSIC_AUDIO_WAV;
|
||||||
|
|
|
@ -709,7 +709,7 @@ typedef enum {
|
||||||
MESH_VERTEX_NORMAL = 8,
|
MESH_VERTEX_NORMAL = 8,
|
||||||
MESH_VERTEX_TANGENT = 16,
|
MESH_VERTEX_TANGENT = 16,
|
||||||
MESH_VERTEX_COLOR = 32,
|
MESH_VERTEX_COLOR = 32,
|
||||||
MESH_VERTEX_INDEX = 64
|
MESH_VERTEX_INDEX = 64
|
||||||
} MeshVertexAttributes;
|
} MeshVertexAttributes;
|
||||||
|
|
||||||
// Material map index
|
// Material map index
|
||||||
|
|
38
src/rlgl.h
38
src/rlgl.h
|
@ -291,7 +291,7 @@ typedef struct RenderBatch {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SHADER_ATTRIB_FLOAT = 0,
|
SHADER_ATTRIB_FLOAT = 0,
|
||||||
SHADER_ATTRIB_VEC2,
|
SHADER_ATTRIB_VEC2,
|
||||||
SHADER_ATTRIB_VEC3,
|
SHADER_ATTRIB_VEC3,
|
||||||
SHADER_ATTRIB_VEC4
|
SHADER_ATTRIB_VEC4
|
||||||
} ShaderAttributeDataType;
|
} ShaderAttributeDataType;
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ typedef enum {
|
||||||
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
|
||||||
} TextureFilter;
|
} TextureFilter;
|
||||||
|
|
||||||
// Texture parameters: wrap mode
|
// Texture parameters: wrap mode
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode
|
TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode
|
||||||
|
@ -435,7 +435,7 @@ typedef enum {
|
||||||
SHADER_LOC_MAP_PREFILTER,
|
SHADER_LOC_MAP_PREFILTER,
|
||||||
SHADER_LOC_MAP_BRDF
|
SHADER_LOC_MAP_BRDF
|
||||||
} ShaderLocationIndex;
|
} ShaderLocationIndex;
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ RLAPI void rlDisableStatePointer(int vertexAttribType);
|
||||||
|
|
||||||
// Textures state
|
// Textures state
|
||||||
RLAPI void rlActiveTextureSlot(int slot); // Select and active a texture slot
|
RLAPI void rlActiveTextureSlot(int slot); // Select and active a texture slot
|
||||||
RLAPI void rlEnableTexture(unsigned int id); // Enable texture
|
RLAPI void rlEnableTexture(unsigned int id); // Enable texture
|
||||||
RLAPI void rlDisableTexture(void); // Disable texture
|
RLAPI void rlDisableTexture(void); // Disable texture
|
||||||
RLAPI void rlEnableTextureCubemap(unsigned int id); // Enable texture cubemap
|
RLAPI void rlEnableTextureCubemap(unsigned int id); // Enable texture cubemap
|
||||||
RLAPI void rlDisableTextureCubemap(void); // Disable texture cubemap
|
RLAPI void rlDisableTextureCubemap(void); // Disable texture cubemap
|
||||||
|
@ -732,8 +732,8 @@ RLAPI Texture2D rlGenTextureBRDF(Shader shader, int size); // Gener
|
||||||
#include <EGL/egl.h> // EGL library
|
#include <EGL/egl.h> // EGL library
|
||||||
#include <GLES2/gl2.h> // OpenGL ES 2.0 library
|
#include <GLES2/gl2.h> // OpenGL ES 2.0 library
|
||||||
#include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library
|
#include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library
|
||||||
|
|
||||||
// It seems OpenGL ES 2.0 instancing entry points are not defined on Raspberry Pi
|
// It seems OpenGL ES 2.0 instancing entry points are not defined on Raspberry Pi
|
||||||
// provided headers (despite being defined in official Khronos GLES2 headers)
|
// provided headers (despite being defined in official Khronos GLES2 headers)
|
||||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
|
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
|
||||||
|
@ -853,7 +853,7 @@ typedef struct rlglData {
|
||||||
unsigned int defaultFShaderId; // Default fragment shader Id (used by default shader program)
|
unsigned int defaultFShaderId; // Default fragment shader Id (used by default shader program)
|
||||||
Shader defaultShader; // Basic shader, support vertex color and diffuse texture
|
Shader defaultShader; // Basic shader, support vertex color and diffuse texture
|
||||||
Shader currentShader; // Shader to be used on rendering (by default, defaultShader)
|
Shader currentShader; // Shader to be used on rendering (by default, defaultShader)
|
||||||
|
|
||||||
bool stereoRender; // Stereo rendering flag
|
bool stereoRender; // Stereo rendering flag
|
||||||
Matrix projectionStereo[2]; // VR stereo rendering eyes projection matrices
|
Matrix projectionStereo[2]; // VR stereo rendering eyes projection matrices
|
||||||
Matrix viewOffsetStereo[2]; // VR stereo rendering eyes view offset matrices
|
Matrix viewOffsetStereo[2]; // VR stereo rendering eyes view offset matrices
|
||||||
|
@ -1182,7 +1182,7 @@ void rlEnd(void)
|
||||||
|
|
||||||
// Verify internal buffers limits
|
// Verify internal buffers limits
|
||||||
// NOTE: This check is combined with usage of rlCheckRenderBatchLimit()
|
// NOTE: This check is combined with usage of rlCheckRenderBatchLimit()
|
||||||
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter) >=
|
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter) >=
|
||||||
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4 - 4))
|
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4 - 4))
|
||||||
{
|
{
|
||||||
// WARNING: If we are between rlPushMatrix() and rlPopMatrix() and we need to force a rlDrawRenderBatch(),
|
// WARNING: If we are between rlPushMatrix() and rlPopMatrix() and we need to force a rlDrawRenderBatch(),
|
||||||
|
@ -1280,7 +1280,7 @@ void rlSetTexture(unsigned int id)
|
||||||
rlDisableTexture();
|
rlDisableTexture();
|
||||||
#else
|
#else
|
||||||
// NOTE: If quads batch limit is reached, we force a draw call and next batch starts
|
// NOTE: If quads batch limit is reached, we force a draw call and next batch starts
|
||||||
if (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter >=
|
if (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter >=
|
||||||
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4)
|
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4)
|
||||||
{
|
{
|
||||||
rlDrawRenderBatch(RLGL.currentBatch);
|
rlDrawRenderBatch(RLGL.currentBatch);
|
||||||
|
@ -1332,7 +1332,7 @@ void rlActiveTextureSlot(int slot)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable texture
|
// Enable texture
|
||||||
void rlEnableTexture(unsigned int id)
|
void rlEnableTexture(unsigned int id)
|
||||||
{
|
{
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
|
@ -1537,7 +1537,7 @@ bool rlIsStereoRenderEnabled(void)
|
||||||
return RLGL.State.stereoRender;
|
return RLGL.State.stereoRender;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear color buffer with color
|
// Clear color buffer with color
|
||||||
|
@ -1567,7 +1567,7 @@ void rlCheckErrors()
|
||||||
while (check)
|
while (check)
|
||||||
{
|
{
|
||||||
const GLenum err = glGetError();
|
const GLenum err = glGetError();
|
||||||
switch (err)
|
switch (err)
|
||||||
{
|
{
|
||||||
case GL_NO_ERROR: check = 0; break;
|
case GL_NO_ERROR: check = 0; break;
|
||||||
case 0x0500: TRACELOG(LOG_WARNING, "GL: Error detected: GL_INVALID_ENUM"); break;
|
case 0x0500: TRACELOG(LOG_WARNING, "GL: Error detected: GL_INVALID_ENUM"); break;
|
||||||
|
@ -2032,7 +2032,7 @@ void rlSetShapesTexture(Texture2D texture, Rectangle source)
|
||||||
RenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements)
|
RenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements)
|
||||||
{
|
{
|
||||||
RenderBatch batch = { 0 };
|
RenderBatch batch = { 0 };
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// Initialize CPU (RAM) vertex buffers (position, texcoord, color data and indexes)
|
// Initialize CPU (RAM) vertex buffers (position, texcoord, color data and indexes)
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
|
@ -2389,7 +2389,7 @@ void rlSetRenderBatchActive(RenderBatch *batch)
|
||||||
{
|
{
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
rlDrawRenderBatch(RLGL.currentBatch);
|
rlDrawRenderBatch(RLGL.currentBatch);
|
||||||
|
|
||||||
if (batch != NULL) RLGL.currentBatch = batch;
|
if (batch != NULL) RLGL.currentBatch = batch;
|
||||||
else RLGL.currentBatch = &RLGL.defaultBatch;
|
else RLGL.currentBatch = &RLGL.defaultBatch;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2410,8 +2410,8 @@ bool rlCheckRenderBatchLimit(int vCount)
|
||||||
bool overflow = false;
|
bool overflow = false;
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >=
|
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >=
|
||||||
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4))
|
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4))
|
||||||
{
|
{
|
||||||
overflow = true;
|
overflow = true;
|
||||||
rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside
|
rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside
|
||||||
|
@ -3137,7 +3137,7 @@ bool rlEnableVertexArray(unsigned int vaoId)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
if (RLGL.ExtSupported.vao)
|
if (RLGL.ExtSupported.vao)
|
||||||
{
|
{
|
||||||
glBindVertexArray(vaoId);
|
glBindVertexArray(vaoId);
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -3262,7 +3262,7 @@ void rlUnloadVertexBuffer(unsigned int vboId)
|
||||||
unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
|
unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
|
||||||
{
|
{
|
||||||
unsigned int id = 0;
|
unsigned int id = 0;
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
unsigned int vertexShaderId = RLGL.State.defaultVShaderId;
|
unsigned int vertexShaderId = RLGL.State.defaultVShaderId;
|
||||||
unsigned int fragmentShaderId = RLGL.State.defaultFShaderId;
|
unsigned int fragmentShaderId = RLGL.State.defaultFShaderId;
|
||||||
|
@ -3437,7 +3437,7 @@ int rlGetLocationAttrib(unsigned int shaderId, const char *attribName)
|
||||||
int location = -1;
|
int location = -1;
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
location = glGetAttribLocation(shaderId, attribName);
|
location = glGetAttribLocation(shaderId, attribName);
|
||||||
|
|
||||||
if (location == -1) TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to find shader attribute: %s", shaderId, attribName);
|
if (location == -1) TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to find shader attribute: %s", shaderId, attribName);
|
||||||
else TRACELOG(LOG_INFO, "SHADER: [ID %i] Shader attribute (%s) set at location: %i", shaderId, attribName, location);
|
else TRACELOG(LOG_INFO, "SHADER: [ID %i] Shader attribute (%s) set at location: %i", shaderId, attribName, location);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -812,7 +812,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
|
||||||
/*
|
/*
|
||||||
Quick sketch to make sense of all of this,
|
Quick sketch to make sense of all of this,
|
||||||
there are 9 parts to draw, also mark the 12 points we'll use
|
there are 9 parts to draw, also mark the 12 points we'll use
|
||||||
|
|
||||||
P0____________________P1
|
P0____________________P1
|
||||||
/| |\
|
/| |\
|
||||||
/1| 2 |3\
|
/1| 2 |3\
|
||||||
|
@ -1037,7 +1037,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int
|
||||||
/*
|
/*
|
||||||
Quick sketch to make sense of all of this,
|
Quick sketch to make sense of all of this,
|
||||||
marks the 16 + 4(corner centers P16-19) points we'll use
|
marks the 16 + 4(corner centers P16-19) points we'll use
|
||||||
|
|
||||||
P0 ================== P1
|
P0 ================== P1
|
||||||
// P8 P9 \\
|
// P8 P9 \\
|
||||||
// \\
|
// \\
|
||||||
|
@ -1555,7 +1555,7 @@ bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshol
|
||||||
float dxl = p2.x - p1.x;
|
float dxl = p2.x - p1.x;
|
||||||
float dyl = p2.y - p1.y;
|
float dyl = p2.y - p1.y;
|
||||||
float cross = dxc*dyl - dyc*dxl;
|
float cross = dxc*dyl - dyc*dxl;
|
||||||
|
|
||||||
if (fabsf(cross) < (threshold*fmaxf(fabsf(dxl), fabsf(dyl))))
|
if (fabsf(cross) < (threshold*fmaxf(fabsf(dxl), fabsf(dyl))))
|
||||||
{
|
{
|
||||||
if (fabsf(dxl) >= fabsf(dyl)) collision = (dxl > 0)? ((p1.x <= point.x) && (point.x <= p2.x)) : ((p2.x <= point.x) && (point.x <= p1.x));
|
if (fabsf(dxl) >= fabsf(dyl)) collision = (dxl > 0)? ((p1.x <= point.x) && (point.x <= p2.x)) : ((p2.x <= point.x) && (point.x <= p1.x));
|
||||||
|
|
|
@ -3511,12 +3511,12 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw textured polygon, defined by vertex and texturecoordinates
|
// Draw textured polygon, defined by vertex and texturecoordinates
|
||||||
// NOTE: Polygon center must have straight line path to all points
|
// NOTE: Polygon center must have straight line path to all points
|
||||||
// without crossing perimeter, points must be in anticlockwise order
|
// without crossing perimeter, points must be in anticlockwise order
|
||||||
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint)
|
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint)
|
||||||
{
|
{
|
||||||
rlCheckRenderBatchLimit((pointsCount - 1)*4);
|
rlCheckRenderBatchLimit((pointsCount - 1)*4);
|
||||||
|
|
||||||
rlSetTexture(texture.id);
|
rlSetTexture(texture.id);
|
||||||
|
|
||||||
// Texturing is only supported on QUADs
|
// Texturing is only supported on QUADs
|
||||||
|
|
10
src/utils.c
10
src/utils.c
|
@ -189,7 +189,7 @@ unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead)
|
||||||
|
|
||||||
if (fileName != NULL)
|
if (fileName != NULL)
|
||||||
{
|
{
|
||||||
if (loadFileData)
|
if (loadFileData)
|
||||||
{
|
{
|
||||||
data = loadFileData(fileName, bytesRead);
|
data = loadFileData(fileName, bytesRead);
|
||||||
return data;
|
return data;
|
||||||
|
@ -243,7 +243,7 @@ bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite)
|
||||||
|
|
||||||
if (fileName != NULL)
|
if (fileName != NULL)
|
||||||
{
|
{
|
||||||
if (saveFileData)
|
if (saveFileData)
|
||||||
{
|
{
|
||||||
saveFileData(fileName, data, bytesToWrite);
|
saveFileData(fileName, data, bytesToWrite);
|
||||||
return success;
|
return success;
|
||||||
|
@ -265,7 +265,7 @@ bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite)
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open file", fileName);
|
else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to open file", fileName);
|
||||||
#else
|
#else
|
||||||
TRACELOG(LOG_WARNING, "FILEIO: Standard file io not supported, use custom file callback");
|
TRACELOG(LOG_WARNING, "FILEIO: Standard file io not supported, use custom file callback");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid");
|
else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid");
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ char *LoadFileText(const char *fileName)
|
||||||
|
|
||||||
if (fileName != NULL)
|
if (fileName != NULL)
|
||||||
{
|
{
|
||||||
if (loadFileText)
|
if (loadFileText)
|
||||||
{
|
{
|
||||||
text = loadFileText(fileName);
|
text = loadFileText(fileName);
|
||||||
return text;
|
return text;
|
||||||
|
@ -338,7 +338,7 @@ bool SaveFileText(const char *fileName, char *text)
|
||||||
|
|
||||||
if (fileName != NULL)
|
if (fileName != NULL)
|
||||||
{
|
{
|
||||||
if (saveFileText)
|
if (saveFileText)
|
||||||
{
|
{
|
||||||
saveFileText(fileName, text);
|
saveFileText(fileName, text);
|
||||||
return success;
|
return success;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue