"...Irrlicht/svn:/svn.code.sf.net/p/irrlicht/code/trunk@1337" did not exist on "1092362c9dd5a7d92d917a93b37e26c4eabb4c7f"
Commit 0aa958f4 authored by hybrid's avatar hybrid

Exposed the MS3D MeshBuffer as SharedMeshBuffer, providing mesh buffers with a shared vertex array.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@836 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 01c43247
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_SHARED_MESH_BUFFER_H_INCLUDED__
#define __S_SHARED_MESH_BUFFER_H_INCLUDED__
#include "irrArray.h"
#include "IMeshBuffer.h"
namespace irr
{
namespace scene
{
//! Implementation of the IMeshBuffer interface with shared vertex list
struct SSharedMeshBuffer : public IMeshBuffer
{
//! constructor
SSharedMeshBuffer() : IMeshBuffer(), Vertices(0)
{
#ifdef _DEBUG
setDebugName("SSharedMeshBuffer");
#endif
}
SSharedMeshBuffer(core::array<video::S3DVertex> *vertices) : IMeshBuffer(), Vertices(vertices)
{
#ifdef _DEBUG
setDebugName("SSharedMeshBuffer");
#endif
}
//! destructor
virtual ~SSharedMeshBuffer() { }
//! returns the material of this meshbuffer
virtual const video::SMaterial& getMaterial() const
{
return Material;
}
//! returns the material of this meshbuffer
virtual video::SMaterial& getMaterial()
{
return Material;
}
//! returns pointer to vertices
virtual const void* getVertices() const
{
if (Vertices)
return Vertices->const_pointer();
else
return 0;
}
//! returns pointer to vertices
virtual void* getVertices()
{
if (Vertices)
return Vertices->pointer();
else
return 0;
}
//! returns amount of vertices
virtual u32 getVertexCount() const
{
if (Vertices)
return Vertices->size();
else
return 0;
}
//! returns pointer to Indices
virtual const u16* getIndices() const
{
return Indices.const_pointer();
}
//! returns pointer to Indices
virtual u16* getIndices()
{
return Indices.pointer();
}
//! returns amount of indices
virtual u32 getIndexCount() const
{
return Indices.size();
}
//! returns an axis aligned bounding box
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return BoundingBox;
}
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box)
{
BoundingBox = box;
}
//! returns which type of vertex data is stored.
virtual video::E_VERTEX_TYPE getVertexType() const
{
return video::EVT_STANDARD;
}
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const
{
return sizeof(video::S3DVertex);
}
//! recalculates the bounding box. should be called if the mesh changed.
virtual void recalculateBoundingBox()
{
if (!Vertices || Vertices->empty() || Indices.empty())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset((*Vertices)[Indices[0]].Pos);
for (u32 i=1; i<Indices.size(); ++i)
BoundingBox.addInternalPoint((*Vertices)[Indices[i]].Pos);
}
}
//! append the vertices and indices to the current buffer
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
//! append the meshbuffer to the current buffer
virtual void append(const IMeshBuffer* const other) {}
video::SMaterial Material; //! material of this meshBuffer
core::array<video::S3DVertex> *Vertices;//! Shared Array of vertices
core::array<u16> Indices; //! Array of Indices
core::aabbox3df BoundingBox; //! Bounding box
};
} // end namespace scene
} // end namespace irr
#endif
...@@ -114,10 +114,10 @@ CAnimatedMeshMS3D::~CAnimatedMeshMS3D() ...@@ -114,10 +114,10 @@ CAnimatedMeshMS3D::~CAnimatedMeshMS3D()
//! loads an md2 file //! loads an ms3d file
bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
{ {
s32 i=0,j; u32 i=0;
if (!file) if (!file)
return false; return false;
...@@ -174,7 +174,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -174,7 +174,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
pPtr += sizeof(MS3DVertex) * numVertices; pPtr += sizeof(MS3DVertex) * numVertices;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
for (i=0; i<numVertices; ++i) for (i=0; i<numVertices; ++i)
for (j=0; j<3; ++j) for (u32 j=0; j<3; ++j)
vertices[i].Vertex[j] = os::Byteswap::byteswap(vertices[i].Vertex[j]); vertices[i].Vertex[j] = os::Byteswap::byteswap(vertices[i].Vertex[j]);
#endif #endif
...@@ -190,7 +190,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -190,7 +190,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
for (i=0; i<numTriangles; ++i) for (i=0; i<numTriangles; ++i)
{ {
triangles[i].Flags = os::Byteswap::byteswap(triangles[i].Flags); triangles[i].Flags = os::Byteswap::byteswap(triangles[i].Flags);
for (j=0; j<3; ++j) for (u32 j=0; j<3; ++j)
{ {
triangles[i].VertexIndices[j] = os::Byteswap::byteswap(triangles[i].VertexIndices[j]); triangles[i].VertexIndices[j] = os::Byteswap::byteswap(triangles[i].VertexIndices[j]);
for (u16 k=0; k<3; ++k) for (u16 k=0; k<3; ++k)
...@@ -225,7 +225,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -225,7 +225,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
pPtr += sizeof(u16); pPtr += sizeof(u16);
//pPtr += sizeof(u16) * triangleCount; // triangle indices //pPtr += sizeof(u16) * triangleCount; // triangle indices
for (j=0; j<triangleCount; ++j) for (u32 j=0; j<triangleCount; ++j)
{ {
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
grp.VertexIds.push_back(os::Byteswap::byteswap(*(u16*)pPtr)); grp.VertexIds.push_back(os::Byteswap::byteswap(*(u16*)pPtr));
...@@ -250,35 +250,29 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -250,35 +250,29 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
// MS3DMaterial *materials = (MS3DMaterial*)pPtr; // MS3DMaterial *materials = (MS3DMaterial*)pPtr;
// pPtr += sizeof(MS3DMaterial) * numMaterials; // pPtr += sizeof(MS3DMaterial) * numMaterials;
if(numMaterials <= 0)
{
// if there are no materials, add at least one buffer // if there are no materials, add at least one buffer
if(numMaterials == 0)
Buffers.push_back (SMS3DMeshBuffer ()); Buffers.push_back(SSharedMeshBuffer(&AnimatedVertices));
SMS3DMeshBuffer& tmpBuffer = Buffers.getLast();
tmpBuffer.BoundingBox = &BoundingBox;
tmpBuffer.Vertices = &AnimatedVertices;
}
for (i=0; i<numMaterials; ++i) for (i=0; i<numMaterials; ++i)
{ {
MS3DMaterial *material = (MS3DMaterial*)pPtr; MS3DMaterial *material = (MS3DMaterial*)pPtr;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
for (j=0; j<4; ++j) for (u32 j=0; j<4; ++j)
material->Ambient[j] = os::Byteswap::byteswap(material->Ambient[j]); material->Ambient[j] = os::Byteswap::byteswap(material->Ambient[j]);
for (j=0; j<4; ++j) for (u32 j=0; j<4; ++j)
material->Diffuse[j] = os::Byteswap::byteswap(material->Diffuse[j]); material->Diffuse[j] = os::Byteswap::byteswap(material->Diffuse[j]);
for (j=0; j<4; ++j) for (u32 j=0; j<4; ++j)
material->Specular[j] = os::Byteswap::byteswap(material->Specular[j]); material->Specular[j] = os::Byteswap::byteswap(material->Specular[j]);
for (j=0; j<4; ++j) for (u32 j=0; j<4; ++j)
material->Emissive[j] = os::Byteswap::byteswap(material->Emissive[j]); material->Emissive[j] = os::Byteswap::byteswap(material->Emissive[j]);
material->Shininess = os::Byteswap::byteswap(material->Shininess); material->Shininess = os::Byteswap::byteswap(material->Shininess);
material->Transparency = os::Byteswap::byteswap(material->Transparency); material->Transparency = os::Byteswap::byteswap(material->Transparency);
#endif #endif
pPtr += sizeof(MS3DMaterial); pPtr += sizeof(MS3DMaterial);
Buffers.push_back (SMS3DMeshBuffer ()); Buffers.push_back(SSharedMeshBuffer(&AnimatedVertices));
SMS3DMeshBuffer& tmpBuffer = Buffers.getLast(); SSharedMeshBuffer& tmpBuffer = Buffers.getLast();
tmpBuffer.Material.MaterialType = video::EMT_SOLID; tmpBuffer.Material.MaterialType = video::EMT_SOLID;
...@@ -288,8 +282,8 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -288,8 +282,8 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
tmpBuffer.Material.SpecularColor = video::SColorf(material->Specular[0], material->Specular[1], material->Specular[2], material->Specular[3]).toSColor (); tmpBuffer.Material.SpecularColor = video::SColorf(material->Specular[0], material->Specular[1], material->Specular[2], material->Specular[3]).toSColor ();
tmpBuffer.Material.Shininess = material->Shininess; tmpBuffer.Material.Shininess = material->Shininess;
tmpBuffer.Material.Textures[0] = Driver->getTexture((const c8*)material->Texture); tmpBuffer.Material.Textures[0] = Driver->getTexture((const c8*)material->Texture);
tmpBuffer.BoundingBox = &BoundingBox; if (tmpBuffer.Material.Textures[0]==0)
tmpBuffer.Vertices = &AnimatedVertices; tmpBuffer.Material.Textures[0] = Driver->getTexture(strrchr((const c8*)material->Texture, '/')+1);
} }
// animation time // animation time
...@@ -320,9 +314,9 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -320,9 +314,9 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
{ {
MS3DJoint *pJoint = (MS3DJoint*)pPtr; MS3DJoint *pJoint = (MS3DJoint*)pPtr;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
for (j=0; j<3; ++j) for (u32 j=0; j<3; ++j)
pJoint->Rotation[j] = os::Byteswap::byteswap(pJoint->Rotation[j]); pJoint->Rotation[j] = os::Byteswap::byteswap(pJoint->Rotation[j]);
for (j=0; j<3; ++j) for (u32 j=0; j<3; ++j)
pJoint->Translation[j] = os::Byteswap::byteswap(pJoint->Translation[j]); pJoint->Translation[j] = os::Byteswap::byteswap(pJoint->Translation[j]);
pJoint->NumRotationKeyframes= os::Byteswap::byteswap(pJoint->NumRotationKeyframes); pJoint->NumRotationKeyframes= os::Byteswap::byteswap(pJoint->NumRotationKeyframes);
pJoint->NumTranslationKeyframes = os::Byteswap::byteswap(pJoint->NumTranslationKeyframes); pJoint->NumTranslationKeyframes = os::Byteswap::byteswap(pJoint->NumTranslationKeyframes);
...@@ -347,7 +341,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -347,7 +341,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
HasAnimation = true; HasAnimation = true;
// get rotation keyframes // get rotation keyframes
for (j=0; j<pJoint->NumRotationKeyframes; ++j) for (u32 j=0; j<pJoint->NumRotationKeyframes; ++j)
{ {
MS3DKeyframe* kf = (MS3DKeyframe*)pPtr; MS3DKeyframe* kf = (MS3DKeyframe*)pPtr;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
...@@ -366,7 +360,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -366,7 +360,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
} }
// get translation keyframes // get translation keyframes
for (j=0; j<pJoint->NumTranslationKeyframes; ++j) for (u32 j=0; j<pJoint->NumTranslationKeyframes; ++j)
{ {
MS3DKeyframe* kf = (MS3DKeyframe*)pPtr; MS3DKeyframe* kf = (MS3DKeyframe*)pPtr;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
...@@ -386,11 +380,11 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -386,11 +380,11 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
} }
//find parent of every joint //find parent of every joint
for (i=0; i<(s32)Joints.size(); ++i) for (i=0; i<Joints.size(); ++i)
{ {
if (Joints[i].ParentName.size() != 0) if (Joints[i].ParentName.size() != 0)
{ {
for (j=0; j<(s32)Joints.size(); ++j) for (u32 j=0; j<Joints.size(); ++j)
if (i != j && Joints[i].ParentName == Joints[j].Name) if (i != j && Joints[i].ParentName == Joints[j].Name)
{ {
Joints[i].Parent = j; Joints[i].Parent = j;
...@@ -403,7 +397,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -403,7 +397,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
} }
// sets up all joints with initial rotation and translation // sets up all joints with initial rotation and translation
for (i=0; i<(s32)Joints.size(); ++i) for (i=0; i<Joints.size(); ++i)
{ {
SJoint& jnt = Joints[i]; SJoint& jnt = Joints[i];
...@@ -426,7 +420,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -426,7 +420,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
for (i=0; i<numTriangles; ++i) for (i=0; i<numTriangles; ++i)
{ {
for (j = 0; j<3; ++j) for (u32 j = 0; j<3; ++j)
{ {
v.TCoords.X = triangles[i].S[j]; v.TCoords.X = triangles[i].S[j];
v.TCoords.Y = triangles[i].T[j]; v.TCoords.Y = triangles[i].T[j];
...@@ -466,7 +460,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -466,7 +460,7 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
//create groups //create groups
s32 iIndex = -1; s32 iIndex = -1;
for (i=0; i<(int)Groups.size(); ++i) for (i=0; i<Groups.size(); ++i)
{ {
SGroup& grp = Groups[i]; SGroup& grp = Groups[i];
...@@ -484,23 +478,28 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file) ...@@ -484,23 +478,28 @@ bool CAnimatedMeshMS3D::loadFile(io::IReadFile* file)
if (!Vertices.empty()) if (!Vertices.empty())
BoundingBox.reset(Vertices[0].Pos); BoundingBox.reset(Vertices[0].Pos);
for (i=0; i<(s32)Vertices.size(); ++i) for (i=0; i<Vertices.size(); ++i)
BoundingBox.addInternalPoint(Vertices[i].Pos); BoundingBox.addInternalPoint(Vertices[i].Pos);
for (i=0; i<Buffers.size(); ++i)
Buffers[i].recalculateBoundingBox();
// inverse translate and rotate all vertices for making animation easier // inverse translate and rotate all vertices for making animation easier
if (HasAnimation) if (HasAnimation)
for (i=0; i<(s32)Joints.size(); ++i)
{ {
for (j=0; j<(s32)Joints[i].VertexIds.size(); ++j) for (u32 k=0; k<Joints.size(); ++k)
{ {
Joints[i].AbsoluteTransformation.inverseTranslateVect( for (u32 l=0; l<Joints[k].VertexIds.size(); ++l)
Vertices[Joints[i].VertexIds[j]].Pos); {
Joints[k].AbsoluteTransformation.inverseTranslateVect(
Vertices[Joints[k].VertexIds[l]].Pos);
Joints[i].AbsoluteTransformation.inverseRotateVect( Joints[k].AbsoluteTransformation.inverseRotateVect(
Vertices[Joints[i].VertexIds[j]].Pos); Vertices[Joints[k].VertexIds[l]].Pos);
Joints[i].AbsoluteTransformation.inverseRotateVect( Joints[k].AbsoluteTransformation.inverseRotateVect(
Vertices[Joints[i].VertexIds[j]].Normal); Vertices[Joints[k].VertexIds[l]].Normal);
}
} }
} }
...@@ -637,8 +636,9 @@ void CAnimatedMeshMS3D::animate(s32 frame) ...@@ -637,8 +636,9 @@ void CAnimatedMeshMS3D::animate(s32 frame)
f32 time = (f32)frame; f32 time = (f32)frame;
core::matrix4 transform; core::matrix4 transform;
lastCalculatedFrame = frame; lastCalculatedFrame = frame;
u32 i;
for (s32 i=0; i<(s32)Joints.size(); ++i) for (i=0; i<Joints.size(); ++i)
{ {
core::vector3df translation = Joints[i].Translation; core::vector3df translation = Joints[i].Translation;
core::vector3df rotation = Joints[i].Rotation; core::vector3df rotation = Joints[i].Rotation;
...@@ -663,7 +663,7 @@ void CAnimatedMeshMS3D::animate(s32 frame) ...@@ -663,7 +663,7 @@ void CAnimatedMeshMS3D::animate(s32 frame)
// transform all vertices // transform all vertices
for (s32 j=0; j<(s32)Joints[i].VertexIds.size(); ++j) for (u32 j=0; j<Joints[i].VertexIds.size(); ++j)
{ {
Joints[i].AbsoluteTransformationAnimated.transformVect( Joints[i].AbsoluteTransformationAnimated.transformVect(
AnimatedVertices[Joints[i].VertexIds[j]].Pos, AnimatedVertices[Joints[i].VertexIds[j]].Pos,
...@@ -681,6 +681,8 @@ void CAnimatedMeshMS3D::animate(s32 frame) ...@@ -681,6 +681,8 @@ void CAnimatedMeshMS3D::animate(s32 frame)
} }
} }
for (i=0; i<Buffers.size(); ++i)
Buffers[i].recalculateBoundingBox();
} }
...@@ -730,7 +732,7 @@ void CAnimatedMeshMS3D::setBoundingBox( const core::aabbox3df& box) ...@@ -730,7 +732,7 @@ void CAnimatedMeshMS3D::setBoundingBox( const core::aabbox3df& box)
//! sets a flag of all contained materials to a new value //! sets a flag of all contained materials to a new value
void CAnimatedMeshMS3D::setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) void CAnimatedMeshMS3D::setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{ {
for (s32 i=0; i<(int)Buffers.size(); ++i) for (u32 i=0; i<Buffers.size(); ++i)
Buffers[i].Material.setFlag(flag, newvalue); Buffers[i].Material.setFlag(flag, newvalue);
} }
...@@ -741,92 +743,8 @@ E_ANIMATED_MESH_TYPE CAnimatedMeshMS3D::getMeshType() const ...@@ -741,92 +743,8 @@ E_ANIMATED_MESH_TYPE CAnimatedMeshMS3D::getMeshType() const
return EAMT_MS3D; return EAMT_MS3D;
} }
//! constructor
CAnimatedMeshMS3D::SMS3DMeshBuffer::SMS3DMeshBuffer()
{
#ifdef _DEBUG
setDebugName("SMS3DMeshBuffer");
#endif
}
//! destructor
CAnimatedMeshMS3D::SMS3DMeshBuffer::~SMS3DMeshBuffer()
{
}
//! returns the material of this meshbuffer
const video::SMaterial& CAnimatedMeshMS3D::SMS3DMeshBuffer::getMaterial() const
{
return Material;
}
//! returns the material of this meshbuffer
video::SMaterial& CAnimatedMeshMS3D::SMS3DMeshBuffer::getMaterial()
{
return Material;
}
//! returns pointer to vertices
const void* CAnimatedMeshMS3D::SMS3DMeshBuffer::getVertices() const
{
return Vertices->const_pointer();
}
//! returns pointer to vertices
void* CAnimatedMeshMS3D::SMS3DMeshBuffer::getVertices()
{
return Vertices->pointer();
}
//! returns amount of vertices
u32 CAnimatedMeshMS3D::SMS3DMeshBuffer::getVertexCount() const
{
return Vertices->size();
}
//! returns pointer to Indices
const u16* CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndices() const
{
return Indices.const_pointer();
}
//! returns pointer to Indices
u16* CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndices()
{
return Indices.pointer();
}
//! returns amount of indices
u32 CAnimatedMeshMS3D::SMS3DMeshBuffer::getIndexCount() const
{
return Indices.size();
}
//! returns an axis aligned bounding box
const core::aabbox3d<f32>& CAnimatedMeshMS3D::SMS3DMeshBuffer::getBoundingBox() const
{
return *BoundingBox;
}
//! returns an axis aligned bounding box
void CAnimatedMeshMS3D::SMS3DMeshBuffer::setBoundingBox( const core::aabbox3df& box)
{
*BoundingBox = box;
}
//! returns which type of vertex data is stored.
video::E_VERTEX_TYPE CAnimatedMeshMS3D::SMS3DMeshBuffer::getVertexType() const
{
return video::EVT_STANDARD;
}
//! returns the byte size (stride, pitch) of the vertex //! returns the byte size (stride, pitch) of the vertex
u32 CAnimatedMeshMS3D::SMS3DMeshBuffer::getVertexPitch() const
{
return sizeof ( video::S3DVertex );
}
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "IReadFile.h" #include "IReadFile.h"
#include "S3DVertex.h" #include "S3DVertex.h"
#include "irrString.h" #include "irrString.h"
#include "SMeshBuffer.h" #include "SSharedMeshBuffer.h"
namespace irr namespace irr
{ {
...@@ -112,66 +112,6 @@ namespace scene ...@@ -112,66 +112,6 @@ namespace scene
u16 MaterialIdx; u16 MaterialIdx;
}; };
//! Simple implementation of the IMeshBuffer interface with S3DVertex vertices.
struct SMS3DMeshBuffer : public IMeshBuffer
{
//! constructor
SMS3DMeshBuffer();
//! destructor
~SMS3DMeshBuffer();
//! returns the material of this meshbuffer
virtual const video::SMaterial& getMaterial() const;
//! returns the material of this meshbuffer
virtual video::SMaterial& getMaterial();
//! returns pointer to vertices
virtual const void* getVertices() const;
//! returns pointer to vertices
virtual void* getVertices();
//! returns amount of vertices
virtual u32 getVertexCount() const;
//! returns pointer to Indices
virtual const u16* getIndices() const;
//! returns pointer to Indices
virtual u16* getIndices();
//! returns amount of indices
virtual u32 getIndexCount() const;
//! returns an axis aligned bounding box
virtual const core::aabbox3d<f32>& getBoundingBox() const;
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box);
//! returns which type of vertex data is stored.
virtual video::E_VERTEX_TYPE getVertexType() const;
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const;
//! recalculates the bounding box. should be called if the mesh changed.
virtual void recalculateBoundingBox() {}
//! append the vertices and indices to the current buffer
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
//! append the meshbuffer to the current buffer
virtual void append(const IMeshBuffer* const other) {}
video::SMaterial Material; //! material for this meshBuffer.
core::array<video::S3DVertex> *Vertices; //! Array of vertices
core::array<u16> Indices; //! Array of the Indices.
core::aabbox3d<f32> *BoundingBox;
};
void animate(s32 frame); void animate(s32 frame);
void getKeyframeData(const core::array<SKeyframe>& keys, f32 time, core::vector3df& outdata) const; void getKeyframeData(const core::array<SKeyframe>& keys, f32 time, core::vector3df& outdata) const;
void getKeyframeRotation(const core::array<SKeyframe>& keys, f32 time, core::vector3df& outdata) const; void getKeyframeRotation(const core::array<SKeyframe>& keys, f32 time, core::vector3df& outdata) const;
...@@ -184,7 +124,7 @@ namespace scene ...@@ -184,7 +124,7 @@ namespace scene
core::array<SJoint> Joints; core::array<SJoint> Joints;
core::array<SGroup> Groups; core::array<SGroup> Groups;
core::array<SMS3DMeshBuffer> Buffers; core::array<SSharedMeshBuffer> Buffers;
f32 totalTime; f32 totalTime;
bool HasAnimation; bool HasAnimation;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment