TrenchBroom / TrenchBroom

Cross-Platform Level Editor
kristianduske.com/trenchbroom
GNU General Public License v3.0
2.04k stars 237 forks source link

Proposal: "Face Building Mode" #316

Open necros0 opened 11 years ago

necros0 commented 11 years ago

Note: This is something for a far away point in time. :)

Purpose

Making a completely new way of doing terrain/organic brushwork.

How it works

Instead of a brush, you have a single triangle face that you manipulate. The editor keeps track of which side is the visible side and auto-generates the rear 3 faces and vertex based on the visible face's normal.

The rear vertex should be placed a short distance from the visible face, preferably starting at the face's center, extending backward along the face's normal ~8 units but snapped to a 1 unit grid.

The user CANNOT change this autogenerated vertex.

Since a brush with 4 sides cannot be concave, there should never be a worry about illegal brushes,

The autogenerated faces and vertex should be drawn differently in some way in the editor to differentiate them from normal faces/vertices.

Implementation

This is obviously the hard part because the quake map format has no native support for something like this.

A quick test showed that the order the planes are declared in a brush definition doesn't seem to affect anything.

What I propose is this:

Any brush(es) in a func_group with the key 'faces' set to '1' will activate this 'mode' for all brushes in the entity. You would only need a single func_group with this key/val but multiple func_groups would be fine as well.

When a map is saved, the editor will save the autogenerated faces after the editable face as if they were normal brushes. This way, the compiler has no idea what is a normal brush and what is autogenerated and since compilers collapse func_groups into world geometry, the end result is identical.

When a map is read, all brushes in the aforementioned func_group will only read the first plane and begin autogenerating the rear faces/vertex right away (or alternatively, can load the other planes to speed map loading time?).

The idea here is to provide this feature while being absolutely transparent to other editors and compilers. Other utilities will never know about autogeneration and there will be no compatibility problems. Of course, you will loose the information if you save in a different editor, but that is outside of the scope.

kduske commented 11 years ago

I have been thinking a lot about something similar. My thoughts go more in the direction of directly editing triangle meshes and letting the editor figure out how to turn that into a proper trisoup. That would allow us to provide more advanced tools for manipulating meshes such as terrain editors and the like.