[Gtkradiant] Custom Map File Format

SmallPileofGibs spog at planetquake.com
Wed Mar 9 16:43:48 CST 2005

That sounds like a good way to proceed =).

GtkRadiant does in fact convert brushes to polygons in order to render
them in the OpenGL views.
In case you might be inspired, the algorithm it currently uses is:

for each plane p of the brush:
    create an 'infinitely large' polygon 'winding' w that lies on p
    for each plane c of the brush
        if c is not equal to p:
            clip w by c using a polygon-vs-plane clipping algorithm

Note: an 'infinitely large' polygon can be made by projecting the
maximum-world-extents bounding-box onto the plane.

The implementation of the polygon-vs-plane clipping algorithm is here:


In the function 'Winding_Clip'.

This method seems to be a good blend of speed, precision and simplicity.


Wednesday, March 9, 2005, 8:31:45 PM, you wrote:

> I am familiar with BSP trees, and how Q3MAP compiles the map file, but I
> appreciate the input.

> I have an algorithm for converting a set of plane-based brushes into
> triangles suitable for rendering, but it is in pseudo-code, and through
> laziness, I haven't wanted to convert it to C.

> However, from the indication I am getting so far, it would be far less
> work to simply write a loader which converts the brushes into triangles
> on load, than it would be to do the same thing in GTKRadiant.

> When I write the code, I will make it fairly generic, and post it here
> for any further consideration you guys might have (in other words, use
> it, don't use it, laugh it, or preserve it as an example of Bad Coding,
> your choice).

> David Jackson

More information about the Gtkradiant mailing list