Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

polygon.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                    polygon.h  -  Polygon and edge primitives
00003                              -------------------
00004     begin                : Fri Nov 2 2001
00005     copyright            : (C) 2001 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, polygon.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2001
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NEPOLYGON_H
00028 #define __NEPOLYGON_H
00029 
00030 #include "base.h"
00031 #include "util.h"
00032 
00033 
00040 namespace NeoEngine
00041 {
00042 
00043 
00048 class NEOENGINE_API Polygon
00049 {
00050     public:
00051 
00053         unsigned short                                v[3];
00054 
00057                                                       Polygon() {}
00058 
00064                                                       Polygon( unsigned short v0, unsigned short v1, unsigned short v2 ) { v[0] = v0; v[1] = v1; v[2] = v2; }
00065 
00069                                                       Polygon( unsigned short *pusIndices ) { fmemcpy( v, pusIndices, sizeof( unsigned short ) * 3 ); }
00070                                        
00074                                                       Polygon( const Polygon &rkPoly ) { fmemcpy( v, rkPoly.v, sizeof( unsigned short ) * 3 ); }
00075                                        
00080         inline unsigned short                        &operator []( int iIndex ) { return v[iIndex]; }
00081 
00086         inline Polygon                               &operator = ( const Polygon &rkPoly ) { v[0] = rkPoly.v[0]; v[1] = rkPoly.v[1]; v[2] = rkPoly.v[2]; return( *this ); }
00087 
00093         inline bool                                   operator == ( const Polygon &rkPoly ) const { return( ( v[0] == rkPoly.v[0] ) && ( v[1] == rkPoly.v[1] ) && ( v[2] == rkPoly.v[2] ) ); }
00094 
00100         inline bool                                   operator < ( const Polygon &rkPoly ) const { return false; }
00101 };
00102 
00103 
00113 class NEOENGINE_API Edge
00114 {
00115     public:
00116 
00118         unsigned short                                m_usVertices[2];
00119 
00121         unsigned int                                  m_uiPolygon;
00122 
00124         Edge                                         *m_pkNeighbour;
00125 
00127         int                                           m_iVisible;
00128 
00132                                                       Edge() { m_usVertices[0] = m_usVertices[1] = 0; m_uiPolygon = 0; m_pkNeighbour = 0; m_iVisible = 0; }
00133 };
00134 
00135 
00136 };
00137 
00138 
00139 #endif

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5