00001 00012 /*************************************************************************** 00013 * Copyright (C) 2007 by Jan Koci * 00014 * honza.koci@email.cz * 00015 * http://kengine.sourceforge.net/tutorial/ 00016 * * 00017 * This program is free software; you can redistribute it and/or modify * 00018 * it under the terms of the GNU General Public License as published by * 00019 * the Free Software Foundation; either version 2 of the License, or * 00020 * (at your option) any later version. * 00021 * * 00022 * This program is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00025 * GNU General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU General Public License * 00028 * along with this program; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00031 ***************************************************************************/ 00032 00033 #pragma once 00034 00035 #include "K3dTriangle.h" 00036 #include "../System/K3dString.h" 00037 #include "../GLRenderer/K3dColor4.h" 00038 00039 #include <vector> 00040 using namespace std; 00041 00042 class K3dFace 00043 { 00044 TVertexArray m_vVertex; 00045 TVertexArray::iterator m_itVertex; 00046 K3dVector3Obj *m_pNormal; 00047 K3dColor4 *m_pColor; 00048 K3dVector3Obj *m_pCentre; 00049 bool m_bIsBlend; 00050 public: 00051 K3dFace(); 00052 ~K3dFace(); 00053 00055 TVertexArray &GetVertexArray() 00056 { 00057 return m_vVertex; 00058 } 00059 00061 void AddVertex ( K3dVertexObj*_pVertex ) 00062 { 00063 m_vVertex.push_back ( _pVertex ); 00064 } 00065 00067 void DeleteVertex ( K3dVertexObj *_pVertex ) 00068 { 00069 m_itVertex = find ( m_vVertex.begin(), m_vVertex.end(), _pVertex ); 00070 if ( m_itVertex != m_vVertex.end() ) 00071 { 00072 m_vVertex.erase ( m_itVertex ); 00073 } 00074 else 00075 { 00076 cerr << "K3dPoly::DeleteVertex -- Vertex " << _pVertex << " doesn't exists " << endl; 00077 } 00078 } 00079 00082 K3dColor4* GetColor() 00083 { 00084 return m_pColor; 00085 } 00086 00089 void SetColor ( K3dColor4* _pColor ) 00090 { 00091 m_pColor = _pColor; 00092 } 00093 00095 bool &IsBlend() 00096 { 00097 return m_bIsBlend; 00098 } 00099 00101 K3dVector3Obj* GetNormal() 00102 { 00103 return m_pNormal; 00104 } 00105 00107 const K3dVector3Obj* GetNormal() const 00108 { 00109 return m_pNormal; 00110 } 00111 00113 void SetNormal ( K3dVector3Obj* _pNormal ) 00114 { 00115 m_pNormal = _pNormal; 00116 } 00117 00119 K3dVector3Obj* GetCentre() 00120 { 00121 return m_pCentre; 00122 } 00123 00125 const K3dVector3Obj* GetCentre() const 00126 { 00127 return m_pCentre; 00128 } 00129 00131 void SetCentre ( K3dVector3Obj* _pCentre ) 00132 { 00133 m_pCentre = _pCentre; 00134 } 00135 }; 00136