gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > PosTest() usefull culling informations

#131943 - a128 - Thu Jun 21, 2007 2:11 pm

Just to share some infos regarding PosTest(posX,posY,posZ) and their results

Code:

   
#define floata(f) ftoa(f32tofloat(f),2)
//use any ftoa() implementation you can find

PosTest(px,py,pz);
      
   int32 closeW=PosTestWresult();
   int32 closeX=PosTestXresult();
   int32 closeY=PosTestYresult();
   int32 closeZ=PosTestZresult();
   
   /* 
    cull near  z<-w
    cull far z>w

    cull left x<-w
    cull right x>w

    cull bottom y<-w
    cull top y>w
   
    */

   
   iprintf("distanz camera W %s\n",floata(closeW));

   iprintf("distanz camera x %s\n",floata(closeX));

   iprintf("distanz camera y %s\n",floata(closeY));

   iprintf("distanz camera z %s\n",floata(closeZ));

if(closeZ<-closeW) iprintf("cull front\n");
else if(closeZ>closeW) iprintf("cull back\n");


if(closeX<-closeW) iprintf("cull left\n");
else if(closeX>closeW) iprintf("cull right\n");
   
   if(closeY<-closeW) iprintf("cull bottom\n");
else if(closeY>closeW) iprintf("cull top\n");