CSampleSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id) : ISceneNode(parent, mgr, id) { Material.Wireframe = false; Material.Lighting = false; Vertices[0] = S3DVertex(0,0,10, 1,1,0, SColor(255,0,255,255), 0, 1); Vertices[1] = S3DVertex(10,0,-10, 1,0,0, SColor(255,255,0,255), 1, 1); Vertices[2] = S3DVertex(0,20,0, 0,1,1, SColor(255,255,255,0), 1, 0); Vertices[3] = S3DVertex(-10,0,-10, 0,0,1, SColor(255,0,255,0), 0, 0); Box.reset(Vertices[0].Pos); for (s32 i=1; i<4; ++i) Box.addInternalPoint(Vertices[i].Pos); }
CSampleSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id): ISceneNode(parent, mgr, id) { float u = 320.0/512.0; float v = 240.0/256.0; Material.Wireframe = false; Material.Lighting = false; Vertices[0] = S3DVertex(-10,-10,0, 0,0,0,SColor(255,255,255,255),0,v); Vertices[1] = S3DVertex( 10,-10,0, 0,0,0,SColor(255,255,255,255),u,v); Vertices[2] = S3DVertex( 10, 10,0, 0,0,0,SColor(255,255,255,255),u,0); Vertices[3] = S3DVertex(-10, 10,0, 0,0,0,SColor(255,255,255,255),0,0); Box.reset(Vertices[0].Pos); for (u32 i=1; i<4; ++i) Box.addInternalPoint(Vertices[i].Pos); }
CSampleSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id) : ISceneNode(parent, mgr, id) { Descriptor = mgr->getVideoDriver()->getVertexDescriptor(0); VertexBuffer = new scene::CVertexBuffer<S3DVertex>(); IndexBuffer = new scene::CIndexBuffer(video::EIT_16BIT); Material.Wireframe = false; Material.Lighting = false; S3DVertex Vertices[4]; Vertices[0] = S3DVertex(0,0,10, 1,1,0, SColor(255,0,255,255), 0, 1); Vertices[1] = S3DVertex(10,0,-10, 1,0,0, SColor(255,255,0,255), 1, 1); Vertices[2] = S3DVertex(0,20,0, 0,1,1, SColor(255,255,255,0), 1, 0); Vertices[3] = S3DVertex(-10,0,-10, 0,0,1, SColor(255,0,255,0), 0, 0); for (s32 i = 0; i<4; ++i) VertexBuffer->addVertex(&Vertices[i]); IndexBuffer->addIndex(0); IndexBuffer->addIndex(2); IndexBuffer->addIndex(3); IndexBuffer->addIndex(2); IndexBuffer->addIndex(1); IndexBuffer->addIndex(3); IndexBuffer->addIndex(1); IndexBuffer->addIndex(0); IndexBuffer->addIndex(3); IndexBuffer->addIndex(2); IndexBuffer->addIndex(0); IndexBuffer->addIndex(1); Box.reset(Vertices[0].Pos); for (s32 i=1; i<4; ++i) Box.addInternalPoint(Vertices[i].Pos); }
//! Draws a 3d axis aligned box. void CNullDriver::draw3DBox(const aabbox3d<f32>& box, SColor color) { vector3df edges[8]; box.getEdges(edges); // TODO: optimize into one big drawIndexPrimitive call. draw3DLine(edges[5], edges[1], color); draw3DLine(edges[1], edges[3], color); draw3DLine(edges[3], edges[7], color); draw3DLine(edges[7], edges[5], color); draw3DLine(edges[0], edges[2], color); draw3DLine(edges[2], edges[6], color); draw3DLine(edges[6], edges[4], color); draw3DLine(edges[4], edges[0], color); draw3DLine(edges[1], edges[0], color); draw3DLine(edges[3], edges[2], color); draw3DLine(edges[7], edges[6], color); draw3DLine(edges[5], edges[4], color); }