Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

RAS_Polygon.h

Go to the documentation of this file.
00001 #ifndef __RAS_POLYGON
00002 #define __RAS_POLYGON
00003 
00004 #include "RAS_TexVert.h"
00005 //#include "KX_BoundingVolumes.h"
00006 #include "RAS_MaterialBucket.h"
00007 
00008 #include <vector>
00009 using namespace std;
00010 
00011 
00012 //
00013 // Bitfield that stores the flags for each CValue derived class
00014 //
00015 struct PolygonFlags {
00016         PolygonFlags() :
00017                 Visible(true),
00018                 Collider(true)
00019         {
00020         }
00021         unsigned char Visible : 1;
00022         unsigned char Collider : 1;
00023         //int Visible : 1;
00024         //int Collider : 1;
00025 };
00026 
00027 class RAS_Polygon
00028 {
00029         RAS_MaterialBucket*                     m_bucket;
00030         KX_VertexIndex                          m_vertexindexbase;
00031         int                                                     m_edgecode;
00032         int                                                     m_numverts;
00033         PolygonFlags                            m_polyFlags;
00034         //PolygonFlags                          m_polyFlags2;
00035         //PolygonFlags                          m_polyFlags3;
00036         //PolygonFlags                          m_polyFlags4;
00037         
00038 
00039 public:
00040         RAS_Polygon(RAS_MaterialBucket* bucket,bool visible,int numverts,int vtxarrayindex) 
00041                 :m_bucket(bucket),
00042                 m_numverts(numverts),
00043                 m_edgecode(0),
00044                 m_vertexindexbase(numverts)

00045         {
00046                 int size = sizeof(RAS_Polygon);
00047                 m_vertexindexbase.m_vtxarray = vtxarrayindex ;//m_bucket->FindVertexArray(numverts);
00048                 m_polyFlags.Visible = visible;
00049         };
00050         virtual ~RAS_Polygon() {};
00051         
00052 //      RAS_TexVert* GetVertex(int index);
00053         int VertexCount() {             return m_numverts;      }
00054 
00055         inline void     SetVertex(int i,int vertexindex ) //const MT_Point3& xyz,const MT_Point2& uv,const unsigned int rgbacolor,const MT_Vector3& normal)
00056         {
00057 
00058                 m_vertexindexbase.SetIndex(i,vertexindex); //m_bucket->FindOrAddVertex(m_vertexindexbase.m_vtxarray,
00059                         //xyz,uv,rgbacolor,normal));
00060         }
00061         
00062         const KX_VertexIndex& GetIndexBase() { return m_vertexindexbase;};
00063 
00064         inline void     SetVisibleWireframeEdges(int edgecode) {m_edgecode = edgecode;};
00065         // each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc.
00066         inline int GetEdgeCode() { return m_edgecode;};
00067         
00068         bool    IsVisible() { return m_polyFlags.Visible;};
00069         bool    IsCollider() { return m_polyFlags.Collider;};
00070         void    SetCollider(bool col) { m_polyFlags.Collider = col;};
00071 
00072         KX_VertexIndex&         GetVertexIndexBase() { return m_vertexindexbase;}
00073 
00074         RAS_MaterialBucket*     GetMaterial() { return m_bucket;};
00075 
00076 };
00077 #endif

Generated at Thu Feb 1 13:03:09 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000