summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmesh/QuadTriMesh.cpp
blob: 64a071abe99b2f72716b3687efa3e240f84c5a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>

#include "QuadTriMesh.h"
#include "Stream.h"

using namespace nv;


bool QuadTriMesh::isQuadFace(uint i) const 
{ 
    return m_faceArray[i].isQuadFace();
}

const QuadTriMesh::Vertex & QuadTriMesh::faceVertex(uint f, uint v) const 
{
    if (isQuadFace(f)) nvDebugCheck(v < 4);
    else nvDebugCheck(v < 3);

    const Face & face = this->faceAt(f);
    return this->vertexAt(face.v[v]);
}


namespace nv
{
    static Stream & operator<< (Stream & s, QuadTriMesh::Face & face)
    {
        return s << face.id << face.v[0] << face.v[1] << face.v[2] << face.v[3];
    }

    Stream & operator<< (Stream & s, QuadTriMesh & mesh)
    {
        return s << mesh.m_faceArray << (BaseMesh &) mesh;
    }
}