How do portals work?
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.
Member of the NeHe team.
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.
You should never let your fears become the boundaries of your dreams.
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:
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
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
Member of the NeHe team.
September 20, 2004 05:25 AM
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
John B
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement