K3dTriangle.h

Go to the documentation of this file.
00001 
00013 /***************************************************************************
00014  *   Copyright (C) 2007 by Jan Koci   *
00015  *   honza.koci@email.cz   *
00016  *   http://kengine.sourceforge.net/tutorial/
00017  *                                                                         *
00018  *   This program is free software; you can redistribute it and/or modify  *
00019  *   it under the terms of the GNU General Public License as published by  *
00020  *   the Free Software Foundation; either version 2 of the License, or     *
00021  *   (at your option) any later version.                                   *
00022  *                                                                         *
00023  *   This program is distributed in the hope that it will be useful,       *
00024  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00025  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00026  *   GNU General Public License for more details.                          *
00027  *                                                                         *
00028  *   You should have received a copy of the GNU General Public License     *
00029  *   along with this program; if not, write to the                         *
00030  *   Free Software Foundation, Inc.,                                       *
00031  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00032  ***************************************************************************/
00033 
00034 #pragma once
00035 
00036 #include "K3dVertexObj.h"
00037 
00038 class K3dTriangle
00039 {
00040                 K3dVector3Obj *m_pVertexArray[3];       
00041                 K3dVector3Obj *m_pNormal;       
00042                 K3dVector3Obj *m_pColor;        
00043                 K3dVector3Obj *m_pCentre;       
00044                 bool m_bIsBlend;        
00045         public:
00046                 K3dTriangle();
00048                 K3dTriangle ( K3dVector3Obj *_pV0, K3dVector3Obj *_pV1, K3dVector3Obj *_pV2 )
00049                 {
00050                         m_pVertexArray[0] = _pV0;
00051                         m_pVertexArray[1] = _pV1;
00052                         m_pVertexArray[2] = _pV2;
00053                 }
00054                 ~K3dTriangle();
00055 
00057                 void Reset();
00058 
00061                 K3dVector3Obj* GetColor()
00062                 {
00063                         return m_pColor;
00064                 }
00065 
00067                 void SetColor ( K3dVector3Obj* _pColor )
00068                 {
00069                         m_pColor = _pColor;
00070                 }
00071 
00073                 bool &GetIsBlend()
00074                 {
00075                         return m_bIsBlend;
00076                 }
00077 
00079                 K3dVector3Obj **GetVertexArray()
00080                 {
00081                         return m_pVertexArray;
00082                 }
00083 
00085                 K3dVector3Obj* GetNormal()
00086                 {
00087                         return m_pNormal;
00088                 }
00089 
00091                 const K3dVector3Obj* GetNormal() const
00092                 {
00093                         return m_pNormal;
00094                 }
00095 
00097                 void SetNormal ( K3dVector3Obj* _pNormal )
00098                 {
00099                         m_pNormal = _pNormal;
00100                 }
00101 
00103                 K3dVector3Obj* GetCentre()
00104                 {
00105                         return m_pCentre;
00106                 }
00107 
00109                 const K3dVector3Obj* GetCentre() const
00110                 {
00111                         return m_pCentre;
00112                 }
00113 
00115                 void SetCentre ( K3dVector3Obj* _pCentre )
00116                 {
00117                         m_pCentre = _pCentre;
00118                 }
00119 
00121                 const K3dVector3Obj* operator[] ( const int _id ) const
00122                 {
00123                         if ( ! ( 0 <= _id ) && ( _id < 3 ) )
00124                         {
00125                                 cerr << "K3dTriangle::int operator[]() -- Error index" << _id << endl;
00126                         }
00127                         return m_pVertexArray[_id];
00128                 }
00130                 K3dVector3 *operator[] ( const int _id )
00131                 {
00132                         if ( ! ( 0 <= _id ) && ( _id < 3 ) )
00133                         {
00134                                 cerr << "K3dTriangle::int operator[]() -- Error index" << _id << endl;
00135                         }
00136                         return m_pVertexArray[_id];
00137                 }
00138 
00140                 K3dVector3Obj *GetVertex ( const int _id )
00141                 {
00142                         if ( ! ( 0 <= _id ) && ( _id < 3 ) )
00143                         {
00144                                 cerr << "K3dTriangle::int operator[]() -- -- Error index" << _id << endl;
00145                         }
00146                         return m_pVertexArray[_id];
00147                 }
00148 
00149                 const K3dVector3Obj *GetVertex ( const int _id ) const
00150                 {
00151                         if ( ! ( 0 <= _id ) && ( _id < 3 ) )
00152                         {
00153                                 cerr << "K3dTriangle::int operator[]() -- Error index" << _id << endl;
00154                         }
00155                         return m_pVertexArray[_id];
00156                 }
00157 
00159                 void SetVertex ( const int _id, K3dVector3Obj *_pVertex )
00160                 {
00161                         m_pVertexArray[_id] = _pVertex;
00162                 }
00163 };

Generated on Thu Aug 16 23:53:26 2007 for K3dEngine by  doxygen 1.5.0