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-2011 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 #ifndef __SubEntity_H__ 00029 #define __SubEntity_H__ 00030 00031 #include "OgrePrerequisites.h" 00032 00033 #include "OgreString.h" 00034 #include "OgreRenderable.h" 00035 #include "OgreHardwareBufferManager.h" 00036 #include "OgreResourceGroupManager.h" 00037 00038 namespace Ogre { 00039 00062 class _OgreExport SubEntity: public Renderable, public SubEntityAlloc 00063 { 00064 // Note no virtual functions for efficiency 00065 friend class Entity; 00066 friend class SceneManager; 00067 protected: 00070 SubEntity(Entity* parent, SubMesh* subMeshBasis); 00071 00074 virtual ~SubEntity(); 00075 00077 Entity* mParentEntity; 00078 00080 String mMaterialName; 00081 00083 MaterialPtr mpMaterial; 00084 00085 // Pointer to the SubMesh defining geometry. 00086 SubMesh* mSubMesh; 00087 00089 bool mVisible; 00090 00092 unsigned short mMaterialLodIndex; 00093 00095 VertexData* mSkelAnimVertexData; 00097 TempBlendedBufferInfo mTempSkelAnimInfo; 00099 TempBlendedBufferInfo mTempVertexAnimInfo; 00101 VertexData* mSoftwareVertexAnimVertexData; 00105 VertexData* mHardwareVertexAnimVertexData; 00107 bool mVertexAnimationAppliedThisFrame; 00109 ushort mHardwarePoseCount; 00111 mutable Real mCachedCameraDist; 00113 mutable const Camera *mCachedCamera; 00114 00116 void prepareTempBlendBuffers(void); 00117 00118 public: 00121 const String& getMaterialName() const; 00122 00129 void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME ); 00130 00137 void setMaterial( const MaterialPtr& material ); 00138 00140 virtual void setVisible(bool visible); 00141 00143 virtual bool isVisible(void) const; 00144 00147 SubMesh* getSubMesh(void); 00148 00150 Entity* getParent(void) const { return mParentEntity; } 00151 00154 const MaterialPtr& getMaterial(void) const; 00155 00158 Technique* getTechnique(void) const; 00159 00162 void getRenderOperation(RenderOperation& op); 00163 00166 void getWorldTransforms(Matrix4* xform) const; 00169 unsigned short getNumWorldTransforms(void) const; 00171 Real getSquaredViewDepth(const Camera* cam) const; 00173 const LightList& getLights(void) const; 00175 bool getCastsShadows(void) const; 00185 VertexData* _getSkelAnimVertexData(void); 00194 VertexData* _getSoftwareVertexAnimVertexData(void); 00199 VertexData* _getHardwareVertexAnimVertexData(void); 00203 TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void); 00207 TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void); 00209 VertexData* getVertexDataForBinding(void); 00210 00213 void _markBuffersUnusedForAnimation(void); 00216 void _markBuffersUsedForAnimation(void); 00218 bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; } 00222 void _restoreBuffersForUnusedAnimation(bool hardwareAnimation); 00223 00225 void _updateCustomGpuParameter( 00226 const GpuProgramParameters::AutoConstantEntry& constantEntry, 00227 GpuProgramParameters* params) const; 00228 00230 void _invalidateCameraCache () 00231 { mCachedCamera = 0; } 00232 }; 00236 } 00237 00238 00239 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:44