Sign in to follow this  
Kazade

How do portals work?

Recommended Posts

In portal rendering, is a portal a polygon shared by two sectors? Or do both sectors have portals that link to each other? I'm a little confused. I understand how portal rendering works, I just cant understand how portals link to other sectors. Any help would be great. thanks Kazade.

Share this post


Link to post
Share on other sites
Well, portals are just virtual "geometry". You can either have have one portal and link both sectors to it, or duplicate it and add it to each sector. If they are used just for visibility, then they are always 2 way. If A can see B then B can see A. But if you use them for something else (pathfinding?) then this might not be always true.

Share this post


Link to post
Share on other sites
Well, i'm making a map editor and i want to make it possible to add portals. I already have planned so that the user can assign different areas as sectors, i'm just wondering should a CPortal class have something like:


class CPortal {
private:
int linkedSectors[2]; //Which would hold the sector ID's that
//the portal links
};


Or should a portal be a special type of poly which is part of a sector and merely points to the sector it links to? or will both ways work?

tell me if i'm not making sense :D

Thanks

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can do it whatever way suits your engine structure. You may want to have a special type of polygon to represent a portal, and store a link to the sector it's "looking at" in that. Then you'd need two copies of the polygon in most situations; one from sector A to sector B, one from B to A, but it would make it easy to have one-way portals. You can store portals separately from the other geometry. You can keep portal polygons with the rest of your geometry, and store sector and portal link information separately from the geometry. Basically, you can do it however you want, as long as the engine has a way to get all the information it needs to render. Which way will be best depends on how the rest of your engine is designed.

John B

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this