I have two questions- both of which probably involve somebody graciously linking me somewhere that answers them (a location I have been unable to find as of yet).
The first is simple:
I'm playing around with the custom scene node tutorial, and trying to get it to draw a cube instead of the pyramidal structure it draws.
Code: Select all
CSampleSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
: scene::ISceneNode(parent, mgr, id)
{
Material.Wireframe = false;
Material.Lighting = false;
Vertices[0] = video::S3DVertex(-10,-10,-10, 1,1,1, video::SColor(255,0,255,255), 1, 1);
Vertices[1] = video::S3DVertex(10,-10,-10, 1,1,1, video::SColor(255,255,0,255), 1, 1);
Vertices[2] = video::S3DVertex(10,10,-10, 1,1,1, video::SColor(255,255,255,0), 1, 1);
Vertices[3] = video::S3DVertex(-10,10,-10, 1,1,1, video::SColor(255,0,255,0), 1, 1);
Vertices[4] = video::S3DVertex(-10,-10,10, 1,1,1, video::SColor(255,0,255,0), 1, 1);
Vertices[5] = video::S3DVertex(10,-10,10, 1,1,1, video::SColor(255,255,255,0), 1, 1);
Vertices[6] = video::S3DVertex(10,10,10, 1,1,1, video::SColor(255,0,255,0), 1, 1);
Vertices[7] = video::S3DVertex(-10,10,10, 1,1,1, video::SColor(255,0,255,0), 1, 1);
Box.reset(Vertices[0].Pos);
for (s32 i=1; i<8; ++i)
Box.addInternalPoint(Vertices[i].Pos);
}
virtual void OnRegisterSceneNode()
{
if (IsVisible)
SceneManager->registerNodeForRendering(this);
ISceneNode::OnRegisterSceneNode();
}
virtual void render()
{
u16 indices[] = { 0,1,2, 0,3,2, 4,5,6, 4,7,6, 0,4,5, 0,1,5, 1,2,6, 1,5,6, 2,3,7, 2,6,7, 3,0,4, 3,7,4 };
video::IVideoDriver* driver = SceneManager->getVideoDriver();
driver->setMaterial(Material);
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->drawIndexedTriangleList(&Vertices[0], 12, &indices[0], 12);
}I do now have a cube, but there's some weird reverse culling going on, and I can't figure out how to sort out my normals to stop that (roughly half of my triangles are invisible at any given time).
I tried to do the:
AutomaticCullingEnabled = false;
bit, but I get an error:
"AutomaticCullingEnabled' undeclared (first use this function)
So, essentially, I'm not sure what I need to do to get that to work (although in the long run, I'd rather be pointed to something that will help explain to me how to sort out a way to cull the correct triangles rather than none at all).
Aside from that, for efficiency's sake, I'd really rather be drawing odd geometric shapes using triangle strips when I can (as I'm looking to make some rather big shapes- polygon count wise).
I searched the forum for discussion on triangles strips and found some really old posts that just told me it wasn't implemented a few years ago.
Any change there? If so, how does one draw triangle strips?
If not, can anybody suggest to me an efficient means to that end? I'm guessing I'll need to modify the core engine if it's not supported? I do gather that people have already done this, so perhaps there is some example code floating around somewhere that would help.
Thanks,[/code]