Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-26 14:46:07 +0000
committerStijn Buys <ingar@osirion.org>2010-11-26 14:46:07 +0000
commita96da42a7c1232dee986e1f658ee34440f78ac6c (patch)
treed406c28b40c6d65e42cce66e0f484386189b8ba6
parenta92dc36d721806f8613a7aa531eca89162de504a (diff)
Corrected patch normals and vertex unwinding order, draw smaller normals with r_normalize 1.
-rw-r--r--src/model/mapfile.cc12
-rw-r--r--src/render/draw.cc5
2 files changed, 10 insertions, 7 deletions
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);
}
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 79daffd..6e60f86 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -532,9 +532,10 @@ void draw_fragment(const model::Fragment *fragment, bool draw_details)
gl::begin(gl::Lines);
gl::color(1.0f, 0.0f, 0.0f);
-
+ const float s = 0.01f;
+
for (size_t i = 0; i < vertex_count; i++) {
- const float s = 0.25f;
+
const float *n = &core::game()->vertexarray()->ptr()[(index+i) * 8 + 2];
const float *v = &core::game()->vertexarray()->ptr()[(index+i) * 8 + 5];