QuadTriMesh.cpp 780 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // This code is in the public domain -- Ignacio Castaño <castano@gmail.com>
  2. #include "QuadTriMesh.h"
  3. #include "Stream.h"
  4. using namespace nv;
  5. bool QuadTriMesh::isQuadFace(uint i) const
  6. {
  7. return m_faceArray[i].isQuadFace();
  8. }
  9. const QuadTriMesh::Vertex & QuadTriMesh::faceVertex(uint f, uint v) const
  10. {
  11. if (isQuadFace(f)) nvDebugCheck(v < 4);
  12. else nvDebugCheck(v < 3);
  13. const Face & face = this->faceAt(f);
  14. return this->vertexAt(face.v[v]);
  15. }
  16. namespace nv
  17. {
  18. static Stream & operator<< (Stream & s, QuadTriMesh::Face & face)
  19. {
  20. return s << face.id << face.v[0] << face.v[1] << face.v[2] << face.v[3];
  21. }
  22. Stream & operator<< (Stream & s, QuadTriMesh & mesh)
  23. {
  24. return s << mesh.m_faceArray << (BaseMesh &) mesh;
  25. }
  26. }