Jump to content

  • Log In with Google      Sign In   
  • Create Account


Frustum generation...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Tobias   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 10:48 AM

Hi, I''m coding a portal engine and everything works fine except generating frustums from the portal polygons. It doesn''t work very well. Just hope someone could help find what''s wrong with my algo. It works something like this:
i = 0; 
j = 1;
 while(i < PortalPoly->NumVertices)
 {
   v1 = Vertices[ Poly.Verts ] - CameraPosition;  //Vertices are world coordinates
   v2 = Vertices[ Poly.Verts[j] ] - CameraPosition;

   Planes[ NumPlanes ].Normal = crossproduct( v1, v2 );
   Planes[ NumPlanes ].Normal.Normalize(); 
   Planes[ NumPlanes ].Dist = - dotproduct( Planes[ NumPlanes ].Normal, CameraPosition );

   i += 1;
   j += 1;
    if( j == PortalPoly->NumVertices )
      j = 0;
   NumPlanes += 1;
}
[/CODE]
Greets Tobias     


Sponsor:

#2 Spellbound   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 February 2000 - 12:18 PM

I can see a few potential problems:

You forget to index with i when you''re assigning v1. Or you just forgot to type it here since I doubt the code would compile.

Is PortalPoly supposed to be the same as Poly?

Maybe you get the wrong direction on the normal when computing the crossproduct.


#3 Tobias   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 February 2000 - 05:33 AM

Actually that''s not the code I use, I just rewrote the function to make it more understandable.
But it could be that the planes face the wrong direction,
is there a good way to check that?

BTW, should vertices be in world space when I create the
frustum from them?

Greets Tobias




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS