1 /**************************************************************************/ 2 /* Copyright 2009 Tim Day */ 3 /* */ 4 /* This file is part of Fracplanet */ 5 /* */ 6 /* Fracplanet is free software: you can redistribute it and/or modify */ 7 /* it under the terms of the GNU General Public License as published by */ 8 /* the Free Software Foundation, either version 3 of the License, or */ 9 /* (at your option) any later version. */ 10 /* */ 11 /* Fracplanet is distributed in the hope that it will be useful, */ 12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ 14 /* GNU General Public License for more details. */ 15 /* */ 16 /* You should have received a copy of the GNU General Public License */ 17 /* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */ 18 /**************************************************************************/ 19 20 /*! \file 21 \brief Interface for class Triangle. 22 */ 23 24 #ifndef _triangle_h_ 25 #define _triangle_h_ 26 27 #include "common.h" 28 #include "rgb.h" 29 #include "xyz.h" 30 31 //! Class to store triangle state. 32 /*! There is no direct access to members. 33 Should probably be a protected member class of TriangleMesh. 34 */ 35 class Triangle 36 { 37 public: 38 Triangle()39 Triangle() 40 {} 41 Triangle(uint v0,uint v1,uint v2)42 Triangle(uint v0,uint v1,uint v2) 43 { 44 _vertex[0]=v0; 45 _vertex[1]=v1; 46 _vertex[2]=v2; 47 } 48 Triangle(const Triangle & t)49 Triangle(const Triangle& t) 50 { 51 _vertex[0]=t.vertex(0); 52 _vertex[1]=t.vertex(1); 53 _vertex[2]=t.vertex(2); 54 } 55 56 //! Return a reference to the vertex because GL will want it's address vertex(uint i)57 const uint& vertex(uint i) const 58 { 59 return _vertex[i]; 60 } 61 62 protected: 63 64 uint _vertex[3]; 65 }; 66 67 #endif 68