瀏覽代碼

Correct issue with triangleCount

pull/508/head
raysan5 7 年之前
父節點
當前提交
fd5e457bb4
共有 1 個檔案被更改,包括 3 行新增2 行删除
  1. +3
    -2
      src/models.c

+ 3
- 2
src/models.c 查看文件

@ -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…
取消
儲存