X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fmeshgen.cc;h=bd9fe534e5fe5e2840dcdfd0019173404be8997b;hb=f6ceb163227d00d7f97df1fc2dfbdd419c56277e;hp=ff7906d4a251803ebecdac612452ec3d6f1fcadc;hpb=197f20b5d4db937029f7b585be23ee7fe5da66dc;p=demo diff --git a/src/meshgen.cc b/src/meshgen.cc index ff7906d..bd9fe53 100644 --- a/src/meshgen.cc +++ b/src/meshgen.cc @@ -119,13 +119,13 @@ void gen_geosphere(Mesh *mesh, float rad, int subdiv, bool hemi) for(int i=0; iindices[i] = i; } - mesh->update_vertex_data(); + mesh->invalidate(); } // ------ heightfield ------ static Vec3 hfield_vertex(float u, float v, float h, float xsz, - float ysz, float height) + float ysz, float height) { float x = u * xsz - xsz / 2.0; float y = h * height; @@ -135,11 +135,11 @@ static Vec3 hfield_vertex(float u, float v, float h, float xsz, } void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub, - int vsub, float (*calc_height)(float u, float v, void *ptr), void *ptr) + int vsub, float (*calc_height)(float u, float v, void *ptr), void *ptr) { - /* + /* usub and vsub is the number of subdivision at each axis - (heightfield = grid) + (heightfield = grid) */ if(usub < 1) usub = 1; @@ -165,21 +165,21 @@ void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub, float dv = 1.0 / (float)num_vvertices; for(int i=0; ivertices[vidx] = vtx; mesh->normals[vidx] = normal; @@ -190,7 +190,7 @@ void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub, } /* - indices: + indices: */ uint16_t *iptr = &mesh->indices[0]; @@ -202,7 +202,6 @@ void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub, int c = d + 1; /* 1st triangle */ - *iptr++ = a; *iptr++ = b; *iptr++ = c; @@ -214,5 +213,5 @@ void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub, *iptr++ = a; } } - mesh->update_vertex_data(); + mesh->invalidate(); }