Merge branch 'raysan5:master' into master

This commit is contained in:
Luiz Pestana 2021-07-27 21:18:49 -03:00 committed by GitHub
commit b5212e216c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 16 deletions

View File

@ -1178,12 +1178,12 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
if (instancing) // Draw mesh instanced 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 rlDrawVertexArrayInstanced(0, mesh.vertexCount, instances);
} }
else // Draw mesh 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); else rlDrawVertexArray(0, mesh.vertexCount);
} }
} }
@ -4397,12 +4397,12 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
} break; } break;
case cgltf_component_type_r_32f: 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]; for (unsigned int i = 0; i < count*typeElements; i++) typedArray[i] = (float)typedAdditionalArray[i];
} break; } break;
case cgltf_component_type_r_32u: 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]; for (unsigned int i = 0; i < count*typeElements; i++) typedArray[i] = (unsigned int)typedAdditionalArray[i];
} break; } break;
default: default:

View File

@ -1422,7 +1422,7 @@ RMDEF Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f }; Quaternion result = { 0.0f, 0.0f, 0.0f, 1.0f };
if (Vector3Length(axis) != 0.0f) if (Vector3Length(axis) != 0.0f)
{
angle *= 0.5f; angle *= 0.5f;
axis = Vector3Normalize(axis); axis = Vector3Normalize(axis);
@ -1436,6 +1436,7 @@ RMDEF Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle)
result.w = cosres; result.w = cosres;
result = QuaternionNormalize(result); result = QuaternionNormalize(result);
}
return result; return result;
} }

View File

@ -3121,7 +3121,7 @@ void rlDrawVertexArray(int offset, int count)
void rlDrawVertexArrayElements(int offset, int count, void *buffer) 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) 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) void rlDrawVertexArrayElementsInstanced(int offset, int count, void *buffer, int instances)
{ {
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #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 #endif
} }