Loading...
Searching...
No Matches
SAnimatedMesh.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_ANIMATED_MESH_H_INCLUDED__
#define __S_ANIMATED_MESH_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "IMesh.h"
#include "aabbox3d.h"
#include "irrArray.h"
namespace irr
{
namespace scene
{
struct SAnimatedMesh : public IAnimatedMesh
{
SAnimatedMesh(scene::IMesh* mesh=0, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN) : IAnimatedMesh(), FramesPerSecond(25.f), Type(type)
{
#ifdef _DEBUG
setDebugName("SAnimatedMesh");
#endif
addMesh(mesh);
recalculateBoundingBox();
}
virtual ~SAnimatedMesh()
{
// drop meshes
for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->drop();
}
virtual u32 getFrameCount() const
{
return Meshes.size();
}
virtual f32 getAnimationSpeed() const
{
return FramesPerSecond;
}
virtual void setAnimationSpeed(f32 fps)
{
FramesPerSecond=fps;
}
virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
{
if (Meshes.empty())
return 0;
return Meshes[frame];
}
void addMesh(IMesh* mesh)
{
if (mesh)
{
mesh->grab();
Meshes.push_back(mesh);
}
}
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return Box;
}
virtual void setBoundingBox(const core::aabbox3df& box)
{
Box = box;
}
void recalculateBoundingBox()
{
Box.reset(0,0,0);
if (Meshes.empty())
return;
Box = Meshes[0]->getBoundingBox();
for (u32 i=1; i<Meshes.size(); ++i)
Box.addInternalBox(Meshes[i]->getBoundingBox());
}
virtual E_ANIMATED_MESH_TYPE getMeshType() const
{
return Type;
}
virtual u32 getMeshBufferCount() const
{
if (Meshes.empty())
return 0;
return Meshes[0]->getMeshBufferCount();
}
virtual IMeshBuffer* getMeshBuffer(u32 nr) const
{
if (Meshes.empty())
return 0;
return Meshes[0]->getMeshBuffer(nr);
}
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
{
if (Meshes.empty())
return 0;
return Meshes[0]->getMeshBuffer(material);
}
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->setMaterialFlag(flag, newvalue);
}
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
{
for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->setHardwareMappingHint(newMappingHint, buffer);
}
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
{
for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->setDirty(buffer);
}
core::array<IMesh*> Meshes;
core::aabbox3d<f32> Box;
f32 FramesPerSecond;
E_ANIMATED_MESH_TYPE Type;
};
} // end namespace scene
} // end namespace irr
#endif
IAnimatedMesh.h
IMesh.h
aabbox3d.h
irr::IReferenceCounted::drop
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.h:116
irr::IReferenceCounted::grab
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.h:86
irr::IReferenceCounted::setDebugName
void setDebugName(const c8 *newName)
Sets the debug name of the object.
Definition IReferenceCounted.h:153
irr::core::aabbox3d
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.h:22
irr::core::array
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
irr::scene::IAnimatedMesh
Interface for an animated mesh.
Definition IAnimatedMesh.h:63
irr::scene::IMeshBuffer
Struct for holding a mesh with a single material.
Definition IMeshBuffer.h:40
irr::scene::IMesh
Class which holds the geometry of an object.
Definition IMesh.h:24
irr::video::SMaterial
Struct for holding parameters for a material renderer.
Definition SMaterial.h:227
irrArray.h
irr::core::aabbox3df
aabbox3d< f32 > aabbox3df
Typedef for a f32 3d bounding box.
Definition aabbox3d.h:324
irr::scene
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition CDynamicMeshBuffer.h:16
irr::scene::E_ANIMATED_MESH_TYPE
E_ANIMATED_MESH_TYPE
Possible types of (animated) meshes.
Definition IAnimatedMesh.h:17
irr::scene::EAMT_UNKNOWN
@ EAMT_UNKNOWN
Unknown animated mesh type.
Definition IAnimatedMesh.h:19
irr::scene::E_BUFFER_TYPE
E_BUFFER_TYPE
Definition EHardwareBufferFlags.h:29
irr::scene::EBT_VERTEX_AND_INDEX
@ EBT_VERTEX_AND_INDEX
Change both vertex and index mapping to the same value.
Definition EHardwareBufferFlags.h:37
irr::scene::E_HARDWARE_MAPPING
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.h:14
irr::video::E_MATERIAL_FLAG
E_MATERIAL_FLAG
Material flags.
Definition EMaterialFlags.h:15
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::f32
float f32
32 bit floating point variable.
Definition irrTypes.h:104
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
irr::scene::SAnimatedMesh::Type
E_ANIMATED_MESH_TYPE Type
The type of the mesh.
Definition SAnimatedMesh.h:181
irr::scene::SAnimatedMesh::getMeshBufferCount
virtual u32 getMeshBufferCount() const
returns amount of mesh buffers.
Definition SAnimatedMesh.h:121
irr::scene::SAnimatedMesh::getMesh
virtual IMesh * getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
Returns the IMesh interface for a frame.
Definition SAnimatedMesh.h:69
irr::scene::SAnimatedMesh::setDirty
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
flags the meshbuffer as changed, reloads hardware buffers
Definition SAnimatedMesh.h:165
irr::scene::SAnimatedMesh::getMeshType
virtual E_ANIMATED_MESH_TYPE getMeshType() const
Returns the type of the animated mesh.
Definition SAnimatedMesh.h:115
irr::scene::SAnimatedMesh::addMesh
void addMesh(IMesh *mesh)
adds a Mesh
Definition SAnimatedMesh.h:78
irr::scene::SAnimatedMesh::getFrameCount
virtual u32 getFrameCount() const
Gets the frame count of the animated mesh.
Definition SAnimatedMesh.h:41
irr::scene::SAnimatedMesh::~SAnimatedMesh
virtual ~SAnimatedMesh()
destructor
Definition SAnimatedMesh.h:32
irr::scene::SAnimatedMesh::getBoundingBox
virtual const core::aabbox3d< f32 > & getBoundingBox() const
Returns an axis aligned bounding box of the mesh.
Definition SAnimatedMesh.h:89
irr::scene::SAnimatedMesh::setHardwareMappingHint
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
set the hardware mapping hint, for driver
Definition SAnimatedMesh.h:158
irr::scene::SAnimatedMesh::recalculateBoundingBox
void recalculateBoundingBox()
Recalculates the bounding box.
Definition SAnimatedMesh.h:101
irr::scene::SAnimatedMesh::getMeshBuffer
virtual IMeshBuffer * getMeshBuffer(u32 nr) const
returns pointer to a mesh buffer
Definition SAnimatedMesh.h:130
irr::scene::SAnimatedMesh::SAnimatedMesh
SAnimatedMesh(scene::IMesh *mesh=0, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN)
constructor
Definition SAnimatedMesh.h:22
irr::scene::SAnimatedMesh::getAnimationSpeed
virtual f32 getAnimationSpeed() const
Gets the default animation speed of the animated mesh.
Definition SAnimatedMesh.h:48
irr::scene::SAnimatedMesh::getMeshBuffer
virtual IMeshBuffer * getMeshBuffer(const video::SMaterial &material) const
Returns pointer to a mesh buffer which fits a material.
Definition SAnimatedMesh.h:142
irr::scene::SAnimatedMesh::setBoundingBox
virtual void setBoundingBox(const core::aabbox3df &box)
set user axis aligned bounding box
Definition SAnimatedMesh.h:95
irr::scene::SAnimatedMesh::Box
core::aabbox3d< f32 > Box
The bounding box of this mesh.
Definition SAnimatedMesh.h:175
irr::scene::SAnimatedMesh::Meshes
core::array< IMesh * > Meshes
All meshes defining the animated mesh.
Definition SAnimatedMesh.h:172
irr::scene::SAnimatedMesh::setAnimationSpeed
virtual void setAnimationSpeed(f32 fps)
Gets the frame count of the animated mesh.
Definition SAnimatedMesh.h:56
irr::scene::SAnimatedMesh::FramesPerSecond
f32 FramesPerSecond
Default animation speed of this mesh.
Definition SAnimatedMesh.h:178
irr::scene::SAnimatedMesh::setMaterialFlag
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
Set a material flag for all meshbuffers of this mesh.
Definition SAnimatedMesh.h:151
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0