Calculating the Extreme X, Y, Z of a .bsp?

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Calculating the Extreme X, Y, Z of a .bsp?

Post by Baker »

Does anyone know how to within the engine calculate the extreme X, Y, Z coordinates (min, max X ... min, max Y, etc.)?

I've been looking through the .bsp stuff and would like to know for "minimap" purposes, but alas I don't understand enough to be able to identify how to capture these values.
metlslime
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Post by metlslime »

I guess, while loading vertices, compare and modify as needed a mins[] and maxs[] for the map
Electro
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia
Contact:

Post by Electro »

Yeah like what metlslime said.

setup a mins to be 99999999 (or some ridiculous number to make sure everything is caught)
maxs to be -99999999

if (vert[0] < mins[0]) mins[0] = vert[0];

same for y and z etc... you get the idea
It's like starting off with an inverted box, then pushing it out every time you have a vertex that requires it to grow.

The result should be a bbox for 'worldspawn' :)
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Post Reply