dungeon_crawler
diff prototype/src/mesh.cc @ 7:8fb37db44fd8
first person motion
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 17 Aug 2012 14:29:37 +0300 |
parents | 252a00508411 |
children | 22562582c82d |
line diff
1.1 --- a/prototype/src/mesh.cc Tue Aug 14 08:49:38 2012 +0300 1.2 +++ b/prototype/src/mesh.cc Fri Aug 17 14:29:37 2012 +0300 1.3 @@ -16,6 +16,11 @@ 1.4 destroy(); 1.5 } 1.6 1.7 +void Mesh::set_name(const char *name) 1.8 +{ 1.9 + this->name = name; 1.10 +} 1.11 + 1.12 const char *Mesh::get_name() const 1.13 { 1.14 return name.c_str(); 1.15 @@ -83,6 +88,16 @@ 1.16 tang_loc = -1; 1.17 } 1.18 1.19 +void Mesh::set_xform(const Matrix4x4 &mat) 1.20 +{ 1.21 + xform = mat; 1.22 +} 1.23 + 1.24 +const Matrix4x4 &Mesh::get_xform() const 1.25 +{ 1.26 + return xform; 1.27 +} 1.28 + 1.29 void Mesh::set_attrib_location(int attr, int loc) 1.30 { 1.31 if(attr == MESH_ATTR_TANGENT) { 1.32 @@ -97,6 +112,10 @@ 1.33 1.34 void Mesh::draw() const 1.35 { 1.36 + glMatrixMode(GL_MODELVIEW); 1.37 + glPushMatrix(); 1.38 + mult_matrix(xform); 1.39 + 1.40 glBindBuffer(GL_ARRAY_BUFFER, vbo[MESH_ATTR_VERTEX]); 1.41 glVertexPointer(3, GL_FLOAT, 0, 0); 1.42 glEnableClientState(GL_VERTEX_ARRAY); 1.43 @@ -126,4 +145,6 @@ 1.44 if(tang_loc >= 0) { 1.45 glDisableVertexAttribArray(tang_loc); 1.46 } 1.47 + 1.48 + glPopMatrix(); 1.49 }