| [148] | 1 | /* | 
|---|
 | 2 | ----------------------------------------------------------------------------- | 
|---|
 | 3 | This source file is part of OGRE | 
|---|
 | 4 | (Object-oriented Graphics Rendering Engine) | 
|---|
 | 5 | For the latest info, see http://www.ogre3d.org | 
|---|
 | 6 |  | 
|---|
 | 7 | Copyright (c) 2000-2013 Torus Knot Software Ltd | 
|---|
 | 8 |  | 
|---|
 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy | 
|---|
 | 10 | of this software and associated documentation files (the "Software"), to deal | 
|---|
 | 11 | in the Software without restriction, including without limitation the rights | 
|---|
 | 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
|---|
 | 13 | copies of the Software, and to permit persons to whom the Software is | 
|---|
 | 14 | furnished to do so, subject to the following conditions: | 
|---|
 | 15 |  | 
|---|
 | 16 | The above copyright notice and this permission notice shall be included in | 
|---|
 | 17 | all copies or substantial portions of the Software. | 
|---|
 | 18 |  | 
|---|
 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
|---|
 | 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|---|
 | 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
|---|
 | 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
|---|
 | 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
|---|
 | 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
|---|
 | 25 | THE SOFTWARE. | 
|---|
 | 26 | ----------------------------------------------------------------------------- | 
|---|
 | 27 | */ | 
|---|
 | 28 | #ifndef __Entity_H__ | 
|---|
 | 29 | #define __Entity_H__ | 
|---|
 | 30 |  | 
|---|
 | 31 | #include "OgrePrerequisites.h" | 
|---|
 | 32 | #include "OgreCommon.h" | 
|---|
 | 33 |  | 
|---|
 | 34 | #include "OgreString.h" | 
|---|
 | 35 | #include "OgreMovableObject.h" | 
|---|
 | 36 | #include "OgreQuaternion.h" | 
|---|
 | 37 | #include "OgreVector3.h" | 
|---|
 | 38 | #include "OgreHardwareBufferManager.h" | 
|---|
 | 39 | #include "OgreMesh.h" | 
|---|
 | 40 | #include "OgreRenderable.h" | 
|---|
 | 41 | #include "OgreResourceGroupManager.h" | 
|---|
 | 42 | #include "OgreHeaderPrefix.h" | 
|---|
 | 43 |  | 
|---|
 | 44 | namespace Ogre { | 
|---|
 | 45 |     /** \addtogroup Core | 
|---|
 | 46 |     *  @{ | 
|---|
 | 47 |     */ | 
|---|
 | 48 |     /** \addtogroup Scene | 
|---|
 | 49 |     *  @{ | 
|---|
 | 50 |     */ | 
|---|
 | 51 |     /** Defines an instance of a discrete, movable object based on a Mesh. | 
|---|
 | 52 |     @remarks | 
|---|
 | 53 |         Ogre generally divides renderable objects into 2 groups, discrete | 
|---|
 | 54 |         (separate) and relatively small objects which move around the world, | 
|---|
 | 55 |         and large, sprawling geometry which makes up generally immovable | 
|---|
 | 56 |         scenery, aka 'level geometry'. | 
|---|
 | 57 |     @par | 
|---|
 | 58 |         The Mesh and SubMesh classes deal with the definition of the geometry | 
|---|
 | 59 |         used by discrete movable objects. Entities are actual instances of | 
|---|
 | 60 |         objects based on this geometry in the world. Therefore there is | 
|---|
 | 61 |         usually a single set Mesh for a car, but there may be multiple | 
|---|
 | 62 |         entities based on it in the world. Entities are able to override | 
|---|
 | 63 |         aspects of the Mesh it is defined by, such as changing material | 
|---|
 | 64 |         properties per instance (so you can have many cars using the same | 
|---|
 | 65 |         geometry but different textures for example). Because a Mesh is split | 
|---|
 | 66 |         into SubMeshes for this purpose, the Entity class is a grouping class | 
|---|
 | 67 |         (much like the Mesh class) and much of the detail regarding | 
|---|
 | 68 |         individual changes is kept in the SubEntity class. There is a 1:1 | 
|---|
 | 69 |         relationship between SubEntity instances and the SubMesh instances | 
|---|
 | 70 |         associated with the Mesh the Entity is based on. | 
|---|
 | 71 |     @par | 
|---|
 | 72 |         Entity and SubEntity classes are never created directly. Use the | 
|---|
 | 73 |         createEntity method of the SceneManager (passing a model name) to | 
|---|
 | 74 |         create one. | 
|---|
 | 75 |     @par | 
|---|
 | 76 |         Entities are included in the scene by associating them with a | 
|---|
 | 77 |         SceneNode, using the attachEntity method. See the SceneNode class | 
|---|
 | 78 |         for full information. | 
|---|
 | 79 |     @note | 
|---|
 | 80 |         No functions were declared virtual to improve performance. | 
|---|
 | 81 |     */ | 
|---|
 | 82 |     class _OgreExport Entity: public MovableObject, public Resource::Listener | 
|---|
 | 83 |     { | 
|---|
 | 84 |         // Allow EntityFactory full access | 
|---|
 | 85 |         friend class EntityFactory; | 
|---|
 | 86 |         friend class SubEntity; | 
|---|
 | 87 |     public: | 
|---|
 | 88 |          | 
|---|
 | 89 |         typedef set<Entity*>::type EntitySet; | 
|---|
 | 90 |         typedef map<unsigned short, bool>::type SchemeHardwareAnimMap; | 
|---|
 | 91 |  | 
|---|
 | 92 |     protected: | 
|---|
 | 93 |  | 
|---|
 | 94 |         /** Private constructor (instances cannot be created directly). | 
|---|
 | 95 |         */ | 
|---|
 | 96 |         Entity(); | 
|---|
 | 97 |         /** Private constructor - specify name (the usual constructor used). | 
|---|
 | 98 |         */ | 
|---|
 | 99 |         Entity( const String& name, const MeshPtr& mesh); | 
|---|
 | 100 |  | 
|---|
 | 101 |         /** The Mesh that this Entity is based on. | 
|---|
 | 102 |         */ | 
|---|
 | 103 |         MeshPtr mMesh; | 
|---|
 | 104 |  | 
|---|
 | 105 |         /** List of SubEntities (point to SubMeshes). | 
|---|
 | 106 |         */ | 
|---|
 | 107 |         typedef vector<SubEntity*>::type SubEntityList; | 
|---|
 | 108 |         SubEntityList mSubEntityList; | 
|---|
 | 109 |  | 
|---|
 | 110 |  | 
|---|
 | 111 |         /// State of animation for animable meshes | 
|---|
 | 112 |         AnimationStateSet* mAnimationState; | 
|---|
 | 113 |  | 
|---|
 | 114 |  | 
|---|
 | 115 |         /// Temp buffer details for software skeletal anim of shared geometry | 
|---|
 | 116 |         TempBlendedBufferInfo mTempSkelAnimInfo; | 
|---|
 | 117 |         /// Vertex data details for software skeletal anim of shared geometry | 
|---|
 | 118 |         VertexData* mSkelAnimVertexData; | 
|---|
 | 119 |         /// Temp buffer details for software vertex anim of shared geometry | 
|---|
 | 120 |         TempBlendedBufferInfo mTempVertexAnimInfo; | 
|---|
 | 121 |         /// Vertex data details for software vertex anim of shared geometry | 
|---|
 | 122 |         VertexData* mSoftwareVertexAnimVertexData; | 
|---|
 | 123 |         /// Vertex data details for hardware vertex anim of shared geometry | 
|---|
 | 124 |         /// - separate since we need to s/w anim for shadows whilst still altering | 
|---|
 | 125 |         ///   the vertex data for hardware morphing (pos2 binding) | 
|---|
 | 126 |         VertexData* mHardwareVertexAnimVertexData; | 
|---|
 | 127 |         /// Have we applied any vertex animation to shared geometry? | 
|---|
 | 128 |         bool mVertexAnimationAppliedThisFrame; | 
|---|
 | 129 |         /// Have the temp buffers already had their geometry prepared for use in rendering shadow volumes? | 
|---|
 | 130 |         bool mPreparedForShadowVolumes; | 
|---|
 | 131 |  | 
|---|
 | 132 |         /** Internal method - given vertex data which could be from the Mesh or | 
|---|
 | 133 |             any submesh, finds the temporary blend copy. | 
|---|
 | 134 |         */ | 
|---|
 | 135 |         const VertexData* findBlendedVertexData(const VertexData* orig); | 
|---|
 | 136 |         /** Internal method - given vertex data which could be from the Mesh or | 
|---|
 | 137 |             any SubMesh, finds the corresponding SubEntity. | 
|---|
 | 138 |         */ | 
|---|
 | 139 |         SubEntity* findSubEntityForVertexData(const VertexData* orig); | 
|---|
 | 140 |  | 
|---|
 | 141 |         /** Internal method for extracting metadata out of source vertex data | 
|---|
 | 142 |             for fast assignment of temporary buffers later. | 
|---|
 | 143 |         */ | 
|---|
 | 144 |         void extractTempBufferInfo(VertexData* sourceData, TempBlendedBufferInfo* info); | 
|---|
 | 145 |         /** Internal method to clone vertex data definitions but to remove blend buffers. */ | 
|---|
 | 146 |         VertexData* cloneVertexDataRemoveBlendInfo(const VertexData* source); | 
|---|
 | 147 |         /** Internal method for preparing this Entity for use in animation. */ | 
|---|
 | 148 |         void prepareTempBlendBuffers(void); | 
|---|
 | 149 |         /** Mark all vertex data as so far unanimated. | 
|---|
 | 150 |         */ | 
|---|
 | 151 |         void markBuffersUnusedForAnimation(void); | 
|---|
 | 152 |         /** Internal method to restore original vertex data where we didn't | 
|---|
 | 153 |             perform any vertex animation this frame. | 
|---|
 | 154 |         */ | 
|---|
 | 155 |         void restoreBuffersForUnusedAnimation(bool hardwareAnimation); | 
|---|
 | 156 |  | 
|---|
 | 157 |         /** Ensure that any unbound  pose animation buffers are bound to a safe | 
|---|
 | 158 |             default. | 
|---|
 | 159 |         @param srcData | 
|---|
 | 160 |             Original vertex data containing original positions. | 
|---|
 | 161 |         @param destData | 
|---|
 | 162 |             Hardware animation vertex data to be checked. | 
|---|
 | 163 |         */ | 
|---|
 | 164 |         void bindMissingHardwarePoseBuffers(const VertexData* srcData,  | 
|---|
 | 165 |             VertexData* destData); | 
|---|
 | 166 |              | 
|---|
 | 167 |         /** When performing software pose animation, initialise software copy | 
|---|
 | 168 |             of vertex data. | 
|---|
 | 169 |         */ | 
|---|
 | 170 |         void initialisePoseVertexData(const VertexData* srcData, VertexData* destData,  | 
|---|
 | 171 |             bool animateNormals); | 
|---|
 | 172 |  | 
|---|
 | 173 |         /** When animating normals for pose animation, finalise normals by filling in | 
|---|
 | 174 |             with the reference mesh normal where applied normal weights < 1. | 
|---|
 | 175 |         */ | 
|---|
 | 176 |         void finalisePoseNormals(const VertexData* srcData, VertexData* destData); | 
|---|
 | 177 |  | 
|---|
 | 178 |         /// Cached bone matrices, including any world transform. | 
|---|
 | 179 |         Matrix4 *mBoneWorldMatrices; | 
|---|
 | 180 |         /// Cached bone matrices in skeleton local space, might shares with other entity instances. | 
|---|
 | 181 |         Matrix4 *mBoneMatrices; | 
|---|
 | 182 |         unsigned short mNumBoneMatrices; | 
|---|
 | 183 |         /// Records the last frame in which animation was updated. | 
|---|
 | 184 |         unsigned long mFrameAnimationLastUpdated; | 
|---|
 | 185 |  | 
|---|
 | 186 |         /// Perform all the updates required for an animated entity. | 
|---|
 | 187 |         void updateAnimation(void); | 
|---|
 | 188 |  | 
|---|
 | 189 |         /// Records the last frame in which the bones was updated. | 
|---|
 | 190 |         /// It's a pointer because it can be shared between different entities with | 
|---|
 | 191 |         /// a shared skeleton. | 
|---|
 | 192 |         unsigned long *mFrameBonesLastUpdated; | 
|---|
 | 193 |  | 
|---|
 | 194 |         /** A set of all the entities which shares a single SkeletonInstance. | 
|---|
 | 195 |             This is only created if the entity is in fact sharing it's SkeletonInstance with | 
|---|
 | 196 |             other Entities. | 
|---|
 | 197 |         */ | 
|---|
 | 198 |         EntitySet* mSharedSkeletonEntities; | 
|---|
 | 199 |  | 
|---|
 | 200 |         /** Private method to cache bone matrices from skeleton. | 
|---|
 | 201 |         @return | 
|---|
 | 202 |             True if the bone matrices cache has been updated. False if note. | 
|---|
 | 203 |         */ | 
|---|
 | 204 |         bool cacheBoneMatrices(void); | 
|---|
 | 205 |  | 
|---|
 | 206 |         /// Flag determines whether or not to display skeleton. | 
|---|
 | 207 |         bool mDisplaySkeleton; | 
|---|
 | 208 |         /** Flag indicating whether hardware animation is supported by this entities materials | 
|---|
 | 209 |             data is saved per scehme number. | 
|---|
 | 210 |         */ | 
|---|
 | 211 |         SchemeHardwareAnimMap mSchemeHardwareAnim; | 
|---|
 | 212 |  | 
|---|
 | 213 |         /// Current state of the hardware animation as represented by the entities parameters. | 
|---|
 | 214 |         bool mCurrentHWAnimationState; | 
|---|
 | 215 |  | 
|---|
 | 216 |         /// Number of hardware poses supported by materials. | 
|---|
 | 217 |         ushort mHardwarePoseCount; | 
|---|
 | 218 |         /// Flag indicating whether we have a vertex program in use on any of our subentities. | 
|---|
 | 219 |         bool mVertexProgramInUse; | 
|---|
 | 220 |         /// Counter indicating number of requests for software animation. | 
|---|
 | 221 |         int mSoftwareAnimationRequests; | 
|---|
 | 222 |         /// Counter indicating number of requests for software blended normals. | 
|---|
 | 223 |         int mSoftwareAnimationNormalsRequests; | 
|---|
 | 224 |         /// Flag indicating whether to skip automatic updating of the Skeleton's AnimationState. | 
|---|
 | 225 |         bool mSkipAnimStateUpdates; | 
|---|
 | 226 |         /// Flag indicating whether to update the main entity skeleton even when an LOD is displayed. | 
|---|
 | 227 |         bool mAlwaysUpdateMainSkeleton; | 
|---|
 | 228 |  | 
|---|
 | 229 |  | 
|---|
 | 230 |         /// The LOD number of the mesh to use, calculated by _notifyCurrentCamera. | 
|---|
 | 231 |         ushort mMeshLodIndex; | 
|---|
 | 232 |  | 
|---|
 | 233 |         /// LOD bias factor, transformed for optimisation when calculating adjusted LOD value. | 
|---|
 | 234 |         Real mMeshLodFactorTransformed; | 
|---|
 | 235 |         /// Index of minimum detail LOD (NB higher index is lower detail). | 
|---|
 | 236 |         ushort mMinMeshLodIndex; | 
|---|
 | 237 |         /// Index of maximum detail LOD (NB lower index is higher detail). | 
|---|
 | 238 |         ushort mMaxMeshLodIndex; | 
|---|
 | 239 |  | 
|---|
 | 240 |         /// LOD bias factor, not transformed. | 
|---|
 | 241 |         Real mMaterialLodFactor; | 
|---|
 | 242 |         /// LOD bias factor, transformed for optimisation when calculating adjusted LOD value. | 
|---|
 | 243 |         Real mMaterialLodFactorTransformed; | 
|---|
 | 244 |         /// Index of minimum detail LOD (NB higher index is lower detail). | 
|---|
 | 245 |         ushort mMinMaterialLodIndex; | 
|---|
 | 246 |         /// Index of maximum detail LOD (NB lower index is higher detail). | 
|---|
 | 247 |         ushort mMaxMaterialLodIndex; | 
|---|
 | 248 |  | 
|---|
 | 249 |         /** List of LOD Entity instances (for manual LODs). | 
|---|
 | 250 |             We don't know when the mesh is using manual LODs whether one LOD to the next will have the | 
|---|
 | 251 |             same number of SubMeshes, therefore we have to allow a separate Entity list | 
|---|
 | 252 |             with each alternate one. | 
|---|
 | 253 |         */ | 
|---|
 | 254 |         typedef vector<Entity*>::type LODEntityList; | 
|---|
 | 255 |         LODEntityList mLodEntityList; | 
|---|
 | 256 |  | 
|---|
 | 257 |         /** This Entity's personal copy of the skeleton, if skeletally animated. | 
|---|
 | 258 |         */ | 
|---|
 | 259 |         SkeletonInstance* mSkeletonInstance; | 
|---|
 | 260 |  | 
|---|
 | 261 |         /// Has this entity been initialised yet? | 
|---|
 | 262 |         bool mInitialised; | 
|---|
 | 263 |  | 
|---|
 | 264 |         /// Last parent transform. | 
|---|
 | 265 |         Matrix4 mLastParentXform; | 
|---|
 | 266 |  | 
|---|
 | 267 |         /// Mesh state count, used to detect differences. | 
|---|
 | 268 |         size_t mMeshStateCount; | 
|---|
 | 269 |  | 
|---|
 | 270 |         /** Builds a list of SubEntities based on the SubMeshes contained in the Mesh. */ | 
|---|
 | 271 |         void buildSubEntityList(MeshPtr& mesh, SubEntityList* sublist); | 
|---|
 | 272 |  | 
|---|
 | 273 |         /// Internal implementation of attaching a 'child' object to this entity and assign the parent node to the child entity. | 
|---|
 | 274 |         void attachObjectImpl(MovableObject *pMovable, TagPoint *pAttachingPoint); | 
|---|
 | 275 |  | 
|---|
 | 276 |         /// Internal implementation of detaching a 'child' object of this entity and clear the parent node of the child entity. | 
|---|
 | 277 |         void detachObjectImpl(MovableObject* pObject); | 
|---|
 | 278 |  | 
|---|
 | 279 |         /// Internal implementation of detaching all 'child' objects of this entity. | 
|---|
 | 280 |         void detachAllObjectsImpl(void); | 
|---|
 | 281 |  | 
|---|
 | 282 |         /// Ensures reevaluation of the vertex processing usage. | 
|---|
 | 283 |         void reevaluateVertexProcessing(void); | 
|---|
 | 284 |  | 
|---|
 | 285 |         /** Calculates the kind of vertex processing in use. | 
|---|
 | 286 |         @remarks | 
|---|
 | 287 |             This function's return value is calculated according to the current  | 
|---|
 | 288 |             active scheme. This is due to the fact that RTSS schemes may be different | 
|---|
 | 289 |             in their handling of hardware animation. | 
|---|
 | 290 |         */ | 
|---|
 | 291 |         bool calcVertexProcessing(void); | 
|---|
 | 292 |      | 
|---|
 | 293 |         /// Apply vertex animation. | 
|---|
 | 294 |         void applyVertexAnimation(bool hardwareAnimation, bool stencilShadows); | 
|---|
 | 295 |         /// Initialise the hardware animation elements for given vertex data. | 
|---|
 | 296 |         ushort initHardwareAnimationElements(VertexData* vdata, ushort numberOfElements, bool animateNormals); | 
|---|
 | 297 |         /// Are software vertex animation temp buffers bound? | 
|---|
 | 298 |         bool tempVertexAnimBuffersBound(void) const; | 
|---|
 | 299 |         /// Are software skeleton animation temp buffers bound? | 
|---|
 | 300 |         bool tempSkelAnimBuffersBound(bool requestNormals) const; | 
|---|
 | 301 |  | 
|---|
 | 302 |     public: | 
|---|
 | 303 |         /// Contains the child objects (attached to bones) indexed by name. | 
|---|
 | 304 |         typedef map<String, MovableObject*>::type ChildObjectList; | 
|---|
 | 305 |     protected: | 
|---|
 | 306 |         ChildObjectList mChildObjectList; | 
|---|
 | 307 |  | 
|---|
 | 308 |  | 
|---|
 | 309 |         /// Bounding box that 'contains' all the mesh of each child entity. | 
|---|
 | 310 |         mutable AxisAlignedBox mFullBoundingBox; | 
|---|
 | 311 |  | 
|---|
 | 312 |         ShadowRenderableList mShadowRenderables; | 
|---|
 | 313 |  | 
|---|
 | 314 |         /** Nested class to allow entity shadows. */ | 
|---|
 | 315 |         class _OgreExport EntityShadowRenderable : public ShadowRenderable | 
|---|
 | 316 |         { | 
|---|
 | 317 |         protected: | 
|---|
 | 318 |             Entity* mParent; | 
|---|
 | 319 |             /// Shared link to position buffer. | 
|---|
 | 320 |             HardwareVertexBufferSharedPtr mPositionBuffer; | 
|---|
 | 321 |             /// Shared link to w-coord buffer (optional). | 
|---|
 | 322 |             HardwareVertexBufferSharedPtr mWBuffer; | 
|---|
 | 323 |             /// Link to current vertex data used to bind (maybe changes). | 
|---|
 | 324 |             const VertexData* mCurrentVertexData; | 
|---|
 | 325 |             /// Original position buffer source binding. | 
|---|
 | 326 |             unsigned short mOriginalPosBufferBinding; | 
|---|
 | 327 |             /// Link to SubEntity, only present if SubEntity has it's own geometry. | 
|---|
 | 328 |             SubEntity* mSubEntity; | 
|---|
 | 329 |  | 
|---|
 | 330 |  | 
|---|
 | 331 |         public: | 
|---|
 | 332 |             EntityShadowRenderable(Entity* parent, | 
|---|
 | 333 |                 HardwareIndexBufferSharedPtr* indexBuffer, const VertexData* vertexData, | 
|---|
 | 334 |                 bool createSeparateLightCap, SubEntity* subent, bool isLightCap = false); | 
|---|
 | 335 |             ~EntityShadowRenderable(); | 
|---|
 | 336 |              | 
|---|
 | 337 |             /// Create the separate light cap if it doesn't already exists. | 
|---|
 | 338 |             void _createSeparateLightCap(); | 
|---|
 | 339 |             /// @copydoc ShadowRenderable::getWorldTransforms. | 
|---|
 | 340 |             void getWorldTransforms(Matrix4* xform) const; | 
|---|
 | 341 |             HardwareVertexBufferSharedPtr getPositionBuffer(void) { return mPositionBuffer; } | 
|---|
 | 342 |             HardwareVertexBufferSharedPtr getWBuffer(void) { return mWBuffer; } | 
|---|
 | 343 |             /// Rebind the source positions (for temp buffer users). | 
|---|
 | 344 |             void rebindPositionBuffer(const VertexData* vertexData, bool force); | 
|---|
 | 345 |             /// @copydoc ShadowRenderable::isVisible. | 
|---|
 | 346 |             bool isVisible(void) const; | 
|---|
 | 347 |             /// @copydoc ShadowRenderable::rebindIndexBuffer. | 
|---|
 | 348 |             virtual void rebindIndexBuffer(const HardwareIndexBufferSharedPtr& indexBuffer); | 
|---|
 | 349 |         }; | 
|---|
 | 350 |     public: | 
|---|
 | 351 |         /** Default destructor. | 
|---|
 | 352 |         */ | 
|---|
 | 353 |         ~Entity(); | 
|---|
 | 354 |  | 
|---|
 | 355 |         /** Gets the Mesh that this Entity is based on. | 
|---|
 | 356 |         */ | 
|---|
 | 357 |         const MeshPtr& getMesh(void) const; | 
|---|
 | 358 |  | 
|---|
 | 359 |         /** Gets a pointer to a SubEntity, ie a part of an Entity. | 
|---|
 | 360 |         */ | 
|---|
 | 361 |         SubEntity* getSubEntity(unsigned int index) const; | 
|---|
 | 362 |  | 
|---|
 | 363 |         /** Gets a pointer to a SubEntity by name | 
|---|
 | 364 |         @remarks  | 
|---|
 | 365 |             Names should be initialized during a Mesh creation. | 
|---|
 | 366 |         */ | 
|---|
 | 367 |         SubEntity* getSubEntity( const String& name ) const; | 
|---|
 | 368 |  | 
|---|
 | 369 |         /** Retrieves the number of SubEntity objects making up this entity. | 
|---|
 | 370 |         */ | 
|---|
 | 371 |         unsigned int getNumSubEntities(void) const; | 
|---|
 | 372 |  | 
|---|
 | 373 |         /** Clones this entity and returns a pointer to the clone. | 
|---|
 | 374 |         @remarks | 
|---|
 | 375 |             Useful method for duplicating an entity. The new entity must be | 
|---|
 | 376 |             given a unique name, and is not attached to the scene in any way | 
|---|
 | 377 |             so must be attached to a SceneNode to be visible (exactly as | 
|---|
 | 378 |             entities returned from SceneManager::createEntity). | 
|---|
 | 379 |         @param newName | 
|---|
 | 380 |             Name for the new entity. | 
|---|
 | 381 |         */ | 
|---|
 | 382 |         Entity* clone( const String& newName ) const; | 
|---|
 | 383 |  | 
|---|
 | 384 |         /** Sets the material to use for the whole of this entity. | 
|---|
 | 385 |         @remarks | 
|---|
 | 386 |             This is a shortcut method to set all the materials for all | 
|---|
 | 387 |             subentities of this entity. Only use this method is you want to | 
|---|
 | 388 |             set the same material for all subentities or if you know there | 
|---|
 | 389 |             is only one. Otherwise call getSubEntity() and call the same | 
|---|
 | 390 |             method on the individual SubEntity. | 
|---|
 | 391 |         */ | 
|---|
 | 392 |         void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME ); | 
|---|
 | 393 |  | 
|---|
 | 394 |          | 
|---|
 | 395 |         /** Sets the material to use for the whole of this entity. | 
|---|
 | 396 |         @remarks | 
|---|
 | 397 |             This is a shortcut method to set all the materials for all | 
|---|
 | 398 |             subentities of this entity. Only use this method is you want to | 
|---|
 | 399 |             set the same material for all subentities or if you know there | 
|---|
 | 400 |             is only one. Otherwise call getSubEntity() and call the same | 
|---|
 | 401 |             method on the individual SubEntity. | 
|---|
 | 402 |         */ | 
|---|
 | 403 |         void setMaterial(const MaterialPtr& material); | 
|---|
 | 404 |  | 
|---|
 | 405 |         /** @copydoc MovableObject::_notifyCurrentCamera. | 
|---|
 | 406 |         */ | 
|---|
 | 407 |         void _notifyCurrentCamera(Camera* cam); | 
|---|
 | 408 |  | 
|---|
 | 409 |         /// @copydoc MovableObject::setRenderQueueGroup. | 
|---|
 | 410 |         void setRenderQueueGroup(uint8 queueID); | 
|---|
 | 411 |  | 
|---|
 | 412 |         /// @copydoc MovableObject::setRenderQueueGroupAndPriority. | 
|---|
 | 413 |         void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority); | 
|---|
 | 414 |  | 
|---|
 | 415 |         /** @copydoc MovableObject::getBoundingBox. | 
|---|
 | 416 |         */ | 
|---|
 | 417 |         const AxisAlignedBox& getBoundingBox(void) const; | 
|---|
 | 418 |  | 
|---|
 | 419 |         /// Merge all the child object Bounds a return it. | 
|---|
 | 420 |         AxisAlignedBox getChildObjectsBoundingBox(void) const; | 
|---|
 | 421 |  | 
|---|
 | 422 |         /** @copydoc MovableObject::_updateRenderQueue. | 
|---|
 | 423 |         */ | 
|---|
 | 424 |         void _updateRenderQueue(RenderQueue* queue); | 
|---|
 | 425 |  | 
|---|
 | 426 |         /** @copydoc MovableObject::getMovableType */ | 
|---|
 | 427 |         const String& getMovableType(void) const; | 
|---|
 | 428 |  | 
|---|
 | 429 |         /** For entities based on animated meshes, gets the AnimationState object for a single animation. | 
|---|
 | 430 |         @remarks | 
|---|
 | 431 |             You animate an entity by updating the animation state objects. Each of these represents the | 
|---|
 | 432 |             current state of each animation available to the entity. The AnimationState objects are | 
|---|
 | 433 |             initialised from the Mesh object. | 
|---|
 | 434 |         */ | 
|---|
 | 435 |         AnimationState* getAnimationState(const String& name) const; | 
|---|
 | 436 |         /** Returns whether the AnimationState with the given name exists. */ | 
|---|
 | 437 |         bool hasAnimationState(const String& name) const; | 
|---|
 | 438 |         /** For entities based on animated meshes, gets the AnimationState objects for all animations. | 
|---|
 | 439 |         @return | 
|---|
 | 440 |             In case the entity is animated, this functions returns the pointer to a AnimationStateSet | 
|---|
 | 441 |             containing all animations of the entries. If the entity is not animated, it returns 0. | 
|---|
 | 442 |         @remarks | 
|---|
 | 443 |             You animate an entity by updating the animation state objects. Each of these represents the | 
|---|
 | 444 |             current state of each animation available to the entity. The AnimationState objects are | 
|---|
 | 445 |             initialised from the Mesh object. | 
|---|
 | 446 |         */ | 
|---|
 | 447 |         AnimationStateSet* getAllAnimationStates(void) const; | 
|---|
 | 448 |  | 
|---|
 | 449 |         /** Tells the Entity whether or not it should display it's skeleton, if it has one. | 
|---|
 | 450 |         */ | 
|---|
 | 451 |         void setDisplaySkeleton(bool display); | 
|---|
 | 452 |  | 
|---|
 | 453 |         /** Returns whether or not the entity is currently displaying its skeleton. | 
|---|
 | 454 |         */ | 
|---|
 | 455 |         bool getDisplaySkeleton(void) const; | 
|---|
 | 456 |  | 
|---|
 | 457 |  | 
|---|
 | 458 |         /** Gets a pointer to the entity representing the numbered manual level of detail. | 
|---|
 | 459 |         @remarks | 
|---|
 | 460 |             The zero-based index never includes the original entity, unlike | 
|---|
 | 461 |             Mesh::getLodLevel. | 
|---|
 | 462 |         */ | 
|---|
 | 463 |         Entity* getManualLodLevel(size_t index) const; | 
|---|
 | 464 |  | 
|---|
 | 465 |         /** Returns the number of manual levels of detail that this entity supports. | 
|---|
 | 466 |         @remarks | 
|---|
 | 467 |             This number never includes the original entity, it is difference | 
|---|
 | 468 |             with Mesh::getNumLodLevels. | 
|---|
 | 469 |         */ | 
|---|
 | 470 |         size_t getNumManualLodLevels(void) const; | 
|---|
 | 471 |  | 
|---|
 | 472 |         /** Returns the current LOD used to render | 
|---|
 | 473 |         */ | 
|---|
 | 474 |         ushort getCurrentLodIndex() { return mMeshLodIndex; } | 
|---|
 | 475 |  | 
|---|
 | 476 |         /** Sets a level-of-detail bias for the mesh detail of this entity. | 
|---|
 | 477 |         @remarks | 
|---|
 | 478 |             Level of detail reduction is normally applied automatically based on the Mesh | 
|---|
 | 479 |             settings. However, it is possible to influence this behaviour for this entity | 
|---|
 | 480 |             by adjusting the LOD bias. This 'nudges' the mesh level of detail used for this | 
|---|
 | 481 |             entity up or down depending on your requirements. You might want to use this | 
|---|
 | 482 |             if there was a particularly important entity in your scene which you wanted to | 
|---|
 | 483 |             detail better than the others, such as a player model. | 
|---|
 | 484 |         @par | 
|---|
 | 485 |             There are three parameters to this method; the first is a factor to apply; it | 
|---|
 | 486 |             defaults to 1.0 (no change), by increasing this to say 2.0, this model would | 
|---|
 | 487 |             take twice as long to reduce in detail, whilst at 0.5 this entity would use lower | 
|---|
 | 488 |             detail versions twice as quickly. The other 2 parameters are hard limits which | 
|---|
 | 489 |             let you set the maximum and minimum level-of-detail version to use, after all | 
|---|
 | 490 |             other calculations have been made. This lets you say that this entity should | 
|---|
 | 491 |             never be simplified, or that it can only use LODs below a certain level even | 
|---|
 | 492 |             when right next to the camera. | 
|---|
 | 493 |         @param factor | 
|---|
 | 494 |             Proportional factor to apply to the distance at which LOD is changed. | 
|---|
 | 495 |             Higher values increase the distance at which higher LODs are displayed (2.0 is | 
|---|
 | 496 |             twice the normal distance, 0.5 is half). | 
|---|
 | 497 |         @param maxDetailIndex | 
|---|
 | 498 |             The index of the maximum LOD this entity is allowed to use (lower | 
|---|
 | 499 |             indexes are higher detail: index 0 is the original full detail model). | 
|---|
 | 500 |         @param minDetailIndex | 
|---|
 | 501 |             The index of the minimum LOD this entity is allowed to use (higher | 
|---|
 | 502 |             indexes are lower detail). Use something like 99 if you want unlimited LODs (the actual | 
|---|
 | 503 |             LOD will be limited by the number in the Mesh). | 
|---|
 | 504 |         */ | 
|---|
 | 505 |         void setMeshLodBias(Real factor, ushort maxDetailIndex = 0, ushort minDetailIndex = 99); | 
|---|
 | 506 |  | 
|---|
 | 507 |         /** Sets a level-of-detail bias for the material detail of this entity. | 
|---|
 | 508 |         @remarks | 
|---|
 | 509 |             Level of detail reduction is normally applied automatically based on the Material | 
|---|
 | 510 |             settings. However, it is possible to influence this behaviour for this entity | 
|---|
 | 511 |             by adjusting the LOD bias. This 'nudges' the material level of detail used for this | 
|---|
 | 512 |             entity up or down depending on your requirements. You might want to use this | 
|---|
 | 513 |             if there was a particularly important entity in your scene which you wanted to | 
|---|
 | 514 |             detail better than the others, such as a player model. | 
|---|
 | 515 |         @par | 
|---|
 | 516 |             There are three parameters to this method; the first is a factor to apply; it | 
|---|
 | 517 |             defaults to 1.0 (no change), by increasing this to say 2.0, this entity would | 
|---|
 | 518 |             take twice as long to use a lower detail material, whilst at 0.5 this entity | 
|---|
 | 519 |             would use lower detail versions twice as quickly. The other 2 parameters are | 
|---|
 | 520 |             hard limits which let you set the maximum and minimum level-of-detail index | 
|---|
 | 521 |             to use, after all other calculations have been made. This lets you say that | 
|---|
 | 522 |             this entity should never be simplified, or that it can only use LODs below | 
|---|
 | 523 |             a certain level even when right next to the camera. | 
|---|
 | 524 |         @param factor | 
|---|
 | 525 |             Proportional factor to apply to the distance at which LOD is changed. | 
|---|
 | 526 |             Higher values increase the distance at which higher LODs are displayed (2.0 is | 
|---|
 | 527 |             twice the normal distance, 0.5 is half). | 
|---|
 | 528 |         @param maxDetailIndex | 
|---|
 | 529 |             The index of the maximum LOD this entity is allowed to use (lower | 
|---|
 | 530 |             indexes are higher detail: index 0 is the original full detail model). | 
|---|
 | 531 |         @param minDetailIndex | 
|---|
 | 532 |             The index of the minimum LOD this entity is allowed to use (higher | 
|---|
 | 533 |             indexes are lower detail. Use something like 99 if you want unlimited LODs (the actual | 
|---|
 | 534 |             LOD will be limited by the number of LOD indexes used in the Material). | 
|---|
 | 535 |         */ | 
|---|
 | 536 |         void setMaterialLodBias(Real factor, ushort maxDetailIndex = 0, ushort minDetailIndex = 99); | 
|---|
 | 537 |  | 
|---|
 | 538 |         /** Sets whether the polygon mode of this entire entity may be | 
|---|
 | 539 |             overridden by the camera detail settings. | 
|---|
 | 540 |         */ | 
|---|
 | 541 |         void setPolygonModeOverrideable(bool PolygonModeOverrideable); | 
|---|
 | 542 |         /** Attaches another object to a certain bone of the skeleton which this entity uses. | 
|---|
 | 543 |         @remarks | 
|---|
 | 544 |             This method can be used to attach another object to an animated part of this entity, | 
|---|
 | 545 |             by attaching it to a bone in the skeleton (with an offset if required). As this entity | 
|---|
 | 546 |             is animated, the attached object will move relative to the bone to which it is attached. | 
|---|
 | 547 |         @par | 
|---|
 | 548 |             An exception is thrown if the movable object is already attached to the bone, another bone or scenenode. | 
|---|
 | 549 |             If the entity has no skeleton or the bone name cannot be found then an exception is thrown. | 
|---|
 | 550 |         @param boneName | 
|---|
 | 551 |             The name of the bone (in the skeleton) to attach this object | 
|---|
 | 552 |         @param pMovable | 
|---|
 | 553 |             Pointer to the object to attach | 
|---|
 | 554 |         @param offsetOrientation | 
|---|
 | 555 |             An adjustment to the orientation of the attached object, relative to the bone. | 
|---|
 | 556 |         @param offsetPosition | 
|---|
 | 557 |             An adjustment to the position of the attached object, relative to the bone. | 
|---|
 | 558 |         @return | 
|---|
 | 559 |             The TagPoint to which the object has been attached | 
|---|
 | 560 |         */ | 
|---|
 | 561 |         TagPoint* attachObjectToBone(const String &boneName, | 
|---|
 | 562 |             MovableObject *pMovable, | 
|---|
 | 563 |             const Quaternion &offsetOrientation = Quaternion::IDENTITY, | 
|---|
 | 564 |             const Vector3 &offsetPosition = Vector3::ZERO); | 
|---|
 | 565 |  | 
|---|
 | 566 |         /** Detach a MovableObject previously attached using attachObjectToBone. | 
|---|
 | 567 |             If the movable object name is not found then an exception is raised. | 
|---|
 | 568 |         @param movableName | 
|---|
 | 569 |             The name of the movable object to be detached. | 
|---|
 | 570 |         */ | 
|---|
 | 571 |         MovableObject* detachObjectFromBone(const String &movableName); | 
|---|
 | 572 |  | 
|---|
 | 573 |         /** Detaches an object by pointer. | 
|---|
 | 574 |         @remarks | 
|---|
 | 575 |             Use this method to destroy a MovableObject which is attached to a bone of belonging this entity. | 
|---|
 | 576 |             But sometimes the object may be not in the child object list because it is a LOD entity, | 
|---|
 | 577 |             this method can safely detect and ignore in this case and won't raise an exception. | 
|---|
 | 578 |         */ | 
|---|
 | 579 |         void detachObjectFromBone(MovableObject* obj); | 
|---|
 | 580 |  | 
|---|
 | 581 |         /// Detach all MovableObjects previously attached using attachObjectToBone | 
|---|
 | 582 |         void detachAllObjectsFromBone(void); | 
|---|
 | 583 |  | 
|---|
 | 584 |         typedef MapIterator<ChildObjectList> ChildObjectListIterator; | 
|---|
 | 585 |         /** Gets an iterator to the list of objects attached to bones on this entity. */ | 
|---|
 | 586 |         ChildObjectListIterator getAttachedObjectIterator(void); | 
|---|
 | 587 |         /** @copydoc MovableObject::getBoundingRadius */ | 
|---|
 | 588 |         Real getBoundingRadius(void) const; | 
|---|
 | 589 |  | 
|---|
 | 590 |         /** @copydoc MovableObject::getWorldBoundingBox */ | 
|---|
 | 591 |         const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const; | 
|---|
 | 592 |         /** @copydoc MovableObject::getWorldBoundingSphere */ | 
|---|
 | 593 |         const Sphere& getWorldBoundingSphere(bool derive = false) const; | 
|---|
 | 594 |  | 
|---|
 | 595 |         /** @copydoc ShadowCaster::getEdgeList. */ | 
|---|
 | 596 |         EdgeData* getEdgeList(void); | 
|---|
 | 597 |         /** @copydoc ShadowCaster::hasEdgeList. */ | 
|---|
 | 598 |         bool hasEdgeList(void); | 
|---|
 | 599 |         /** @copydoc ShadowCaster::getShadowVolumeRenderableIterator. */ | 
|---|
 | 600 |         ShadowRenderableListIterator getShadowVolumeRenderableIterator( | 
|---|
 | 601 |             ShadowTechnique shadowTechnique, const Light* light, | 
|---|
 | 602 |             HardwareIndexBufferSharedPtr* indexBuffer, size_t* indexBufferUsedSize, | 
|---|
 | 603 |             bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 ); | 
|---|
 | 604 |  | 
|---|
 | 605 |         /** Internal method for retrieving bone matrix information. */ | 
|---|
 | 606 |         const Matrix4* _getBoneMatrices(void) const { return mBoneMatrices;} | 
|---|
 | 607 |         /** Internal method for retrieving bone matrix information. */ | 
|---|
 | 608 |         unsigned short _getNumBoneMatrices(void) const { return mNumBoneMatrices; } | 
|---|
 | 609 |         /** Returns whether or not this entity is skeletally animated. */ | 
|---|
 | 610 |         bool hasSkeleton(void) const { return mSkeletonInstance != 0; } | 
|---|
 | 611 |         /** Get this Entity's personal skeleton instance. */ | 
|---|
 | 612 |         SkeletonInstance* getSkeleton(void) const { return mSkeletonInstance; } | 
|---|
 | 613 |         /** Returns whether or not hardware animation is enabled. | 
|---|
 | 614 |         @remarks | 
|---|
 | 615 |             Because fixed-function indexed vertex blending is rarely supported | 
|---|
 | 616 |             by existing graphics cards, hardware animation can only be done if | 
|---|
 | 617 |             the vertex programs in the materials used to render an entity support | 
|---|
 | 618 |             it. Therefore, this method will only return true if all the materials | 
|---|
 | 619 |             assigned to this entity have vertex programs assigned, and all those | 
|---|
 | 620 |             vertex programs must support 'includes_morph_animation true' if using | 
|---|
 | 621 |             morph animation, 'includes_pose_animation true' if using pose animation | 
|---|
 | 622 |             and 'includes_skeletal_animation true' if using skeletal animation. | 
|---|
 | 623 |  | 
|---|
 | 624 |             Also note the the function returns value according to the current active | 
|---|
 | 625 |             scheme. This is due to the fact that RTSS schemes may be different in their | 
|---|
 | 626 |             handling of hardware animation. | 
|---|
 | 627 |         */ | 
|---|
 | 628 |         bool isHardwareAnimationEnabled(void); | 
|---|
 | 629 |  | 
|---|
 | 630 |         /** @copydoc MovableObject::_notifyAttached */ | 
|---|
 | 631 |         void _notifyAttached(Node* parent, bool isTagPoint = false); | 
|---|
 | 632 |         /** Returns the number of requests that have been made for software animation | 
|---|
 | 633 |         @remarks | 
|---|
 | 634 |             If non-zero then software animation will be performed in updateAnimation | 
|---|
 | 635 |             regardless of the current setting of isHardwareAnimationEnabled or any | 
|---|
 | 636 |             internal optimise for eliminate software animation. Requests for software | 
|---|
 | 637 |             animation are made by calling the addSoftwareAnimationRequest() method. | 
|---|
 | 638 |         */ | 
|---|
 | 639 |         int getSoftwareAnimationRequests(void) const { return mSoftwareAnimationRequests; } | 
|---|
 | 640 |         /** Returns the number of requests that have been made for software animation of normals | 
|---|
 | 641 |         @remarks | 
|---|
 | 642 |             If non-zero, and getSoftwareAnimationRequests() also returns non-zero, | 
|---|
 | 643 |             then software animation of normals will be performed in updateAnimation | 
|---|
 | 644 |             regardless of the current setting of isHardwareAnimationEnabled or any | 
|---|
 | 645 |             internal optimise for eliminate software animation. Currently it is not | 
|---|
 | 646 |             possible to force software animation of only normals. Consequently this | 
|---|
 | 647 |             value is always less than or equal to that returned by getSoftwareAnimationRequests(). | 
|---|
 | 648 |             Requests for software animation of normals are made by calling the | 
|---|
 | 649 |             addSoftwareAnimationRequest() method with 'true' as the parameter. | 
|---|
 | 650 |         */ | 
|---|
 | 651 |         int getSoftwareAnimationNormalsRequests(void) const { return mSoftwareAnimationNormalsRequests; } | 
|---|
 | 652 |         /** Add a request for software animation | 
|---|
 | 653 |         @remarks | 
|---|
 | 654 |             Tells the entity to perform animation calculations for skeletal/vertex | 
|---|
 | 655 |             animations in software, regardless of the current setting of | 
|---|
 | 656 |             isHardwareAnimationEnabled().  Software animation will be performed | 
|---|
 | 657 |             any time one or more requests have been made.  If 'normalsAlso' is | 
|---|
 | 658 |             'true', then the entity will also do software blending on normal | 
|---|
 | 659 |             vectors, in addition to positions. This advanced method useful for | 
|---|
 | 660 |             situations in which access to actual mesh vertices is required, | 
|---|
 | 661 |             such as accurate collision detection or certain advanced shading | 
|---|
 | 662 |             techniques. When software animation is no longer needed, | 
|---|
 | 663 |             the caller of this method should always remove the request by calling | 
|---|
 | 664 |             removeSoftwareAnimationRequest(), passing the same value for | 
|---|
 | 665 |             'normalsAlso'. | 
|---|
 | 666 |         */ | 
|---|
 | 667 |         void addSoftwareAnimationRequest(bool normalsAlso); | 
|---|
 | 668 |         /** Removes a request for software animation | 
|---|
 | 669 |         @remarks | 
|---|
 | 670 |             Calling this decrements the entity's internal counter of the number | 
|---|
 | 671 |             of requests for software animation.  If the counter is already zero | 
|---|
 | 672 |             then calling this method throws an exception.  The 'normalsAlso' | 
|---|
 | 673 |             flag if set to 'true' will also decrement the internal counter of | 
|---|
 | 674 |             number of requests for software animation of normals. | 
|---|
 | 675 |         */ | 
|---|
 | 676 |         void removeSoftwareAnimationRequest(bool normalsAlso); | 
|---|
 | 677 |  | 
|---|
 | 678 |         /** Shares the SkeletonInstance with the supplied entity. | 
|---|
 | 679 |             Note that in order for this to work, both entities must have the same | 
|---|
 | 680 |             Skeleton. | 
|---|
 | 681 |         */ | 
|---|
 | 682 |         void shareSkeletonInstanceWith(Entity* entity); | 
|---|
 | 683 |  | 
|---|
 | 684 |         /** Returns whether or not this entity is either morph or pose animated. | 
|---|
 | 685 |         */ | 
|---|
 | 686 |         bool hasVertexAnimation(void) const; | 
|---|
 | 687 |  | 
|---|
 | 688 |  | 
|---|
 | 689 |         /** Stops sharing the SkeletonInstance with other entities. | 
|---|
 | 690 |         */ | 
|---|
 | 691 |         void stopSharingSkeletonInstance(); | 
|---|
 | 692 |  | 
|---|
 | 693 |  | 
|---|
 | 694 |         /** Returns whether this entity shares it's SkeltonInstance with other entity instances. | 
|---|
 | 695 |         */ | 
|---|
 | 696 |         inline bool sharesSkeletonInstance() const { return mSharedSkeletonEntities != NULL; } | 
|---|
 | 697 |  | 
|---|
 | 698 |         /** Returns a pointer to the set of entities which share a SkeletonInstance. | 
|---|
 | 699 |             If this instance does not share it's SkeletonInstance with other instances @c NULL will be returned | 
|---|
 | 700 |         */ | 
|---|
 | 701 |         inline const EntitySet* getSkeletonInstanceSharingSet() const { return mSharedSkeletonEntities; } | 
|---|
 | 702 |  | 
|---|
 | 703 |         /** Updates the internal animation state set to include the latest | 
|---|
 | 704 |             available animations from the attached skeleton. | 
|---|
 | 705 |         @remarks | 
|---|
 | 706 |             Use this method if you manually add animations to a skeleton, or have | 
|---|
 | 707 |             linked the skeleton to another for animation purposes since creating | 
|---|
 | 708 |             this entity. | 
|---|
 | 709 |         @note | 
|---|
 | 710 |             If you have called getAnimationState prior to calling this method, | 
|---|
 | 711 |             the pointers will still remain valid. | 
|---|
 | 712 |         */ | 
|---|
 | 713 |         void refreshAvailableAnimationState(void); | 
|---|
 | 714 |  | 
|---|
 | 715 |         /** Advanced method to perform all the updates required for an animated entity. | 
|---|
 | 716 |         @remarks | 
|---|
 | 717 |             You don't normally need to call this, but it's here in case you wish | 
|---|
 | 718 |             to manually update the animation of an Entity at a specific point in | 
|---|
 | 719 |             time. Animation will not be updated more than once a frame no matter | 
|---|
 | 720 |             how many times you call this method. | 
|---|
 | 721 |         */ | 
|---|
 | 722 |         void _updateAnimation(void); | 
|---|
 | 723 |  | 
|---|
 | 724 |         /** Tests if any animation applied to this entity. | 
|---|
 | 725 |         @remarks | 
|---|
 | 726 |             An entity is animated if any animation state is enabled, or any manual bone | 
|---|
 | 727 |             applied to the skeleton. | 
|---|
 | 728 |         */ | 
|---|
 | 729 |         bool _isAnimated(void) const; | 
|---|
 | 730 |  | 
|---|
 | 731 |         /** Tests if skeleton was animated. | 
|---|
 | 732 |         */ | 
|---|
 | 733 |         bool _isSkeletonAnimated(void) const; | 
|---|
 | 734 |  | 
|---|
 | 735 |         /** Advanced method to get the temporarily blended skeletal vertex information | 
|---|
 | 736 |             for entities which are software skinned. | 
|---|
 | 737 |         @remarks | 
|---|
 | 738 |             Internal engine will eliminate software animation if possible, this | 
|---|
 | 739 |             information is unreliable unless added request for software animation | 
|---|
 | 740 |             via addSoftwareAnimationRequest. | 
|---|
 | 741 |         @note | 
|---|
 | 742 |             The positions/normals of the returned vertex data is in object space. | 
|---|
 | 743 |         */ | 
|---|
 | 744 |         VertexData* _getSkelAnimVertexData(void) const; | 
|---|
 | 745 |         /** Advanced method to get the temporarily blended software vertex animation information | 
|---|
 | 746 |         @remarks | 
|---|
 | 747 |             Internal engine will eliminate software animation if possible, this | 
|---|
 | 748 |             information is unreliable unless added request for software animation | 
|---|
 | 749 |             via addSoftwareAnimationRequest. | 
|---|
 | 750 |         @note | 
|---|
 | 751 |             The positions/normals of the returned vertex data is in object space. | 
|---|
 | 752 |         */ | 
|---|
 | 753 |         VertexData* _getSoftwareVertexAnimVertexData(void) const; | 
|---|
 | 754 |         /** Advanced method to get the hardware morph vertex information | 
|---|
 | 755 |         @note | 
|---|
 | 756 |             The positions/normals of the returned vertex data is in object space. | 
|---|
 | 757 |         */ | 
|---|
 | 758 |         VertexData* _getHardwareVertexAnimVertexData(void) const; | 
|---|
 | 759 |         /** Advanced method to get the temp buffer information for software | 
|---|
 | 760 |             skeletal animation. | 
|---|
 | 761 |         */ | 
|---|
 | 762 |         TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void); | 
|---|
 | 763 |         /** Advanced method to get the temp buffer information for software | 
|---|
 | 764 |             morph animation. | 
|---|
 | 765 |         */ | 
|---|
 | 766 |         TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void); | 
|---|
 | 767 |         /// Override to return specific type flag. | 
|---|
 | 768 |         uint32 getTypeFlags(void) const; | 
|---|
 | 769 |         /// Retrieve the VertexData which should be used for GPU binding. | 
|---|
 | 770 |         VertexData* getVertexDataForBinding(void); | 
|---|
 | 771 |  | 
|---|
 | 772 |         /// Identify which vertex data we should be sending to the renderer. | 
|---|
 | 773 |         enum VertexDataBindChoice | 
|---|
 | 774 |         { | 
|---|
 | 775 |             BIND_ORIGINAL, | 
|---|
 | 776 |             BIND_SOFTWARE_SKELETAL, | 
|---|
 | 777 |             BIND_SOFTWARE_MORPH, | 
|---|
 | 778 |             BIND_HARDWARE_MORPH | 
|---|
 | 779 |         }; | 
|---|
 | 780 |         /// Choose which vertex data to bind to the renderer. | 
|---|
 | 781 |         VertexDataBindChoice chooseVertexDataForBinding(bool hasVertexAnim); | 
|---|
 | 782 |  | 
|---|
 | 783 |         /** Are buffers already marked as vertex animated? */ | 
|---|
 | 784 |         bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; } | 
|---|
 | 785 |         /** Mark just this vertex data as animated. | 
|---|
 | 786 |         */ | 
|---|
 | 787 |         void _markBuffersUsedForAnimation(void); | 
|---|
 | 788 |  | 
|---|
 | 789 |         /** Has this Entity been initialised yet? | 
|---|
 | 790 |         @remarks | 
|---|
 | 791 |             If this returns false, it means this Entity hasn't been completely | 
|---|
 | 792 |             constructed yet from the underlying resources (Mesh, Skeleton), which  | 
|---|
 | 793 |             probably means they were delay-loaded and aren't available yet. This | 
|---|
 | 794 |             Entity won't render until it has been successfully initialised, nor | 
|---|
 | 795 |             will many of the manipulation methods function. | 
|---|
 | 796 |         */ | 
|---|
 | 797 |         bool isInitialised(void) const { return mInitialised; } | 
|---|
 | 798 |  | 
|---|
 | 799 |         /** Try to initialise the Entity from the underlying resources. | 
|---|
 | 800 |         @remarks | 
|---|
 | 801 |             This method builds the internal structures of the Entity based on it | 
|---|
 | 802 |             resources (Mesh, Skeleton). This may or may not succeed if the  | 
|---|
 | 803 |             resources it references have been earmarked for background loading, | 
|---|
 | 804 |             so you should check isInitialised afterwards to see if it was successful. | 
|---|
 | 805 |         @param forceReinitialise | 
|---|
 | 806 |             If @c true, this forces the Entity to tear down it's | 
|---|
 | 807 |             internal structures and try to rebuild them. Useful if you changed the | 
|---|
 | 808 |             content of a Mesh or Skeleton at runtime. | 
|---|
 | 809 |         */ | 
|---|
 | 810 |         void _initialise(bool forceReinitialise = false); | 
|---|
 | 811 |         /** Tear down the internal structures of this Entity, rendering it uninitialised. */ | 
|---|
 | 812 |         void _deinitialise(void); | 
|---|
 | 813 |  | 
|---|
 | 814 |         /** Resource::Listener hook to notify Entity that a delay-loaded Mesh is | 
|---|
 | 815 |             complete. | 
|---|
 | 816 |         */ | 
|---|
 | 817 |         void backgroundLoadingComplete(Resource* res); | 
|---|
 | 818 |  | 
|---|
 | 819 |         /// @copydoc MovableObject::visitRenderables | 
|---|
 | 820 |         void visitRenderables(Renderable::Visitor* visitor,  | 
|---|
 | 821 |             bool debugRenderables = false); | 
|---|
 | 822 |  | 
|---|
 | 823 |         /** Get the LOD strategy transformation of the mesh LOD factor. */ | 
|---|
 | 824 |         Real _getMeshLodFactorTransformed() const; | 
|---|
 | 825 |          | 
|---|
 | 826 |         /** Entity's skeleton's AnimationState will not be automatically updated when set to true. | 
|---|
 | 827 |             Useful if you wish to handle AnimationState updates manually. | 
|---|
 | 828 |         */ | 
|---|
 | 829 |         void setSkipAnimationStateUpdate(bool skip) { | 
|---|
 | 830 |             mSkipAnimStateUpdates = skip; | 
|---|
 | 831 |         } | 
|---|
 | 832 |          | 
|---|
 | 833 |         /** Entity's skeleton's AnimationState will not be automatically updated when set to true. | 
|---|
 | 834 |             Useful if you wish to handle AnimationState updates manually. | 
|---|
 | 835 |         */ | 
|---|
 | 836 |         bool getSkipAnimationStateUpdate() const { | 
|---|
 | 837 |             return mSkipAnimStateUpdates; | 
|---|
 | 838 |         } | 
|---|
 | 839 |  | 
|---|
 | 840 |         /** The skeleton of the main entity will be updated even if the an LOD entity is being displayed. | 
|---|
 | 841 |             useful if you have entities attached to the main entity. Otherwise position of attached | 
|---|
 | 842 |             entities will not be updated. | 
|---|
 | 843 |         */ | 
|---|
 | 844 |         void setAlwaysUpdateMainSkeleton(bool update) { | 
|---|
 | 845 |             mAlwaysUpdateMainSkeleton = update; | 
|---|
 | 846 |         } | 
|---|
 | 847 |  | 
|---|
 | 848 |         /** The skeleton of the main entity will be updated even if the an LOD entity is being displayed. | 
|---|
 | 849 |             useful if you have entities attached to the main entity. Otherwise position of attached | 
|---|
 | 850 |             entities will not be updated. | 
|---|
 | 851 |         */ | 
|---|
 | 852 |         bool getAlwaysUpdateMainSkeleton() const { | 
|---|
 | 853 |             return mAlwaysUpdateMainSkeleton; | 
|---|
 | 854 |         } | 
|---|
 | 855 |  | 
|---|
 | 856 |          | 
|---|
 | 857 |     }; | 
|---|
 | 858 |  | 
|---|
 | 859 |     /** Factory object for creating Entity instances */ | 
|---|
 | 860 |     class _OgreExport EntityFactory : public MovableObjectFactory | 
|---|
 | 861 |     { | 
|---|
 | 862 |     protected: | 
|---|
 | 863 |         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params); | 
|---|
 | 864 |     public: | 
|---|
 | 865 |         EntityFactory() {} | 
|---|
 | 866 |         ~EntityFactory() {} | 
|---|
 | 867 |  | 
|---|
 | 868 |         static String FACTORY_TYPE_NAME; | 
|---|
 | 869 |  | 
|---|
 | 870 |         const String& getType(void) const; | 
|---|
 | 871 |         void destroyInstance( MovableObject* obj); | 
|---|
 | 872 |  | 
|---|
 | 873 |     }; | 
|---|
 | 874 |     /** @} */ | 
|---|
 | 875 |     /** @} */ | 
|---|
 | 876 |  | 
|---|
 | 877 | } // namespace Ogre | 
|---|
 | 878 |  | 
|---|
 | 879 | #include "OgreHeaderSuffix.h" | 
|---|
 | 880 |  | 
|---|
 | 881 | #endif // __Entity_H__ | 
|---|