X-Git-Url: https://eleni.mutantstargoat.com/git/?p=demo;a=blobdiff_plain;f=src%2Fmeshgen.cc;h=bd9fe534e5fe5e2840dcdfd0019173404be8997b;hp=ddcd5715cc5ba8a73d77e0da3f564e6b2ba0f9ff;hb=1e8963fc3f8191e328bbecd04cfbcba31d7d0bdf;hpb=73b9db25a6deff93da45f3c45290ca8a56fefed3 diff --git a/src/meshgen.cc b/src/meshgen.cc index ddcd571..bd9fe53 100644 --- a/src/meshgen.cc +++ b/src/meshgen.cc @@ -125,7 +125,7 @@ void gen_geosphere(Mesh *mesh, float rad, int subdiv, bool hemi) // ------ 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; @@ -174,10 +174,10 @@ void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub, slopes in x, z, axis */ Vec3 tangent = hfield_vertex(u + du, v, calc_height(u + du, v, ptr), - xsz, ysz, height) - vtx; + xsz, ysz, height) - vtx; Vec3 bitangent = hfield_vertex(u, v + dv, calc_height(u, v + dv, ptr), - xsz, ysz, height) - vtx; + xsz, ysz, height) - vtx; Vec3 normal = normalize(cross(bitangent, tangent)); @@ -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];