Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

Tclip.c File Reference

#include <assert.h>
#include <string.h>
#include "TClip.h"
#include "engine.h"
#include "bitmap._h"
#include "list.h"
#include "ram.h"
#include "timer.h"

Go to the source code of this file.

Compounds

struct  geTClip_StaticsType

Defines

#define V_ALL_IN   (0)
#define V0_OUT   (1)
#define V1_OUT   (2)
#define V2_OUT   (4)
#define LINEAR_INTERPOLATE(a, l, h)   ((l)+(((h)-(l))*(a)))
#define RASTERIZECC

Typedefs

typedef geTClip_StaticsType geTClip_StaticsType

Enumerations

enum  geTClip_ClippingPlane {
  BACK_CLIPPING_PLANE = 0, LEFT_CLIPPING_PLANE, RIGHT_CLIPPING_PLANE, TOP_CLIPPING_PLANE,
  BOTTOM_CLIPPING_PLANE, NUM_CLIPPING_PLANES
}

Functions

 TIMER_VARS (TClip_Triangle)
typedef void (RASTERIZECC *geTClip_Rasterize_FuncPtr)(const GE_LVertex *TriVtx)
void RASTERIZECC geTClip_Rasterize_Tex (const GE_LVertex *TriVtx)
void RASTERIZECC geTClip_Rasterize_Gou (const GE_LVertex *TriVtx)
void GENESISCC geTClip_Split (GE_LVertex *NewVertex, const GE_LVertex *V1, const GE_LVertex *V2, int ClippingPlane)
void GENESISCC geTClip_TrianglePlane (const GE_LVertex *zTriVertex, geTClip_ClippingPlane ClippingPlane)
void GENESISCC geTClip_TrianglePlane_Old (const GE_LVertex *zTriVertex, geTClip_ClippingPlane ClippingPlane)
void GENESISCC geTClip_SetRenderFlags (uint32 newflags)
geBoolean GENESISCC geTClip_Push (void)
geBoolean GENESISCC geTClip_Pop (void)
geBoolean GENESISCC geTClip_SetTexture (const geBitmap *Bitmap)
void GENESISCC geTClip_SetupEdges (geEngine *Engine, geFloat LeftEdge, geFloat RightEdge, geFloat TopEdge, geFloat BottomEdge, geFloat BackEdge)
void geTClip_Done (void)
void GENESISCC geTClip_Triangle (const GE_LVertex TriVertex[3])
void GENESISCC geTClip_Rasterize (const GE_LVertex *TriVtx)
void GENESISCC geTClip_UnclippedTriangle (const GE_LVertex TriVertex[3])

Variables

LinkgeTClip_Link = NULL
geTClip_StaticsType geTClip_Statics
uint32 ActiveRenderFlags = 0


Define Documentation

#define LINEAR_INTERPOLATE a,
l,
 )     ((l)+(((h)-(l))*(a)))
 

Definition at line 100 of file Tclip.c.

Referenced by geTClip_Split().

#define RASTERIZECC
 

Definition at line 102 of file Tclip.c.

Referenced by geTClip_Rasterize_Gou(), and geTClip_Rasterize_Tex().

#define V0_OUT   (1)
 

Definition at line 95 of file Tclip.c.

Referenced by geTClip_TrianglePlane().

#define V1_OUT   (2)
 

Definition at line 96 of file Tclip.c.

Referenced by geTClip_TrianglePlane().

#define V2_OUT   (4)
 

Definition at line 97 of file Tclip.c.

Referenced by geTClip_TrianglePlane().

#define V_ALL_IN   (0)
 

Definition at line 94 of file Tclip.c.

Referenced by geTClip_TrianglePlane().


Typedef Documentation

typedef struct geTClip_StaticsType geTClip_StaticsType
 


Enumeration Type Documentation

enum geTClip_ClippingPlane
 

Enumeration values:
BACK_CLIPPING_PLANE 
LEFT_CLIPPING_PLANE 
RIGHT_CLIPPING_PLANE 
TOP_CLIPPING_PLANE 
BOTTOM_CLIPPING_PLANE 
NUM_CLIPPING_PLANES 

Definition at line 83 of file Tclip.c.


Function Documentation

void geTClip_Done void   ) 
 

Definition at line 233 of file Tclip.c.

References TIMER_REPORT.

00234 {
00235         TIMER_REPORT(TClip_Triangle);
00236 }

geBoolean GENESISCC geTClip_Pop void   ) 
 

Definition at line 174 of file Tclip.c.

References ActiveRenderFlags, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, geRam_Free, geTClip_Link, geTClip_Statics, Link_Destroy(), Link_Peek(), Link_Pop(), List_Stop(), NULL, and geTClip_StaticsType::RenderFlags.

00175 {
00176 geTClip_StaticsType * TCI;
00177         if ( ! geTClip_Link )
00178                 return GE_FALSE;
00179         TCI = Link_Pop( geTClip_Link );
00180         if ( ! TCI )
00181                 return GE_FALSE;
00182         memcpy(&geTClip_Statics,TCI,sizeof(geTClip_StaticsType));
00183         geRam_Free(TCI);
00184 
00185         if ( ! Link_Peek(geTClip_Link) )
00186         {
00187                 Link_Destroy(geTClip_Link);
00188                 geTClip_Link = NULL;
00189                 List_Stop();
00190         }
00191 
00192         ActiveRenderFlags = geTClip_Statics.RenderFlags; // LA, set ARF from newly pop'd statics
00193         
00194         return GE_TRUE;
00195 }

geBoolean GENESISCC geTClip_Push void   ) 
 

Definition at line 148 of file Tclip.c.

References ActiveRenderFlags, GE_FALSE, GE_TRUE, geBoolean, GENESISCC, geRam_Allocate, geTClip_Link, geTClip_Statics, Link_Create(), Link_Push(), List_Start(), and geTClip_StaticsType::RenderFlags.

00149 {
00150 geTClip_StaticsType * TCI;
00151 
00152         geTClip_Statics.RenderFlags = ActiveRenderFlags; // LA
00153 
00154         if ( ! geTClip_Link )
00155         {
00156                 List_Start();
00157                 geTClip_Link = Link_Create();
00158                 if ( ! geTClip_Link ) 
00159                         return GE_FALSE;
00160         }
00161 
00162         TCI = geRam_Allocate(sizeof(geTClip_StaticsType));
00163         if ( ! TCI )
00164                 return GE_FALSE;
00165         memcpy(TCI,&geTClip_Statics,sizeof(geTClip_StaticsType));
00166 
00167         Link_Push( geTClip_Link , TCI );
00168 
00169         geTClip_Statics.RenderFlags = 0;        // LA, this is needed to set RF = 0 for default after any _Push
00170         
00171         return GE_TRUE;
00172 }

void GENESISCC geTClip_Rasterize const GE_LVertex TriVtx  )  [static]
 

Definition at line 266 of file Tclip.c.

References ActiveRenderFlags, geTClip_StaticsType::Driver, GENESISCC, geTClip_Statics, DRV_Driver::RenderGouraudPoly, DRV_Driver::RenderMiscTexturePoly, and geTClip_StaticsType::THandle.

00267 {
00268 
00269 // we require GE_LVertex == DRV_TLVertex == GE_TLVertex
00270 //      this is a silly point because the TClip inputs should really be GE_TLVertex anyway !!!!
00271 
00272         if ( geTClip_Statics.THandle )
00273         {
00274                 geTClip_Statics.Driver->RenderMiscTexturePoly((DRV_TLVertex *)TriVtx,
00275                         3,geTClip_Statics.THandle,ActiveRenderFlags);   // LA
00276         }
00277         else
00278         {
00279                 geTClip_Statics.Driver->RenderGouraudPoly((DRV_TLVertex *)TriVtx,
00280                         3,ActiveRenderFlags); // LA
00281         }
00282 }

void RASTERIZECC geTClip_Rasterize_Gou const GE_LVertex TriVtx  )  [static]
 

Definition at line 261 of file Tclip.c.

References ActiveRenderFlags, geTClip_StaticsType::Driver, geTClip_Statics, RASTERIZECC, and DRV_Driver::RenderGouraudPoly.

Referenced by geTClip_SetTexture().

00262 {
00263         geTClip_Statics.Driver->RenderGouraudPoly((DRV_TLVertex *)TriVtx,3,ActiveRenderFlags); // LA
00264 }

void RASTERIZECC geTClip_Rasterize_Tex const GE_LVertex TriVtx  )  [static]
 

Definition at line 255 of file Tclip.c.

References ActiveRenderFlags, geTClip_StaticsType::Driver, geTClip_Statics, RASTERIZECC, DRV_Driver::RenderMiscTexturePoly, and geTClip_StaticsType::THandle.

Referenced by geTClip_SetTexture().

00256 {
00257         geTClip_Statics.Driver->RenderMiscTexturePoly((DRV_TLVertex *)TriVtx,
00258                 3,geTClip_Statics.THandle, ActiveRenderFlags); // LA
00259 }

void GENESISCC geTClip_SetRenderFlags uint32  newflags  ) 
 

Definition at line 141 of file Tclip.c.

References ActiveRenderFlags, GENESISCC, geTClip_Statics, and geTClip_StaticsType::RenderFlags.

00142 {
00143         geTClip_Statics.RenderFlags = newflags;
00144         ActiveRenderFlags = newflags;
00145         return;
00146 }

geBoolean GENESISCC geTClip_SetTexture const geBitmap Bitmap  ) 
 

Definition at line 197 of file Tclip.c.

References geTClip_StaticsType::Bitmap, GE_TRUE, geBitmap_GetTHandle(), geBoolean, GENESISCC, geTClip_Rasterize_Gou(), geTClip_Rasterize_Tex(), geTClip_Statics, NULL, geTClip_StaticsType::RasterizeFunc, and geTClip_StaticsType::THandle.

Referenced by gePuppet_DrawShadow(), and gePuppet_Render().

00198 {
00199         geTClip_Statics.Bitmap = Bitmap;
00200         if ( Bitmap )
00201         {
00202                 geTClip_Statics.THandle = geBitmap_GetTHandle(Bitmap);
00203                 assert(geTClip_Statics.THandle);
00204                 geTClip_Statics.RasterizeFunc = geTClip_Rasterize_Tex;
00205         }
00206         else
00207         {
00208                 geTClip_Statics.THandle = NULL;
00209                 geTClip_Statics.RasterizeFunc = geTClip_Rasterize_Gou;
00210         }
00211 return GE_TRUE;
00212 }

void GENESISCC geTClip_SetupEdges geEngine Engine,
geFloat  LeftEdge,
geFloat  RightEdge,
geFloat  TopEdge,
geFloat  BottomEdge,
geFloat  BackEdge
 

Definition at line 214 of file Tclip.c.

References geTClip_StaticsType::BackEdge, geTClip_StaticsType::BottomEdge, geTClip_StaticsType::Driver, geEngine::DriverInfo, Engine, geTClip_StaticsType::Engine, GENESISCC, geTClip_Statics, geTClip_StaticsType::LeftEdge, Sys_DriverInfo::RDriver, geTClip_StaticsType::RightEdge, and geTClip_StaticsType::TopEdge.

Referenced by gePuppet_Render().

00221 { 
00222         assert(Engine);
00223         memset(&geTClip_Statics,0,sizeof(geTClip_Statics));
00224         geTClip_Statics.Engine          = Engine;
00225         geTClip_Statics.Driver          = Engine->DriverInfo.RDriver; //Engine_GetRDriver(Engine);
00226         geTClip_Statics.LeftEdge        = LeftEdge;
00227         geTClip_Statics.RightEdge       = RightEdge;
00228         geTClip_Statics.TopEdge         = TopEdge;
00229         geTClip_Statics.BottomEdge      = BottomEdge;
00230         geTClip_Statics.BackEdge        = BackEdge;
00231 }

void GENESISCC geTClip_Split GE_LVertex NewVertex,
const GE_LVertex V1,
const GE_LVertex V2,
int  ClippingPlane
[static]
 

Definition at line 286 of file Tclip.c.

References GE_LVertex::a, GE_LVertex::b, BACK_CLIPPING_PLANE, geTClip_StaticsType::BackEdge, BOTTOM_CLIPPING_PLANE, geTClip_StaticsType::BottomEdge, GE_LVertex::g, geFloat, GENESISCC, geTClip_Statics, LEFT_CLIPPING_PLANE, geTClip_StaticsType::LeftEdge, LINEAR_INTERPOLATE, GE_LVertex::r, RIGHT_CLIPPING_PLANE, geTClip_StaticsType::RightEdge, TOP_CLIPPING_PLANE, geTClip_StaticsType::TopEdge, GE_LVertex::u, GE_LVertex::v, V1, V2, GE_LVertex::X, GE_LVertex::Y, and GE_LVertex::Z.

Referenced by geTClip_TrianglePlane().

00287 {
00288         geFloat Ratio=0.0f;
00289         geFloat OneOverZ1,OneOverZ2;
00290         
00291         #ifdef ONE_OVER_Z_PIPELINE
00292                 // in here ->Z is really (one over z)
00293         OneOverZ1 = V1->Z;
00294         OneOverZ2 = V2->Z;
00295         #else
00296         OneOverZ1 = 1.0f/V1->Z;
00297         OneOverZ2 = 1.0f/V2->Z;
00298         #endif
00299 
00300         switch (ClippingPlane)
00301         {
00302                 case (BACK_CLIPPING_PLANE):
00303                         assert((V2->Z - V1->Z)!=0.0f);
00304                         Ratio = ((1.0f/geTClip_Statics.BackEdge) - OneOverZ2)/( OneOverZ1 - OneOverZ2 );
00305 
00306                         NewVertex->X = LINEAR_INTERPOLATE(Ratio,(V2->X),(V1->X));
00307                         NewVertex->Y = LINEAR_INTERPOLATE(Ratio,(V2->Y),(V1->Y));
00308                         #ifdef ONE_OVER_Z_PIPELINE
00309                         NewVertex->Z = 1.0f/ geTClip_Statics.BackEdge;
00310                         #else
00311                         NewVertex->Z = geTClip_Statics.BackEdge;
00312                         #endif
00313                 
00314                         break;
00315                 case (LEFT_CLIPPING_PLANE):
00316                         assert((V2->X - V1->X)!=0.0f);
00317                         Ratio = (geTClip_Statics.LeftEdge - V2->X)/( V1->X - V2->X);
00318 
00319                         NewVertex->X = geTClip_Statics.LeftEdge;
00320                         NewVertex->Y = LINEAR_INTERPOLATE(Ratio,(V2->Y),(V1->Y));
00321                         #ifdef ONE_OVER_Z_PIPELINE
00322                         NewVertex->Z = LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00323                         #else
00324                         NewVertex->Z = 1.0f/LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00325                         #endif
00326         
00327                         break;
00328                 case (RIGHT_CLIPPING_PLANE):
00329                         assert((V2->X - V1->X)!=0.0f);
00330                         Ratio = (geTClip_Statics.RightEdge - V2->X)/( V1->X - V2->X);
00331 
00332                         NewVertex->X = geTClip_Statics.RightEdge;
00333                         NewVertex->Y = LINEAR_INTERPOLATE(Ratio,(V2->Y),(V1->Y));
00334                         #ifdef ONE_OVER_Z_PIPELINE
00335                         NewVertex->Z = LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00336                         #else
00337                         NewVertex->Z = 1.0f/LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00338                         #endif
00339 
00340                         break;
00341                 case (TOP_CLIPPING_PLANE):
00342                         assert((V2->Y - V1->Y)!=0.0f);
00343                         Ratio = (geTClip_Statics.TopEdge - V2->Y)/( V1->Y - V2->Y);
00344 
00345                         NewVertex->X = LINEAR_INTERPOLATE(Ratio,(V2->X),(V1->X));
00346                         NewVertex->Y = geTClip_Statics.TopEdge;
00347                         #ifdef ONE_OVER_Z_PIPELINE
00348                         NewVertex->Z = LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00349                         #else
00350                         NewVertex->Z = 1.0f/LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00351                         #endif
00352                         
00353                         break;
00354                 case (BOTTOM_CLIPPING_PLANE):
00355                         assert((V2->Y - V1->Y)!=0.0f);
00356                         Ratio = (geTClip_Statics.BottomEdge - V2->Y)/( V1->Y - V2->Y);
00357 
00358                         NewVertex->X = LINEAR_INTERPOLATE(Ratio,(V2->X),(V1->X));
00359                         NewVertex->Y = geTClip_Statics.BottomEdge;
00360                         #ifdef ONE_OVER_Z_PIPELINE
00361                         NewVertex->Z = LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00362                         #else
00363                         NewVertex->Z = 1.0f/LINEAR_INTERPOLATE(Ratio,OneOverZ2,OneOverZ1);
00364                         #endif
00365 
00366                         break;
00367         }
00368 
00369         
00370         {
00371         geFloat OneOverZ1_Ratio;
00372         geFloat OneOverZ2_Ratio;
00373                 #ifdef ONE_OVER_Z_PIPELINE
00374                 OneOverZ1 *= 1.0f / NewVertex->Z;
00375                 OneOverZ2 *= 1.0f / NewVertex->Z;
00376                 #else
00377                 OneOverZ1 *= NewVertex->Z;
00378                 OneOverZ2 *= NewVertex->Z;
00379                 #endif
00380                 OneOverZ1_Ratio = OneOverZ1 * Ratio;
00381                 OneOverZ2_Ratio = OneOverZ2 * Ratio;
00382 
00383                 //  the following is optimized to get rid of a handfull of multiplies. Read:
00384                 //      NewVertex->r = LINEAR_INTERPOLATE(Ratio,(V2->r * OneOverZ2),(V1->r * OneOverZ1));
00385 
00386                 NewVertex->r =(V2->r * OneOverZ2) + (V1->r * OneOverZ1_Ratio) - (V2->r * OneOverZ2_Ratio);
00387                 NewVertex->g =(V2->g * OneOverZ2) + (V1->g * OneOverZ1_Ratio) - (V2->g * OneOverZ2_Ratio);
00388                 NewVertex->b =(V2->b * OneOverZ2) + (V1->b * OneOverZ1_Ratio) - (V2->b * OneOverZ2_Ratio);
00389                 NewVertex->a =(V2->a * OneOverZ2) + (V1->a * OneOverZ1_Ratio) - (V2->a * OneOverZ2_Ratio);
00390                 NewVertex->u =(V2->u * OneOverZ2) + (V1->u * OneOverZ1_Ratio) - (V2->u * OneOverZ2_Ratio);
00391                 NewVertex->v =(V2->v * OneOverZ2) + (V1->v * OneOverZ1_Ratio) - (V2->v * OneOverZ2_Ratio);
00392         }
00393 
00394 }

void GENESISCC geTClip_Triangle const GE_LVertex  TriVertex[3]  ) 
 

Definition at line 238 of file Tclip.c.

References BACK_CLIPPING_PLANE, GENESISCC, geTClip_TrianglePlane(), geTClip_TrianglePlane_Old(), TIMER_P, and TIMER_Q.

Referenced by gePuppet_DrawShadow(), and gePuppet_Render().

00239 {
00240 
00241         TIMER_P(TClip_Triangle);
00242 
00243 #if 1
00244         geTClip_TrianglePlane(TriVertex,BACK_CLIPPING_PLANE);
00245         //geTClip_TrianglePlane(TriVertex,LEFT_CLIPPING_PLANE);
00246 #else
00247         geTClip_TrianglePlane_Old(TriVertex,BACK_CLIPPING_PLANE);
00248 #endif
00249 
00250         TIMER_Q(TClip_Triangle);
00251 }

void GENESISCC geTClip_TrianglePlane const GE_LVertex zTriVertex,
geTClip_ClippingPlane  ClippingPlane
[static]
 

Definition at line 399 of file Tclip.c.

References ActiveRenderFlags, BACK_CLIPPING_PLANE, geTClip_StaticsType::BackEdge, BOTTOM_CLIPPING_PLANE, geTClip_StaticsType::BottomEdge, geTClip_StaticsType::Driver, GENESISCC, geTClip_Split(), geTClip_Statics, LEFT_CLIPPING_PLANE, geTClip_StaticsType::LeftEdge, NUM_CLIPPING_PLANES, geTClip_StaticsType::RasterizeFunc, DRV_Driver::RenderGouraudPoly, DRV_Driver::RenderMiscTexturePoly, RIGHT_CLIPPING_PLANE, geTClip_StaticsType::RightEdge, geTClip_StaticsType::THandle, TOP_CLIPPING_PLANE, geTClip_StaticsType::TopEdge, uint32, V0_OUT, V1_OUT, V2_OUT, V_ALL_IN, GE_LVertex::X, GE_LVertex::Y, and GE_LVertex::Z.

Referenced by geTClip_Triangle().

00401 {
00402 uint32 OutBits = 0;
00403 
00404         switch(ClippingPlane)
00405         {
00406         case BACK_CLIPPING_PLANE:
00407 
00408                 OutBits |= (TriVertex[0].Z < geTClip_Statics.BackEdge) ? V0_OUT : 0;
00409                 OutBits |= (TriVertex[1].Z < geTClip_Statics.BackEdge) ? V1_OUT : 0;
00410                 OutBits |= (TriVertex[2].Z < geTClip_Statics.BackEdge) ? V2_OUT : 0;
00411 
00412         case LEFT_CLIPPING_PLANE:
00413 
00414                 OutBits |= (TriVertex[0].X < geTClip_Statics.LeftEdge)  ? (V0_OUT<<3) : 0;
00415                 OutBits |= (TriVertex[1].X < geTClip_Statics.LeftEdge)  ? (V1_OUT<<3) : 0;
00416                 OutBits |= (TriVertex[2].X < geTClip_Statics.LeftEdge)  ? (V2_OUT<<3) : 0;
00417 
00418         case RIGHT_CLIPPING_PLANE:
00419 
00420                 OutBits |= (TriVertex[0].X > geTClip_Statics.RightEdge) ? (V0_OUT<<6) : 0;
00421                 OutBits |= (TriVertex[1].X > geTClip_Statics.RightEdge) ? (V1_OUT<<6) : 0;
00422                 OutBits |= (TriVertex[2].X > geTClip_Statics.RightEdge) ? (V2_OUT<<6) : 0;
00423 
00424         case TOP_CLIPPING_PLANE:
00425 
00426                 OutBits |= (TriVertex[0].Y < geTClip_Statics.TopEdge) ? (V0_OUT<<9) : 0;
00427                 OutBits |= (TriVertex[1].Y < geTClip_Statics.TopEdge) ? (V1_OUT<<9) : 0;
00428                 OutBits |= (TriVertex[2].Y < geTClip_Statics.TopEdge) ? (V2_OUT<<9) : 0;
00429 
00430         case BOTTOM_CLIPPING_PLANE:
00431 
00432                 OutBits |= (TriVertex[0].Y > geTClip_Statics.BottomEdge) ?  (V0_OUT<<12) : 0;
00433                 OutBits |= (TriVertex[1].Y > geTClip_Statics.BottomEdge) ?  (V1_OUT<<12) : 0;
00434                 OutBits |= (TriVertex[2].Y > geTClip_Statics.BottomEdge) ?  (V2_OUT<<12) : 0;
00435 
00436         case NUM_CLIPPING_PLANES:
00437                 break;
00438         }
00439 
00440         if ( OutBits )
00441         {
00442         GE_LVertex NewTriVertex[3];
00443 
00444         memset(NewTriVertex, '\0',sizeof(GE_LVertex)*(3));
00445 
00446                 ClippingPlane = 0;
00447                 for(;;)
00448                 {
00449                         assert(ClippingPlane < NUM_CLIPPING_PLANES);
00450 
00451                         switch ( OutBits & 7 )
00452                         {
00453                                 case (V_ALL_IN):  //NOT CLIPPED
00454                                         OutBits >>= 3;
00455                                         ClippingPlane ++;
00456                                         continue;
00457 
00458                                 // these all return:
00459 
00460                                 case (V0_OUT):
00461                                         NewTriVertex[0] = TriVertex[2];
00462                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+0,TriVertex+2,ClippingPlane);
00463                                         NewTriVertex[2] = TriVertex[1];
00464 
00465                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1);
00466 
00467                                         NewTriVertex[0] = NewTriVertex[1];
00468                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+0,TriVertex+1,ClippingPlane);
00469 
00470                                         //<> could gain a little speed like this, but who cares?
00471                                         //      if ( ! (OutBits>>3) )
00472                                         //              goto Rasterize
00473                                         //      else
00474                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1); 
00475                                         return;
00476 
00477                                 case (V1_OUT):
00478                                         NewTriVertex[0] = TriVertex[0];
00479                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+0,TriVertex+1,ClippingPlane);
00480                                         NewTriVertex[2] = TriVertex[2];
00481 
00482                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1);
00483 
00484                                         NewTriVertex[0] = NewTriVertex[1];
00485                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+1,TriVertex+2,ClippingPlane);
00486                                         
00487                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1); 
00488                                         return;
00489 
00490                                 case (V0_OUT + V1_OUT):
00491                                         NewTriVertex[0] = TriVertex[2];
00492                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+0,TriVertex+2,ClippingPlane);
00493                                         geTClip_Split(&(NewTriVertex[2]),TriVertex+1,TriVertex+2,ClippingPlane);
00494                                 
00495                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1); 
00496                                         return;
00497 
00498                                 case (V2_OUT):
00499                                         NewTriVertex[0] = TriVertex[1];
00500                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+1,TriVertex+2,ClippingPlane);
00501                                         NewTriVertex[2] = TriVertex[0];
00502 
00503                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1);
00504 
00505                                         NewTriVertex[0] = NewTriVertex[1];
00506                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+0,TriVertex+2,ClippingPlane);
00507 
00508                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1);
00509                                         return;
00510 
00511                                 case (V2_OUT + V0_OUT):
00512                                         NewTriVertex[0] = TriVertex[1];
00513                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+1,TriVertex+2,ClippingPlane);
00514                                         geTClip_Split(&(NewTriVertex[2]),TriVertex+0,TriVertex+1,ClippingPlane);
00515 
00516                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1);
00517                                         return;
00518 
00519                                 case (V2_OUT + V1_OUT):
00520                                         NewTriVertex[0] = TriVertex[0];
00521                                         geTClip_Split(&(NewTriVertex[1]),TriVertex+0,TriVertex+1,ClippingPlane);
00522                                         geTClip_Split(&(NewTriVertex[2]),TriVertex+0,TriVertex+2,ClippingPlane);
00523 
00524                                         geTClip_TrianglePlane(NewTriVertex,ClippingPlane+1);
00525                                         return;
00526 
00527                                 case (V2_OUT + V1_OUT + V0_OUT):
00528                                         /* TOTALLY CLIPPED */
00529                                         return;
00530                         }
00531                 }
00532         }
00533 
00534 #if 0 // {
00535 
00536         // this eliminates an 'if' , but doesn't seem to help :^(
00537         // presumably because it's a predictable branch
00538         geTClip_Statics.RasterizeFunc(TriVertex);
00539 
00540 #else //}{
00541 
00542         if ( geTClip_Statics.THandle )
00543         {
00544                 geTClip_Statics.Driver->RenderMiscTexturePoly((DRV_TLVertex *)TriVertex,
00545                         3,geTClip_Statics.THandle,ActiveRenderFlags); // LA
00546         }
00547         else
00548         {
00549                 geTClip_Statics.Driver->RenderGouraudPoly((DRV_TLVertex *)TriVertex,3,ActiveRenderFlags); // LA
00550         }
00551 
00552 #endif //}
00553 
00554 }

void GENESISCC geTClip_TrianglePlane_Old const GE_LVertex zTriVertex,
geTClip_ClippingPlane  ClippingPlane
[static]
 

Referenced by geTClip_Triangle().

void GENESISCC geTClip_UnclippedTriangle const GE_LVertex  TriVertex[3]  ) 
 

Definition at line 557 of file Tclip.c.

References ActiveRenderFlags, geTClip_StaticsType::Driver, GENESISCC, geTClip_Statics, DRV_Driver::RenderGouraudPoly, DRV_Driver::RenderMiscTexturePoly, and geTClip_StaticsType::THandle.

00558 {
00559         if ( geTClip_Statics.THandle )
00560         {
00561                 geTClip_Statics.Driver->RenderMiscTexturePoly((DRV_TLVertex *)TriVertex,
00562                         3,geTClip_Statics.THandle,ActiveRenderFlags);
00563         }
00564         else
00565         {
00566                 geTClip_Statics.Driver->RenderGouraudPoly((DRV_TLVertex *)TriVertex,3,ActiveRenderFlags);
00567         }
00568         return;
00569 }

TIMER_VARS TClip_Triangle   ) 
 

typedef void RASTERIZECC *  geTClip_Rasterize_FuncPtr  )  const
 


Variable Documentation

uint32 ActiveRenderFlags = 0 [static]
 

Definition at line 136 of file Tclip.c.

Referenced by geTClip_Pop(), geTClip_Push(), geTClip_Rasterize(), geTClip_Rasterize_Gou(), geTClip_Rasterize_Tex(), geTClip_SetRenderFlags(), geTClip_TrianglePlane(), and geTClip_UnclippedTriangle().

Link* geTClip_Link = NULL [static]
 

Definition at line 134 of file Tclip.c.

Referenced by geTClip_Pop(), and geTClip_Push().

geTClip_StaticsType geTClip_Statics [static]
 

Definition at line 135 of file Tclip.c.

Referenced by geTClip_Pop(), geTClip_Push(), geTClip_Rasterize(), geTClip_Rasterize_Gou(), geTClip_Rasterize_Tex(), geTClip_SetRenderFlags(), geTClip_SetTexture(), geTClip_SetupEdges(), geTClip_Split(), geTClip_TrianglePlane(), and geTClip_UnclippedTriangle().


Generated on Tue Sep 30 12:38:11 2003 for GTestAndEngine by doxygen 1.3.2