Provide meshbuffer level access to vertex elements which always exist.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1085 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
e409667ce0
commit
81ff2ebb72
|
@ -105,6 +105,30 @@ namespace scene
|
|||
return T().getType();
|
||||
}
|
||||
|
||||
//! returns position of vertex i
|
||||
virtual const core::vector3df& getPosition(u32 i) const
|
||||
{
|
||||
return Vertices[i].Pos;
|
||||
}
|
||||
|
||||
//! returns position of vertex i
|
||||
virtual core::vector3df& getPosition(u32 i)
|
||||
{
|
||||
return Vertices[i].Pos;
|
||||
}
|
||||
|
||||
//! returns normal of vertex i
|
||||
virtual const core::vector3df& getNormal(u32 i) const
|
||||
{
|
||||
return Vertices[i].Normal;
|
||||
}
|
||||
|
||||
//! returns normal of vertex i
|
||||
virtual core::vector3df& getNormal(u32 i)
|
||||
{
|
||||
return Vertices[i].Normal;
|
||||
}
|
||||
|
||||
|
||||
//! append the vertices and indices to the current buffer
|
||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)
|
||||
|
|
|
@ -103,6 +103,18 @@ namespace scene
|
|||
//! recalculates the bounding box. should be called if the mesh changed.
|
||||
virtual void recalculateBoundingBox() = 0;
|
||||
|
||||
//! returns position of vertex i
|
||||
virtual const core::vector3df& getPosition(u32 i) const = 0;
|
||||
|
||||
//! returns position of vertex i
|
||||
virtual core::vector3df& getPosition(u32 i) = 0;
|
||||
|
||||
//! returns normal of vertex i
|
||||
virtual const core::vector3df& getNormal(u32 i) const = 0;
|
||||
|
||||
//! returns normal of vertex i
|
||||
virtual core::vector3df& getNormal(u32 i) = 0;
|
||||
|
||||
//! append the vertices and indices to the current buffer
|
||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
|
||||
|
||||
|
|
|
@ -201,6 +201,62 @@ struct SSkinMeshBuffer : public IMeshBuffer
|
|||
}
|
||||
}
|
||||
|
||||
//! returns position of vertex i
|
||||
virtual const core::vector3df& getPosition(u32 i) const
|
||||
{
|
||||
switch (VertexType)
|
||||
{
|
||||
case video::EVT_2TCOORDS:
|
||||
return Vertices_2TCoords[i].Pos;
|
||||
case video::EVT_TANGENTS:
|
||||
return Vertices_Tangents[i].Pos;
|
||||
default:
|
||||
return Vertices_Standard[i].Pos;
|
||||
}
|
||||
}
|
||||
|
||||
//! returns position of vertex i
|
||||
virtual core::vector3df& getPosition(u32 i)
|
||||
{
|
||||
switch (VertexType)
|
||||
{
|
||||
case video::EVT_2TCOORDS:
|
||||
return Vertices_2TCoords[i].Pos;
|
||||
case video::EVT_TANGENTS:
|
||||
return Vertices_Tangents[i].Pos;
|
||||
default:
|
||||
return Vertices_Standard[i].Pos;
|
||||
}
|
||||
}
|
||||
|
||||
//! returns normal of vertex i
|
||||
virtual const core::vector3df& getNormal(u32 i) const
|
||||
{
|
||||
switch (VertexType)
|
||||
{
|
||||
case video::EVT_2TCOORDS:
|
||||
return Vertices_2TCoords[i].Normal;
|
||||
case video::EVT_TANGENTS:
|
||||
return Vertices_Tangents[i].Normal;
|
||||
default:
|
||||
return Vertices_Standard[i].Normal;
|
||||
}
|
||||
}
|
||||
|
||||
//! returns normal of vertex i
|
||||
virtual core::vector3df& getNormal(u32 i)
|
||||
{
|
||||
switch (VertexType)
|
||||
{
|
||||
case video::EVT_2TCOORDS:
|
||||
return Vertices_2TCoords[i].Normal;
|
||||
case video::EVT_TANGENTS:
|
||||
return Vertices_Tangents[i].Normal;
|
||||
default:
|
||||
return Vertices_Standard[i].Normal;
|
||||
}
|
||||
}
|
||||
|
||||
//! append the vertices and indices to the current buffer
|
||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
|
||||
|
||||
|
|
|
@ -71,23 +71,11 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
|
|||
{
|
||||
for( u32 k=0; k<frameMesh->getMeshBuffer(j)->getVertexCount(); ++k )
|
||||
{
|
||||
switch( frameMesh->getMeshBuffer(j)->getVertexType() )
|
||||
{
|
||||
case video::EVT_STANDARD:
|
||||
p.pos = ((video::S3DVertex*)frameMesh->getMeshBuffer(j)->getVertices())[k].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertex*)frameMesh->getMeshBuffer(j)->getVertices())[k].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
case video::EVT_TANGENTS:
|
||||
p.pos = ((video::S3DVertexTangents*)frameMesh->getMeshBuffer(j)->getVertices())[k].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertexTangents*)frameMesh->getMeshBuffer(j)->getVertices())[k].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
}
|
||||
p.pos = frameMesh->getMeshBuffer(j)->getPosition(k);
|
||||
if( UseNormalDirection )
|
||||
p.vector = frameMesh->getMeshBuffer(j)->getNormal(k) / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
|
||||
p.startTime = now;
|
||||
|
||||
|
@ -130,23 +118,11 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
|
|||
|
||||
u32 vertexNumber = os::Randomizer::rand() % frameMesh->getMeshBuffer(randomMB)->getVertexCount();
|
||||
|
||||
switch( frameMesh->getMeshBuffer(randomMB)->getVertexType() )
|
||||
{
|
||||
case video::EVT_STANDARD:
|
||||
p.pos = ((video::S3DVertex*)frameMesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertex*)frameMesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
case video::EVT_TANGENTS:
|
||||
p.pos = ((video::S3DVertexTangents*)frameMesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertexTangents*)frameMesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
}
|
||||
p.pos = frameMesh->getMeshBuffer(randomMB)->getPosition(vertexNumber);
|
||||
if( UseNormalDirection )
|
||||
p.vector = frameMesh->getMeshBuffer(randomMB)->getNormal(vertexNumber) / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
|
||||
p.startTime = now;
|
||||
|
||||
|
|
|
@ -65,23 +65,11 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
|
|||
{
|
||||
for( u32 k=0; k<Mesh->getMeshBuffer(j)->getVertexCount(); ++k )
|
||||
{
|
||||
switch( Mesh->getMeshBuffer(j)->getVertexType() )
|
||||
{
|
||||
case video::EVT_STANDARD:
|
||||
p.pos = ((video::S3DVertex*)Mesh->getMeshBuffer(j)->getVertices())[k].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertex*)Mesh->getMeshBuffer(j)->getVertices())[k].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
case video::EVT_TANGENTS:
|
||||
p.pos = ((video::S3DVertexTangents*)Mesh->getMeshBuffer(j)->getVertices())[k].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertexTangents*)Mesh->getMeshBuffer(j)->getVertices())[k].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
}
|
||||
p.pos = Mesh->getMeshBuffer(j)->getPosition(k);
|
||||
if( UseNormalDirection )
|
||||
p.vector = Mesh->getMeshBuffer(j)->getNormal(k) / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
|
||||
p.startTime = now;
|
||||
|
||||
|
@ -124,23 +112,11 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
|
|||
|
||||
u32 vertexNumber = os::Randomizer::rand() % Mesh->getMeshBuffer(randomMB)->getVertexCount();
|
||||
|
||||
switch( Mesh->getMeshBuffer(randomMB)->getVertexType() )
|
||||
{
|
||||
case video::EVT_STANDARD:
|
||||
p.pos = ((video::S3DVertex*)Mesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertex*)Mesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
case video::EVT_TANGENTS:
|
||||
p.pos = ((video::S3DVertexTangents*)Mesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Pos;
|
||||
if( UseNormalDirection )
|
||||
p.vector = ((video::S3DVertexTangents*)Mesh->getMeshBuffer(randomMB)->getVertices())[vertexNumber].Normal / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
break;
|
||||
}
|
||||
p.pos = Mesh->getMeshBuffer(randomMB)->getPosition(vertexNumber);
|
||||
if( UseNormalDirection )
|
||||
p.vector = Mesh->getMeshBuffer(randomMB)->getNormal(vertexNumber) / NormalDirectionModifier;
|
||||
else
|
||||
p.vector = Direction;
|
||||
|
||||
p.startTime = now;
|
||||
|
||||
|
|
Loading…
Reference in New Issue