Code: Select all
driver->beginScene(true, true, SColor(255,0,0,0));
smgr->drawAll();
driver->draw3DLine(vector3df(0,0,-50), vector3df(0,0,-100), SColor(255,255,0,0));
guienv->drawAll();
driver->endScene();
thanks in advance
Code: Select all
driver->beginScene(true, true, SColor(255,0,0,0));
smgr->drawAll();
driver->draw3DLine(vector3df(0,0,-50), vector3df(0,0,-100), SColor(255,255,0,0));
guienv->drawAll();
driver->endScene();
Bate wrote:Can someone tell me why the 3DLine is always black, no matter what I use for SColor?
Is there maybe a better way to create 3d lines? Because I don't know how to manage (switch on/off) several lines inside the main loop. Also, I need to draw lines on a circular path and right now I have no idea how to realize that.Code: Select all
driver->beginScene(true, true, SColor(255,0,0,0)); smgr->drawAll(); driver->draw3DLine(vector3df(0,0,-50), vector3df(0,0,-100), SColor(255,255,0,0)); guienv->drawAll(); driver->endScene();
thanks in advance
Code: Select all
//! Draws a 3d line.
/** For some implementations, this method simply calls
drawIndexedTriangles for some triangles.
Note that the line is drawn using the current transformation
matrix and material. So if you need to draw the 3D line
independently of the current transformation, use
\code
driver->setMaterial(unlitMaterial);
driver->setTransform(video::ETS_WORLD, core::matrix4());
\endcode
for some properly set up material before drawing the line.
Some drivers support line thickness set in the material.
\param start Start of the 3d line.
\param end End of the 3d line.
\param color Color of the line. */
virtual void draw3DLine(const core::vector3df& start,
const core::vector3df& end, SColor color = SColor(255,255,255,255)) =0;
Code: Select all
irr::core::array<vector3df> arrayVertices[100];
irr::core::array<u32 /* OR s32 */> arrayIndices[100];
Code: Select all
irr::core::array<S3DVertex> arrayVertices[3];
arrayVertices[0] = S3DVertex(/* NO IDEA */);
arrayVertices[1] = S3DVertex(/* NO IDEA */);
arrayVertices[2] = S3DVertex(/* NO IDEA */);
irr::core::array<u16> arrayIndices[3];
arrayIndices[0] = 0;
arrayIndices[1] = 1;
arrayIndices[2] = 2;
// main loop
driver->drawVertexPrimitiveList(arrayVertices, 3, arrayIndices, 3, EVT_STANDARD, EPT_LINE_STRIP, EIT_16BIT);
no, beside what hybrid already told you, this two lines will create 200 arrays and not 2 arrays with 100 elements each !!!Bate wrote:like this?
Code: Select all
irr::core::array<vector3df> arrayVertices[100]; irr::core::array<u32 /* OR s32 */> arrayIndices[100];
Code: Select all
irr::core::array<S3DVertex> arrayVertices;
arrayVertices[0] = S3DVertex(/* not working */);
arrayVertices[1] = S3DVertex(/* not working */);
arrayVertices[2] = S3DVertex(/* not working */);
irr::core::array<u16> arrayIndices;
arrayIndices[0] = 0;
arrayIndices[1] = 1;
arrayIndices[2] = 2;
no, it isn't !!!Bate wrote:Is this basically a correct creation and value assignment?
Code: Select all
irr::core::array<S3DVertex> arrayVertices; arrayVertices[0] = S3DVertex(/* not working */); arrayVertices[1] = S3DVertex(/* not working */); arrayVertices[2] = S3DVertex(/* not working */); irr::core::array<u16> arrayIndices; arrayIndices[0] = 0; arrayIndices[1] = 1; arrayIndices[2] = 2;
Code: Select all
irr::core::array<S3DVertex> arrayVertices;
arrayVertices.push_back(S3DVertex(p1x, p1y, p1z, 0,0,0, SColor(255, 255,0,0),0,0));
arrayVertices.push_back(S3DVertex(p2x, p2y, p2z, 0,0,0, SColor(255, 255,0,0),0,0));
arrayVertices.push_back(S3DVertex(p3x, p3y, p3z, 0,0,0, SColor(255, 255,0,0),0,0));
irr::core::array<u16> arrayIndices;
arrayIndices.push_back(0);
arrayIndices.push_back(1);
arrayIndices.push_back(2);
Code: Select all
S3DVertex arrayVertices[3];
arrayVertices[0] = S3DVertex(p1x, p1y, p1z, 0,0,0, SColor(255, 255,0,0),0,0);
arrayVertices[1] = S3DVertex(p2x, p2y, p2z, 0,0,0, SColor(255, 255,0,0),0,0);
arrayVertices[2] = S3DVertex(p3x, p3y, p3z, 0,0,0, SColor(255, 255,0,0),0,0);
u16 arrayIndices[3];
arrayIndices[0] = 0;
arrayIndices[1] = 1;
arrayIndices[2] = 2;
Code: Select all
S3DVertex arrayVertices[3];
arrayVertices[0] = S3DVertex(0, 0, -100, 0,0,0, SColor(255, 255,0,0),0,0);
arrayVertices[1] = S3DVertex(0, 50, -85, 0,0,0, SColor(255, 255,0,0),0,0);
arrayVertices[2] = S3DVertex(25, 0, -75, 0,0,0, SColor(255, 255,0,0),0,0);
u16 arrayIndices[3];
arrayIndices[0] = 0;
arrayIndices[1] = 1;
arrayIndices[2] = 2;
// Use Material Color since SColor in S3DVertex doesn't do anything
SMaterial mt;
mt.AmbientColor = mt.DiffuseColor = mt.EmissiveColor = SColor(255, 255, 0, 0);
driver->setMaterial(mt);
// Main Loop
driver->drawVertexPrimitiveList(arrayVertices, 3, arrayIndices, 3, EVT_STANDARD, EPT_LINE_STRIP, EIT_16BIT);