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-2013 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 #include "OgreHeaderPrefix.h"
00038 
00039 namespace Ogre {
00040 
00063     class _OgreExport SubEntity: public Renderable, public SubEntityAlloc
00064     {
00065         // Note no virtual functions for efficiency
00066         friend class Entity;
00067         friend class SceneManager;
00068     protected:
00071         SubEntity(Entity* parent, SubMesh* subMeshBasis);
00072 
00075         virtual ~SubEntity();
00076 
00078         Entity* mParentEntity;
00079 
00081         MaterialPtr mMaterialPtr;
00082 
00084         SubMesh* mSubMesh;
00085 
00087         size_t mIndexStart;
00088 
00090         size_t mIndexEnd;
00091 
00093         bool mVisible;
00094 
00096         uint8 mRenderQueueID;
00098         bool mRenderQueueIDSet;
00100         ushort mRenderQueuePriority;
00102         bool mRenderQueuePrioritySet;
00103 
00105         unsigned short mMaterialLodIndex;
00106 
00108         VertexData* mSkelAnimVertexData;
00110         TempBlendedBufferInfo mTempSkelAnimInfo;
00112         TempBlendedBufferInfo mTempVertexAnimInfo;
00114         VertexData* mSoftwareVertexAnimVertexData;
00118         VertexData* mHardwareVertexAnimVertexData;
00120         bool mVertexAnimationAppliedThisFrame;
00122         ushort mHardwarePoseCount;
00124         mutable Real mCachedCameraDist;
00126         mutable const Camera *mCachedCamera;
00127 
00129         void prepareTempBlendBuffers(void);
00130 
00131     public:
00134         const String& getMaterialName() const;
00135 
00142         void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
00143 
00150         void setMaterial( const MaterialPtr& material );
00151 
00153         virtual void setVisible(bool visible);
00154 
00156         virtual bool isVisible(void) const;
00157 
00169         virtual void setRenderQueueGroup(uint8 queueID);
00170 
00184         virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
00185 
00187         virtual uint8 getRenderQueueGroup(void) const;
00188 
00190         virtual ushort getRenderQueuePriority(void) const;
00191 
00193         virtual bool isRenderQueueGroupSet(void) const;
00194 
00196         virtual bool isRenderQueuePrioritySet(void) const;
00197 
00200         SubMesh* getSubMesh(void);
00201 
00203         Entity* getParent(void) const { return mParentEntity; }
00204 
00207         const MaterialPtr& getMaterial(void) const;
00208 
00211         Technique* getTechnique(void) const;
00212 
00215         void getRenderOperation(RenderOperation& op);
00216 
00221         void setIndexDataStartIndex(size_t start_index);
00222 
00226         size_t getIndexDataStartIndex() const;
00227 
00232         void setIndexDataEndIndex(size_t end_index);
00233 
00236         size_t getIndexDataEndIndex() const;
00237 
00240         void resetIndexDataStartEndIndex();
00241 
00244         void getWorldTransforms(Matrix4* xform) const;
00247         unsigned short getNumWorldTransforms(void) const;
00249         Real getSquaredViewDepth(const Camera* cam) const;
00251         const LightList& getLights(void) const;
00253         bool getCastsShadows(void) const;
00263         VertexData* _getSkelAnimVertexData(void);
00272         VertexData* _getSoftwareVertexAnimVertexData(void);
00277         VertexData* _getHardwareVertexAnimVertexData(void);
00281         TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
00285         TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
00287         VertexData* getVertexDataForBinding(void);
00288 
00291         void _markBuffersUnusedForAnimation(void);
00294         void _markBuffersUsedForAnimation(void);
00296         bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
00300         void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
00301 
00303         void _updateCustomGpuParameter(
00304             const GpuProgramParameters::AutoConstantEntry& constantEntry,
00305             GpuProgramParameters* params) const;
00306 
00308         void _invalidateCameraCache ()
00309         { mCachedCamera = 0; }
00310     };
00314 }
00315 
00316 #include "OgreHeaderSuffix.h"
00317 
00318 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:48