removed getVertexPitch() method

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@923 dfc29bdd-3216-0410-991c-e03cc46cb475
master
irrlicht 2007-09-08 05:06:47 +00:00
parent 7c965509aa
commit 7b734957d8
8 changed files with 49 additions and 57 deletions

View File

@ -105,11 +105,6 @@ namespace scene
return T().getType(); return T().getType();
} }
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const
{
return sizeof ( T );
}
//! append the vertices and indices to the current buffer //! append the vertices and indices to the current buffer
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices)

View File

@ -14,44 +14,47 @@ namespace irr
{ {
namespace scene namespace scene
{ {
//! Enumeration for all vertex types there are.
enum E_PRIMITIVE_TYPE
{
//! All vertices are non-connected points.
EPT_POINTS=0,
//! All vertices form a single connected line. //! Enumeration for all primitive types there are.
EPT_LINE_STRIP, enum E_PRIMITIVE_TYPE
{
//! All vertices are non-connected points.
EPT_POINTS=0,
//! Just as LINE_STRIP, but the last and the first vertex is also connected. //! All vertices form a single connected line.
EPT_LINE_LOOP, EPT_LINE_STRIP,
//! Every two vertices are connected creating n/2 lines. //! Just as LINE_STRIP, but the last and the first vertex is also connected.
EPT_LINES, EPT_LINE_LOOP,
//! After the first two vertices each vertex defines a new triangle. //! Every two vertices are connected creating n/2 lines.
//! Always the two last and the new one form a new triangle. EPT_LINES,
EPT_TRIANGLE_STRIP,
//! After the first two vertices each vertex defines a new triangle. //! After the first two vertices each vertex defines a new triangle.
//! All around the common first vertex. //! Always the two last and the new one form a new triangle.
EPT_TRIANGLE_FAN, EPT_TRIANGLE_STRIP,
//! Explicitly set all vertices for each triangle. //! After the first two vertices each vertex defines a new triangle.
EPT_TRIANGLES, //! All around the common first vertex.
EPT_TRIANGLE_FAN,
//! After the first two vertices each further tw vetices create a quad with the preceding two. //! Explicitly set all vertices for each triangle.
EPT_QUAD_STRIP, EPT_TRIANGLES,
//! Every four vertices create a quad. //! After the first two vertices each further tw vetices create a quad with the preceding two.
EPT_QUADS, EPT_QUAD_STRIP,
//! Every four vertices create a quad.
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.
EPT_POINT_SPRITES
};
//! Just as LINE_LOOP, but filled.
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.
EPT_POINT_SPRITES
};
//! Struct for holding a mesh with a single material //! Struct for holding a mesh with a single material
/** SMeshBuffer is a simple implementation of a MeshBuffer. */ /** SMeshBuffer is a simple implementation of a MeshBuffer. */
@ -71,9 +74,6 @@ enum E_PRIMITIVE_TYPE
//! returns which type of vertex data is stored. //! returns which type of vertex data is stored.
virtual video::E_VERTEX_TYPE getVertexType() const = 0; virtual video::E_VERTEX_TYPE getVertexType() const = 0;
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const = 0;
//! returns pointer to vertex data. The data is an array of vertices. Which vertex //! returns pointer to vertex data. The data is an array of vertices. Which vertex
//! type is used can be determined with getVertexType(). //! type is used can be determined with getVertexType().
virtual const void* getVertices() const = 0; virtual const void* getVertices() const = 0;

View File

@ -189,6 +189,20 @@ struct S3DVertexTangents : S3DVertex
inline u32 getVertexPitchFromType(E_VERTEX_TYPE vertexType)
{
switch (vertexType)
{
case video::EVT_2TCOORDS:
return sizeof(video::S3DVertex2TCoords);
case video::EVT_TANGENTS:
return sizeof(video::S3DVertexTangents);
}
return sizeof(video::S3DVertex);
}
} // end namespace video } // end namespace video
} // end namespace irr } // end namespace irr

View File

@ -108,12 +108,6 @@ namespace scene
return video::EVT_STANDARD; 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. //! recalculates the bounding box. should be called if the mesh changed.
virtual void recalculateBoundingBox() virtual void recalculateBoundingBox()
{ {

View File

@ -149,17 +149,6 @@ struct SSkinMeshBuffer : public IMeshBuffer
return VertexType; return VertexType;
} }
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const
{
switch (VertexType)
{
case video::EVT_2TCOORDS: return sizeof(video::S3DVertex2TCoords);
case video::EVT_TANGENTS: return sizeof(video::S3DVertexTangents);
default: return sizeof(video::S3DVertex);
}
}
virtual void MoveTo_2TCoords() virtual void MoveTo_2TCoords()
{ {
if (VertexType==video::EVT_STANDARD) if (VertexType==video::EVT_STANDARD)

View File

@ -443,7 +443,7 @@ void CAnimatedMeshSceneNode::render()
for ( g=0; g<m->getMeshBufferCount(); ++g) for ( g=0; g<m->getMeshBufferCount(); ++g)
{ {
scene::IMeshBuffer* mb = m->getMeshBuffer(g); scene::IMeshBuffer* mb = m->getMeshBuffer(g);
const u32 vSize = mb->getVertexPitch(); const u32 vSize = video::getVertexPitchFromType(mb->getVertexType());
const video::S3DVertex* v = ( const video::S3DVertex*)mb->getVertices(); const video::S3DVertex* v = ( const video::S3DVertex*)mb->getVertices();
for ( i = 0; i != mb->getVertexCount(); ++i ) for ( i = 0; i != mb->getVertexCount(); ++i )
{ {

View File

@ -291,7 +291,7 @@ void CMeshManipulator::transformMesh(scene::IMesh* mesh, const core::matrix4& m)
IMeshBuffer* buffer = mesh->getMeshBuffer(b); IMeshBuffer* buffer = mesh->getMeshBuffer(b);
const u32 vtxcnt = buffer->getVertexCount(); const u32 vtxcnt = buffer->getVertexCount();
const u32 vtxPitch = buffer->getVertexPitch (); const u32 vtxPitch = video::getVertexPitchFromType(buffer->getVertexType());
video::S3DVertex* v = (video::S3DVertex*) buffer->getVertices(); video::S3DVertex* v = (video::S3DVertex*) buffer->getVertices();

View File

@ -157,7 +157,7 @@ void CMeshSceneNode::render()
u32 vSize; u32 vSize;
u32 i; u32 i;
vSize = mb->getVertexPitch (); vSize = video::getVertexPitchFromType(mb->getVertexType());
const video::S3DVertex* v = ( const video::S3DVertex*)mb->getVertices(); const video::S3DVertex* v = ( const video::S3DVertex*)mb->getVertices();
video::SColor c ( 255, 128 ,0, 0 ); video::SColor c ( 255, 128 ,0, 0 );