Overall what I'm trying to do is convert a file outputted by Rhino3D (modeling program) to a Quake map format. Unfortunately, my understanding of geometry is not significant. In Rhino3D, I'm outputting a .OBJ file which among other things contains vertices which form boxes.
This would form a box:
Format: v [x] [y] [z]
v 14.4892405864481 18.52604290295816 56.95011570721119
v 14.4892405864481 23.52604290295816 56.95011570721119
v 14.4892405864481 18.52604290295816 61.95011570721119
v 14.4892405864481 23.52604290295816 61.95011570721119
Now, somehow I need to convert that to a Quake "brush". Here's an excerpt from a Quake .MAP format specification:
Each brush is like a box. The brush has 6 faces, sides. The faces are planes (3 noncolinear points). How do I convert the Rhino3D vertices into planes, in clockwise fashion? Can somebody help guide me on how to do this? I'm totally lost at this point. I was able to convert one box, but others fail. I'm not sure why, but this whole planes intersecting thing is confusing me as well. I don't need to worry about Texture or anything after that in each plane line. What I'm doing right now to the huge floating points is just rounding them down (e.g. 14.4892405864481 to 14). I'm doing it in VB.NET but I don't need code written for me (although it would be nice), just a direction.
This would form a box:
Format: v [x] [y] [z]
v 14.4892405864481 18.52604290295816 56.95011570721119
v 14.4892405864481 23.52604290295816 56.95011570721119
v 14.4892405864481 18.52604290295816 61.95011570721119
v 14.4892405864481 23.52604290295816 61.95011570721119
Now, somehow I need to convert that to a Quake "brush". Here's an excerpt from a Quake .MAP format specification:
2.1.2 Brushes:
Brushes are one of the two primary components of a MAP file. Each brush defines a solid region. Brushes define this region as the intersection of four or more planes. Each plane is defined by three noncolinear points. These points must go in a clockwise orientation:
1--2-------->
|
3
|
|
,
Each brush statement looks like this:
{
( 128 0 0 ) ( 128 1 0 ) ( 128 0 1 ) GROUND1_6 0 0 0 1.0 1.0
( 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
( 0 384 0 ) ( 1 384 0 ) ( 0 384 1 ) GROUND1_6 0 0 0 1.0 1.0
( 0 0 64 ) ( 1 0 64 ) ( 0 1 64 ) GROUND1_6 0 0 0 1.0 1.0
( 0 0 128 ) ( 0 1 128 ) ( 1 0 128 ) GROUND1_6 0 0 0 1.0 1.0
}
That's probably just a bit confusing when you first see it. It defines a rectangular region that extends from (128,128,64) to (256,384,128). Here's what a single line means:
( 128 0 0 ) ( 128 1 0 ) ( 128 0 1 ) GROUND1_6 0 0 0 1.0 1.0
1st Point 2nd Point 3rd Point Texture x_off y_off rotation x_scale y_scale
Each brush is like a box. The brush has 6 faces, sides. The faces are planes (3 noncolinear points). How do I convert the Rhino3D vertices into planes, in clockwise fashion? Can somebody help guide me on how to do this? I'm totally lost at this point. I was able to convert one box, but others fail. I'm not sure why, but this whole planes intersecting thing is confusing me as well. I don't need to worry about Texture or anything after that in each plane line. What I'm doing right now to the huge floating points is just rounding them down (e.g. 14.4892405864481 to 14). I'm doing it in VB.NET but I don't need code written for me (although it would be nice), just a direction.