28 #ifndef __StaticGeometry_H__ 29 #define __StaticGeometry_H__ 212 void copyIndexes(
const T* src, T* dst,
size_t count,
size_t indexOffset)
214 if (indexOffset == 0)
216 memcpy(dst, src,
sizeof(T) * count);
222 *dst++ =
static_cast<T
>(*src++ + indexOffset);
239 void getWorldTransforms(
Matrix4* xform)
const;
240 Real getSquaredViewDepth(
const Camera* cam)
const;
242 bool getCastsShadows(
void)
const;
249 void build(
bool stencilShadows);
251 void dump(std::ofstream& of)
const;
287 void build(
bool stencilShadows);
296 GeometryIterator getGeometryIterator(
void);
300 void dump(std::ofstream& of)
const;
327 bool createSeparateLightCap,
bool isLightCap =
false);
330 void getWorldTransforms(
Matrix4* xform)
const;
364 void build(
bool stencilShadows);
371 MaterialIterator getMaterialIterator(
void);
373 void dump(std::ofstream& of)
const;
378 void updateShadowRenderables(
381 bool extrudeVertices,
Real extrusionDistance,
unsigned long flags = 0 );
444 void build(
bool stencilShadows);
449 const String& getMovableType(
void)
const;
450 void _notifyCurrentCamera(
Camera* cam);
452 Real getBoundingRadius(
void)
const;
456 bool debugRenderables =
false);
457 bool isVisible(
void)
const;
458 uint32 getTypeFlags(
void)
const;
462 LODIterator getLODIterator(
void);
467 bool extrudeVertices,
Real extrusionDistance,
unsigned long flags = 0 );
471 bool hasEdgeList(
void);
474 void dump(std::ofstream& of)
const;
524 virtual Region* getRegion(
const Vector3& point,
bool autoCreate);
531 virtual void getRegionIndexes(
const Vector3& point,
551 SubMeshLodGeometryLinkList* determineGeometry(
SubMesh* sm);
561 template <
typename T>
565 for (
size_t i = 0; i < numIndexes; ++i)
568 remap.insert(IndexRemap::value_type(*pBuffer++, remap.size()));
574 template <
typename T>
578 for (
size_t i = 0; i < numIndexes; ++i)
581 IndexRemap::const_iterator ix = remap.find(*src++);
582 assert(ix != remap.end());
583 *dst++ =
static_cast<T
>(ix->second);
635 virtual void addSceneNode(
const SceneNode* node);
647 virtual void build(
void);
654 virtual void destroy(
void);
659 virtual void reset(
void);
671 mUpperDistance = dist;
672 mSquaredUpperDistance = mUpperDistance * mUpperDistance;
680 {
return mSquaredUpperDistance; }
683 virtual void setVisible(
bool visible);
705 virtual void setCastShadows(
bool castShadows);
720 mRegionDimensions = size;
721 mHalfRegionDimensions = size * 0.5;
741 void setVisibilityFlags(
uint32 flags);
743 uint32 getVisibilityFlags()
const;
756 virtual void setRenderQueueGroup(
uint8 queueID);
759 virtual uint8 getRenderQueueGroup(
void)
const;
762 bool debugRenderables =
false);
767 RegionIterator getRegionIterator(
void);
772 virtual void dump(
const String& filename)
const;
Real mLodValue
LOD value at which this LOD starts to apply (squared)
Class which represents the renderable aspects of a set of shadow volume faces.
uint32 mVisibilityFlags
Stores the visibility flags for the regions.
Concrete IteratorWrapper for nonconst access to the underlying container.
MaterialBucket * mParent
Pointer to parent bucket.
HardwareVertexBufferSharedPtr mPositionBuffer
LODBucket * mParent
Pointer to parent LODBucket.
Real getLodValue(void) const
Get the LOD value.
vector< QueuedGeometry * >::type QueuedGeometryList
Abstract class defining the interface all renderable objects must implement.
VectorIterator< LODBucketList > LODIterator
list< OptimisedSubMeshGeometry * >::type OptimisedSubMeshGeometryList
virtual void setRegionDimensions(const Vector3 &size)
Sets the size of a single region of geometry.
virtual bool isVisible(void) const
Are the batches visible?
virtual Real getSquaredRenderingDistance(void) const
Gets the squared distance at which batches are no longer rendered.
CurrentGeometryMap mCurrentGeometryMap
Abstract class defining a movable object in a scene.
Strategy for determining level of detail.
Shared pointer implementation used to share index buffers.
ulong mLightListUpdated
The last frame that this light list was updated in.
Structure recording a queued submesh for the build.
MaterialBucketMap mMaterialBucketMap
Lookup of Material Buckets in this region.
AxisAlignedBox worldBounds
Pre-transformed world AABB.
Camera * mCamera
Current camera.
bool mVertexProgramInUse
Is a vertex program in use somewhere in this group?
virtual void setOrigin(const Vector3 &origin)
Sets the origin of the geometry.
Summary class collecting together vertex source information.
virtual void setRenderingDistance(Real dist)
Sets the distance at which batches are no longer rendered.
Implementation of a Quaternion, i.e.
QueuedSubMeshList mQueuedSubMeshes
vector< ShadowRenderable * >::type ShadowRenderableList
Vector3 mCentre
Center of the region.
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
4-dimensional homogeneous vector.
Technique * getCurrentTechnique(void) const
Get the current Technique.
const Vector3 & getCentre(void) const
Get the centre point of the region.
SubMeshGeometryLookup mSubMeshGeometryLookup
Cached links from SubMeshes to (potentially optimised) geometry This is not used for deletion since t...
const String & getName(void) const
Get the name of this object.
String mFormatString
String identifying the vertex / index format.
float Real
Software floating point type.
void copyIndexes(const T *src, T *dst, size_t count, size_t indexOffset)
size_t mMaxVertexIndex
Maximum vertex indexable.
vector< QueuedSubMesh * >::type QueuedSubMeshList
bool mRenderQueueIDSet
Flags whether the RenderQueue's default should be used.
Class to manage the scene object rendering queue.
Summary class collecting together index data source information.
VectorIterator< GeometryBucketList > GeometryIterator
Iterator over geometry.
SceneNode * mNode
Scene node.
QueuedGeometryList mQueuedGeometry
Geometry which has been queued up pre-build (not for deallocation)
HardwareVertexBufferSharedPtr getPositionBuffer(void)
Class representing a node in the scene graph.
map< String, MaterialBucket * >::type MaterialBucketMap
Lookup of Material Buckets in this region.
Structure recording a queued geometry for low level builds.
ShadowTechnique
An enumeration of broad shadow techniques.
virtual const Vector3 & getOrigin(void) const
Gets the origin of this geometry.
StaticGeometry * getParent(void) const
MapIterator< MaterialBucketMap > MaterialIterator
Iterator over the materials in this LOD.
vector< GeometryBucket * >::type GeometryBucketList
list of Geometry Buckets in this region
This class contains the information required to describe the edge connectivity of a given set of vert...
bool isVertexProgramInUse() const
map< SubMesh *, SubMeshLodGeometryLinkList * >::type SubMeshGeometryLookup
Nested class to allow shadows.
String mMaterialName
Material being used.
Defines a part of a complete mesh.
unsigned short mLod
LOD level (0 == full LOD)
A LODBucket is a collection of smaller buckets with the same LOD.
Saved link between SubMesh at a LOD and vertex/index data May point to original or optimised geometry...
ShadowCaster::ShadowRenderableList & getShadowRenderableList()
Class encapsulating a standard 4x4 homogeneous matrix.
HardwareIndexBuffer::IndexType mIndexType
Size of indexes.
Standard 3-dimensional vector.
Real mLodValue
Current LOD value, passed on to do material LOD later.
A GeometryBucket is a the lowest level bucket where geometry with the same vertex & index format is s...
Shared pointer implementation used to share vertex buffers.
virtual Real getRenderingDistance(void) const
Gets the distance at which batches are no longer rendered.
uint32 mRegionID
Unique identifier for the region.
HardwareVertexBufferSharedPtr getWBuffer(void)
std::map< K, V, P, A > type
StaticGeometry * mParent
Parent static geometry.
const String & getMaterialName(void) const
Get the material name.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly...
map< String, GeometryBucket * >::type CurrentGeometryMap
vector< Real >::type LodValueList
AxisAlignedBox mAABB
Local AABB relative to region centre.
const IndexData * getIndexData(void) const
Get the index data for this geometry.
~OptimisedSubMeshGeometry()
map< uint32, Region * >::type RegionMap
Indexed region map based on packed x/y/z region index, 10 bits for each axis.
MaterialBucket * getParent(void)
LightList mLightList
List of lights for this region.
vector< LODBucket * >::type LODBucketList
list of LOD Buckets in this region
EdgeData * getEdgeList() const
HardwareVertexBufferSharedPtr mWBuffer
RegionMap mRegionMap
Map of regions.
map< size_t, size_t >::type IndexRemap
static const Vector3 UNIT_SCALE
EdgeData * mEdgeList
Edge list, used if stencil shadow casting is enabled.
OptimisedSubMeshGeometry()
A viewpoint from which the scene will be rendered.
ushort mCurrentLod
The current LOD level, as determined from the last camera.
Real mSquaredUpperDistance
VertexData * mVertexData
Vertex information, includes current number of vertices committed to be a part of this bucket...
Struct holding geometry optimised per SubMesh / LOD level, ready for copying to instances.
OptimisedSubMeshGeometryList mOptimisedSubMeshGeometryList
List of geometry which has been optimised for SubMesh use This is the primary storage used for cleani...
A MaterialBucket is a collection of smaller buckets with the same Material (and implicitly the same L...
IndexData * mIndexData
Index information, includes index type which limits the max number of vertices which are allowed in o...
const MaterialPtr & getMaterial(void) const
Get the material for this bucket.
GeometryBucketList mGeometryBucketList
list of Geometry Buckets in this region
virtual const Vector3 & getRegionDimensions(void) const
Gets the size of a single batch of geometry.
uint32 getID(void) const
Get the region ID of this region.
vector< SubMeshLodGeometryLink >::type SubMeshLodGeometryLinkList
uint8 mRenderQueueID
The render queue to use when rendering this object.
MapIterator< RegionMap > RegionIterator
Iterator for iterating over contained regions.
Pre-transforms and batches up meshes for efficient use as static geometry in a scene.
QueuedGeometryList mQueuedGeometryList
Geometry queued for a single LOD (deallocated here)
virtual bool getCastShadows(void)
Will the geometry from this object cast shadows?
Region * mParent
Pointer to parent region.
Vector3 mRegionDimensions
void remapIndexes(T *src, T *dst, const IndexRemap &remap, size_t numIndexes)
Method for altering indexes based on a remap.
Technique * mTechnique
Active technique.
'New' rendering operation using vertex buffers.
Class representing an approach to rendering this particular Material.
Defines an instance of a discrete, movable object based on a Mesh.
const VertexData * getVertexData(void) const
Get the vertex data for this geometry.
Mesh::LodValueList mLodValues
LOD values as built up - use the max at each level.
The details of a topological region which is the highest level of partitioning for this class...
ushort getLod(void) const
Get the LOD index.
static const Quaternion IDENTITY
LODBucket * getParent(void)
Real mSquaredViewDepth
Cached squared view depth value to avoid recalculation by GeometryBucket.
A 3D box aligned with the x/y/z axes.
Manages the organisation and rendering of a 'scene' i.e.
SubMeshLodGeometryLinkList * geometryLodList
Link to LOD list of geometry, potentially optimised.
const LodStrategy * mLodStrategy
LOD strategy reference.
LODBucketList mLodBucketList
List of LOD buckets.
Vector3 mHalfRegionDimensions
ShadowCaster::ShadowRenderableList mShadowRenderables
List of shadow renderables.
Representation of a dynamic light source in the scene.
QueuedSubMeshList mQueuedSubMeshes
Local list of queued meshes (not used for deallocation)
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
SubMeshLodGeometryLink * geometry
Real mBoundingRadius
Local bounding radius.
SceneManager * mSceneMgr
Scene manager link.
void buildIndexRemap(T *pBuffer, size_t numIndexes, IndexRemap &remap)
Method for figuring out which vertices are used by an index buffer and calculating a remap lookup for...
MaterialPtr mMaterial
Pointer to material being used.