[Gtkradiant] svn trunk: hitting "s" in brush primitives mode crashes (NULL pointer)

divVerent at alientrap.org divVerent at alientrap.org
Wed Jul 9 02:39:46 CDT 2008

On Tue, Jul 08, 2008 at 08:10:48AM +0200, Rudolf Polzer wrote:
> On Sat, Jul 05, 2008 at 09:32:34PM +0200, Rudolf Polzer wrote:
> > On Sat, Jul 05, 2008 at 09:03:43AM +0200, Martin Gerhardy wrote:
> > > > Is there really no way to switch back to it, can maybe the old
> > > > surfacedialog.cpp code that worked just fine be turned into a plugin?
> > > > The code is still there, all I need to know is the code the functions
> > > > had before they called stuff from g_SurfaceTable... but svn won't tell
> > > > me any past history of that code.
> > > 
> > > The 'old' code of 1.5 is in branches/1.5 - you should have a look at
> > > that code maybe. The zeroradiant code base is based on 1.4. Maybe that's
> > > the reason why you don't get any history.
> > 
> > Sure, but I am quite sure that brush primitives mode did not have that
> > bug in 1.4... so I'd like to revert the change that introduced the
> > surface dialog plugin. Too bad I can't see it in svn log...
> > 
> > for now, I'll have to switch back to 1.5 as it seems, as fixing that bug
> > is beyond my abilities and I need brush primitives mode for this map.
> I am currently trying to get the brushprimitives-to-traditional
> conversion right. This is not code yet, just code lookalike... but 
> I think these conversion routines should work, once completed.
> Not sure if I will have time to complete that into a patch, but maybe
> someone else of you will.

Attached: a diff for WORKING brush primitives to texdef conversion (as
opposed to your comment in brush_primit.cpp that states it is not
possible). Shift and scale no longer get lost when opening a BP map in
Texdef mode. Beware of roundoff errors, though; I did quite some effort
to minimize their impact, but it isn't perfect (worked fine for the maps
I have here though).

Possibly you want to snap angles close to 0/90/180 degrees to these
exact numbers.

Known "big issue": the conversion of course isn't always possible. Brush
primitives format allows you to rotate anything, while Texdef format
does not work in some cases.

Example: take this square:

A = '0  0 0'
B = '4  5 3'
C = '8  0 6'
D = '4 -5 3'

First, check that this is a square:

AB is orthogonal to BC: 4*4 + 5*(-5) + 3*3 = 0
BC is orthogonal to CD: 4*(-4) + (-5)*(-5) + 3*(-3) = 0
CD is orthogonal to DA: (-4)*(-4) + 5*(-5) + (-3)*(-3) = 0
DA is orthogonal to AB: (-4)*4 + 5*5 + (-3)*3 = 0
A, B, C, D lie on one plane: x/4 - z/3 = 0

Now try to fit a square texture on it. In the Quake system, you'd have
to map a square texture on the projection of ABCD onto the xy plane (as
z has the highest coefficient in the plane normal). That is, you'd map a
square texture to

'0  0'
'4  5'
'8  0'
'4 -5'

That is not a square or rectangle any more - however, shift, scale and
rotation only allow specifying rectangles on the projection plane.

Therefore, texdef sucks. Sure, you already knew that. What also follows
from this is that "rotation lock" cannot work in texdef format, even if
you tried to get it right, as this above ABCD is nothing more than a
square with the side length 5*sqrt(2) - something that sure has a quite
nice texdef representation when rotated to the xy plane (where it'll
have the coordinates '0 0', '5 5', '10 0', '5 -5').

Can you please implement brush primitives support for the surface
dialog (that is, at least tell me that you actually care and are going
to start some time), or tell me that you won't do it because you don't
care for your users so I can stop bothering with it and go back to
GtkRadiant 1.5? I really need working free rotation, AND being able to
change texture projection parameters.

If you are NOT going to make the surface dialog support brush
primitives, you should rather take out brush primitives mode ENTIRELY,
and only offer the conversion on loading map files.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: working-brushprimit-texdef-conversion.diff
Type: text/x-diff
Size: 10911 bytes
Desc: not available
Url : http://zerowing.idsoftware.com/pipermail/gtkradiant/attachments/20080709/fcf347fe/attachment.diff 

More information about the Gtkradiant mailing list