0

Many level editors like Quake or Source games uses implicit plane equation for brush side representation (by 3 points) instead of simple (n.x n.y n.z d).

 {
     ...
     ( 256 0 0 ) ( 256 0 1 ) ( 256 1 0 ) GROUND1_6 0 0 0 1.0 1.0
     ( 0 128 0 ) ( 0 128 1 ) ( 1 128 0 ) GROUND1_6 0 0 0 1.0 1.0
     ...
 }

Is there some reason for this? I know it can be easily converted to any form, just wonder why they used this form. Is it some floating point precision stuff?

user1188351
  • 93
  • 2
  • 10
  • 'Snap-to-Grid' editing perhaps? Probably to avoid cracks that might appear due to practical (or lazy) use of floating-point routines. – Brett Hale Apr 14 '15 at 13:29
  • Looks like so. Inside qbsp planes read with atoi(..), so its always integer numbers. This ensures brush sides to be aligned to grid. [link](https://github.com/id-Software/Quake-2-Tools/blob/master/bsp/qbsp3/map.c) – user1188351 Apr 14 '15 at 13:48

1 Answers1

2

Quake uses the plane equation, and plane sidedness test, extensively, and so while it seems awkward or annoying if you're just looking to render map geometry, it was likely a pretty easy decision to use this representation. As alluded to above, it allows the map format to use integer coordinates for plane sides. This means the format itself is "lossless" and immune to floating point rounding issues. Vertex coordinates can be calculated at either floating point or full double precision. In fact, newer BSP compilers (q3map2, quemap, etc..) do use double precision for some face splitting calculations.

jdolan
  • 580
  • 5
  • 14