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-2012 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 mMaterial;
    00084
    00085         // Pointer to the SubMesh defining geometry.
    00086         SubMesh* mSubMesh;
    00087
    00089         bool mVisible;
    00090
    00092         uint8 mRenderQueueID;
    00094         bool mRenderQueueIDSet;
    00096         ushort mRenderQueuePriority;
    00098         bool mRenderQueuePrioritySet;
    00099
    00101         unsigned short mMaterialLodIndex;
    00102
    00104         VertexData* mSkelAnimVertexData;
    00106         TempBlendedBufferInfo mTempSkelAnimInfo;
    00108         TempBlendedBufferInfo mTempVertexAnimInfo;
    00110         VertexData* mSoftwareVertexAnimVertexData;
    00114         VertexData* mHardwareVertexAnimVertexData;
    00116         bool mVertexAnimationAppliedThisFrame;
    00118         ushort mHardwarePoseCount;
    00120         mutable Real mCachedCameraDist;
    00122         mutable const Camera *mCachedCamera;
    00123
    00125         void prepareTempBlendBuffers(void);
    00126
    00127     public:
    00130         const String& getMaterialName() const;
    00131
    00138         void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
    00139
    00146         void setMaterial( const MaterialPtr& material );
    00147
    00149         virtual void setVisible(bool visible);
    00150
    00152         virtual bool isVisible(void) const;
    00153
    00165         virtual void setRenderQueueGroup(uint8 queueID);
    00166
    00180         virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
    00181
    00183         virtual uint8 getRenderQueueGroup(void) const;
    00184
    00186         virtual ushort getRenderQueuePriority(void) const;
    00187
    00189         virtual bool isRenderQueueGroupSet(void) const;
    00190
    00192         virtual bool isRenderQueuePrioritySet(void) const;
    00193
    00196         SubMesh* getSubMesh(void);
    00197
    00199         Entity* getParent(void) const { return mParentEntity; }
    00200
    00203         const MaterialPtr& getMaterial(void) const;
    00204
    00207         Technique* getTechnique(void) const;
    00208
    00211         void getRenderOperation(RenderOperation& op);
    00212
    00215         void getWorldTransforms(Matrix4* xform) const;
    00218         unsigned short getNumWorldTransforms(void) const;
    00220         Real getSquaredViewDepth(const Camera* cam) const;
    00222         const LightList& getLights(void) const;
    00224         bool getCastsShadows(void) const;
    00234         VertexData* _getSkelAnimVertexData(void);
    00243         VertexData* _getSoftwareVertexAnimVertexData(void);
    00248         VertexData* _getHardwareVertexAnimVertexData(void);
    00252         TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
    00256         TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
    00258         VertexData* getVertexDataForBinding(void);
    00259
    00262         void _markBuffersUnusedForAnimation(void);
    00265         void _markBuffersUsedForAnimation(void);
    00267         bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
    00271         void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
    00272
    00274         void _updateCustomGpuParameter(
    00275             const GpuProgramParameters::AutoConstantEntry& constantEntry,
    00276             GpuProgramParameters* params) const;
    00277
    00279         void _invalidateCameraCache ()
    00280         { mCachedCamera = 0; }
    00281     };
    00285 }
    00286
    00287
    00288 #endif

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:24