K3dPlaneVis.h

Go to the documentation of this file.
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 "K3dPlane.h"
00036 #include "../GLRenderer/K3dColor3.h"
00037 #include "../System/GameData/K3dVector3Data.h"
00038 
00039 
00040 class K3dPlaneVis: public K3dPlane
00041 {
00042                 TVector3Array m_vVertex;                                
00043                 TVector3Array::iterator m_itVertex;             
00044                 K3dColor3 *m_pColor;                                    
00045                 float m_fWidth;                                                 
00046                 float m_fHeight;                                                
00047         public:
00048                 K3dPlaneVis();
00049                 ~K3dPlaneVis();
00050 
00051                 K3dPlaneVis& operator= ( K3dPlaneVis& _rkPlaneVis );
00052 
00054                 TVector3Array &GetVertexArray()
00055                 {
00056                         return m_vVertex;
00057                 }
00058 
00060                 void AddVertex ( K3dVector3Obj *_pVertex )
00061                 {
00062                         if ( m_vVertex.size() > 4 )
00063                         {
00064                                 cerr << "Error in K3dPlaneVis::AddVertex -- Max number of plane vertices must be 4. Now you adding 5 vertex !!!" << endl;
00065                         }
00066                         else
00067                         {
00068                                 m_vVertex.push_back ( _pVertex );
00069                         }
00070                 }
00071 
00073                 void DeleteVertex ( K3dVector3Obj *_pVertex )
00074                 {
00075                         m_itVertex = find ( m_vVertex.begin(), m_vVertex.end(), _pVertex );
00076                         if ( m_itVertex != m_vVertex.end() )
00077                         {
00078                                 m_vVertex.erase ( m_itVertex );
00079                         }
00080                         else
00081                         {
00082                                 cerr <<  "Error - K3dPlaneVis::DeleteVertex() -- Vertex  " << _pVertex << " doesn't exists " << endl;
00083                         }
00084                 }
00085 
00087                 void DeleteVertexArray()
00088                 {
00089                         m_vVertex.clear();
00090                 }
00091 
00093                 K3dColor3 *GetColor()
00094                 {
00095                         return m_pColor;
00096                 }
00097 
00099                 void SetColor ( K3dColor3 *_pColor )
00100                 {
00101                         m_pColor = _pColor;
00102                 }
00103 
00105                 float &GetWidth()
00106                 {
00107                         return m_fWidth;
00108                 }
00109 
00111                 float &GetHeight()
00112                 {
00113                         return m_fHeight;
00114                 }
00115 };
00116 
00117 

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