Data
Structures
The main scenery data structure, for a portal engine, looks like a connected graph. Each node has data for one sector, the links between nodes are made by sector portals. One suggestion, to implement this structure, is create a linked list with all scenery sectors and define in sectors structures pointers to adjacent sectors. Each pointer is related with one portal. If the portal is visible, the engine call recursively the visualization algorithm, passing the sector pointed as an parameter. The graph nodes have all information needed to render a sector and their objects. For example, can have a polygon mesh and a list to objects that are inside it. The polygon mesh have information about the sector walls. Thinking in implementation, can have a list of vertexes and a list of polygons composed by this vertexes. In adition, each portal polygon have a pointer to a destin sector. The polygons can have too, an texture ID, a transparency level, its normal vector, ... 3DFC structure is very close as the above. The difference is each polygon don't have a pointer to the possible destin sectors, but a flag. If the flag is TRUE, the polygon is a portal. In this case the destin sector is found in a specific list. For performace reasons, in nexts versions, I will change this to the structure described above. Other diferences are related with future features to be added, and don't are relevant now.