Skip to main content
gamedev.net
🔒 Locked

Portal Engine

Started by darrin 0 replies 500+ views
Original Post
darrin
darrin
Hi All, I am currently writing something to use the portal engine, and have noticed something not quite right. Starting in the 1st room, if you rotate and look at the far door, the engine is calculating the entire number of rooms thru this portal, where by rights it should only be calculating the tunnel connecting the 2 rooms, or at most the room the tunnel connects to as well. Anyone noticed this / Fixed this / wants me to fix it? Cheers Darrin
darrin
darrin
Well,
I have found a couple of small bits, for anyone who is interested.

In the BRect.c code, under
PR_DWORD BRECT_CreateFromObject (BRECT *rect, PR_SEGMENT *seg)

is the following loop, just add the vert++ near the end to the existing code. Still not culling as many portals as it should, but working on it.


for (vertnum = 1; vertnum < seg->num_vertices; vertnum++)
{
vdata = vert->vdata;

if (vdata->flags)
return 0;

if (vdata->sx < rect->x0)
rect->x0 = (PR_DWORD)vdata->sx;
else if (vdata->sx > rect->x1)
rect->x1 = (PR_DWORD)vdata->sx;

if (vdata->sy < rect->y0)
rect->y0 = (PR_DWORD)vdata->sy;
else if (vdata->sy > rect->y1)
rect->y1 = (PR_DWORD)vdata->sy;

vert++; //ADD THIS TO EXISTING CODE
}


Cheers
Darrin

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.