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 00131 void setMaterial( const MaterialPtr& material ); 00132 00134 virtual void setVisible(bool visible); 00135 00137 virtual bool isVisible(void) const; 00138 00141 SubMesh* getSubMesh(void); 00142 00144 Entity* getParent(void) const { return mParentEntity; } 00145 00148 const MaterialPtr& getMaterial(void) const; 00149 00152 Technique* getTechnique(void) const; 00153 00156 void getRenderOperation(RenderOperation& op); 00157 00160 void getWorldTransforms(Matrix4* xform) const; 00163 unsigned short getNumWorldTransforms(void) const; 00165 Real getSquaredViewDepth(const Camera* cam) const; 00167 const LightList& getLights(void) const; 00169 bool getCastsShadows(void) const; 00179 VertexData* _getSkelAnimVertexData(void); 00188 VertexData* _getSoftwareVertexAnimVertexData(void); 00193 VertexData* _getHardwareVertexAnimVertexData(void); 00197 TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void); 00201 TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void); 00203 VertexData* getVertexDataForBinding(void); 00204 00207 void _markBuffersUnusedForAnimation(void); 00210 void _markBuffersUsedForAnimation(void); 00212 bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; } 00216 void _restoreBuffersForUnusedAnimation(bool hardwareAnimation); 00217 00219 void _updateCustomGpuParameter( 00220 const GpuProgramParameters::AutoConstantEntry& constantEntry, 00221 GpuProgramParameters* params) const; 00222 00224 void _invalidateCameraCache () 00225 { mCachedCamera = 0; } 00226 }; 00227 00228 } 00229 00230 00231 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:26 2009