From a96da42a7c1232dee986e1f658ee34440f78ac6c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 26 Nov 2010 14:46:07 +0000 Subject: Corrected patch normals and vertex unwinding order, draw smaller normals with r_normalize 1. --- src/model/mapfile.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/model') diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index deb22a5..f57106d 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -328,6 +328,7 @@ bool MapFile::read_patchdef() } patchvertices[r][c].assign(x, y, z); + patchvertices[r][c] *= SCALE; } if (!(linestream >> word)) { @@ -390,12 +391,13 @@ bool MapFile::read_patchdef() // TODO triangulate, assign texture coordinates for (size_t r = 0; r < rows-1; r++) { for (size_t c = 0; c < columns -1; c++) { + // unwind face counter-clockwise Quad *quad = new Quad( - patchvertices[r][c] * SCALE, - patchvertices[r][c+1] * SCALE, - patchvertices[r+1][c+1] * SCALE, - patchvertices[r+1][c] * SCALE, - math::normal(patchvertices[r][c], patchvertices[r][c+1], patchvertices[r+1][c+1]) + patchvertices[r+1][c+1], + patchvertices[r][c+1], + patchvertices[r][c], + patchvertices[r+1][c], + math::normal(patchvertices[r][c+1], patchvertices[r][c], patchvertices[r+1][c+1]) ); primitives->add_quad(quad); } -- cgit v1.2.3