projects
/
demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
backup
[demo]
/
src
/
meshgen.cc
diff --git
a/src/meshgen.cc
b/src/meshgen.cc
index
ddcd571
..
bd9fe53
100644
(file)
--- 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,
// ------ 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;
{
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,
}
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
usub and vsub is the number of subdivision at each axis
- (heightfield = grid)
+ (heightfield = grid)
*/
if(usub < 1)
usub = 1;
*/
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),
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),
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));
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];
*/
uint16_t *iptr = &mesh->indices[0];