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