by Spike » Sat Dec 24, 2016 4:51 pm
terrain is fairly straight forward, you can just call a builtin to raise or lower the terrain around some point, with a radius parameter and stuff. painting textures is basically the same with an added width. you shouldn't really need csaddon's terrain code for anything other than documentation.
however you first need to define the maximum size of the terrain as worldspawn keys, and use the 'mod_terrain_save' console command to save it to disk.
brush editing is much more convoluted, yes.
regarding pointers the easiest way to deal with them is to just define some global arrays and pass those into the brush builtins as needed. then you can just index the arrays without resorting to allocating/freeing/etc pointers.
from the engine side its somewhat straight forward. the [cs|ss]qc can get a list of brushes within a bbox, it can query a list of planes from each brush, it can delete brushes, it can create brushes (any redundant planes are ignored). there's also a utility function or two that can calculate the winding[read: polygon/trifan] of a face from a brush/plane-list.
the qc is then responsible for modifying the plane lists of each brush. to split a brush just clone it and insert a plane into the original and the copy, with the plane being mirrored. when you then delete the original and create your two copies the engine will disregard any redundant planes and you end up with two neighbouring brushes.
but yeah, at the end of the day, the qc just sees lists of planes. each plane has two texture 'planes', so you can just treat each plane as a 4*3 matrix. to move/rotate/whatever a brush, just transform those matricies - yay dotproducts. My code should contain an example of this for rotation/moving/etc, but you'd want to give it a decent UI.
Vertex manipulation is much more challenging. My aproach was to just decompose the brush into polygons and then reform the brush according to the modified polies. any concavities result in cutting into the rest of the brush, these should be obvious in the previews that I added.
but yes, terrain+meshes+entities should be enough for most things if you're going for an open-world kind of feel. You can even embed non-sealed BSPs too if you need more complex geometry made with eg trenchbroom.
including brush editor stuff is more for completeness.
.