Merge commit 'e3810c016ffc52eed030a8f5657f15e35460b89a' * commit 'e3810c016ffc52eed030a8f5657f15e35460b89a': checkpoint
This commit is contained in:
@@ -210,26 +210,27 @@ void generateRipples() {
|
||||
int x = 0;
|
||||
int yOffset = y * width;
|
||||
for ( ; x < width; x += 1) {
|
||||
int o = ((yOffset + x) << 3);
|
||||
int o1 = o + 8 + 5;
|
||||
int ow = o + w8 + 5;
|
||||
int ow1 = ow + 8;
|
||||
struct vert_s *v = (struct vec3_s *)(vertices + x);
|
||||
//int o = ((yOffset + x) << 3);
|
||||
//int o1 = o + 8 + 5;
|
||||
//int ow = o + w8 + 5;
|
||||
//int ow1 = ow + 8;
|
||||
|
||||
struct vec3_s n1, n2, n3;
|
||||
vec3Sub(&n1, (struct vec3_s *)(vertices + o1 + 5), (struct vec3_s *)(vertices + o + 5));
|
||||
vec3Sub(&n2, (struct vec3_s *)(vertices + ow + 5), (struct vec3_s *)(vertices + o + 5));
|
||||
vec3Sub(&n1, (struct vec3_s *)&(v+1)->x, (struct vec3_s *)&v->x);
|
||||
vec3Sub(&n2, (struct vec3_s *)&(v+width)->x, (struct vec3_s *)&v->x);
|
||||
vec3Cross(&n3, &n1, &n2);
|
||||
vec3Norm(&n3);
|
||||
|
||||
// Average of previous normal and N1 x N2
|
||||
vec3Sub(&n1, (struct vec3_s *)(vertices + ow1 + 5), (struct vec3_s *)(vertices + o + 5));
|
||||
vec3Sub(&n1, (struct vec3_s *)&(v+width+1)->x, (struct vec3_s *)&v->x);
|
||||
vec3Cross(&n2, &n1, &n2);
|
||||
vec3Add(&n3, &n3, &n2);
|
||||
vec3Norm(&n3);
|
||||
|
||||
vertices[o + 0] = n3.x;
|
||||
vertices[o + 1] = n3.y;
|
||||
vertices[o + 2] = -n3.z;
|
||||
v->nx = n3.x;
|
||||
v->ny = n3.y;
|
||||
v->nz = -n3.z;
|
||||
|
||||
// reset Z
|
||||
//vertices[(yOffset + x) << 3 + 7] = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user