Go to the documentation of this file.
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);
251 void dump(std::ofstream& of)
const;
300 void dump(std::ofstream& of)
const;
327 bool createSeparateLightCap,
bool isLightCap =
false);
373 void dump(std::ofstream& of)
const;
381 bool extrudeVertices,
Real extrusionDistance,
unsigned long flags = 0 );
456 bool debugRenderables =
false);
467 bool extrudeVertices,
Real extrusionDistance,
unsigned long flags = 0 );
474 void dump(std::ofstream& of)
const;
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);
671 mUpperDistance = dist;
672 mSquaredUpperDistance = mUpperDistance * mUpperDistance;
680 {
return mSquaredUpperDistance; }
720 mRegionDimensions = size;
721 mHalfRegionDimensions = size * 0.5;
762 bool debugRenderables =
false);
QueuedGeometryList mQueuedGeometryList
Geometry queued for a single LOD (deallocated here)
static const Vector3 UNIT_SCALE
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject ...
void getRenderOperation(RenderOperation &op)
Gets the render operation required to send this object to the frame buffer.
map< size_t, size_t >::type IndexRemap
MaterialIterator getMaterialIterator(void)
Get an iterator over the materials in this LOD.
vector< Real >::type LodValueList
virtual ~StaticGeometry()
Destructor.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
EdgeData * getEdgeList(void)
Overridden from MovableObject.
map< uint32, Region * >::type RegionMap
Indexed region map based on packed x/y/z region index, 10 bits for each axis.
uint32 getTypeFlags(void) const
Get the 'type flags' for this MovableObject.
String mFormatString
String identifying the vertex / index format.
ShadowCaster::ShadowRenderableList mShadowRenderables
List of shadow renderables.
void build(bool stencilShadows)
Build.
vector< ShadowRenderable * >::type ShadowRenderableList
A viewpoint from which the scene will be rendered.
HardwareVertexBufferSharedPtr mWBuffer
StaticGeometry * getParent(void) const
QueuedGeometryList mQueuedGeometry
Geometry which has been queued up pre-build (not for deallocation)
void build(bool stencilShadows)
Build.
void updateShadowRenderables(ShadowTechnique shadowTechnique, const Vector4 &lightPos, HardwareIndexBufferSharedPtr *indexBuffer, bool extrudeVertices, Real extrusionDistance, unsigned long flags=0)
void addRenderables(RenderQueue *queue, uint8 group, Real lodValue)
Add children to the render queue.
MapIterator< MaterialBucketMap > MaterialIterator
Iterator over the materials in this LOD.
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject ...
RegionIterator getRegionIterator(void)
Get an iterator over the regions in this geometry.
virtual AxisAlignedBox calculateBounds(VertexData *vertexData, const Vector3 &position, const Quaternion &orientation, const Vector3 &scale)
Calculate world bounds from a set of vertex data.
SubMeshLodGeometryLinkList * geometryLodList
Link to LOD list of geometry, potentially optimised.
MapIterator< RegionMap > RegionIterator
Iterator for iterating over contained regions.
Class which represents the renderable aspects of a set of shadow volume faces.
virtual void reset(void)
Clears any of the entities / nodes added to this geometry and destroys anything which has already bee...
SubMeshLodGeometryLink * geometry
uint32 getID(void) const
Get the region ID of this region.
ShadowTechnique
An enumeration of broad shadow techniques.
Concrete IteratorWrapper for nonconst access to the underlying container.
Representation of a dynamic light source in the scene.
Vector3 mCentre
Center of the region.
OptimisedSubMeshGeometryList mOptimisedSubMeshGeometryList
List of geometry which has been optimised for SubMesh use This is the primary storage used for cleani...
map< String, GeometryBucket * >::type CurrentGeometryMap
Struct holding geometry optimised per SubMesh / LOD level, ready for copying to instances.
void dump(std::ofstream &of) const
Dump contents for diagnostics.
ShadowCaster::ShadowRenderableList & getShadowRenderableList()
LODBucket(Region *parent, unsigned short lod, Real lodValue)
Abstract class defining a movable object in a scene.
virtual const Vector3 & getRegionDimensions(void) const
Gets the size of a single batch of geometry.
ShadowRenderableListIterator getShadowVolumeRenderableIterator(ShadowTechnique shadowTechnique, const Light *light, HardwareIndexBufferSharedPtr *indexBuffer, size_t *indexBufferUsedSize, bool extrudeVertices, Real extrusionDistance, unsigned long flags=0)
Gets an iterator over the renderables required to render the shadow volume.
Shared pointer implementation used to share index buffers.
vector< SubMeshLodGeometryLink >::type SubMeshLodGeometryLinkList
void remapIndexes(T *src, T *dst, const IndexRemap &remap, size_t numIndexes)
Method for altering indexes based on a remap.
virtual uint8 getRenderQueueGroup(void) const
Gets the queue group for this entity, see setRenderQueueGroup for full details.
bool assign(QueuedGeometry *qsm)
Try to assign geometry to this bucket.
uint8 mRenderQueueID
The render queue to use when rendering this object.
HardwareIndexBuffer::IndexType mIndexType
Size of indexes.
virtual Vector3 getRegionCentre(ushort x, ushort y, ushort z)
Get the centre of an indexed region.
The details of a topological region which is the highest level of partitioning for this class.
StaticGeometry * mParent
Parent static geometry.
Vector3 mHalfRegionDimensions
A MaterialBucket is a collection of smaller buckets with the same Material (and implicitly the same L...
virtual void getRegionIndexes(const Vector3 &point, ushort &x, ushort &y, ushort &z)
Get the region indexes for a point.
Real mSquaredUpperDistance
virtual void setRenderQueueGroup(uint8 queueID)
Sets the render queue group this object will be rendered through.
virtual bool getCastShadows(void)
Will the geometry from this object cast shadows?
void build(bool stencilShadows)
Build.
Pre-transforms and batches up meshes for efficient use as static geometry in a scene.
void splitGeometry(VertexData *vd, IndexData *id, SubMeshLodGeometryLink *targetGeomLink)
Split some shared geometry into dedicated geometry.
size_t mMaxVertexIndex
Maximum vertex indexable.
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...
Class representing an approach to rendering this particular Material.
virtual void destroy(void)
Destroys all the built geometry state (reverse of build).
void _updateRenderQueue(RenderQueue *queue)
Internal method by which the movable object must add Renderable subclass instances to the rendering q...
void copyIndexes(const T *src, T *dst, size_t count, size_t indexOffset)
virtual ~GeometryBucket()
bool getCastsShadows(void) const
Method which reports whether this renderable would normally cast a shadow.
Vector3 mRegionDimensions
SubMeshLodGeometryLinkList * determineGeometry(SubMesh *sm)
Look up or calculate the geometry data to use for this SubMesh.
GeometryIterator getGeometryIterator(void)
Get an iterator over the contained geometry.
Defines an instance of a discrete, movable object based on a Mesh.
Class representing a node in the scene graph.
LODBucketList mLodBucketList
List of LOD buckets
Camera * mCamera
Current camera.
EdgeData * getEdgeList() const
Real getBoundingRadius(void) const
Retrieves the radius of the origin-centered bounding sphere for this object.
const LightList & getLights(void) const
Gets a list of lights, ordered relative to how close they are to this renderable.
Technique * getTechnique(void) const
Retrieves a pointer to the Material Technique this renderable object uses.
Summary class collecting together vertex source information.
MaterialBucket * mParent
Pointer to parent bucket.
Implementation of a Quaternion, i.e.
Strategy for determining level of detail.
void assign(QueuedSubMesh *qmesh)
Assign a queued mesh to this region, read for final build.
const MaterialPtr & getMaterial(void) const
Get the material for this bucket.
OptimisedSubMeshGeometry()
virtual Region * getRegion(uint32 index)
Get the region using a packed index, returns null if it doesn't exist.
Class encapsulating a standard 4x4 homogeneous matrix.
void build(bool stencilShadows)
Build this region.
~OptimisedSubMeshGeometry()
const AxisAlignedBox & getBoundingBox(void) const
Retrieves the local axis-aligned bounding box for this object.
CurrentGeometryMap mCurrentGeometryMap
void getWorldTransforms(Matrix4 *xform) const
Overridden from ShadowRenderable.
SceneNode * mNode
Scene node.
uint32 mVisibilityFlags
Stores the visibility flags for the regions.
virtual void setVisible(bool visible)
Hides or shows all the batches.
void assign(QueuedSubMesh *qsm, ushort atLod)
Assign a queued submesh to this bucket, using specified mesh LOD.
Manages the organisation and rendering of a 'scene' i.e.
virtual Real getSquaredRenderingDistance(void) const
Gets the squared distance at which batches are no longer rendered.
virtual void addSceneNode(const SceneNode *node)
Adds all the Entity objects attached to a SceneNode and all it's children to the static geometry.
HardwareVertexBufferSharedPtr mPositionBuffer
A LODBucket is a collection of smaller buckets with the same LOD.
bool isVertexProgramInUse() const
Shared pointer implementation used to share vertex buffers.
Defines a part of a complete mesh.
virtual AxisAlignedBox getRegionBounds(ushort x, ushort y, ushort z)
Get the bounds of an indexed region.
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables)
Region * mParent
Pointer to parent region.
virtual void build(void)
Build the geometry.
Structure recording a queued submesh for the build.
list< OptimisedSubMeshGeometry * >::type OptimisedSubMeshGeometryList
map< String, MaterialBucket * >::type MaterialBucketMap
Lookup of Material Buckets in this region.
Technique * getCurrentTechnique(void) const
Get the current Technique.
Technique * mTechnique
Active technique.
void _notifyCurrentCamera(Camera *cam)
Internal method to notify the object of the camera to be used for the next rendering operation.
vector< LODBucket * >::type LODBucketList
list of LOD Buckets in this region
virtual Region * getRegion(ushort x, ushort y, ushort z, bool autoCreate)
Get the region using indexes.
A 3D box aligned with the x/y/z axes.
virtual Region * getRegion(const Vector3 &point, bool autoCreate)
Get the region within which a point lies.
VectorIterator< LODBucketList > LODIterator
StaticGeometry(SceneManager *owner, const String &name)
Constructor; do not use directly (.
virtual void addEntity(Entity *ent, const Vector3 &position, const Quaternion &orientation=Quaternion::IDENTITY, const Vector3 &scale=Vector3::UNIT_SCALE)
Adds an Entity to the static geometry.
String getGeometryFormatString(SubMeshLodGeometryLink *geom)
Get a packed string identifying the geometry format.
ushort getLod(void) const
Get the LOD index.
VectorIterator< GeometryBucketList > GeometryIterator
Iterator over geometry.
unsigned short mLod
LOD level (0 == full LOD)
String mMaterialName
Material being used.
LODIterator getLODIterator(void)
Get an iterator over the LODs in this region.
GeometryBucket(MaterialBucket *parent, const String &formatString, const VertexData *vData, const IndexData *iData)
LODShadowRenderable(LODBucket *parent, HardwareIndexBufferSharedPtr *indexBuffer, const VertexData *vertexData, bool createSeparateLightCap, bool isLightCap=false)
virtual void setOrigin(const Vector3 &origin)
Sets the origin of the geometry.
LODBucket * getParent(void)
virtual bool isVisible(void) const
Are the batches visible?
Region(StaticGeometry *parent, const String &name, SceneManager *mgr, uint32 regionID, const Vector3 ¢re)
MaterialPtr mMaterial
Pointer to material being used.
virtual const Vector3 & getOrigin(void) const
Gets the origin of this geometry.
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables)
AxisAlignedBox mAABB
Local AABB relative to region centre.
vector< QueuedSubMesh * >::type QueuedSubMeshList
const String & getName(void) const
Get the name of this object.
SubMeshGeometryLookup mSubMeshGeometryLookup
Cached links from SubMeshes to (potentially optimised) geometry This is not used for deletion since t...
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
MaterialBucket * getParent(void)
ushort mCurrentLod
The current LOD level, as determined from the last camera.
VertexData * mVertexData
Vertex information, includes current number of vertices committed to be a part of this bucket.
std::map< K, V, P, A > type
virtual Region * getRegion(const AxisAlignedBox &bounds, bool autoCreate)
Virtual method for getting a region most suitable for the passed in bounds.
vector< QueuedGeometry * >::type QueuedGeometryList
4-dimensional homogeneous vector.
Saved link between SubMesh at a LOD and vertex/index data May point to original or optimised geometry...
uint32 getVisibilityFlags() const
Returns the visibility flags of the regions.
QueuedSubMeshList mQueuedSubMeshes
Structure recording a queued geometry for low level builds.
HardwareVertexBufferSharedPtr getPositionBuffer(void)
const IndexData * getIndexData(void) const
Get the index data for this geometry.
virtual void setRegionDimensions(const Vector3 &size)
Sets the size of a single region of geometry.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly.
const Vector3 & getCentre(void) const
Get the centre point of the region.
EdgeData * mEdgeList
Edge list, used if stencil shadow casting is enabled.
bool isVisible(void) const
Returns whether or not this object is supposed to be visible or not.
virtual void rebindIndexBuffer(const HardwareIndexBufferSharedPtr &indexBuffer)
Overridden from ShadowRenderable.
MaterialBucket(LODBucket *parent, const String &materialName)
uint32 mRegionID
Unique identifier for the region.
Abstract class defining the interface all renderable objects must implement.
LODBucket * mParent
Pointer to parent LODBucket.
virtual void setRenderingDistance(Real dist)
Sets the distance at which batches are no longer rendered.
ulong mLightListUpdated
The last frame that this light list was updated in.
AxisAlignedBox worldBounds
Pre-transformed world AABB.
Real getSquaredViewDepth(const Camera *cam) const
Returns the camera-relative squared depth of this renderable.
Real getLodValue(void) const
Get the LOD value.
QueuedSubMeshList mQueuedSubMeshes
Local list of queued meshes (not used for deallocation)
static const Quaternion IDENTITY
void dump(std::ofstream &of) const
Dump contents for diagnostics.
float Real
Software floating point type.
IndexData * mIndexData
Index information, includes index type which limits the max number of vertices which are allowed in o...
Real mLodValue
Current LOD value, passed on to do material LOD later.
const String & getMaterialName(void) const
Get the material name.
This class contains the information required to describe the edge connectivity of a given set of vert...
Real mLodValue
LOD value at which this LOD starts to apply (squared)
void addRenderables(RenderQueue *queue, uint8 group, Real lodValue)
Add children to the render queue.
void dump(std::ofstream &of) const
Dump contents for diagnostics.
const VertexData * getVertexData(void) const
Get the vertex data for this geometry.
virtual void setCastShadows(bool castShadows)
Sets whether this geometry should cast shadows.
virtual Real getRenderingDistance(void) const
Gets the distance at which batches are no longer rendered.
bool mRenderQueueIDSet
Flags whether the RenderQueue's default should be used.
Nested class to allow shadows.
Real mBoundingRadius
Local bounding radius.
Mesh::LodValueList mLodValues
LOD values as built up - use the max at each level.
bool mVertexProgramInUse
Is a vertex program in use somewhere in this group?
const LodStrategy * mLodStrategy
LOD strategy reference.
virtual Real getVolumeIntersection(const AxisAlignedBox &box, ushort x, ushort y, ushort z)
Get the volume intersection for an indexed region with some bounds.
void getWorldTransforms(Matrix4 *xform) const
Gets the world transform matrix / matrices for this renderable object.
virtual ~MaterialBucket()
const MaterialPtr & getMaterial(void) const
Retrieves a weak reference to the material this renderable object uses.
Summary class collecting together index data source information.
RegionMap mRegionMap
Map of regions.
GeometryBucketList mGeometryBucketList
list of Geometry Buckets in this region
Standard 3-dimensional vector.
A GeometryBucket is a the lowest level bucket where geometry with the same vertex & index format is s...
SceneManager * mSceneMgr
Scene manager link.
'New' rendering operation using vertex buffers.
Real mSquaredViewDepth
Cached squared view depth value to avoid recalculation by GeometryBucket.
const String & getMovableType(void) const
Returns the type name of this object.
vector< GeometryBucket * >::type GeometryBucketList
list of Geometry Buckets in this region
virtual void dump(const String &filename) const
Dump the contents of this StaticGeometry to a file for diagnostic purposes.
bool hasEdgeList(void)
Overridden member from ShadowCaster.
Class to manage the scene object rendering queue.
void setVisibilityFlags(uint32 flags)
Sets the visibility flags of all the regions at once.
map< SubMesh *, SubMeshLodGeometryLinkList * >::type SubMeshGeometryLookup
MaterialBucketMap mMaterialBucketMap
Lookup of Material Buckets in this region.
virtual uint32 packIndex(ushort x, ushort y, ushort z)
Pack 3 indexes into a single index value.
void dump(std::ofstream &of) const
Dump contents for diagnostics.
LightList mLightList
List of lights for this region.
HardwareVertexBufferSharedPtr getWBuffer(void)
void assign(QueuedGeometry *qsm)
Assign geometry to this bucket.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.