I tried to add a 3d rectangle into my scene, by following this tutorial : http://irrlicht.sourceforge.net/docu/example003.html, but I failed and now I get a black rectangle that's not fully drawn ().
Here's my render:
Code: Select all
virtual void render()
{
u16 indices[] = { 0, 1, 2, 0, 2, 3, 0, 1, 5, 0, 4, 5, 0, 3, 7, 0, 7, 4, 1, 2, 5, 2, 5, 6, 2, 6, 3, 3, 6, 7, 6, 5, 4, 6, 7, 4 };
video::IVideoDriver* driver = SceneManager->getVideoDriver();
driver->setMaterial(Material);
driver->setTransform(irr::video::ETS_WORLD, AbsoluteTransformation);
driver->drawVertexPrimitiveList(&Vertices[0], 8, &indices[0], 12);
}
Code: Select all
Poutre(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, PoutreStruct une_poutre)
: scene::ISceneNode(parent, mgr, id)
{
Material.Wireframe = false;
Material.Lighting = false;
Vertices[0] = video::S3DVertex(
une_poutre.noeud1.x + (une_poutre.larg / 2),
une_poutre.noeud1.y + (une_poutre.retomb / 2),
une_poutre.noeud1.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[1] = video::S3DVertex(
une_poutre.noeud1.x + (une_poutre.larg / 2),
une_poutre.noeud1.y - (une_poutre.retomb / 2),
une_poutre.noeud1.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[2] = video::S3DVertex(
une_poutre.noeud1.x - (une_poutre.larg / 2),
une_poutre.noeud1.y - (une_poutre.retomb / 2),
une_poutre.noeud1.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[3] = video::S3DVertex(
une_poutre.noeud1.x - (une_poutre.larg / 2),
une_poutre.noeud1.y + (une_poutre.retomb / 2),
une_poutre.noeud1.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[4] = video::S3DVertex(
une_poutre.noeud2.x + (une_poutre.larg / 2),
une_poutre.noeud2.y + (une_poutre.retomb / 2),
une_poutre.noeud2.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[5] = video::S3DVertex(
une_poutre.noeud2.x + (une_poutre.larg / 2),
une_poutre.noeud2.y - (une_poutre.retomb / 2),
une_poutre.noeud2.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[6] = video::S3DVertex(
une_poutre.noeud2.x - (une_poutre.larg / 2),
une_poutre.noeud2.y - (une_poutre.retomb / 2),
une_poutre.noeud2.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Vertices[7] = video::S3DVertex(
une_poutre.noeud2.x - (une_poutre.larg / 2),
une_poutre.noeud2.y + (une_poutre.retomb / 2),
une_poutre.noeud2.z,
0, 0, 0,
video::SColor(0, 0, 0, 0),
0, 0);
Box.reset(Vertices[0].Pos);
for (s32 i = 1; i < 8; ++i)
Box.addInternalPoint(Vertices[i].Pos);
}
As it's in french, please consider the word 'poutre' as a beam wood, and 'noeud' as node. I get two nodes that give me the coordinates of my beam wood.
Thank you for your help