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

mesh.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                        mesh.h  -  Mesh highlevel class
00003                              -------------------
00004     begin                : Thu Nov 1 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, mesh.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 __NEMESH_H
00028 #define __NEMESH_H
00029 
00030 
00037 #include "base.h"
00038 #include "pointer.h"
00039 #include "sceneentity.h"
00040 #include "pool.h"
00041 
00042 #include <vector>
00043 #include <string>
00044 
00045 
00046 namespace NeoEngine
00047 {
00048 
00049 
00050 // External classes
00051 class SubMesh;
00052 class Skeleton;
00053 
00054 
00055 // Forward declarations
00056 class Mesh;
00057 class MeshEntity;
00058 
00059 #ifdef WIN32
00060 #  ifndef __HAVE_VECTOR_NESUBMESH
00061      UDTVectorEXPIMP( class SubMesh* );
00062 #    define __HAVE_VECTOR_NESUBMESH
00063 #  endif
00064 #endif
00065 
00066 
00067 PoolExport( Mesh );
00068 
00069 typedef Pool< Mesh > MeshPool;
00070 
00071 
00076 class NEOENGINE_API Mesh : public RefCounter
00077 {
00078     protected:
00079 
00081         MeshPool                                     *m_pkPool;
00082 
00084         HashString                                    m_strName;
00085 
00086 
00087     public:
00088     
00090         std::vector< SubMesh* >                       m_vpkSubMeshes;
00091 
00093         Skeleton                                     *m_pkSkeleton;
00094         
00095 
00100                                                       Mesh( const HashString &rstrName = "", MeshPool *pkPool = 0 );
00101 
00104         virtual                                      ~Mesh();
00105 
00109         inline const HashString                      &GetName() const { return m_strName; }
00110 
00115         void                                          SetName( const HashString &rstrName );
00116 };
00117 
00118 
00119 SmartPointer( Mesh );
00120 
00121 
00127 class NEOENGINE_API MeshEntity : public SceneEntity
00128 {
00129     public:
00130 
00131         DefineVisitable()
00132 
00133 
00134     public:
00135 
00139         enum MESHFLAG
00140         {
00141           NOFLAGS                                     = 0x00000000,
00142 
00144           VOLUMEINTERSECTION                          = 0x00000001,
00145 
00147           AUTOGENVOLUME                               = 0x00000002
00148         };
00149 
00150 
00151     protected:
00152 
00154         MeshPtr                                       m_pkMesh;
00155 
00157         Skeleton                                     *m_pkSkeleton;
00158         
00160         std::vector< SubMesh* >                       m_vpkSubMeshes;
00161 
00163         unsigned int                                  m_uiFlags;
00164 
00165 
00169         virtual void                                  SetNode();
00170 
00171 
00172     public:
00173 
00177                                                       MeshEntity( const MeshPtr &pkMesh );
00178 
00182                                                       MeshEntity( MeshEntity &rkMesh );
00183 
00186         virtual                                      ~MeshEntity();
00187 
00194         virtual bool                                  Render( Frustum *pkFrustum = 0, bool bForce = false );
00195 
00200         virtual void                                  Update( float fDeltaTime );
00201 
00206         virtual SceneEntity                          *Duplicate();
00207 
00215         virtual bool                                  Intersection( BoundingVolume *pkObj, ContactSet *pkContactSet = 0, bool bInvertNormal = false );
00216 
00223         virtual bool                                  Intersection( const Ray &rkRay, ContactSet *pkContactSet = 0 );
00224 
00229         void                                          SetSubMeshAnimation( const HashString &rstrAnimation );
00230 
00235         void                                          SetSubMeshAnimation( unsigned int uiAnimation );
00236 
00241         virtual void                                  SetFlags( unsigned int uiFlags );
00242 
00247         virtual void                                  ResetFlags( unsigned int uiFlags );
00248 
00252         inline const std::vector< SubMesh* >         &GetSubMeshes() const { return m_vpkSubMeshes; }
00253 
00257         inline Skeleton                              *GetSkeleton() { return m_pkSkeleton; }
00258 
00262         inline MeshPtr                                GetMesh() { return m_pkMesh; }
00263 
00267         void                                          GenerateBoundingVolume();
00268 };
00269 
00270 
00271 };
00272 
00273 
00274 #endif

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