How can I load map or bsp files from worldcraft into my open gl
Programm??!!??!!??

In in the map file are only planes with three edges. How can I display them
as 'normal' vertices with four edges?
Example: This should define a cube which  64 units width, height and depth

( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

I've tried to load it but then I got some triangles and not a cube

I don't know how to load the binary .bsp files.

Or can anyone give me an othe world editor???

On Sun, 27 May 2001 09:35:59 +0200, "Timo Wingender"

>How can I load map or bsp files from worldcraft into my open gl
>Programm??!!??!!??

>In in the map file are only planes with three edges. How can I display them
>as 'normal' vertices with four edges?
>Example: This should define a cube which  64 units width, height and depth

>( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
>( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
>( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
>( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
>( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
>( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

editors represent geometry in terms of plane equations rather than as
vertices and meshes.

Hope it helps...

And then the game engine does what with the plane equations?
Spend 5 minutes figuring out intersection lines and points to figure out
what the
actual vertices should be?

V-man

> On Sun, 27 May 2001 09:35:59 +0200, "Timo Wingender"

> >How can I load map or bsp files from worldcraft into my open gl
> >Programm??!!??!!??

> >In in the map file are only planes with three edges. How can I display them
> >as 'normal' vertices with four edges?
> >Example: This should define a cube which  64 units width, height and depth

> >( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
> >( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
> >( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
> >( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
> >( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
> >( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

> editors represent geometry in terms of plane equations rather than as
> vertices and meshes.

> Hope it helps...

Quote:> In in the map file are only planes with three edges. How can I display
them
> as 'normal' vertices with four edges?
> Example: This should define a cube which  64 units width, height and depth

> ( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
> ( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
> ( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
> ( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
> ( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
> ( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

What you see here are always 3 points together that define each of the 6
planes for your cube. What you now have to do is
1. turn the 3 points into a real plane (the plane normal should point
outwards the cube)
2. make a huge polygon (preferably a rectangle) for each plane
3. split each side-polygon with each other plane, keeping the part that lies
on the backside of the plane and throwing away the rest

voila! You have 6 polygons that you can render.
For more in-depht information have a look into Quakes tool sources, where
all this is done.

Mathias

would you inform me when you get it going?

thanks!

gruss

Stephan-Frank Henry
----------------------------------

Quote:

> How can I load map or bsp files from worldcraft into my open gl
> Programm??!!??!!??

> In in the map file are only planes with three edges. How can I display
them
> as 'normal' vertices with four edges?
> Example: This should define a cube which  64 units width, height and depth

> ( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
> ( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
> ( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
> ( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
> ( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
> ( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

> I've tried to load it but then I got some triangles and not a cube

> I don't know how to load the binary .bsp files.

> Or can anyone give me an othe world editor???

No...the quake utilities do this when they create the bsp files...they have
polygons defined in them not planes. I can't remember where all the bsp file
format details were but I remember finding them easily with a standard
search engine.

I think there's also an open source project called Aftershock... they can
load quake levels and walk around in them.

Tony

Quote:

> And then the game engine does what with the plane equations?
> Spend 5 minutes figuring out intersection lines and points to figure out
> what the
> actual vertices should be?

> V-man

Quote:> What you see here are always 3 points together that define each of the 6
> planes for your cube. What you now have to do is
> 1. turn the 3 points into a real plane (the plane normal should point
> outwards the cube)

turn into a real plane??? Isn't it a real plane??? How to do it???

Quote:> 2. make a huge polygon (preferably a rectangle) for each plane

How can I make a polygon from it??? It musnt be a rectangle, it could also
be an triangle or an polygon with x edges(or I'm wrong there???)

Quote:> 3. split each side-polygon with each other plane, keeping the part that
lies
> on the backside of the plane and throwing away the rest

Why have I to split it with the other planes?

Thankx for the information but it doesnt helps me much. I simply want to
display a map file in my OpenGL Programm!!!

Quote:> turn into a real plane??? Isn't it a real plane??? How to do it???

Ok, maybe I expressed it wrong. Each three points define the plane they are
lying on.
All points that lie on a plane satisfy this equation:

x*nx+y*ny+z*nz = d;

where (x,y,z) is a point, (nx,ny,nz) the normal of the plane and d the
distance of the plane from the origin along the normal of the plane (in
units of ||n||).

So how to build a plane with three given points that lie on that plane?
let x1,x2,x3 be these three points.

v1=x2-x1;
v2=x3-x1;

v1 and v2 are two (non colinear) vectors that lie on the plane;
to finally get the normal, just do a crossproduct of v1 and v2:
n=v1^v2;

better normalize the normal now...

n=Normalize(n);

all what is still left is d;

which can be calculated:

d=x1.x*n.x+v1.y*n.y+v1.z*n.z;

Quote:> How can I make a polygon from it??? It musnt be a rectangle, it could also
> be an triangle or an polygon with x edges(or I'm wrong there???)

yes, it could be any (convex?) Polygon that is large enough. But rectangles
cover a large area and are easy to produce.
I really advice you to have a look into Quakes Tool sources!

Quote:> Why have I to split it with the other planes?

This is too hard for me to explain in English :-(
Just imagine a cube. You have created really big side-polygons. They have
already the right position but are so big that they do intersect each other.
Now imagine you cut away all parts that hang over the cube. What you did was
to split away all parts of each side-polygon that were lying in front of the
plane of each other side!

Here some pseudo-code:

for (int bs=0;bs<num_brushsides;bs++)
{
face=FaceForPlane(brushsides[bs].plane); // create the oversized
rectangle
for (bs2=0;bs2<num_brushsides;bs2++)
{
if (bs2==bs) continue;
SplitFrontPart(brushsides[bs2].plane,*face); // cut away
everything that lies in front of the other brushside, keeping the back-part
}
RenderFace(*face); // you should store your final face somewhere
}

I hope this helps a bit. And again, have a look into quakes tool sources!

Mathias

I think this will help me

Kanst mir auch in Deutsch schreiben;-)

I'm not looking for just web sites, but mainly for printed material.  Are
there any good books that discuss the topics?

Web sites are always good resources, because they can remain up to date, but
books are easy to thumb through and you don't need to be in front of a
computer to do the research.  You Dad's out there probably know what I mean.
:)

Thanks.

6. colors