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

FRUSTUM.H

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  Frustum.h                                                                           */
00003 /*                                                                                      */
00004 /*  Author: John Pollard                                                                */
00005 /*  Description: Frustum creation/clipping                                              */
00006 /*                                                                                      */
00007 /*  The contents of this file are subject to the Genesis3D Public License               */
00008 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00009 /*  compliance with the License. You may obtain a copy of the License at                */
00010 /*  http://www.genesis3d.com                                                            */
00011 /*                                                                                      */
00012 /*  Software distributed under the License is distributed on an "AS IS"                 */
00013 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00014 /*  the License for the specific language governing rights and limitations              */
00015 /*  under the License.                                                                  */
00016 /*                                                                                      */
00017 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00018 /*  Genesis3D Version 1.1 released November 15, 1999                                 */
00019 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00020 /*                                                                                      */
00021 /****************************************************************************************/
00022 #ifndef GE_FRUSTUM_H
00023 #define GE_FRUSTUM_H
00024 
00025 #include <Assert.h>
00026 //#include <Windows.h>
00027 
00028 #include "BaseType.h"
00029 #include "GBSPFile.h"
00030 #include "Vec3d.h"
00031 #include "Camera.h"
00032 #include "XForm3d.h"
00033 #include "Surface.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 #define MAX_FCP                                         32                      // Max ClipPlanes for frustum...
00040 
00041 #define CLIP_PLANE_EPSILON  0.001f
00042 
00043 //================================================================================
00044 //      Structure defines
00045 //================================================================================
00046 typedef struct Frustum_Info
00047 {
00048         int32                   NumPlanes;                                      // Number of frustum planes to clip against
00049         GFX_Plane               Planes[MAX_FCP];                        // Planes to clip against
00050                                         
00051         // Quick LUTS For BBox testing against frustum
00052         int32                   FrustumBBoxIndexes[MAX_FCP*6];
00053         int32                   *pFrustumBBoxIndexes[MAX_FCP];
00054 } Frustum_Info;
00055 
00056 //================================================================================
00057 //      Function ProtoTypes
00058 //================================================================================
00059 void Frustum_SetFromCamera(Frustum_Info *Info, geCamera *Camera);
00060 geBoolean Frustum_SetFromPoly(Frustum_Info *Info, geVec3d *Verts, int32 NumVerts, geBoolean Flip);
00061 void Frustum_RotateToWorldSpace(Frustum_Info *In, geCamera *Camera, Frustum_Info *Out);
00062 void Frustum_TransformToWorldSpace(const Frustum_Info *In, const geCamera *Camera, Frustum_Info *Out);
00063 
00064 geBoolean gePlane_ClipVertsFannedUVRGB( const geVec3d *In, const Surf_TexVert *TIn, int32 NumIn, 
00065                                                                                 const GFX_Plane *Plane, 
00066                                                                                 geVec3d *Out, Surf_TexVert *TOut, int32 *NumOut);
00067 
00068 geBoolean Frustum_ClipToPlane(          GFX_Plane *pPlane, 
00069                                                                         geVec3d *pIn, geVec3d *pOut,
00070                                                                         int32 NumVerts, int32 *OutVerts);
00071 geBoolean Frustum_ClipToPlaneUV(        GFX_Plane *pPlane, 
00072                                                                         geVec3d *pIn, geVec3d *pOut,
00073                                                                         Surf_TexVert *pTIn, Surf_TexVert *pTOut,
00074                                                                         int32 NumVerts, int32 *OutVerts);
00075 
00076 geBoolean Frustum_ClipToPlaneUVRGB(GFX_Plane *pPlane, 
00077                                                                         geVec3d *pIn, geVec3d *pOut,
00078                                                                         Surf_TexVert *pTIn, Surf_TexVert *pTOut,
00079                                                                         int32 NumVerts, int32 *OutVerts);
00080 
00081 geBoolean Frustum_ClipToPlaneUVRGBA(GFX_Plane *pPlane, 
00082                                                                         geVec3d *pIn, geVec3d *pOut,
00083                                                                         Surf_TexVert *pTIn, Surf_TexVert *pTOut,
00084                                                                         int32 NumVerts, int32 *OutVerts);
00085 
00086 geBoolean Frustum_ClipToPlaneRGB(       GFX_Plane *pPlane, 
00087                                                                         geVec3d *pIn, geVec3d *pOut,
00088                                                                         Surf_TexVert *pTIn, Surf_TexVert *pTOut,
00089                                                                         int32 NumVerts, int32 *OutVerts);
00090 
00091 geBoolean Frustum_ClipToPlaneL(         GFX_Plane *pPlane, 
00092                                                                         GE_LVertex *pIn, GE_LVertex *pOut,
00093                                                                         int32 NumVerts, int32 *OutVerts);       // CB added
00094 
00095 void Frustum_Project(geVec3d *pIn, Surf_TexVert *pTIn, DRV_TLVertex *pOut, int32 NumVerts, const geCamera *Camera);
00096 void Frustum_ProjectRGB(geVec3d *pIn, Surf_TexVert *pTIn, DRV_TLVertex *pOut, int32 NumVerts, const geCamera *Camera);
00097 void Frustum_ProjectRGBA(geVec3d *pIn, Surf_TexVert *pTIn, DRV_TLVertex *pOut, int32 NumVerts, const geCamera *Camera);
00098 void Frustum_ProjectRGBNoClamp(geVec3d *pIn, Surf_TexVert *pTIn, DRV_TLVertex *pOut, int32 NumVerts, const geCamera *Camera);
00099 
00100 geBoolean Frustum_PointsInFrustum(const geVec3d *Pin, const GFX_Plane *Plane, int32 NumVerts, int32 *c);
00101 
00102 geBoolean Frustum_PointInFrustum(const Frustum_Info *Fi, const geVec3d *Point, geFloat Radius);
00103 
00104 geBoolean Frustum_ClipAllPlanesL(const Frustum_Info * Fi,uint32 ClipFlags,GE_LVertex *Verts, int32 *pNumVerts);
00105 
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif

Generated on Tue Sep 30 12:35:44 2003 for GTestAndEngine by doxygen 1.3.2