basicVoxel.h/.cpp (I have both files, h contains the declaration and .cpp the definition as expected) - this generates each voxel based on what type is supplied by the world Generator and player controller function (to allow the player to edit the voxels)
voxelNode.h/.cpp (again both exist containing declaration and definition respectively) - this takes the voxels generated by the function(s) in basicVoxel and assembles them into a 256^3 chunk and takes care of optimizing the mesh for actual usage
main.cpp - the main thread resides here and is where Irrlicht renders everything, where the physics engine collides things and where the worldGenerator adds trees, water, animals etc to the world
Now I'm not sure how I should proceed with this, the basicVoxel currently ends with
Code: Select all
SMesh * cubeMesh = new SMesh();
cubeMesh->addMeshBuffer(buffer);
ISceneNode * cubeSceneNode = smgr->addMeshSceneNode(cubeMesh);
if(cubeSceneNode)
cubeSceneNode->setMaterialFlag(EMF_LIGHTING, false);
Sending the cubeMesh there?
sending a sceneNode there? (I really don't need a sceneNode for the cube, or rather I don't think I do as the cube itself will be added to a larger node, unless keeping the cube a separate node makes it easier to select it as an add/remove operation in which case I'm all for that)
I at least assume I should be able to send the chunk to the main thread in a similar fashion.
the chunk builder is built to take pure mesh data (with color data associated) but should be easy enough to extend into taking a full node (which, I can see benefits with since various different voxels will have different properties at a later stage, I don't remember if a node can have any arbitrary data tied to it or not but if it can then that's cool)