OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreSubEntity.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE 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 
38 namespace Ogre {
39 
63  {
64  // Note no virtual functions for efficiency
65  friend class Entity;
66  friend class SceneManager;
67  protected:
70  SubEntity(Entity* parent, SubMesh* subMeshBasis);
71 
74  virtual ~SubEntity();
75 
78 
81 
84 
85  // Pointer to the SubMesh defining geometry.
87 
89  bool mVisible;
90 
92  unsigned short mMaterialLodIndex;
93 
113  mutable const Camera *mCachedCamera;
114 
116  void prepareTempBlendBuffers(void);
117 
118  public:
121  const String& getMaterialName() const;
122 
129  void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
130 
137  void setMaterial( const MaterialPtr& material );
138 
140  virtual void setVisible(bool visible);
141 
143  virtual bool isVisible(void) const;
144 
147  SubMesh* getSubMesh(void);
148 
150  Entity* getParent(void) const { return mParentEntity; }
151 
154  const MaterialPtr& getMaterial(void) const;
155 
158  Technique* getTechnique(void) const;
159 
162  void getRenderOperation(RenderOperation& op);
163 
166  void getWorldTransforms(Matrix4* xform) const;
169  unsigned short getNumWorldTransforms(void) const;
171  Real getSquaredViewDepth(const Camera* cam) const;
173  const LightList& getLights(void) const;
175  bool getCastsShadows(void) const;
185  VertexData* _getSkelAnimVertexData(void);
194  VertexData* _getSoftwareVertexAnimVertexData(void);
199  VertexData* _getHardwareVertexAnimVertexData(void);
203  TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
207  TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
209  VertexData* getVertexDataForBinding(void);
210 
213  void _markBuffersUnusedForAnimation(void);
216  void _markBuffersUsedForAnimation(void);
218  bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
222  void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
223 
225  void _updateCustomGpuParameter(
226  const GpuProgramParameters::AutoConstantEntry& constantEntry,
227  GpuProgramParameters* params) const;
228 
231  { mCachedCamera = 0; }
232  };
236 }
237 
238 
239 #endif
ushort mHardwarePoseCount
Number of hardware blended poses supported by material.
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:85
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
String mMaterialName
Name of Material in use by this SubEntity.
Definition: OgreSubEntity.h:80
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:203
TempBlendedBufferInfo mTempVertexAnimInfo
Temp buffer details for software Vertex anim geometry.
Definition: OgreSubEntity.h:99
VertexData * mHardwareVertexAnimVertexData
Vertex data details for hardware Vertex anim of shared geometry.
Structure for recording the use of temporary blend buffers.
Manages the organisation and rendering of a 'scene' i.e.
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
const Camera * mCachedCamera
The camera for which the cached distance is valid.
SubMesh * mSubMesh
Definition: OgreSubEntity.h:86
Entity * getParent(void) const
Accessor to get parent Entity.
Class representing an approach to rendering this particular Material.
Definition: OgreTechnique.h:53
Abstract class defining the interface all renderable objects must implement.
Structure recording the use of an automatic parameter.
Utility class which defines the sub-parts of an Entity.
Definition: OgreSubEntity.h:62
bool mVertexAnimationAppliedThisFrame
Have we applied any vertex animation to geometry?
Defines an instance of a discrete, movable object based on a Mesh.
Definition: OgreEntity.h:81
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Collects together the program parameters used for a GpuProgram.
void _invalidateCameraCache()
Invalidate the camera distance cache.
Defines a part of a complete mesh.
Definition: OgreSubMesh.h:62
unsigned short ushort
bool mVisible
Is this SubEntity visible?
Definition: OgreSubEntity.h:89
Summary class collecting together vertex source information.
'New' rendering operation using vertex buffers.
TempBlendedBufferInfo mTempSkelAnimInfo
Quick lookup of buffers.
Definition: OgreSubEntity.h:97
Entity * mParentEntity
Pointer to parent.
Definition: OgreSubEntity.h:77
MaterialPtr mpMaterial
Cached pointer to material.
Definition: OgreSubEntity.h:83
VertexData * mSkelAnimVertexData
blend buffer details for dedicated geometry
Definition: OgreSubEntity.h:95
VertexData * mSoftwareVertexAnimVertexData
Vertex data details for software Vertex anim of shared geometry.
bool _getBuffersMarkedForAnimation(void) const
Are buffers already marked as vertex animated?
unsigned short mMaterialLodIndex
The LOD number of the material to use, calculated by Entity::_notifyCurrentCamera.
Definition: OgreSubEntity.h:92
_StringBase String
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
Definition: OgreMaterial.h:677
Real mCachedCameraDist
Cached distance to last camera for getSquaredViewDepth.