28 #ifndef __InstancedGeometry_H__
29 #define __InstancedGeometry_H__
205 void copyIndexes(
const T* src, T* dst,
size_t count,
size_t indexOffset)
207 if (indexOffset == 0)
209 memcpy(dst, src,
sizeof(T) * count);
215 *dst++ =
static_cast<T
>(*src++ + indexOffset);
225 Real getBoundingRadius(
void)
const;
233 void getWorldTransforms(
Matrix4* xform)
const;
234 virtual unsigned short getNumWorldTransforms(
void)
const ;
235 Real getSquaredViewDepth(
const Camera* cam)
const;
237 bool getCastsShadows(
void)
const;
238 String getFormatString(
void)
const;
246 void dump(std::ofstream& of)
const;
289 void setPosition(
Vector3 position);
290 const Vector3& getPosition(
void)
const;
291 void yaw(
const Radian& angle);
292 void pitch(
const Radian& angle);
293 void roll(
const Radian& angle);
295 void setScale(
const Vector3& scale);
296 const Vector3& getScale()
const;
304 void translate(
const Vector3& d);
305 Matrix3 getLocalAxes(
void)
const;
306 void updateAnimation(
void);
358 void dump(std::ofstream& of)
const;
367 void setMaterial(
const String & name);
412 void dump(std::ofstream& of)
const;
485 const String& getMovableType(
void)
const;
486 void _notifyCurrentCamera(
Camera* cam);
489 Real getBoundingRadius(
void)
const;
491 bool isVisible(
void)
const;
494 bool debugRenderables =
false);
505 void updateBoundingBox();
508 void dump(std::ofstream& of)
const;
510 void updateContainers(
LODBucket* bucket );
512 void attachToScene();
513 void addInstancedObject(
unsigned short index,
InstancedObject*
object);
590 virtual void getBatchInstanceIndexes(
const Vector3& point,
623 template <
typename T>
627 for (
size_t i = 0; i < numIndexes; ++i)
630 remap.insert(IndexRemap::value_type(*pBuffer++, remap.size()));
636 template <
typename T>
640 for (
size_t i = 0; i < numIndexes; ++i)
643 IndexRemap::const_iterator ix = remap.find(*src++);
644 assert(ix != remap.end());
645 *dst++ =
static_cast<T
>(ix->second);
699 virtual void addSceneNode(
const SceneNode* node);
711 virtual void build(
void);
720 void addBatchInstance(
void);
726 virtual void destroy(
void);
731 virtual void reset(
void);
743 mUpperDistance = dist;
744 mSquaredUpperDistance = mUpperDistance * mUpperDistance;
752 {
return mSquaredUpperDistance; }
755 virtual void setVisible(
bool visible);
777 virtual void setCastShadows(
bool castShadows);
792 mBatchInstanceDimensions = size;
793 mHalfBatchInstanceDimensions = size * 0.5;
823 virtual void setRenderQueueGroup(
uint8 queueID);
826 virtual uint8 getRenderQueueGroup(
void)
const;
835 bool debugRenderables =
false);
840 virtual void dump(
const String& filename)
const;
868 virtual void setProvideWorldInverses(
bool flag);
MaterialPtr mMaterial
Pointer to material being used.
Class encapsulating a set of AnimationState objects.
Real mLodValue
Current lod value, passed on to do material lod later.
QueuedGeometryList mQueuedGeometry
Geometry which has been queued up pre-build (not for deallocation)
AnimationStateSet * mAnimationState
This is the main animation state.
A viewpoint from which the scene will be rendered.
Class encapsulating a standard 4x4 homogeneous matrix.
CurrentGeometryMap mCurrentGeometryMap
BatchInstanceMap mBatchInstanceMap
Map of BatchInstances.
QueuedSubMeshList mQueuedSubMeshes
AxisAlignedBox & getAABB(void)
retun the BoundingBox information. Usefull when cloning the batch instance.
float Real
Software floating point type.
SceneManager * mSceneMgr
Scene manager link.
Vector3 mBatchInstanceDimensions
Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene...
SkeletonPtr mBaseSkeleton
this is just a pointer to the base skeleton that will be used for each animated object in the batches...
Vector3 mHalfBatchInstanceDimensions
vector< GeometryBucket * >::type GeometryBucketList
list of Geometry Buckets that contains the instanced object
map< String, MaterialBucket * >::type MaterialBucketMap
Lookup of Material Buckets in this BatchInstance.
Matrix4 * mBoneMatrices
Cached bone matrices in skeleton local space.
unsigned short mNumBoneMatrices
unsigned short mLod
LOD level (0 == full LOD)
String mFormatString
String identifying the vertex / index format.
vector< QueuedSubMesh * >::type QueuedSubMeshList
virtual bool isVisible(void) const
Are the batches visible?
VertexData * mVertexData
Vertex information, includes current number of vertices committed to be a part of this bucket...
Manages the organisation and rendering of a 'scene' i.e.
const VertexData * getVertexData(void) const
Get the vertex data for this geometry.
vector< QueuedGeometry * >::type QueuedGeometryList
Real mSquaredUpperDistance
Real mBoundingRadius
Local bounding radius.
InstancedGeometry * getParent(void) const
A LODBucket is a collection of smaller buckets with the same LOD.
virtual Real getSquaredRenderingDistance(void) const
Gets the squared distance at which batches are no longer rendered.
Simple implementation of MovableObject and Renderable for single-part custom objects.
A 3D box aligned with the x/y/z axes.
A 3x3 matrix which can represent rotations around axes.
Represents the state of an animation and the weight of it's influence.
virtual bool getProvideWorldInverses(void) const
SkeletonPtr getBaseSkeleton(void)
map< SubMesh *, SubMeshLodGeometryLinkList * >::type SubMeshGeometryLookup
MaterialBucket * mParent
Pointer to parent bucket.
Class representing an approach to rendering this particular Material.
RenderOperationVector & getRenderOperationVector()
get the mRenderOps vector.
Strategy for determining level of detail.
Matrix4 * mBoneWorldMatrices
Cached bone matrices, including any world transform.
SkeletonInstance * getSkeletonInstance(void)
RenderOperationVector mRenderOps
This vector stores all the renderOperation used in the batch.
void copyIndexes(const T *src, T *dst, size_t count, size_t indexOffset)
Technique * mTechnique
Active technique.
ushort getLod(void) const
Get the lod index.
Abstract class defining a movable object in a scene.
vector< String >::type QueuedSubMeshOriginList
Class representing a node in the scene graph.
SkeletonInstance * mSkeletonInstance
const MaterialPtr & getMaterial(void) const
Get the material for this bucket.
Implementation of a Quaternion, i.e.
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
Structure recording a queued submesh for the build.
The details of a topological BatchInstance which is the highest level of partitioning for this class...
AxisAlignedBox worldBounds
Pre-transformed world AABB.
IndexData * mIndexData
Index information, includes index type which limits the max number of vertices which are allowed in o...
OptimisedSubMeshGeometryList mOptimisedSubMeshGeometryList
List of geometry which has been optimised for SubMesh use This is the primary storage used for cleani...
map< uint32, BatchInstance * >::type BatchInstanceMap
Indexed BatchInstance map based on packed x/y/z BatchInstance index, 10 bits for each axis...
MapIterator< MaterialBucketMap > MaterialIterator
Iterator over the materials in this LOD.
SubMeshGeometryLookup mSubMeshGeometryLookup
Cached links from SubMeshes to (potentially optimised) geometry This is not used for deletion since t...
virtual Real getRenderingDistance(void) const
Gets the distance at which batches are no longer rendered.
static const Quaternion IDENTITY
AnimationStateSet * mAnimationState
State of animation for animable meshes.
vector< RenderOperation * >::type RenderOperationVector
Simple vectors where are stored all the renderoperations of the Batch.
list< OptimisedSubMeshGeometry * >::type OptimisedSubMeshGeometryList
virtual void setRenderingDistance(Real dist)
Sets the distance at which batches are no longer rendered.
size_t mMaxVertexIndex
Maximum vertex indexable.
QueuedSubMeshList mQueuedSubMeshes
Local list of queued meshes (not used for deallocation)
Struct holding geometry optimised per SubMesh / lod level, ready for copying to instances.
unsigned short mTexCoordIndex
Index of the Texcoord where the index is stored.
ushort mCurrentLod
The current lod level, as determined from the last camera.
Saved link between SubMesh at a LOD and vertex/index data May point to original or optimised geometry...
uint32 getID(void) const
Get the BatchInstance ID of this BatchInstance.
Mesh::LodValueList mLodValues
Lod values as built up - use the max at each level.
Defines an instance of a discrete, movable object based on a Mesh.
InstancedGeometry * mBatch
Pointer to the Batch.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
virtual const Vector3 & getBatchInstanceDimensions(void) const
Gets the size of a single batch of geometry.
bool mProvideWorldInverses
Flags to indicate whether the World Transform Inverse matrices are passed to the shaders.
Summary class collecting together index data source information.
void setLastIndex(int index)
Transform is relative to the space of the parent node.
Camera * mCamera
Current camera, passed on to do material lod later.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly...
unsigned int getObjectCount(void)
A MaterialBucket is a collection of smaller buckets with the same Material (and implicitly the same L...
Real getLodValue(void) const
Get the lod value.
Structure recording a queued geometry for low level builds.
map< String, GeometryBucket * >::type CurrentGeometryMap
GeometryBucketList mGeometryBucketList
list of Geometry Buckets in this BatchInstance
Real mLodValue
lod value at which this LOD starts to apply (squared)
Defines a part of a complete mesh.
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...
uint8 mRenderQueueID
The render queue to use when rendering this object.
vector< GeometryBucket * >::type GeometryBucketList
list of Geometry Buckets in this BatchInstance
VectorIterator< LODBucketList > LODIterator
LODBucketList mLodBucketList
List of LOD buckets.
Transform is relative to the local space.
Standard 3-dimensional vector.
GeometryBucketList & getGeometryBucketList(void)
HardwareIndexBuffer::IndexType mIndexType
Size of indexes.
ObjectsMap & getInstancesMap(void)
std::map< K, V, P, A > type
map< unsigned short, InstancedObject * >::type ObjectsMap
SceneNode * mNode
Scene node.
Summary class collecting together vertex source information.
A GeometryBucket is a the lowest level bucket where geometry with the same vertex & index format is s...
~OptimisedSubMeshGeometry()
String mMaterialName
Material being used.
const String & getMaterialName(void) const
Get the material name.
MapIterator< BatchInstanceMap > BatchInstanceIterator
Iterator for iterating over contained BatchInstances.
vector< Real >::type LodValueList
map< size_t, size_t >::type IndexRemap
Wrapper class which indicates a given angle value is in Radians.
InstancedGeometry * mParent
Parent static geometry.
BatchInstance * mInstancedGeometryInstance
const String & getName(void) const
Get the name of this object.
GeometryBucketList mGeometryBucketList
Class to manage the scene object rendering queue.
SubMeshLodGeometryLinkList * geometryLodList
Link to LOD list of geometry, potentially optimised.
void remapIndexes(T *src, T *dst, const IndexRemap &remap, size_t numIndexes)
Method for altering indexes based on a remap.
LODBucket * mParent
Pointer to parent LODBucket.
SkeletonInstance * mSkeletonInstance
virtual void setOrigin(const Vector3 &origin)
Sets the origin of the geometry.
MapIterator< ObjectsMap > InstancedObjectIterator
const LodStrategy * mLodStrategy
Lod strategy reference.
Specialisation of SharedPtr to allow SharedPtr to be assigned to SkeletonPtr.
OptimisedSubMeshGeometry()
QueuedGeometryList mQueuedGeometryList
Geometry queued for a single LOD (deallocated here)
Technique * getCurrentTechnique(void) const
Get the current Technique.
Real mSquaredViewDepth
Cached squared view depth value to avoid recalculation by GeometryBucket.
SubMeshLodGeometryLink * geometry
AxisAlignedBox mAABB
Local AABB relative to BatchInstance centre.
vector< SubMeshLodGeometryLink >::type SubMeshLodGeometryLinkList
uint32 mBatchInstanceID
Unique identifier for the BatchInstance.
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
BatchInstance * mParent
Pointer to parent BatchInstance.
virtual const Vector3 & getOrigin(void) const
Gets the origin of this geometry.
AnimationStateSet * getBaseAnimationState(void)
SkeletonInstance * getBaseSkeletonInstance(void)
Concrete IteratorWrapper for nonconst access to the underlying container.
virtual void setBatchInstanceDimensions(const Vector3 &size)
Sets the size of a single BatchInstance of geometry.
unsigned int mObjectCount
number of objects in the batch
BatchInstance * getParent(void)
bool mRenderQueueIDSet
Flags whether the RenderQueue's default should be used.
SceneNode * getSceneNode(void)
unsigned long mFrameAnimationLastUpdated
Records the last frame in which animation was updated.
const IndexData * getIndexData(void) const
Get the index data for this geometry.
static const Vector3 UNIT_SCALE
virtual bool getCastShadows(void)
Will the geometry from this object cast shadows?
vector< LODBucket * >::type LODBucketList
list of LOD Buckets in this BatchInstance
LODBucket * getParent(void)
A SkeletonInstance is a single instance of a Skeleton used by a world object.
MaterialBucket * getParent(void)
MaterialBucketMap mMaterialBucketMap
Lookup of Material Buckets in this BatchInstance.
VectorIterator< GeometryBucketList > GeometryIterator
Iterator over geometry.