tavli
diff src/object.cc @ 11:a8e26f163f99
poulia
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 27 Jun 2015 08:01:51 +0300 |
parents | a0d30f6f20d4 |
children | 283eb6e9f0a3 |
line diff
1.1 --- a/src/object.cc Fri Jun 26 05:41:18 2015 +0300 1.2 +++ b/src/object.cc Sat Jun 27 08:01:51 2015 +0300 1.3 @@ -90,6 +90,72 @@ 1.4 glPopMatrix(); 1.5 } 1.6 1.7 +void Object::draw_wire(const Vector4 &col) const 1.8 +{ 1.9 + glPushAttrib(GL_ENABLE_BIT); 1.10 + glDisable(GL_LIGHTING); 1.11 + 1.12 + glMatrixMode(GL_MODELVIEW); 1.13 + glPushMatrix(); 1.14 + glMultTransposeMatrixf(matrix[0]); 1.15 + 1.16 + glColor4f(col.x, col.y, col.z, col.w); 1.17 + mesh->draw_wire(); 1.18 + 1.19 + glPopMatrix(); 1.20 + glPopAttrib(); 1.21 +} 1.22 + 1.23 +void Object::draw_vertices(const Vector4 &col) const 1.24 +{ 1.25 + glPushAttrib(GL_ENABLE_BIT); 1.26 + glDisable(GL_LIGHTING); 1.27 + 1.28 + glMatrixMode(GL_MODELVIEW); 1.29 + glPushMatrix(); 1.30 + glMultTransposeMatrixf(matrix[0]); 1.31 + 1.32 + glColor4f(col.x, col.y, col.z, col.w); 1.33 + mesh->draw_vertices(); 1.34 + 1.35 + glPopMatrix(); 1.36 + glPopAttrib(); 1.37 +} 1.38 + 1.39 +void Object::draw_normals(float len, const Vector4 &col) const 1.40 +{ 1.41 + glPushAttrib(GL_ENABLE_BIT); 1.42 + glDisable(GL_LIGHTING); 1.43 + 1.44 + glMatrixMode(GL_MODELVIEW); 1.45 + glPushMatrix(); 1.46 + glMultTransposeMatrixf(matrix[0]); 1.47 + 1.48 + glColor4f(col.x, col.y, col.z, col.w); 1.49 + mesh->set_vis_vecsize(len); 1.50 + mesh->draw_normals(); 1.51 + 1.52 + glPopMatrix(); 1.53 + glPopAttrib(); 1.54 +} 1.55 + 1.56 +void Object::draw_tangents(float len, const Vector4 &col) const 1.57 +{ 1.58 + glPushAttrib(GL_ENABLE_BIT); 1.59 + glDisable(GL_LIGHTING); 1.60 + 1.61 + glMatrixMode(GL_MODELVIEW); 1.62 + glPushMatrix(); 1.63 + glMultTransposeMatrixf(matrix[0]); 1.64 + 1.65 + glColor4f(col.x, col.y, col.z, col.w); 1.66 + mesh->set_vis_vecsize(len); 1.67 + mesh->draw_tangents(); 1.68 + 1.69 + glPopMatrix(); 1.70 + glPopAttrib(); 1.71 +} 1.72 + 1.73 bool Object::intersect(const Ray &ray, HitPoint *hit) const 1.74 { 1.75 return false; // TODO