00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://ogre.sourceforge.net/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __Entity_H__ 00026 #define __Entity_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 #include "OgreCommon.h" 00030 00031 #include "OgreString.h" 00032 #include "OgreMovableObject.h" 00033 #include "OgreAnimationState.h" 00034 #include "OgreQuaternion.h" 00035 #include "OgreVector3.h" 00036 00037 00038 namespace Ogre { 00070 class _OgreExport Entity: public MovableObject 00071 { 00072 // Allow SceneManager full access 00073 friend class SceneManager; 00074 friend class SubEntity; 00075 private: 00076 00079 Entity(); 00082 Entity( const String& name, Mesh* mesh, SceneManager* creator); 00083 00086 String mName; 00087 00090 Mesh* mMesh; 00091 00094 typedef std::vector<SubEntity*> SubEntityList; 00095 SubEntityList mSubEntityList; 00096 00100 SceneManager* mCreatorSceneManager; 00101 00102 00104 AnimationStateSet mAnimationState; 00105 00107 static String msMovableType; 00108 00109 00111 Matrix4 *mBoneMatrices; 00112 unsigned short mNumBoneMatrices; 00113 00115 void cacheBoneMatrices(void); 00116 00118 bool mDisplaySkeleton; 00119 00120 00122 ushort mMeshLodIndex; 00123 00125 Real mMeshLodFactorInv; 00127 ushort mMinMeshLodIndex; 00129 ushort mMaxMeshLodIndex; 00130 00132 Real mMaterialLodFactorInv; 00134 ushort mMinMaterialLodIndex; 00136 ushort mMaxMaterialLodIndex; 00137 00139 bool mUsingManualLOD; 00144 typedef std::vector<SubEntityList*> LODSubEntityList; 00145 LODSubEntityList mLodSubEntityList; 00146 00148 void buildSubEntityList(Mesh* mesh, SubEntityList* sublist); 00149 00151 void attachObjectImpl(MovableObject *pMovable, TagPoint *pAttachingPoint); 00152 00153 public: 00155 typedef std::map<String, MovableObject*> ChildObjectList; 00156 protected: 00157 ChildObjectList mChildObjectList; 00158 00159 00161 AxisAlignedBox *mFullBoundingBox; 00162 00163 bool mNormaliseNormals; 00164 00165 00166 public: 00169 ~Entity(); 00170 00173 Mesh* getMesh(void); 00174 00177 SubEntity* getSubEntity(unsigned int index); 00178 00182 SubEntity* getSubEntity( const String& name ); 00183 00186 unsigned int getNumSubEntities(void) const; 00187 00197 Entity* clone( const String& newName ); 00198 00207 void setMaterialName(const String& name); 00208 00211 void _notifyCurrentCamera(Camera* cam); 00212 00215 const AxisAlignedBox& getBoundingBox(void) const; 00216 00218 AxisAlignedBox getChildObjectsBoundingBox(void) const; 00219 00222 void _updateRenderQueue(RenderQueue* queue); 00223 00225 const String& getName(void) const; 00226 00228 const String& getMovableType(void) const; 00229 00236 AnimationState* getAnimationState(const String& name); 00243 AnimationStateSet* getAllAnimationStates(void); 00244 00247 void setDisplaySkeleton(bool display); 00248 00249 00276 void setMeshLodBias(Real factor, ushort maxDetailIndex = 0, ushort minDetailIndex = 99); 00277 00304 void setMaterialLodBias(Real factor, ushort maxDetailIndex = 0, ushort minDetailIndex = 99); 00305 00307 void setRenderDetail(SceneDetailLevel renderDetail); 00308 00319 void attachObjectToBone(const String &boneName, MovableObject *pMovable, const Quaternion &offsetOrientation = Quaternion::IDENTITY, const Vector3 &offsetPosition = Vector3::ZERO); 00320 00322 MovableObject* detachObjectFromBone(const String &movableName); 00323 00324 typedef MapIterator<ChildObjectList> ChildObjectListIterator; 00326 ChildObjectListIterator getAttachedObjectIterator(void); 00328 Real getBoundingRadius(void) const; 00337 void setNormaliseNormals(bool normalise) { mNormaliseNormals = normalise; } 00338 00340 bool getNormaliseNormals(void) const {return mNormaliseNormals; } 00341 00342 00343 }; 00344 00345 } // namespace 00346 00347 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:10 2004