#ifndef PRIVATEOBJECTST
#define PRIVATEOBJECTST
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
/* For DLL using these function :*/
#include "cpa_expt.h" 
#include "cpa_expt.h" 
#include "textu_st.h"
#include "GLD.h"
#include "light.h"
 
 
 
typedef struct GLI_tdstAligned3DVector_
{
  MTH_tdxReal xX,xY,xZ;
  MTH_tdxReal ALIGN;
} GLI_tdstAligned3DVector;
 
typedef struct GLI_tdstAligned2DVector_
{
  float  xX   ;
  float  xY   ;
  float  xOoZ ;
  unsigned long ulPackedColor;
} GLI_tdstAligned2DVector;
/* ------------------------- ZLISTE ----------------------------*/
 
typedef struct GLI_tdstOneNodeOfZListe_
{
    void                            *p_ThreePoints;
    GLI_tdstTexture                 *p_TextureOfTheTriangle;
    struct GLI_tdstOneNodeOfZListe_ *p_NextNode;
    unsigned long                   lCurrentDrawMask;
    tdstFogParams                   *p_stFogParams;
	ACP_tdxHandleOfMaterial         p_stMaterial;
} GLI_tdstOneNodeOfZListe;
 
#define GLI_MaxZEntryPO2				12 /* == 4096 entries * n tables */
#define GLI_MaxZListeTrianglesPO2		11
#define GLI_NumberOfZListes				1
 
typedef struct GLI_tdstZListe_
{
    long							lMinValue[GLI_NumberOfZListes];
    long							lMaxValue[GLI_NumberOfZListes];
    GLI_tdstOneNodeOfZListe			*aDEF_p_tdstTableOfZentryNearestOfWaterPlane[GLI_NumberOfZListes<<GLI_MaxZEntryPO2];
    GLI_tdstOneNodeOfZListe			*p_stCurrentZNode;
    GLI_tdstOneNodeOfZListe			aDEF_tdstZListeNodes[1<<GLI_MaxZListeTrianglesPO2];
    long							lPointCounters;
    void							*p_CurrentPoint;
    void							*p_TableOfPoints;
} GLI_tdstZListe;
 
/* ----------------------- END ZLISTE --------------------------*/
 
 
#define GLI_C_ClipMaskXMin                              0x00000001                   
#define GLI_C_ClipMaskXMax                              0x00000002
#define GLI_C_ClipMaskYMin                              0x00000004
#define GLI_C_ClipMaskYMax                              0x00000008
#define GLI_C_CutMaskXMin                               0x00000010
#define GLI_C_CutMaskXMax                               0x00000020
#define GLI_C_CutMaskYMin                               0x00000040
#define GLI_C_CutMaskYMax                               0x00000080
#define GLI_C_ClipMaskZ                                 0x00000100
#define GLI_C_ClipMaskWater                             0x00000200
#define GLI_C_IsCameraInBoundingVolume                  0x00000400
#define GLI_C_IsObjectMatrixAlreadyInverted             0x00000800
#define GLI_C_AtLeastOneNegativeColorWasDetected        0x00001000
#define GLI_C_TrianglesMustBeSorted                     0x00008000
 
#define GLI_C_ClipMaskAllDirection                      (GLI_C_ClipMaskXMin | GLI_C_ClipMaskXMax | GLI_C_ClipMaskYMin | GLI_C_ClipMaskYMax | GLI_C_ClipMaskZ)
 
 
typedef struct GLI_tdstInternalGlobalValuesFor3dEngine_
{
    GLD_tdstViewportAttributes  *p_stVpt ;
    GEO_tdstGeometricObject     *p_stObj ;
    long                        lDrawModeMask;
    long                        lHierachDrawMask;
    long                        lCurrentDrawMask;
    long                        GLD_RenderingCounter;
    long                        lClippingModeMask;
 
    MTH3D_tdstVector            stCenterOfCurrentBoundingSphere;
    MTH_tdxReal                 stRadiusOfCurrentBoundingSphere;
 
    /* BIG TABLES*/
    GLI_tdstAligned3DVector     GLI_TurnedScaledDisplecedPoint  [C_lMaxVertexPerObject] ;
    GLI_tdstAligned2DVector     GLI_ScreenPoint                 [C_lMaxVertexPerObject] ;
    MTH_tdxReal                 GLI_aDEF_xWaterPlaneDepth       [(C_lMaxVertexPerObject>>1)-8] ;
    GEO_tdstColor               GLI_aDEF_stColorsRLID           [C_lMaxVertexPerObject] ;
    GEO_tdstColor               GLI_aDEF_stColorsRLIS           [C_lMaxVertexPerObject] ;
    GEO_tdstColor               GLI_aDEF_stColorsRLIA;
    ACP_tdst2DUVValues          GLI_aDEF_stEnvUV                [C_lMaxVertexPerObject] ;   /*used for environment UV (chromed)*/
 
    GEO_tdstColor               GLI_stColorsAdd;
    GEO_tdstColor               GLI_stColorsMul;
 
    POS_tdstCompletePosition    *gs_st_CameraMatrix;
    POS_tdstCompletePosition    *gs_st_CurrentMatrix;
    POS_tdstCompletePosition    gs_st_CurrentMatrixInverted;
    POS_tdstCompletePosition    gs_st_CurrentMatrixMultiplyedWithCameraMatrix;
 
 
    float                       fZClipping;
    float                       fWClipping;
    float                       fXMinClipping;
    float                       fXMaxClipping;
    float                       fYMinClipping;
    float                       fYMaxClipping;
    GLI_tdstTexture             *p_stCurrentTexture;
    ACP_tdxHandleOfMaterial     hCurrentMaterial;
 
    struct GLI_tdstCamera_      *p_stCurrentCamera;
    MTH_tdxReal                 xWaterPlaneDistance;
    GLI_tdstAligned3DVector     stWaterPlanNormale;
    unsigned long               ulColorInitForSprite;
    unsigned long               ulSpecularColorForSprite;
    float                       fMulU;
    float                       fMulV;
 
    GLI_tdstZListe              *p_TheZListe;
    unsigned long               ulCurrentZTable;
 
    /*For fog*/
    tdstFogParams               *p_stActiveFog;
    tdstFogParams               *p_stLastComputedFog;
    long                        xFogIsOn;
    long                        xTextureDontAcceptFog;
 
 
    /*For mirror*/
    long                        lAMirrorIsDetected;
    BOOL                        bDrawMirrorSymetric;
    long                        lDisplayMenuIsDetected;
 
    /*For alpha*/
    float                       xGlobalAlpha;
} GLI_tdstInternalGlobalValuesFor3dEngine;
 
/* This must be a power of two.*/
 void GLI_vSerialComputeVerticesPositions(GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobalsParrameters,long xStart,long xNumber);
 void GLI_vSerialComputeVertexColor(GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobalsParrameters,long xStart,long xNumber,void *p_VertexScreen);
 
#ifdef __cplusplus
};
#endif /* __cplusplus */
 
 
#endif  /* PRIVATEOBJECTST*/
