ソースを参照

Remove trailing spaces

pull/1696/head
raysan5 3年前
コミット
aed0fee2ca
8個のファイルの変更60行の追加60行の削除
  1. +7
    -7
      src/core.c
  2. +22
    -22
      src/models.c
  3. +1
    -1
      src/raudio.c
  4. +1
    -1
      src/raylib.h
  5. +19
    -19
      src/rlgl.h
  6. +3
    -3
      src/shapes.c
  7. +2
    -2
      src/textures.c
  8. +5
    -5
      src/utils.c

+ 7
- 7
src/core.c ファイルの表示

@ -2032,7 +2032,7 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName)
if (vShaderStr != NULL) RL_FREE(vShaderStr);
if (fShaderStr != NULL) RL_FREE(fShaderStr);
// After shader loading, we TRY to set default location names
if (shader.id > 0)
{
@ -2043,7 +2043,7 @@ Shader LoadShader(const char *vsFileName, const char *fsFileName)
// vertex color location = 3
// vertex tangent location = 4
// vertex texcoord2 location = 5
// NOTE: If any location is not found, loc point becomes -1
// Get handles to GLSL input attibute locations
@ -2075,9 +2075,9 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
{
Shader shader = { 0 };
shader.locs = (int *)RL_CALLOC(MAX_SHADER_LOCATIONS, sizeof(int));
shader.id = rlLoadShaderCode(vsCode, fsCode);
// After shader loading, we TRY to set default location names
if (shader.id > 0)
{
@ -2088,7 +2088,7 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
// vertex color location = 3
// vertex tangent location = 4
// vertex texcoord2 location = 5
// NOTE: If any location is not found, loc point becomes -1
// 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
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
SetMouseScale((float)CORE.Window.screen.width/fbWidth, (float)CORE.Window.screen.height/fbHeight);
#endif
@ -4443,7 +4443,7 @@ static void SetupViewport(int width, int height)
float xScale = 1.0f, yScale = 1.0f;
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);
#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);
#endif

+ 22
- 22
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));
}
return model;
}
@ -839,7 +839,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
rlEnableVertexArray(mesh->vaoId);
// NOTE: Attributes must be uploaded considering default locations points
// Enable vertex attributes: position (shader-location = 0)
mesh->vboId[0] = rlLoadVertexBuffer(mesh->vertices, mesh->vertexCount*3*sizeof(float), dynamic);
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);
else TRACELOG(LOG_INFO, "VBO: Mesh uploaded successfully to VRAM (GPU)");
rlDisableVertexArray();
#endif
}
@ -943,12 +943,12 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
rlEnableStatePointer(GL_TEXTURE_COORD_ARRAY, mesh.texcoords);
rlEnableStatePointer(GL_NORMAL_ARRAY, mesh.normals);
rlEnableStatePointer(GL_COLOR_ARRAY, mesh.colors);
rlPushMatrix();
rlMultMatrixf(MatrixToFloat(transforms[0]));
rlColor4ub(material.maps[MATERIAL_MAP_DIFFUSE].color.r,
material.maps[MATERIAL_MAP_DIFFUSE].color.g,
material.maps[MATERIAL_MAP_DIFFUSE].color.b,
rlColor4ub(material.maps[MATERIAL_MAP_DIFFUSE].color.r,
material.maps[MATERIAL_MAP_DIFFUSE].color.g,
material.maps[MATERIAL_MAP_DIFFUSE].color.b,
material.maps[MATERIAL_MAP_DIFFUSE].color.a);
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;
float16 *instanceTransforms = NULL;
unsigned int instancesVboId = 0;
// Bind shader program
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.g/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);
}
@ -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.g/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);
}
@ -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().
// 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
instancesVboId = rlLoadVertexBuffer(instanceTransforms, instances*sizeof(float16), false);
@ -1042,7 +1042,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
rlDisableVertexBuffer();
rlDisableVertexArray();
// Accumulate internal matrix transform (push/pop) and view matrix
// NOTE: In this case, model instance transformation must be computed in the shader
matModelView = MatrixMultiply(rlGetMatrixTransform(), matView);
@ -1058,7 +1058,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
// transform: function parameter transformation
matModelView = MatrixMultiply(transforms[0], MatrixMultiply(rlGetMatrixTransform(), matView));
}
// 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)));
//-----------------------------------------------------
@ -1070,10 +1070,10 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
{
// Select current shader texture slot
rlActiveTextureSlot(i);
// Enable texture for active slot
if ((i == MATERIAL_MAP_IRRADIANCE) ||
(i == MATERIAL_MAP_PREFILTER) ||
if ((i == MATERIAL_MAP_IRRADIANCE) ||
(i == MATERIAL_MAP_PREFILTER) ||
(i == MATERIAL_MAP_CUBEMAP)) rlEnableTextureCubemap(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]);
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION]);
rlEnableVertexBuffer(mesh.vboId[0]);
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_POSITION], 3, RL_FLOAT, 0, 0, 0);
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
rlActiveTextureSlot(i);
// Disable texture for active slot
if ((i == MATERIAL_MAP_IRRADIANCE) ||
(i == MATERIAL_MAP_PREFILTER) ||
if ((i == MATERIAL_MAP_IRRADIANCE) ||
(i == MATERIAL_MAP_PREFILTER) ||
(i == MATERIAL_MAP_CUBEMAP)) rlDisableTextureCubemap();
else rlDisableTexture();
}

+ 1
- 1
src/raudio.c ファイルの表示

@ -1313,7 +1313,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int d
else if (TextIsEqual(fileExtLower, ".wav"))
{
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
bool success = drwav_init_memory(ctxWav, (const void*)data, dataSize, NULL);
music.ctxType = MUSIC_AUDIO_WAV;

+ 1
- 1
src/raylib.h ファイルの表示

@ -709,7 +709,7 @@ typedef enum {
MESH_VERTEX_NORMAL = 8,
MESH_VERTEX_TANGENT = 16,
MESH_VERTEX_COLOR = 32,
MESH_VERTEX_INDEX = 64
MESH_VERTEX_INDEX = 64
} MeshVertexAttributes;
// Material map index

+ 19
- 19
src/rlgl.h ファイルの表示

@ -291,7 +291,7 @@ typedef struct RenderBatch {
typedef enum {
SHADER_ATTRIB_FLOAT = 0,
SHADER_ATTRIB_VEC2,
SHADER_ATTRIB_VEC3,
SHADER_ATTRIB_VEC3,
SHADER_ATTRIB_VEC4
} ShaderAttributeDataType;
@ -387,7 +387,7 @@ typedef enum {
TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
} TextureFilter;
// Texture parameters: wrap mode
typedef enum {
TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode
@ -435,7 +435,7 @@ typedef enum {
SHADER_LOC_MAP_PREFILTER,
SHADER_LOC_MAP_BRDF
} ShaderLocationIndex;
#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
#define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS
@ -526,7 +526,7 @@ RLAPI void rlDisableStatePointer(int vertexAttribType);
// Textures state
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 rlEnableTextureCubemap(unsigned int id); // Enable 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 <GLES2/gl2.h> // OpenGL ES 2.0 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)
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
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)
Shader defaultShader; // Basic shader, support vertex color and diffuse texture
Shader currentShader; // Shader to be used on rendering (by default, defaultShader)
bool stereoRender; // Stereo rendering flag
Matrix projectionStereo[2]; // VR stereo rendering eyes projection matrices
Matrix viewOffsetStereo[2]; // VR stereo rendering eyes view offset matrices
@ -1182,7 +1182,7 @@ void rlEnd(void)
// Verify internal buffers limits
// 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))
{
// 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();
#else
// 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)
{
rlDrawRenderBatch(RLGL.currentBatch);
@ -1332,7 +1332,7 @@ void rlActiveTextureSlot(int slot)
#endif
}
// Enable texture
// Enable texture
void rlEnableTexture(unsigned int id)
{
#if defined(GRAPHICS_API_OPENGL_11)
@ -1537,7 +1537,7 @@ bool rlIsStereoRenderEnabled(void)
return RLGL.State.stereoRender;
#else
return false;
#endif
#endif
}
// Clear color buffer with color
@ -1567,7 +1567,7 @@ void rlCheckErrors()
while (check)
{
const GLenum err = glGetError();
switch (err)
switch (err)
{
case GL_NO_ERROR: check = 0; 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 batch = { 0 };
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
// 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)
rlDrawRenderBatch(RLGL.currentBatch);
if (batch != NULL) RLGL.currentBatch = batch;
else RLGL.currentBatch = &RLGL.defaultBatch;
#endif
@ -2410,8 +2410,8 @@ bool rlCheckRenderBatchLimit(int vCount)
bool overflow = false;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >=
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4))
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >=
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4))
{
overflow = true;
rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside
@ -3137,7 +3137,7 @@ bool rlEnableVertexArray(unsigned int vaoId)
{
bool result = false;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (RLGL.ExtSupported.vao)
if (RLGL.ExtSupported.vao)
{
glBindVertexArray(vaoId);
result = true;
@ -3262,7 +3262,7 @@ void rlUnloadVertexBuffer(unsigned int vboId)
unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
{
unsigned int id = 0;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
unsigned int vertexShaderId = RLGL.State.defaultVShaderId;
unsigned int fragmentShaderId = RLGL.State.defaultFShaderId;
@ -3437,7 +3437,7 @@ int rlGetLocationAttrib(unsigned int shaderId, const char *attribName)
int location = -1;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
location = glGetAttribLocation(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);
#endif

+ 3
- 3
src/shapes.c ファイルの表示

@ -812,7 +812,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
/*
Quick sketch to make sense of all of this,
there are 9 parts to draw, also mark the 12 points we'll use
P0____________________P1
/| |\
/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,
marks the 16 + 4(corner centers P16-19) points we'll use
P0 ================== P1
// P8 P9 \\
// \\
@ -1555,7 +1555,7 @@ bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshol
float dxl = p2.x - p1.x;
float dyl = p2.y - p1.y;
float cross = dxc*dyl - dyc*dxl;
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));

+ 2
- 2
src/textures.c ファイルの表示

@ -3511,12 +3511,12 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
}
// 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
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint)
{
rlCheckRenderBatchLimit((pointsCount - 1)*4);
rlSetTexture(texture.id);
// Texturing is only supported on QUADs

+ 5
- 5
src/utils.c ファイルの表示

@ -189,7 +189,7 @@ unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead)
if (fileName != NULL)
{
if (loadFileData)
if (loadFileData)
{
data = loadFileData(fileName, bytesRead);
return data;
@ -243,7 +243,7 @@ bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite)
if (fileName != NULL)
{
if (saveFileData)
if (saveFileData)
{
saveFileData(fileName, data, bytesToWrite);
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: Standard file io not supported, use custom file callback");
#endif
#endif
}
else TRACELOG(LOG_WARNING, "FILEIO: File name provided is not valid");
@ -280,7 +280,7 @@ char *LoadFileText(const char *fileName)
if (fileName != NULL)
{
if (loadFileText)
if (loadFileText)
{
text = loadFileText(fileName);
return text;
@ -338,7 +338,7 @@ bool SaveFileText(const char *fileName, char *text)
if (fileName != NULL)
{
if (saveFileText)
if (saveFileText)
{
saveFileText(fileName, text);
return success;

読み込み中…
キャンセル
保存