OgreSubEntity.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
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 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 #ifndef __SubEntity_H__
00030 #define __SubEntity_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 
00034 #include "OgreString.h"
00035 #include "OgreRenderable.h"
00036 #include "OgreHardwareBufferManager.h"
00037 
00038 namespace Ogre {
00039 
00056     class _OgreExport SubEntity: public Renderable, public SubEntityAlloc
00057     {
00058         // Note no virtual functions for efficiency
00059         friend class Entity;
00060         friend class SceneManager;
00061     protected:
00064         SubEntity(Entity* parent, SubMesh* subMeshBasis);
00065 
00068         virtual ~SubEntity();
00069 
00071         Entity* mParentEntity;
00072 
00074         String mMaterialName;
00075 
00077         MaterialPtr mpMaterial;
00078 
00079         // Pointer to the SubMesh defining geometry.
00080         SubMesh* mSubMesh;
00081 
00083         bool mVisible;
00084 
00086         unsigned short mMaterialLodIndex;
00087 
00089         VertexData* mSkelAnimVertexData;
00091         TempBlendedBufferInfo mTempSkelAnimInfo;
00093         TempBlendedBufferInfo mTempVertexAnimInfo;
00095         VertexData* mSoftwareVertexAnimVertexData;
00099         VertexData* mHardwareVertexAnimVertexData;
00101         bool mVertexAnimationAppliedThisFrame;
00103         ushort mHardwarePoseCount;
00105         mutable Real mCachedCameraDist;
00107         mutable const Camera *mCachedCamera;
00108 
00110         void prepareTempBlendBuffers(void);
00111 
00112     public:
00115         const String& getMaterialName() const;
00116 
00123         void setMaterialName( const String& name );
00124 
00126         virtual void setVisible(bool visible);
00127 
00129         virtual bool isVisible(void) const;
00130 
00133         SubMesh* getSubMesh(void);
00134 
00136         Entity* getParent(void) const { return mParentEntity; }
00137 
00140         const MaterialPtr& getMaterial(void) const;
00141 
00144         Technique* getTechnique(void) const;
00145 
00148         void getRenderOperation(RenderOperation& op);
00149 
00152         void getWorldTransforms(Matrix4* xform) const;
00155         unsigned short getNumWorldTransforms(void) const;
00157         Real getSquaredViewDepth(const Camera* cam) const;
00159         const LightList& getLights(void) const;
00161         bool getCastsShadows(void) const;
00171         VertexData* _getSkelAnimVertexData(void);
00180         VertexData* _getSoftwareVertexAnimVertexData(void);
00185         VertexData* _getHardwareVertexAnimVertexData(void);
00189         TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
00193         TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
00195         VertexData* getVertexDataForBinding(void);
00196 
00199         void _markBuffersUnusedForAnimation(void);
00202         void _markBuffersUsedForAnimation(void);
00204         bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
00208         void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
00209 
00211         void _updateCustomGpuParameter(
00212             const GpuProgramParameters::AutoConstantEntry& constantEntry,
00213             GpuProgramParameters* params) const;
00214 
00216         void _invalidateCameraCache ()
00217         { mCachedCamera = 0; }
00218     };
00219 
00220 }
00221 
00222 
00223 #endif

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Tue Nov 4 11:02:35 2008