Changeset 3492 for trunk/packages/vizservers/nanovis/ConvexPolygon.cpp
- Timestamp:
- Mar 13, 2013, 9:57:03 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/ConvexPolygon.cpp
r3452 r3492 21 21 #include "Trace.h" 22 22 23 using namespace vrmath; 24 23 25 ConvexPolygon::ConvexPolygon(VertexVector newvertices) 24 26 { … … 27 29 28 30 void 29 ConvexPolygon::transform(const Mat 4x4& mat)31 ConvexPolygon::transform(const Matrix4x4d& mat) 30 32 { 31 33 VertexVector tmp = vertices; … … 33 35 34 36 for (unsigned int i = 0; i < tmp.size(); i++) { 35 Vector4 vec = tmp[i];37 Vector4f vec = tmp[i]; 36 38 vertices.push_back(mat.transform(vec)); 37 39 } … … 39 41 40 42 void 41 ConvexPolygon::translate(const Vector4 & shift)43 ConvexPolygon::translate(const Vector4f& shift) 42 44 { 43 45 VertexVector tmp = vertices; … … 45 47 46 48 for (unsigned int i = 0; i < tmp.size(); i++) { 47 Vector4 vec = tmp[i];48 vertices.push_back(vec +shift);49 Vector4f vec = tmp[i]; 50 vertices.push_back(vec + shift); 49 51 } 50 52 } … … 54 56 55 57 bool 56 ConvexPolygon::clip( Plane& clipPlane, bool copyToTexcoord)58 ConvexPolygon::clip(nv::Plane& clipPlane, bool copyToTexcoord) 57 59 { 58 60 if (vertices.size() == 0) { … … 74 76 // add it to the new list as well. 75 77 76 Vector4 plane = clipPlane.getCoeffs();78 Vector4f plane = clipPlane.getCoeffs(); 77 79 78 80 // This implementation is based on the Mesa 3D library (MIT license) … … 149 151 150 152 void 151 ConvexPolygon::emit(bool useTexture, const Vector3 & shift, const Vector3& scale)153 ConvexPolygon::emit(bool useTexture, const Vector3f& shift, const Vector3f& scale) 152 154 { 153 155 if (vertices.size() >= 3) { … … 156 158 glTexCoord4fv((float *)&(vertices[i])); 157 159 } 158 Vector4 tmp = (vertices[i]);159 Vector4 shift_4d = Vector4(shift.x, shift.y, shift.z, 0);160 Vector4f tmp = (vertices[i]); 161 Vector4f shift_4d = Vector4f(shift.x, shift.y, shift.z, 0); 160 162 tmp = tmp + shift_4d; 161 163 tmp.x = tmp.x * scale.x;
Note: See TracChangeset
for help on using the changeset viewer.