Automatic Coordinate Generation With Culling On?

OK, I’m writing my world editor for the game engine I have created and have a minor problem. I have culling on, of course. Now, when I click on “Brush->Cube”, the program will manually create a 128x128x128 cube for me, but is it necessary for me to have to code in each vertex coordinate manually in the IDM_CUBE case statement, or is there a function built-in that will properly create a cube with all of it’s faces facing outward? Thanks for the help.

glutSolidCube() ?

Well, you can use glut to plot a cube. Sure.

Once you have it plotted, then what?

Supposedly, your editor will actually spit out a file? Perhaps you actually want to run collission detection and other physics on this data? Do you want to support adding/subtracting overlappig primitives and properly merge them into bigger meshes?

To actually create a world editor, you’ll probably have to deal with geometry on a much more intimate level, including knowing what your specific faces/coordinates are and which way they’re pointing. As you have to write that code anyway, you might as well write it up front – that’s where the hard work goes.

Once you can deal with basic shape CSG, or ploygon soups, or whatever your engine uses for its geometry, then you can take advantage of the fact that you have access to all the geometry in your own well-defined format, and merge all geometry with the same texture/material into one mesh, so you can actually draw (and cull) it efficiently.