Browse Source

Correct issue with triangleCount

pull/508/head
raysan5 6 years ago
parent
commit
fd5e457bb4
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/models.c

+ 3
- 2
src/models.c View File

@ -1179,9 +1179,9 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
Color *pixels = GetImageData(heightmap);
// NOTE: One vertex per pixel
kt">int triangleCount = (mapX-1)*(mapZ-1)*2; // One quad every four pixels
n">mesh.triangleCount = (mapX-1)*(mapZ-1)*2; // One quad every four pixels
mesh.vertexCount = triangleCount*3;
mesh.vertexCount = mesh.triangleCount*3;
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
mesh.normals = (float *)malloc(mesh.vertexCount*3*sizeof(float));
@ -1584,6 +1584,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
// Move data from mapVertices temp arays to vertices float array
mesh.vertexCount = vCounter;
mesh.triangleCount = vCounter/3;
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
mesh.normals = (float *)malloc(mesh.vertexCount*3*sizeof(float));

Loading…
Cancel
Save