# 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
    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;
    00154         const Quaternion& getWorldOrientation(void) const;
    00156         const Vector3& getWorldPosition(void) const;
    00159         bool getNormaliseNormals(void) const;
    00162         unsigned short getNumWorldTransforms(void) const;
    00164         Real getSquaredViewDepth(const Camera* cam) const;
    00166         const LightList& getLights(void) const;
    00168         bool getCastsShadows(void) const;
    00178         VertexData* _getSkelAnimVertexData(void);
    00187         VertexData* _getSoftwareVertexAnimVertexData(void);
    00192         VertexData* _getHardwareVertexAnimVertexData(void);
    00196         TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
    00200         TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
    00202         VertexData* getVertexDataForBinding(void);
    00203
    00206         void _markBuffersUnusedForAnimation(void);
    00209         void _markBuffersUsedForAnimation(void);
    00211         bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
    00215         void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
    00216
    00218         void _updateCustomGpuParameter(
    00219             const GpuProgramParameters::AutoConstantEntry& constantEntry,
    00220             GpuProgramParameters* params) const;
    00221
    00223         void _invalidateCameraCache ()
    00224         { mCachedCamera = 0; }
    00225     };
    00226
    00227 }
    00228
    00229
    00230 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:04 2008