Fix patch for meshbuffers with different primitives.

Half the calculations for number of primitives had been wrong.
Also fix a compile-warning.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5427 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-04-16 21:34:58 +00:00
parent de1bbfdc50
commit dbd17774d0
3 changed files with 14 additions and 9 deletions

View File

@ -37,12 +37,17 @@ namespace scene
EPT_TRIANGLES,
//! After the first two vertices each further two vertices create a quad with the preceding two.
//! Not supported by Direct3D
EPT_QUAD_STRIP,
//! Every four vertices create a quad.
//! Not supported by Direct3D
//! Deprecated with newer OpenGL drivers
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
//! Not supported by Direct3D
//! Deprecated with newer OpenGL drivers
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.

View File

@ -146,9 +146,9 @@ namespace scene
virtual u32 getChangedID_Index() const = 0;
//! Describe what kind of primitive geometry is used by the meshbuffer
/** Note: Default is EPT_TRIANGLES. Using other types is fine for rendering.
/** Note: Default is EPT_TRIANGLES. Using other types is fine for rendering.
But meshbuffer manipulation functions might expect type EPT_TRIANGLES
to work correctly. Also mesh writers will generally fail (badly!) with other
to work correctly. Also mesh writers will generally fail (badly!) with other
types than EPT_TRIANGLES. */
virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) = 0;
@ -163,14 +163,14 @@ namespace scene
{
case scene::EPT_POINTS: return indexCount;
case scene::EPT_LINE_STRIP: return indexCount-1;
case scene::EPT_LINE_LOOP: return indexCount-1;
case scene::EPT_LINE_LOOP: return indexCount;
case scene::EPT_LINES: return indexCount/2;
case scene::EPT_TRIANGLE_STRIP: return (indexCount-2)/3;
case scene::EPT_TRIANGLE_FAN: return (indexCount-2)/3;
case scene::EPT_TRIANGLE_STRIP: return (indexCount-2);
case scene::EPT_TRIANGLE_FAN: return (indexCount-2);
case scene::EPT_TRIANGLES: return indexCount/3;
case scene::EPT_QUAD_STRIP: return (indexCount-2)/4;
case scene::EPT_QUAD_STRIP: return (indexCount-2)/2;
case scene::EPT_QUADS: return indexCount/4;
case scene::EPT_POLYGON: return indexCount-1;
case scene::EPT_POLYGON: return indexCount; // (not really primitives, that would be 1, works like line_strip)
case scene::EPT_POINT_SPRITES: return indexCount;
}
return 0;

View File

@ -21,9 +21,9 @@ struct SSkinMeshBuffer : public IMeshBuffer
//! Default constructor
SSkinMeshBuffer(video::E_VERTEX_TYPE vt=video::EVT_STANDARD) :
ChangedID_Vertex(1), ChangedID_Index(1), VertexType(vt),
PrimitiveType(EPT_TRIANGLES),
MappingHint_Vertex(EHM_NEVER), MappingHint_Index(EHM_NEVER),
BoundingBoxNeedsRecalculated(true),
PrimitiveType(EPT_TRIANGLES)
BoundingBoxNeedsRecalculated(true)
{
#ifdef _DEBUG
setDebugName("SSkinMeshBuffer");