Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 4e5e2a9..0016bcf 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -561,17 +561,17 @@ void draw_fragment(model::Fragment *fragment, bool draw_details)
gl::color(1.0f, 0.0f, 0.0f);
- const float s = 0.1f;
-
- const float *n = core::game()->vertexarray()->normal() + index * 3;
- const float *v = core::game()->vertexarray()->vertex() + index * 3;
-
for (size_t i = 0; i < vertex_count; i++) {
- gl::normal(-n[i*3], -n[i*3 +1 ], -n[i*3 +2]);
- gl::vertex(v[i*3], v[i*3 +1 ], v[i*3 +2]);
+ 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];
- gl::normal(n[i*3], n[i*3 +1 ], n[i*3 +2]);
- gl::vertex(v[i*3] + n[i*3] * s, v[i*3 +1] + n[i*3 +1] * s, v[i*3 +2] + n[i*3+2] * s);
+ gl::normal(-n[0], -n[1], -n[2]);
+ gl::vertex(v[0], v[1], v[2]);
+
+ gl::normal(n[0], n[1], n[2]);
+ gl::vertex(v[0] + n[0] * s, v[1] + n[1] * s, v[2] + n[2] * s);
+
}
gl::end();
}
@@ -589,7 +589,6 @@ void draw_model_fragments(model::Model *model,
bool use_light = true; // gl::disable(GL_LIGHTING) is set
bool use_texture = false; // texturing
bool use_env = false; // environment mapping
- //bool use_color_array = true; // glEnableClientState(GL_COLOR_ARRAY) is set
// TODO this should probably be initialized somewhere else
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
@@ -1242,17 +1241,20 @@ void draw(float seconds)
}
// set vertex array pointers
- glVertexPointer(3, GL_FLOAT, 0, core::game()->vertexarray()->vertex());
- glNormalPointer(GL_FLOAT, 0, core::game()->vertexarray()->normal());
- glTexCoordPointer(3, GL_FLOAT, 0, core::game()->vertexarray()->texture());
-// glColorPointer(3, GL_FLOAT, sizeof(float) * (model::VERTEXSIZE - 3), core::game()->vertexarray()->color());
+ glInterleavedArrays(GL_T2F_N3F_V3F, 0, core::game()->vertexarray()->ptr());
+
+ /*
+ // this doesnt work
+ glTexCoordPointer(2, GL_FLOAT, 6 * sizeof(float), core::game()->vertexarray()->ptr());
+ glNormalPointer(GL_FLOAT, 5 * sizeof(float), &core::game()->vertexarray()->ptr()[2]);
+ glVertexPointer(3, GL_FLOAT, 5 * sizeof(float), &core::game()->vertexarray()->ptr()[5]);
+ */
// enable vertex arrays
- glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
-// glDisableClientState(GL_COLOR_ARRAY);
-
+ glEnableClientState(GL_VERTEX_ARRAY);
+
gl::disable(GL_DEPTH_TEST);
gl::depthmask(GL_FALSE); // disable depth buffer writing