Commit dbe744d1 authored by hybrid's avatar hybrid

Fix draw3dTriangle to render proper 3d objects, not just lines. In order to...

Fix draw3dTriangle to render proper 3d objects, not just lines. In order to recover the previous behavior, set the 3d material to wireframe.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2723 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 870f4f07
...@@ -625,7 +625,6 @@ void CNullDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices, ...@@ -625,7 +625,6 @@ void CNullDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
} }
//! Draws an indexed triangle fan. //! Draws an indexed triangle fan.
void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices,
u32 vertexCount, const u16* indexList, u32 triangleCount) u32 vertexCount, const u16* indexList, u32 triangleCount)
...@@ -634,7 +633,6 @@ void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices, ...@@ -634,7 +633,6 @@ void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices,
} }
//! Draws a 3d line. //! Draws a 3d line.
void CNullDriver::draw3DLine(const core::vector3df& start, void CNullDriver::draw3DLine(const core::vector3df& start,
const core::vector3df& end, SColor color) const core::vector3df& end, SColor color)
...@@ -642,17 +640,27 @@ void CNullDriver::draw3DLine(const core::vector3df& start, ...@@ -642,17 +640,27 @@ void CNullDriver::draw3DLine(const core::vector3df& start,
} }
//! Draws a 3d triangle. //! Draws a 3d triangle.
void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color) void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color)
{ {
draw3DLine(triangle.pointA, triangle.pointB, color); S3DVertex vertices[3];
draw3DLine(triangle.pointB, triangle.pointC, color); vertices[0].Pos=triangle.pointA;
draw3DLine(triangle.pointC, triangle.pointA, color); vertices[0].Color=color;
vertices[0].Normal=triangle.getNormal().normalize();
vertices[0].TCoords.set(0.f,0.f);
vertices[1].Pos=triangle.pointB;
vertices[1].Color=color;
vertices[1].Normal=vertices[0].Normal;
vertices[1].TCoords.set(0.5f,1.f);
vertices[2].Pos=triangle.pointC;
vertices[2].Color=color;
vertices[2].Normal=vertices[0].Normal;
vertices[2].TCoords.set(1.f,0.f);
const u16 indexList[] = {0,1,2};
drawVertexPrimitiveList(vertices, 3, indexList, 1, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
} }
//! Draws a 3d axis aligned box. //! Draws a 3d axis aligned box.
void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color) void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)
{ {
......
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