I know for outdoor scenes its best to use quadtrees and for indoor scenes a portal engine seems to be the best, but what about a combination of both?
I think of a big landscape (from a heightmap) with a house or a cave in it.
It would be nice if I could do the indoor scenes with portals because of some special effects i plan to use, but I don’t know how to fit the outdoor terrain into this scheme.
paste an “object” on your quadtree, wich is your portal going to outdoor, this object is ( like a tree ) simply rendered if it is on a visible quat, and then, there it is processed like the ordinary portal engine…
on the other hand, the landscape is like a huge portal while you are indoor, means, every where you can look out ( windows, doors ) the quad is the portal on the other side, wich will be drawn then at the moment an ordinary portal would be drawn…
very usefull there ooprogramming, and the result is something like this
for every Tree i
tree[ i ]->Render( );
for every Portal i
Portal[ i ]->Render( );
for every Box i
box[ i ]->Render( );
for every QuadTree i
quadtree[ i ]->Render( );
just no quad->rendersportal->rendersquad->rendersportal recalling please
I would have programmed it with oop anyways. If I understood right I should make the following classes:
class Portal : public Polygon
class Indoor : public Sector
class Outdoor : public Sector
What do I do if portals are across a node boudary in my quadtree? With normal polygons i just place them in both nodes or split them. Drawing two polygons instead of one isn’t that expensive but drawing two portals means drawing a whole sector twice.
a boolesh flag is something great
bool globaldrawing = true;
bool yet_drawn = false;
void draw( )
if( yet_drawn == globaldrawing )
yet_drawn = globaldrawing;
void DrawScene( )
for every object i
object[ i ]->draw( );
globaldrawing = !globaldrawing;
now this checks if a object ( mesh, landscape, or whatever ) has been drawn yet in this frame…
or at least, it should ( hope i wrote it correctly… )
Thats a good idea!
I just wonder why I didn’t think of such a simple solution for that problem .
I’ll give that a try.
Thanks a lot.
Do a portal engine, with a renderer attatched to each sector. Then the indoor sectors can be rendered using fast blasts to the card (as they’ll be small sectors) or using oct-trees and outdoor sectors can be rendered using quadtrees.