From e9c7ab925fe3fb8530389f0e554496bdf3fa6ce9 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 27 Jul 2021 23:35:54 +0200 Subject: [PATCH] REVIEWED: rlDrawVertexArrayElements() #1891 --- src/models.c | 8 ++++---- src/rlgl.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/models.c b/src/models.c index 856d334d9..c66371396 100644 --- a/src/models.c +++ b/src/models.c @@ -1178,12 +1178,12 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins if (instancing) // Draw mesh instanced { - if (mesh.indices != NULL) rlDrawVertexArrayElementsInstanced(0, mesh.triangleCount*3, 0, instances); + if (mesh.indices != NULL) rlDrawVertexArrayElementsInstanced(0, mesh.triangleCount*3, mesh.indices, instances); else rlDrawVertexArrayInstanced(0, mesh.vertexCount, instances); } else // Draw mesh { - if (mesh.indices != NULL) rlDrawVertexArrayElements(0, mesh.triangleCount*3, 0); + if (mesh.indices != NULL) rlDrawVertexArrayElements(0, mesh.triangleCount*3, mesh.indices); else rlDrawVertexArray(0, mesh.vertexCount); } } @@ -4397,12 +4397,12 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo } break; case cgltf_component_type_r_32f: { - float* typedArray = (float*) array; + float *typedArray = (float *)array; for (unsigned int i = 0; i < count*typeElements; i++) typedArray[i] = (float)typedAdditionalArray[i]; } break; case cgltf_component_type_r_32u: { - unsigned int* typedArray = (unsigned int*) array; + unsigned int *typedArray = (unsigned int *)array; for (unsigned int i = 0; i < count*typeElements; i++) typedArray[i] = (unsigned int)typedAdditionalArray[i]; } break; default: diff --git a/src/rlgl.h b/src/rlgl.h index a2d890e60..f8ca4fa27 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -3121,7 +3121,7 @@ void rlDrawVertexArray(int offset, int count) void rlDrawVertexArrayElements(int offset, int count, void *buffer) { - glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short*)buffer + offset); + glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short *)buffer + offset); } void rlDrawVertexArrayInstanced(int offset, int count, int instances) @@ -3134,7 +3134,7 @@ void rlDrawVertexArrayInstanced(int offset, int count, int instances) void rlDrawVertexArrayElementsInstanced(int offset, int count, void *buffer, int instances) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short*)buffer + offset, instances); + glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (unsigned short *)buffer + offset, instances); #endif }