OGRE  1.9.0
OgreSubEntity.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __SubEntity_H__
29#define __SubEntity_H__
30
31#include "OgrePrerequisites.h"
32
33#include "OgreString.h"
34#include "OgreRenderable.h"
37#include "OgreHeaderPrefix.h"
38
39namespace Ogre {
40
64 {
65 // Note no virtual functions for efficiency
66 friend class Entity;
67 friend class SceneManager;
68 protected:
71 SubEntity(Entity* parent, SubMesh* subMeshBasis);
72
75 virtual ~SubEntity();
76
79
82
85
88
90 size_t mIndexEnd;
91
94
103
105 unsigned short mMaterialLodIndex;
106
126 mutable const Camera *mCachedCamera;
127
130
131 public:
134 const String& getMaterialName() const;
135
142 void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
143
150 void setMaterial( const MaterialPtr& material );
151
153 virtual void setVisible(bool visible);
154
156 virtual bool isVisible(void) const;
157
169 virtual void setRenderQueueGroup(uint8 queueID);
170
184 virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
185
187 virtual uint8 getRenderQueueGroup(void) const;
188
190 virtual ushort getRenderQueuePriority(void) const;
191
193 virtual bool isRenderQueueGroupSet(void) const;
194
196 virtual bool isRenderQueuePrioritySet(void) const;
197
201
203 Entity* getParent(void) const { return mParentEntity; }
204
207 const MaterialPtr& getMaterial(void) const;
208
212
216
221 void setIndexDataStartIndex(size_t start_index);
222
227
232 void setIndexDataEndIndex(size_t end_index);
233
236 size_t getIndexDataEndIndex() const;
237
241
244 void getWorldTransforms(Matrix4* xform) const;
247 unsigned short getNumWorldTransforms(void) const;
249 Real getSquaredViewDepth(const Camera* cam) const;
251 const LightList& getLights(void) const;
253 bool getCastsShadows(void) const;
288
296 bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
300 void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
301
304 const GpuProgramParameters::AutoConstantEntry& constantEntry,
305 GpuProgramParameters* params) const;
306
309 { mCachedCamera = 0; }
310 };
314}
315
316#include "OgreHeaderSuffix.h"
317
318#endif
#define _OgreExport
Definition: OgrePlatform.h:260
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Defines an instance of a discrete, movable object based on a Mesh.
Definition: OgreEntity.h:83
Structure recording the use of an automatic parameter.
Collects together the program parameters used for a GpuProgram.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
'New' rendering operation using vertex buffers.
Abstract class defining the interface all renderable objects must implement.
Manages the organisation and rendering of a 'scene' i.e.
Utility class which defines the sub-parts of an Entity.
Definition: OgreSubEntity.h:64
virtual ushort getRenderQueuePriority(void) const
Gets the queue group for this entity, see setRenderQueueGroup for full details.
const Camera * mCachedCamera
The camera for which the cached distance is valid.
virtual void setRenderQueueGroup(uint8 queueID)
Sets the render queue group this SubEntity will be rendered through.
const LightList & getLights(void) const
Gets a list of lights, ordered relative to how close they are to this renderable.
virtual void setVisible(bool visible)
Tells this SubEntity whether to be visible or not.
unsigned short mMaterialLodIndex
The LOD number of the material to use, calculated by Entity::_notifyCurrentCamera.
Entity * getParent(void) const
Accessor to get parent Entity.
SubMesh * mSubMesh
Pointer to the SubMesh defining geometry.
Definition: OgreSubEntity.h:84
size_t getIndexDataStartIndex() const
Returns the current value of the start index used for drawing.
virtual uint8 getRenderQueueGroup(void) const
Gets the queue group for this entity, see setRenderQueueGroup for full details.
VertexData * mSkelAnimVertexData
Blend buffer details for dedicated geometry.
VertexData * _getSoftwareVertexAnimVertexData(void)
Advanced method to get the temporarily blended software morph vertex information.
size_t getIndexDataEndIndex() const
Returns the current value of the start index used for drawing.
void _markBuffersUsedForAnimation(void)
Mark all vertex data as animated.
virtual bool isRenderQueuePrioritySet(void) const
Gets the queue group for this entity, see setRenderQueueGroup for full details.
void resetIndexDataStartEndIndex()
Reset the custom start/end index to the default values.
void setMaterial(const MaterialPtr &material)
Sets a Material to be used.
virtual bool isVisible(void) const
Returns whether or not this SubEntity is supposed to be visible.
unsigned short getNumWorldTransforms(void) const
Overridden - see Renderable.
void setIndexDataEndIndex(size_t end_index)
Tells this SubEntity to draw a subset of the SubMesh by adjusting the index buffer extents.
ushort mHardwarePoseCount
Number of hardware blended poses supported by material.
const MaterialPtr & getMaterial(void) const
Overridden - see Renderable.
TempBlendedBufferInfo mTempSkelAnimInfo
Quick lookup of buffers.
size_t mIndexEnd
override the end index for the RenderOperation
Definition: OgreSubEntity.h:90
MaterialPtr mMaterialPtr
Cached pointer to material.
Definition: OgreSubEntity.h:81
Real mCachedCameraDist
Cached distance to last camera for getSquaredViewDepth.
TempBlendedBufferInfo mTempVertexAnimInfo
Temp buffer details for software Vertex anim geometry.
Technique * getTechnique(void) const
Overridden - see Renderable.
VertexData * _getHardwareVertexAnimVertexData(void)
Advanced method to get the hardware morph vertex information.
ushort mRenderQueuePriority
The render queue priority to use when rendering this renderable.
void _updateCustomGpuParameter(const GpuProgramParameters::AutoConstantEntry &constantEntry, GpuProgramParameters *params) const
Overridden from Renderable to provide some custom behaviour.
SubMesh * getSubMesh(void)
Accessor method to read mesh data.
bool getCastsShadows(void) const
Method which reports whether this renderable would normally cast a shadow.
bool mRenderQueueIDSet
Flags whether the RenderQueue's default should be used.
Definition: OgreSubEntity.h:98
bool mRenderQueuePrioritySet
Flags whether the RenderQueue's default should be used.
void getWorldTransforms(Matrix4 *xform) const
Overridden - see Renderable.
VertexData * getVertexDataForBinding(void)
Retrieve the VertexData which should be used for GPU binding.
void getRenderOperation(RenderOperation &op)
Overridden - see Renderable.
bool _getBuffersMarkedForAnimation(void) const
Are buffers already marked as vertex animated?
size_t mIndexStart
override the start index for the RenderOperation
Definition: OgreSubEntity.h:87
Entity * mParentEntity
Pointer to parent.
Definition: OgreSubEntity.h:78
void prepareTempBlendBuffers(void)
Internal method for preparing this Entity for use in animation.
SubEntity(Entity *parent, SubMesh *subMeshBasis)
Private constructor - don't allow creation by anybody else.
virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority)
Sets the render queue group and group priority this SubEntity will be rendered through.
void setMaterialName(const String &name, const String &groupName=ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME)
Sets the name of the Material to be used.
VertexData * mSoftwareVertexAnimVertexData
Vertex data details for software Vertex anim of shared geometry.
virtual bool isRenderQueueGroupSet(void) const
Gets the queue group for this entity, see setRenderQueueGroup for full details.
void _invalidateCameraCache()
Invalidate the camera distance cache.
void _markBuffersUnusedForAnimation(void)
Mark all vertex data as so far unanimated.
void setIndexDataStartIndex(size_t start_index)
Tells this SubEntity to draw a subset of the SubMesh by adjusting the index buffer extents.
Real getSquaredViewDepth(const Camera *cam) const
Overridden, see Renderable.
virtual ~SubEntity()
Private destructor.
VertexData * mHardwareVertexAnimVertexData
Vertex data details for hardware Vertex anim of shared geometry.
const String & getMaterialName() const
Gets the name of the Material in use by this instance.
TempBlendedBufferInfo * _getVertexAnimTempBufferInfo(void)
Advanced method to get the temp buffer information for software morph animation.
bool mVertexAnimationAppliedThisFrame
Have we applied any vertex animation to geometry?
bool mVisible
Is this SubEntity visible?
Definition: OgreSubEntity.h:93
uint8 mRenderQueueID
The render queue to use when rendering this renderable.
Definition: OgreSubEntity.h:96
TempBlendedBufferInfo * _getSkelAnimTempBufferInfo(void)
Advanced method to get the temp buffer information for software skeletal animation.
void _restoreBuffersForUnusedAnimation(bool hardwareAnimation)
Internal method to copy original vertex data to the morph structures should there be no active animat...
VertexData * _getSkelAnimVertexData(void)
Advanced method to get the temporarily blended vertex information for entities which are software ski...
Defines a part of a complete mesh.
Definition: OgreSubMesh.h:63
Class representing an approach to rendering this particular Material.
Definition: OgreTechnique.h:54
Structure for recording the use of temporary blend buffers.
Summary class collecting together vertex source information.
unsigned char uint8
Definition: OgrePlatform.h:346
float Real
Software floating point type.
_StringBase String
unsigned short ushort