Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,212 @@
# Microsoft Developer Studio Project File - Name="Glide3" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=Glide3 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Glide3.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Glide3.mak" CFG="Glide3 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Glide3 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Glide3 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Glide3 - Win32 Retail" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/GliGlou/Drivers/Glide3", MVPAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Glide3 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "temp\Release"
# PROP Intermediate_Dir "temp\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "t:\mssdk\include" /I "t:\3dFX\sdk\GLIDE3x\SRC\INCLUDE" /I "x:\cpa\public" /I "x:\cpa\public\gli" /I "x:\cpa\public\geo" /I "inc" /I "x:\cpa\tempgrp\gliglou\multidrv\inc" /I "..\\" /D "NDEBUG" /D "_WINDOWS" /D "USE_PROFILER" /D "WIN32" /D "GLIDE3" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"x:\cpa\exe\main\dll\GliVD2vr.dll"
!ELSEIF "$(CFG)" == "Glide3 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "temp\Debug"
# PROP Intermediate_Dir "temp\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "t:\mssdk\include" /I "t:\3dFX\sdk\GLIDE3x\SRC\INCLUDE" /I "x:\cpa\public" /I "x:\cpa\public\gli" /I "x:\cpa\public\geo" /I "inc" /I "x:\cpa\tempgrp\gliglou\multidrv\inc" /I "..\\" /D "_DEBUG" /D "VISUAL" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "WIN32" /D "GLIDE3" /U "t:\3dFX\GLIDE\SRC\SST1\INCLUDE" /U "x:\cpa\public" /U "x:\cpa\public\gli" /U "x:\cpa\public\geo" /U "inc" /U "x:\cpa\tempgrp\gliglou\multidrv\inc" /U "..\\" /U "t:\mssdk\include" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"x:\cpa\exe\main\dll\GliVD2vd.dll" /pdbtype:sept
!ELSEIF "$(CFG)" == "Glide3 - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Glide3__"
# PROP BASE Intermediate_Dir "Glide3__"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Temp\Retail"
# PROP Intermediate_Dir "Temp\Retail"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "t:\3dFX\sdk\GLIDE3x\SRC\INCLUDE" /I "x:\cpa\public" /I "x:\cpa\public\gli" /I "x:\cpa\public\geo" /I "inc" /I "x:\cpa\tempgrp\gliglou\multidrv\inc" /I "..\\" /D "NDEBUG" /D "_WINDOWS" /D "RETAIL" /D "WIN32" /D "GLIDE3" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"x:\cpa\exe\main\dll\GliVD2vf.dll"
!ENDIF
# Begin Target
# Name "Glide3 - Win32 Release"
# Name "Glide3 - Win32 Debug"
# Name "Glide3 - Win32 Retail"
# Begin Group "Src"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Acces_ALL.c
!IF "$(CFG)" == "Glide3 - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "Glide3 - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "Glide3 - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\ClipTRIANGLES.c
# End Source File
# Begin Source File
SOURCE=..\DllCom.c
# End Source File
# Begin Source File
SOURCE=.\Src\Glide3_Acces.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\Src\Glide3_Dll.c
# End Source File
# Begin Source File
SOURCE=.\Src\Glide3_Domat.c
# End Source File
# Begin Source File
SOURCE=.\Src\Glide3_HdwTx.c
# End Source File
# Begin Source File
SOURCE=.\Src\Glide3_Init.c
# End Source File
# Begin Source File
SOURCE=..\GliDLL.def
# End Source File
# End Group
# Begin Group "inc"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\DllCom.h
# End Source File
# Begin Source File
SOURCE=.\inc\Glide2To3.h
# End Source File
# Begin Source File
SOURCE=.\inc\TextuDFX.h
# End Source File
# End Group
# Begin Group "lib"
# PROP Default_Filter ""
# Begin Source File
SOURCE=T:\mssdk\lib\ddraw.lib
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\ddraw.lib
# End Source File
# Begin Source File
SOURCE=T:\3Dfx\Sdk\Glide3x\Src\Lib\Win32\glide3x.lib
# End Source File
# End Group
# Begin Source File
SOURCE=.\Glide3.mak
# End Source File
# End Target
# End Project

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,508 @@
#define __MSC__
#include <GLIDE.H>
#include "TextuDFX.h"
#include "PRF.h"
#include "drawflags.h"
#include "Glide2To3.h"
//#define GLI_GLIDE1_CurrentTmu 0
GrChipID_t GLI_GLIDE1_xTmuNumber = 0;
// GET
#define GetX(a) a.x
#define GetY(a) a.y
#define GetZ(a) a.oow
#define GetPackedColor(a) *(unsigned long *)&a.r
#define GetPackedSpecular(a,b)
#define GetU(a) a.tmuvtx[GLI_GLIDE1_xTmuNumber].sow
#define GetV(a) a.tmuvtx[GLI_GLIDE1_xTmuNumber].tow
// SET
#define SetX(a,b) a.x = b
#define SetY(a,b) a.y = b
#define SetZ(a,b) a.oow = b
#define SetPackedColor(a,b) *(unsigned long *)&a.r = b
//#define SetPackedSpecular(a,b) *(unsigned long *)&a.g = b
#define SetPackedSpecular(a,b)
#define SetU(a,b) a.tmuvtx[GLI_GLIDE1_xTmuNumber].sow = b
#define SetV(a,b) a.tmuvtx[GLI_GLIDE1_xTmuNumber].tow = b
#define SetU_Cpy(a,b) *(unsigned long *)&a.tmuvtx[GLI_GLIDE1_xTmuNumber].sow = *(unsigned long *)&b
#define SetV_Cpy(a,b) *(unsigned long *)&a.tmuvtx[GLI_GLIDE1_xTmuNumber].tow = *(unsigned long *)&b
// constante <20> ne d<>finir que pour d<>bugger ou pour anti_bug temporaire
//#define GLI_DEBUG_TESTALLVERTICES
#if defined(USE_PROFILER) // MT {
#define M_grDrawTriangle(a,b,c)\
{\
grDrawTriangle((a),(b),(c));\
PRF_MDRV_vSetIndependantVariable( PRF_C_ulIdpDisplayedTriangle , 1 );\
}
#else
#define M_grDrawTriangle grDrawTriangle
#endif // MT }
// Fond de roulement GLIDE1
// GLOBALS
GLI_tdScreenVertx CurrentDestXYZ[4];
#define GLI_M_RestoreCW()
void GLI_BeforeDraw()
{
};
void GLI_AfterDraw()
{\
}
#define GLI_M_Restore3DFXColor(P)\
{\
P . g = (float)((unsigned char *)&(P.r))[1];\
P . b = (float)((unsigned char *)&(P.r))[0];\
P . a = (float)((unsigned char *)&(P.r))[3];\
P . r = (float)((unsigned char *)&(P.r))[2];\
P . tmuvtx[GLI_GLIDE1_xTmuNumber].sow *= P . oow * GLI_BIG_GLOBALS -> fMulV;\
P . tmuvtx[GLI_GLIDE1_xTmuNumber].tow *= P . oow * GLI_BIG_GLOBALS -> fMulU;\
}
GLI_FuncNodeBegin(GLI_vDrawTriangle)
{
GLI_M_Restore3DFXColor(CurrentDestXYZ[0]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[1]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[2]);
#ifdef GLI_DEBUG_TESTALLVERTICES
if (
(CurrentDestXYZ[0].y < 0.0f) || (CurrentDestXYZ[1].y < 0.0f) || (CurrentDestXYZ[2].y < 0.0f) || (CurrentDestXYZ[0].y > 480.0f) || (CurrentDestXYZ[1].y > 480.0f) || (CurrentDestXYZ[2].y > 480.0f) ||
(CurrentDestXYZ[0].x < 0.0f) || (CurrentDestXYZ[1].x < 0.0f) || (CurrentDestXYZ[2].x < 0.0f) || (CurrentDestXYZ[0].x > 640.0f) || (CurrentDestXYZ[1].x > 640.0f) || (CurrentDestXYZ[2].x > 640.0f)
)
return;
#endif
M_grDrawTriangle( &CurrentDestXYZ[0], &CurrentDestXYZ[1], &CurrentDestXYZ[2]);
}
GLI_FuncNodeBegin(GLI_vDrawWiredTriangle)
{
GLI_M_Restore3DFXColor(CurrentDestXYZ[0]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[1]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[2]);
#ifdef GLI_DEBUG_TESTALLVERTICES
if (
(CurrentDestXYZ[0].y < 0.0f) || (CurrentDestXYZ[1].y < 0.0f) || (CurrentDestXYZ[2].y < 0.0f) || (CurrentDestXYZ[0].y > 480.0f) || (CurrentDestXYZ[1].y > 480.0f) || (CurrentDestXYZ[2].y > 480.0f) ||
(CurrentDestXYZ[0].x < 0.0f) || (CurrentDestXYZ[1].x < 0.0f) || (CurrentDestXYZ[2].x < 0.0f) || (CurrentDestXYZ[0].x > 640.0f) || (CurrentDestXYZ[1].x > 640.0f) || (CurrentDestXYZ[2].x > 640.0f)
)
return;
#endif
grDrawLine( &CurrentDestXYZ[0], &CurrentDestXYZ[1] );
grDrawLine( &CurrentDestXYZ[1], &CurrentDestXYZ[2] );
grDrawLine( &CurrentDestXYZ[0], &CurrentDestXYZ[2] );
}
GLI_FuncNodeBegin(GLI_vZSortTriangle)
{
/* draw */
float ZMax;
if ((unsigned long)GLI_BIG_GLOBALS -> p_TheZListe -> p_CurrentPoint > (unsigned long)GLI_BIG_GLOBALS -> p_TheZListe -> p_TableOfPoints + ((3L << GLI_MaxZListeTrianglesPO2)* sizeof (GLI_tdScreenVertx)) - 3L * sizeof(GLI_tdScreenVertx))
return;
GLI_M_Restore3DFXColor(CurrentDestXYZ[0]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[1]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[2]);
memcpy(GLI_BIG_GLOBALS -> p_TheZListe -> p_CurrentPoint , CurrentDestXYZ , sizeof(GLI_tdScreenVertx) * 3L);
if (*(unsigned long *)&GetZ(CurrentDestXYZ[0]) < *(unsigned long *)&GetZ(CurrentDestXYZ[1]))
*(unsigned long *)&ZMax = *(unsigned long *)&GetZ(CurrentDestXYZ[0]);
else
*(unsigned long *)&ZMax = *(unsigned long *)&GetZ(CurrentDestXYZ[1]);
if (*(unsigned long *)&ZMax > *(unsigned long *)&GetZ(CurrentDestXYZ[2]))
*(unsigned long *)&ZMax = *(unsigned long *)&GetZ(CurrentDestXYZ[2]);
GLI_v_AddNodeInZList(ZMax);
(unsigned long)GLI_BIG_GLOBALS -> p_TheZListe -> p_CurrentPoint += sizeof(GLI_tdScreenVertx) * 3L;
PRF_MDRV_vSetIndependantVariable( PRF_C_ulIdpDisplayedTriangle , 1 );
}
void GLI_DrawQuad(void)
{
/* draw 2 triangles */
GLI_M_Restore3DFXColor(CurrentDestXYZ[0]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[1]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[2]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[3]);
if ( GLI_BIG_GLOBALS -> lClippingModeMask & GLI_C_TrianglesMustBeSorted )
{
GLI_BIG_GLOBALS -> lCurrentDrawMask &= ~GLI_C_lIsGouraud;
if ((unsigned long)GLI_BIG_GLOBALS -> p_TheZListe -> p_CurrentPoint > (unsigned long)GLI_BIG_GLOBALS -> p_TheZListe -> p_TableOfPoints + ((3L << GLI_MaxZListeTrianglesPO2)* sizeof (GLI_tdScreenVertx)) - 4L * sizeof(GLI_tdScreenVertx))
return;
memcpy(GLI_BIG_GLOBALS -> p_TheZListe -> p_CurrentPoint , CurrentDestXYZ , sizeof(GLI_tdScreenVertx) * 4L);
GLI_v_AddNodeInZList(GetZ(CurrentDestXYZ[0]));
(unsigned long)GLI_BIG_GLOBALS -> p_TheZListe -> p_CurrentPoint += sizeof(GLI_tdScreenVertx) * 4L;
}
else
{
#ifdef GLI_DEBUG_TESTALLVERTICES
if (
(CurrentDestXYZ[0].y < 0.0f) || (CurrentDestXYZ[1].y < 0.0f) || (CurrentDestXYZ[2].y < 0.0f) || (CurrentDestXYZ[3].y < 0.0f) || (CurrentDestXYZ[0].y > 480.0f) || (CurrentDestXYZ[1].y > 480.0f) || (CurrentDestXYZ[2].y > 480.0f) || (CurrentDestXYZ[3].y > 480.0f) ||
(CurrentDestXYZ[0].x < 0.0f) || (CurrentDestXYZ[1].x < 0.0f) || (CurrentDestXYZ[2].x < 0.0f) || (CurrentDestXYZ[3].x < 0.0f) || (CurrentDestXYZ[0].x > 640.0f) || (CurrentDestXYZ[1].x > 640.0f) || (CurrentDestXYZ[2].x > 640.0f) || (CurrentDestXYZ[3].x > 640.0f)
)
return;
#endif
M_grDrawTriangle( &CurrentDestXYZ[0], &CurrentDestXYZ[1], &CurrentDestXYZ[2]);
M_grDrawTriangle( &CurrentDestXYZ[3], &CurrentDestXYZ[2], &CurrentDestXYZ[0]);
PRF_MDRV_vIncreaseVariable( PRF_C_ulVarFaces + PRF_MDRV_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvDisplayed, 2 );
PRF_MDRV_vSetIndependantVariable( PRF_C_ulIdpDisplayedFaces, 1 );
}
}
void GLI_DrawLine(void)
{
GLI_M_Restore3DFXColor(CurrentDestXYZ[0]);
GLI_M_Restore3DFXColor(CurrentDestXYZ[1]);
#ifdef GLI_DEBUG_TESTALLVERTICES
if(
(CurrentDestXYZ[0].y < 0.0f) || (CurrentDestXYZ[1].y < 0.0f) || (CurrentDestXYZ[0].y > 480.0f) || (CurrentDestXYZ[1].y > 480.0f) ||
(CurrentDestXYZ[0].x < 0.0f) || (CurrentDestXYZ[1].x < 0.0f) || (CurrentDestXYZ[0].x > 640.0f) || (CurrentDestXYZ[1].x > 640.0f)
)
return;
#endif
grDrawLine ( &CurrentDestXYZ[0], &CurrentDestXYZ[1] );
}
void GLI_vDrawZSortedTriangle(void *p_3Point)
{
#ifdef GLI_DEBUG_TESTALLVERTICES
if (
( ((GLI_tdScreenVertx *)p_3Point)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point)->y > 480.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->y > 480.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->y > 480.0f) ||
( ((GLI_tdScreenVertx *)p_3Point)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point)->x > 640.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->x > 640.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->x > 640.0f)
)
return;
#endif
grDrawTriangle( (GLI_tdScreenVertx *)p_3Point, ((GLI_tdScreenVertx *)p_3Point) + 1, ((GLI_tdScreenVertx *)p_3Point) + 2);
}
void GLI_vDrawZSortedQuad(void *p_3Point)
{
#ifdef GLI_DEBUG_TESTALLVERTICES
if (
( ((GLI_tdScreenVertx *)p_3Point)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+3)->y < 0.0f) || (((GLI_tdScreenVertx *)p_3Point)->y > 480.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->y > 480.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->y > 480.0f) || (((GLI_tdScreenVertx *)p_3Point+3)->y > 480.0f) ||
( ((GLI_tdScreenVertx *)p_3Point)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point+3)->x < 0.0f) || (((GLI_tdScreenVertx *)p_3Point)->x > 640.0f) || (((GLI_tdScreenVertx *)p_3Point+1)->x > 640.0f) || (((GLI_tdScreenVertx *)p_3Point+2)->x > 640.0f) || (((GLI_tdScreenVertx *)p_3Point+3)->x > 640.0f)
)
return;
#endif
grDrawTriangle( (GLI_tdScreenVertx *)p_3Point, ((GLI_tdScreenVertx *)p_3Point) + 1, ((GLI_tdScreenVertx *)p_3Point) + 2);
grDrawTriangle( ((GLI_tdScreenVertx *)p_3Point) + 3, ((GLI_tdScreenVertx *)p_3Point) + 2, ((GLI_tdScreenVertx *)p_3Point) + 0);
}
void GLI_vAddDrawFunc()
{
if (GLI_BIG_GLOBALS -> lClippingModeMask & GLI_C_TrianglesMustBeSorted)
{
GLI_M_AddFunc(GLI_vZSortTriangle);
ulFuncMask |= Flag_GLI_vZSortTriangle;
}
else if ( (GLI_BIG_GLOBALS->lCurrentDrawMask & GLI_C_lIsNotWired) == 0 )
{
GLI_M_AddFunc(GLI_vDrawWiredTriangle);
ulFuncMask |= Flag_GLI_vDrawWiredTriangle;
}
else
{
GLI_M_AddFunc(GLI_vDrawTriangle);
ulFuncMask |= Flag_GLI_vDrawTriangle;
}
}
void GLI_ReComputeClippingMask()
{
*(float *)&fX_CMP_Optimize = GLI_BIG_GLOBALS->fXMaxClipping;
*(float *)&fY_CMP_Optimize = GLI_BIG_GLOBALS->fYMaxClipping;
*(float *)&fXMin_CLIP_Optimize = GLI_BIG_GLOBALS->fXMinClipping;
*(float *)&fYMin_CLIP_Optimize = GLI_BIG_GLOBALS->fYMinClipping;
*(float *)&fXMax_CLIP_Optimize = GLI_BIG_GLOBALS->fXMaxClipping; // - 1.0f;
*(float *)&fYMax_CLIP_Optimize = GLI_BIG_GLOBALS->fYMaxClipping; // - 1.0f;
GLI_BIG_GLOBALS -> lClippingModeMask |= (GLI_BIG_GLOBALS -> lClippingModeMask & GLI_C_lCLIP_ALL) << 4;
}
//********************************************************************************************
// Name: GLI_DRV_vSendSpriteToClip
// Goal: draw a sprite
// Code: Philippe Vimont
// OPTIMMIZED : No
//********************************************************************************************
void GLI_DRV_vSendSpriteToClip
(
GLI_tdstAligned2DVector *a4_st2DVertex ,
MTH_tdxReal xZ ,
GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT
)
{
float fClipYMax, fClipYMin, fClipXMax, fClipXMin;
GLI_BeforeDraw();
if (a4_st2DVertex[0].xY == a4_st2DVertex[1].xY) /* Aligned sprite */
{
GLI_ReComputeClippingMask();
if ( ( *(long *) &a4_st2DVertex[0].xY > fYMax_CLIP_Optimize) || (*(long *) &a4_st2DVertex[2].xY < fYMin_CLIP_Optimize) || (*(long *) &a4_st2DVertex[0].xX < fXMin_CLIP_Optimize) || (*(long *) &a4_st2DVertex[1].xX > fXMax_CLIP_Optimize) )
return;
/*
* clip xMax
*/
if ( *(long *) &a4_st2DVertex[0].xX > fXMax_CLIP_Optimize )
{
fClipXMax = (GLI_BIG_GLOBALS->fXMaxClipping - a4_st2DVertex[1].xX) / ( a4_st2DVertex[0].xX - a4_st2DVertex[1].xX );
a4_st2DVertex[0].xX = a4_st2DVertex[3].xX = GLI_BIG_GLOBALS->fXMaxClipping;
}
else
fClipXMax = 1.0f;
/*
* clip xMin
*/
if ( *(long *) &a4_st2DVertex[1].xX < fXMin_CLIP_Optimize )
{
fClipXMin = (fClipXMax * ( GLI_BIG_GLOBALS->fXMinClipping - a4_st2DVertex[1].xX) ) / ( a4_st2DVertex[0].xX - a4_st2DVertex[1].xX );
a4_st2DVertex[1].xX = a4_st2DVertex[2].xX = GLI_BIG_GLOBALS->fXMinClipping;
}
else
fClipXMin = 0.0f;
/*
* clip yMin
*/
if ( *(long *) &a4_st2DVertex[0].xY < fYMin_CLIP_Optimize )
{
fClipYMin = (GLI_BIG_GLOBALS->fYMinClipping - a4_st2DVertex[2].xY) / ( a4_st2DVertex[0].xY - a4_st2DVertex[2].xY );
a4_st2DVertex[0].xY = a4_st2DVertex[1].xY = GLI_BIG_GLOBALS->fYMinClipping;
}
else
fClipYMin = 1.0f;
/*
* clip yMax
*/
if ( *(long *) &a4_st2DVertex[2].xY > fYMax_CLIP_Optimize )
{
fClipYMax = (fClipYMin * ( GLI_BIG_GLOBALS->fYMaxClipping - a4_st2DVertex[2].xY ) ) / ( a4_st2DVertex[0].xY - a4_st2DVertex[2].xY );
a4_st2DVertex[2].xY = a4_st2DVertex[3].xY = GLI_BIG_GLOBALS->fYMaxClipping;
}
else
fClipYMax = 0.0f;
}
else
{
if ( (a4_st2DVertex [0] . xY < 0.0f) || (a4_st2DVertex [1] . xY < 0.0f) || (a4_st2DVertex [2] . xY < 0.0f) || (a4_st2DVertex [3] . xY < 0.0f) ) return;
if ( (a4_st2DVertex [0] . xX < 0.0f) || (a4_st2DVertex [1] . xX < 0.0f) || (a4_st2DVertex [2] . xX < 0.0f) || (a4_st2DVertex [3] . xX < 0.0f) ) return;
if ( (a4_st2DVertex [0] . xY > 480.0f) || (a4_st2DVertex [1] . xY > 480.0f) || (a4_st2DVertex [2] . xY > 480.0f) || (a4_st2DVertex [3] . xY > 480.0f) ) return;
if ( (a4_st2DVertex [0] . xX > 640.0f) || (a4_st2DVertex [1] . xX > 640.0f) || (a4_st2DVertex [2] . xX > 640.0f) || (a4_st2DVertex [3] . xX > 640.0f) ) return;
fClipXMin = fClipYMax = 0.0f;
fClipYMin = fClipXMax = 1.0f;
}
GLI_M_InitSprite();
SetU(CurrentDestXYZ[0], fClipXMax );
SetV(CurrentDestXYZ[0], fClipYMin );
SetU(CurrentDestXYZ[1], fClipXMin );
SetV(CurrentDestXYZ[1], fClipYMin );
SetU(CurrentDestXYZ[2], fClipXMin );
SetV(CurrentDestXYZ[2], fClipYMax );
SetU(CurrentDestXYZ[3], fClipXMax );
SetV(CurrentDestXYZ[3], fClipYMax );
GLI_DrawQuad();
GLI_AfterDraw();
}
//********************************************************************************************
// Name: GLI_DRV_vSendSpriteToClipWithUV 1.0
// Goal:
// Code: Philippe Vimont / 1.0
// REM:
// OPTIMMIZED : No
//********************************************************************************************
void GLI_DRV_vSendSpriteToClipWithUV
(
GLI_tdstAligned2DVector *a4_st2DVertex ,
MTH_tdxReal *a8_stUVVertex,
MTH_tdxReal xZ ,
GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT)
{
GLI_BeforeDraw();
GLI_M_InitSprite();
if (a4_st2DVertex [0] . xY < 0.0f) return;
if (a4_st2DVertex [1] . xY < 0.0f) return;
if (a4_st2DVertex [2] . xY < 0.0f) return;
if (a4_st2DVertex [3] . xY < 0.0f) return;
if (a4_st2DVertex [0] . xY > GLI_BIG_GLOBALS->fYMaxClipping) return;
if (a4_st2DVertex [1] . xY > GLI_BIG_GLOBALS->fYMaxClipping) return;
if (a4_st2DVertex [2] . xY > GLI_BIG_GLOBALS->fYMaxClipping) return;
if (a4_st2DVertex [3] . xY > GLI_BIG_GLOBALS->fYMaxClipping) return;
if ( p_stGlobaleMT->p_stCurrentTexture->lIncrementIsEnable )
{
float fAddU, fAddV;
fAddU = p_stGlobaleMT-> p_stCurrentTexture -> fAddU;
fAddV = p_stGlobaleMT-> p_stCurrentTexture -> fAddV;
SetU(CurrentDestXYZ[2], a8_stUVVertex[4] + fAddU );
SetV(CurrentDestXYZ[2], a8_stUVVertex[4 + 1] + fAddV);
SetU(CurrentDestXYZ[3], a8_stUVVertex[6] + fAddU);
SetV(CurrentDestXYZ[3], a8_stUVVertex[6 + 1] + fAddV);
SetU(CurrentDestXYZ[0], a8_stUVVertex[0] + fAddU);
SetV(CurrentDestXYZ[0], a8_stUVVertex[0 + 1] + fAddV);
SetU(CurrentDestXYZ[1], a8_stUVVertex[2] + fAddU);
SetV(CurrentDestXYZ[1], a8_stUVVertex[2 + 1] + fAddV);
}
else
{
SetU(CurrentDestXYZ[2], a8_stUVVertex[4]);
SetV(CurrentDestXYZ[2], a8_stUVVertex[4 + 1]);
SetU(CurrentDestXYZ[3], a8_stUVVertex[6]);
SetV(CurrentDestXYZ[3], a8_stUVVertex[6 + 1]);
SetU(CurrentDestXYZ[0], a8_stUVVertex[0]);
SetV(CurrentDestXYZ[0], a8_stUVVertex[0 + 1]);
SetU(CurrentDestXYZ[1], a8_stUVVertex[2]);
SetV(CurrentDestXYZ[1], a8_stUVVertex[2 + 1]);
}
GLI_DrawQuad();
GLI_AfterDraw();
}
//********************************************************************************************
// Name: GLI_DRV_vSendSingleLineToClip
// Goal: draw a line
// Code: Vincent Lhullier
// OPTIMMIZED : No
//********************************************************************************************
void GLI_DRV_vSendSingleLineToClip
(
GLD_tdstViewportAttributes *p_stVpt ,
GLI_tdstAligned3DVector *p_stVertex1 ,
GLI_tdstAligned2DVector *p_st2DVertex1 ,
GLI_tdstAligned3DVector *p_stVertex2 ,
GLI_tdstAligned2DVector *p_st2DVertex2 ,
GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT,
long lDrawModeMask, GEO_tdstColor *p_stColor
)
{
#ifdef _DEBUG
GLI_tdstAligned2DVector stP1, stP2;
GLI_tdstAligned3DVector st3DP1, st3DP2;
float fFactor;
p_st2DVertex1->ulPackedColor = 0xFFFFFFFF;
p_st2DVertex2->ulPackedColor = 0xFFFFFFFF;
/* xClipping */
if (p_st2DVertex1->xX < p_st2DVertex2->xX)
{
stP1 = *p_st2DVertex1;
st3DP1 = *p_stVertex1;
stP2 = *p_st2DVertex2;
st3DP2 = *p_stVertex2;
}
else
{
stP1 = *p_st2DVertex2;
st3DP1 = *p_stVertex2;
stP2 = *p_st2DVertex1;
st3DP2 = *p_stVertex1;
}
if (( stP2.xX < 0.0f) || ( stP1.xX > 640.0f ) )
return;
if ( stP1.xX < 0.0f )
{
fFactor = stP2.xX / (stP2.xX - stP1.xX );
stP1.xY = stP2.xY - ( stP2.xY - stP1.xY) * fFactor;
st3DP1.xZ = st3DP2.xZ - ( st3DP2.xY - st3DP1.xY) * fFactor;
stP1.xX = 0.0f;
}
if ( stP2.xX > 640.0f)
{
fFactor = (stP1.xX - 640.0f) / (stP2.xX - stP1.xX );
stP2.xY = stP1.xY - ( stP2.xY - stP1.xY) * fFactor;
st3DP2.xZ = st3DP1.xZ - ( st3DP2.xY - st3DP1.xY) * fFactor;
stP2.xX = 640.0f;
}
/* yClipping */
if ( stP1.xY < stP2.xY)
{
p_st2DVertex1 = &stP1;
p_stVertex1 = &st3DP1;
p_st2DVertex2 = &stP2;
p_stVertex2 = &st3DP2;
}
else
{
p_st2DVertex1 = &stP2;
p_stVertex1 = &st3DP2;
p_st2DVertex2 = &stP1;
p_stVertex2 = &st3DP1;
}
if (( p_st2DVertex2->xY < 0.0f) || ( p_st2DVertex1->xY > 480.0f ) )
return;
if ( p_st2DVertex1->xY < 0.0f )
{
fFactor = p_st2DVertex2->xY / (p_st2DVertex2->xY - p_st2DVertex1->xY );
p_st2DVertex1->xX = p_st2DVertex2->xX - ( p_st2DVertex2->xX - p_st2DVertex1->xX) * fFactor;
p_stVertex1->xZ = p_stVertex2->xZ - ( p_stVertex2->xZ - p_stVertex1->xZ) * fFactor;
p_st2DVertex1->xY = 0.0f;
}
if ( p_st2DVertex2->xY > 480.0f)
{
fFactor = (p_st2DVertex1->xY - 480.0f) / (p_st2DVertex2->xY - p_st2DVertex1->xY );
p_st2DVertex2->xX = p_st2DVertex1->xX - ( p_st2DVertex2->xX - p_st2DVertex1->xX) * fFactor;
p_stVertex2->xZ = p_stVertex1->xZ - ( p_stVertex2->xZ - p_stVertex1->xZ) * fFactor;
p_st2DVertex2->xY = 480.0f;
}
#else
if (p_st2DVertex1->xX < 0) return;
if (p_st2DVertex1->xY < 0) return;
if (p_st2DVertex1->xX > 640.0f) return;
if (p_st2DVertex1->xY > 480.0f) return;
if (p_st2DVertex2->xX < 0) return;
if (p_st2DVertex2->xY < 0) return;
if (p_st2DVertex2->xX > 640.0f) return;
if (p_st2DVertex2->xY > 480.0f) return;
#endif
GLI_M_InitLine();
GLI_BeforeDraw();
GLI_DrawLine();
GLI_AfterDraw();
}

View File

@@ -0,0 +1,27 @@
/*
=======================================================================================
Name : Glide2_Dll.c
Author : vincent lhullier Date :16/09/98
Description : specific DLL fonction
=======================================================================================
*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include "init_gli.h"
#include "DLLCom.h"
#include "DLLCaps.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstGliDriverIdentity stGlide2Id =
{
"Glide3",
"Driver for voodoo2 graphic card",
"1.0.0",
GLI_C_VersionGlide3
};
void fn_vInitDllIdentity( void )
{
memcpy( &g_stGliDrvId, &stGlide2Id, sizeof( tdstGliDriverIdentity ) );
}

View File

@@ -0,0 +1,729 @@
/******************************************************************************************
FILE : CLIPDomat.C
VERS : 1.00 \ Marc Villemain - version directX5
0.00 \ Philippe Vimont
DATE : 15.05.97
Select materials
*******************************************************************************************/
#include "Gli_st.h"
#include "GLI_Defn.h"
#include "polygon.h"
#include "mater_st.h"
#include "light_st.h"
#include "PvObj_st.h"
#include "Liste.h"
#include "watrplan.h"
#include "proj.h"
#include "vpt3D.h"
#include "camera.h"
#include "material.h"
#include "texture.h"
#include "light.h"
#include "GliBench.h"
#include "TEX.h"
#define __MSC__
#include <GLIDE.H>
#include "TextuDFX.h"
#include "DLLCom.h"
#include "PRF.h"
#include "Glide2To3.h"
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef ZARMA
}
#endif
extern long GLI_g_lNumberOfFogTableEntries;
extern long GLI_g_lWDepthMinMaxValue[2];
GrFog_t Gli_C_xFogTable[ 64 ];
float GLI_ga_fFogDist[ 64 ];
static unsigned long gs_ulDepthBufferTestEnabled = 0;
void GLI_vSetFogParams( tdstFogParams *_p_stFogParams );
/*
=======================================================================================
Special function for displaying black polygon
it's for cinematic scene to hide non black for color
=======================================================================================
*/
GLI_tdScreenVertx g_stBlackTriangle[16];
long g_lNumberOfBlackTriangles = 0;
void GLI_DRV_vNoBlackPolygon()
{
g_lNumberOfBlackTriangles = 0;
}
void GLI_DRV_vAddBlackPolygon( long _lLeft, long _lTop, long _lRight, long _lBottom )
{
GLI_tdScreenVertx *p_stVertex;
p_stVertex = g_stBlackTriangle + g_lNumberOfBlackTriangles;
memset( p_stVertex, 0, 4 * sizeof( GLI_tdScreenVertx ) );
g_lNumberOfBlackTriangles += 4;
p_stVertex->x = (float) _lLeft;
p_stVertex->y = (float) _lBottom;
p_stVertex->oow = .8f;
p_stVertex++;
p_stVertex->x = (float) _lLeft;
p_stVertex->y = (float) _lTop;
p_stVertex->oow = .8f;
p_stVertex++;
p_stVertex->x = (float) _lRight;
p_stVertex->y = (float) _lTop;
p_stVertex->oow = .8f;
p_stVertex++;
p_stVertex->x = (float) _lRight;
p_stVertex->y = (float) _lBottom;
p_stVertex->oow = .8f;
}
void GLI_vSendBlackPolygon()
{
GLI_tdScreenVertx *p_stVertex, *p_stLastVertex;
if (g_lNumberOfBlackTriangles == 0)
return;
p_stVertex = g_stBlackTriangle;
p_stLastVertex = p_stVertex + g_lNumberOfBlackTriangles;
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_ITERATED,FXFALSE);//*/
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
grColorCombine(GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_ZERO,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_CONSTANT,FALSE);
for ( ; p_stVertex < p_stLastVertex; p_stVertex += 4)
{
grDrawTriangle( p_stVertex, p_stVertex + 1, p_stVertex + 2 );
grDrawTriangle( p_stVertex + 2, p_stVertex + 3, p_stVertex );
}
}
//********************************************************************************************
// Name: GLI_vDoTextureSelection
// Goal:
// Code: Philippe Vimont
// OPTIMMIZED : No
//********************************************************************************************
static long bIsWriteEnable = 1;
void GLI_ZBufferClearNearestAndCompareInverted()
{
grColorMask(FXFALSE, FXFALSE);
grBufferClear( 0, 0, GLI_g_lWDepthMinMaxValue[0]);
grDepthBufferFunction(GR_CMP_GREATER);
grColorMask(FXTRUE, FXTRUE);
}
void GLI_ZBufferCompareRestored()
{
grDepthBufferFunction(GR_CMP_LESS);
}
void GLI_DFX_ClearZBufferRegion(long lXStart,long lXEnd,long lYStart,long lYEnd)
{
grColorMask(FXFALSE, FXFALSE);
grBufferClear( 0, 0, GLI_g_lWDepthMinMaxValue[1]);
grDepthBufferFunction(GR_CMP_LESS);
grColorMask(FXTRUE, FXTRUE);
}
void GLI_DFX_EnableWriteToZBuffer()
{
if (bIsWriteEnable) return;
grDepthMask(FXTRUE);
bIsWriteEnable = 1;
}
void GLI_DFX_DisableWriteToZBuffer()
{
if (!bIsWriteEnable) return;
grDepthMask(FXFALSE);
bIsWriteEnable = 0;
}
/*
----------------------------------------------------------------------------------------
Description : To manage use of ZBuffer
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vEnableDepthTest()
{
if( gs_ulDepthBufferTestEnabled )
return;
grDepthBufferFunction( GR_CMP_LESS );
gs_ulDepthBufferTestEnabled = 1;
}
void GLI_DRV_vDisableDepthTest()
{
if( ! gs_ulDepthBufferTestEnabled )
return;
grDepthBufferFunction( GR_CMP_ALWAYS );
gs_ulDepthBufferTestEnabled = 0;
}
static ACP_tdxIndex xSaveFogIsOn = 0;
static GrChipID_t xSaveTmuNumber = -1;
static unsigned char ucSaveCyclingMode[2] = {-1, -1};
static unsigned char ucSaveFunction = -1;
/*
----------------------------------------------------------------------------------------
Description : called before the rendering of any triangle
----------------------------------------------------------------------------------------
*/
BOOL GLI_DRV_bBeginScene()
{
return TRUE;
}
/*
----------------------------------------------------------------------------------------
Description : called after the rendering of all triangles
----------------------------------------------------------------------------------------
*/
BOOL GLI_DRV_bEndScene()
{
return TRUE;
}
/*
----------------------------------------------------------------------------------------
Description : Set init parameter as none set
----------------------------------------------------------------------------------------
*/
void GLI_fn_vInitRenderParameters( void )
{
bIsWriteEnable = 1;
xSaveFogIsOn = 0;
xSaveTmuNumber = -1;
ucSaveCyclingMode[0] = ucSaveCyclingMode[1] = -1;
ucSaveFunction = -1;
}
/*
----------------------------------------------------------------------------------------
Description : set render parameters that will work for all faces which are not
transparent
----------------------------------------------------------------------------------------
*/
void GLI_fn_vSetRenderParametersBeforeOpaqueFace( void )
{
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_NONE,GR_COMBINE_OTHER_TEXTURE,FXFALSE);
grColorCombine(GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_ZERO,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_CONSTANT,FALSE);
grAlphaTestFunction( GR_CMP_ALWAYS );
grAlphaTestReferenceValue( 0xC0 );
ucSaveFunction = 4;
GLI_DFX_EnableWriteToZBuffer();
}
void GLI_DRV_vDoOpaqueTextureSelection(GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT)
{
GLI_tdstTextureDFX *p_stSpecParam;
BOOL bTexture;
if (*GLD_p_lRenderingCounter != p_stGlobaleMT->GLD_RenderingCounter)
{
p_stGlobaleMT->GLD_RenderingCounter = *GLD_p_lRenderingCounter;
GLI_vSendBlackPolygon();
GLI_DFX_EnableWriteToZBuffer();
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_ITERATED,FXFALSE);
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FALSE);
ucSaveFunction = 4;
}
bTexture = (p_stGlobaleMT->p_stCurrentTexture != NULL) && (p_stGlobaleMT->p_stCurrentTexture->bIsAvailable);
if (bTexture)
{
p_stSpecParam = p_stGlobaleMT -> p_stCurrentTexture -> p_stSpecParam;
GLI_GLIDE1_xTmuNumber = p_stSpecParam->xTmuNumber;
/*
* UV multiplier
*/
p_stGlobaleMT -> fMulU = p_stSpecParam -> lMultiplyHeight;
p_stGlobaleMT -> fMulV = p_stSpecParam -> lMultiplyWidth;
}
if (
(bTexture && (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & (GLI_C_lAlphaTexture | GLI_C_lNZFilteredTexture | GLI_C_lAddTransparencyTexture) ) )
|| (!(p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsNotGrided) && (p_stGlobaleMT->xGlobalAlpha < 0.98f))
)
{
p_stGlobaleMT -> lClippingModeMask |= GLI_C_TrianglesMustBeSorted;
return;
}
p_stGlobaleMT -> lClippingModeMask &= 0xffffffff - GLI_C_TrianglesMustBeSorted;
if ( p_stGlobaleMT->lCurrentDrawMask & GLI_C_lIsEnableZSorting )
GLI_DRV_vEnableDepthTest();
else
GLI_DRV_vDisableDepthTest();
/*
* fog
*/
if (GLI_BIG_GLOBALS->xFogIsOn)
{
if ( GLI_BIG_GLOBALS->p_stLastComputedFog != GLI_BIG_GLOBALS->p_stActiveFog )
{
GLI_vSetFogParams( GLI_BIG_GLOBALS->p_stActiveFog );
GLI_BIG_GLOBALS->p_stLastComputedFog = GLI_BIG_GLOBALS->p_stActiveFog;
}
if (!xSaveFogIsOn)
{
grFogMode( GR_FOG_WITH_TABLE_ON_Q );
xSaveFogIsOn = 1;
}
}
else if (xSaveFogIsOn)
{
// FOG OFF
grFogMode( GR_FOG_DISABLE);
xSaveFogIsOn = 0;
}
/*
* mirror
*/
if (GLI_BIG_GLOBALS->lAMirrorIsDetected & 2)
{
}
/*
* not a mirror
*/
else
{
if ( bTexture )
{
/*
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & GLI_C_lAlphaTest)
{
if (ucSaveFunction != 5)
{
static unsigned char ucalpha = 0xD0;
grAlphaTestFunction( GR_CMP_GEQUAL );
grAlphaTestReferenceValue( ucalpha );
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
ucSaveFunction = 5;
}
}
else
*/
{
if (ucSaveFunction != 4)
{
//grAlphaTestFunction( GR_CMP_ALWAYS );
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_ITERATED,FXFALSE);
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FALSE);
ucSaveFunction = 4;
}
}
/*
* Chromakey
*/
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & GLI_C_lNZTexture)
{
unsigned long ulChromakey;
grChromakeyMode( GR_CHROMAKEY_ENABLE );
/*
* CB : La valeur de chromakey doit etre <20>gale <20> : 5 bits de poids fort, plus les 3 bits de poids fort copi<70>s dans les bits de poids faible.... !!!
* VL : sauf pour la composante G : 6 bit de poids fort + 2 bit de poids fort copi<70>s dans les bits de poids faible !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
ulChromakey = (p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x00F800F8) | ((p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x00E000E0) >> 5);
ulChromakey|= (p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x0000FC00) | ((p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x0000C000) >> 6);
grChromakeyValue( ulChromakey );
}
else
{
grChromakeyMode( GR_CHROMAKEY_DISABLE );
}
/*
* uv cycling mode
*/
if ( p_stGlobaleMT -> p_stCurrentTexture -> ucCylingMode != ucSaveCyclingMode[ GLI_GLIDE1_xTmuNumber ] )
{
switch ( ucSaveCyclingMode[ GLI_GLIDE1_xTmuNumber ] = p_stGlobaleMT -> p_stCurrentTexture -> ucCylingMode )
{
case 0:
//NO CYCLING
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_CLAMP,GR_TEXTURECLAMP_CLAMP);
break;
case GLI_C_lCylingUV:
//CYCLING
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_WRAP,GR_TEXTURECLAMP_WRAP);
break;
case GLI_C_lCylingU:
//CYCLING V
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_CLAMP,GR_TEXTURECLAMP_WRAP);
break;
case GLI_C_lCylingV:
//CYCLING U
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_WRAP , GR_TEXTURECLAMP_CLAMP);
break;
}
}
/*
* texture Tmu
*/
if (GLI_GLIDE1_xTmuNumber != xSaveTmuNumber)
{
grTexCombine((GLI_GLIDE1_xTmuNumber+1) & 0x1,GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,FALSE,FALSE);
grTexCombine(GLI_GLIDE1_xTmuNumber,GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,FXFALSE, FXFALSE );
xSaveTmuNumber = GLI_GLIDE1_xTmuNumber;
}
grTexSource( GLI_GLIDE1_xTmuNumber, p_stSpecParam -> xStartAddress, p_stSpecParam -> xEvenOdd, &p_stSpecParam -> stInfoBitmapGlide);
if (p_stGlobaleMT->p_stCurrentTexture->lTextureCaps & GLI_C_lPaletteTexture)
{
grTexDownloadTable( GR_TEXTABLE_PALETTE, p_stGlobaleMT->p_stCurrentTexture->p_vColorTable );
}
}
else /* gouraud */
{
if (ucSaveFunction != 0)
{
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
grAlphaTestFunction( GR_CMP_ALWAYS );
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_ITERATED,FXFALSE);
grColorCombine(GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_NONE, FXFALSE);
ucSaveFunction = 0;
}
}
}
}
/*
----------------------------------------------------------------------------------------
Description : set render parameters that will work for all transparency faces
----------------------------------------------------------------------------------------
*/
void GLI_fn_vSetRenderParametersBeforeTransparencyFace( void )
{
grAlphaTestFunction( GR_CMP_ALWAYS );
GLI_DFX_DisableWriteToZBuffer();
}
void GLI_vDoTransparentTextureSelection(GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT)
{
GLI_tdstTextureDFX *p_stSpecParam;
/*
* write to Z buffer ?
*/
if (p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsWriteZBuffer)
GLI_DFX_EnableWriteToZBuffer();
else
GLI_DFX_DisableWriteToZBuffer();
if ( p_stGlobaleMT->lCurrentDrawMask & GLI_C_lIsEnableZSorting )
GLI_DRV_vEnableDepthTest();
else
GLI_DRV_vDisableDepthTest();
/*
* fog
*/
if (GLI_BIG_GLOBALS->xFogIsOn)
{
if ( GLI_BIG_GLOBALS->p_stLastComputedFog != GLI_BIG_GLOBALS->p_stActiveFog )
{
GLI_vSetFogParams( GLI_BIG_GLOBALS->p_stActiveFog );
GLI_BIG_GLOBALS->p_stLastComputedFog = GLI_BIG_GLOBALS->p_stActiveFog;
}
if (!xSaveFogIsOn)
{
grFogMode( GLI_g_lNumberOfFogTableEntries );
xSaveFogIsOn = 1;
}
}
else if (xSaveFogIsOn)
{
// FOG OFF
grFogMode( GR_FOG_DISABLE);
xSaveFogIsOn = 0;
}
/*
* mirror
*/
if (p_stGlobaleMT->lAMirrorIsDetected & 2)
{
if ((!(p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsNotGrided)) && (p_stGlobaleMT->xGlobalAlpha < 0.98f))
{
}
else
{
}
}
/*
* not a mirror
*/
else
{
if ((p_stGlobaleMT -> p_stCurrentTexture != NULL) && (p_stGlobaleMT -> p_stCurrentTexture -> bIsAvailable))
{
p_stSpecParam = p_stGlobaleMT -> p_stCurrentTexture -> p_stSpecParam;
GLI_GLIDE1_xTmuNumber = p_stSpecParam->xTmuNumber;
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & (GLI_C_lAlphaTexture | GLI_C_lNZFilteredTexture | GLI_C_lAddTransparencyTexture) )
{
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & GLI_C_lAddTransparencyTexture)
{
// Trans ADD
if (ucSaveFunction != 1)
{
grAlphaBlendFunction( GR_BLEND_ONE,GR_BLEND_ONE,GR_BLEND_ZERO ,GR_BLEND_ZERO );
grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FXFALSE);
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL_ALPHA,GR_COMBINE_LOCAL_CONSTANT,GR_COMBINE_OTHER_TEXTURE,FALSE);
ucSaveFunction = 1;
}
// No fog With This;
if (xSaveFogIsOn)
{
grFogMode( GR_FOG_DISABLE);
xSaveFogIsOn = 0;
}
}
else if (ucSaveFunction != 2)
{
// Trans ALPHA
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,GR_BLEND_ONE_MINUS_SRC_ALPHA,GR_BLEND_ONE ,GR_BLEND_ZERO );
grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FXFALSE);
grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FXFALSE );
ucSaveFunction = 2;
}
}
else //if ((!(p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsNotGrided)) && (xGlobaLAlpha < 0.98f))
{
// Trans ALPHA ITERATED
if (ucSaveFunction != 3)
{
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,GR_BLEND_ONE_MINUS_SRC_ALPHA,GR_BLEND_ONE,GR_BLEND_ZERO );
grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_ITERATED,FXFALSE);//*/
grColorCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_NONE,GR_COMBINE_OTHER_TEXTURE,FXFALSE );
ucSaveFunction = 3;
}
}
/*
* Chromakey
*/
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & GLI_C_lNZTexture)
{
unsigned long ulChromakey;
grChromakeyMode( GR_CHROMAKEY_ENABLE );
/*
* CB : La valeur de chromakey doit etre <20>gale <20> : 5 bits de poids fort, plus les 3 bits de poids fort copi<70>s dans les bits de poids faible.... !!!
* VL : sauf pour la composante G : 6 bit de poids fort + 2 bit de poids fort copi<70>s dans les bits de poids faible !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
ulChromakey = (p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x00F800F8) | ((p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x00E000E0) >> 5);
ulChromakey|= (p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x0000FC00) | ((p_stGlobaleMT->p_stCurrentTexture->lChromakeyColorRGBA & 0x0000C000) >> 6);
grChromakeyValue( ulChromakey );
}
else
{
grChromakeyMode( GR_CHROMAKEY_DISABLE );
}
/*
* uv cycling mode
*/
if ( p_stGlobaleMT -> p_stCurrentTexture -> ucCylingMode != ucSaveCyclingMode[ GLI_GLIDE1_xTmuNumber ] )
{
switch ( ucSaveCyclingMode[ GLI_GLIDE1_xTmuNumber ] = p_stGlobaleMT -> p_stCurrentTexture -> ucCylingMode )
{
case 0:
//NO CYCLING
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_CLAMP,GR_TEXTURECLAMP_CLAMP);
break;
case GLI_C_lCylingUV:
//CYCLING
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_WRAP,GR_TEXTURECLAMP_WRAP);
break;
case GLI_C_lCylingU:
//CYCLING V
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_CLAMP,GR_TEXTURECLAMP_WRAP);
break;
case GLI_C_lCylingV:
//CYCLING U
grTexClampMode(GLI_GLIDE1_xTmuNumber, GR_TEXTURECLAMP_WRAP , GR_TEXTURECLAMP_CLAMP);
break;
}
}
/*
* texture Tmu
*/
if (GLI_GLIDE1_xTmuNumber != xSaveTmuNumber)
{
grTexCombine((GLI_GLIDE1_xTmuNumber+1) & 0x1,GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,FALSE,FALSE);
grTexCombine(GLI_GLIDE1_xTmuNumber,GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,FXFALSE, FXFALSE );
xSaveTmuNumber = GLI_GLIDE1_xTmuNumber;
}
grTexSource( GLI_GLIDE1_xTmuNumber, p_stSpecParam -> xStartAddress, p_stSpecParam -> xEvenOdd, &p_stSpecParam -> stInfoBitmapGlide);
}
else
{
// GOURAUD
if (((p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsNotGrided) == 0) && (p_stGlobaleMT->xGlobalAlpha < 0.98f) )
{
// alpha iterated transparency
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,GR_BLEND_ONE_MINUS_SRC_ALPHA,GR_BLEND_ONE,GR_BLEND_ZERO );
grAlphaCombine(GR_COMBINE_FUNCTION_BLEND, GR_COMBINE_FACTOR_LOCAL_ALPHA,GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_NONE,FXFALSE);
p_stGlobaleMT -> lClippingModeMask |= GLI_C_TrianglesMustBeSorted;
}
else
{
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_ITERATED,FXFALSE);
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
}
grColorCombine(GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_ITERATED, GR_COMBINE_OTHER_NONE, FXFALSE);
ucSaveFunction = 0;
}
}
}
void GLI_WriteRegion3DFX(long X, long Y, long l, long h, unsigned char *p_ucSrc, long SrcPitch , GrLfbInfo_t *p_info)
{
long *p_sourceptr , *p_sourceptrLast , *p_destptr ,lYCounterLocal;
short *p_Src;
long lPitch = p_info->strideInBytes / 4;
p_Src = (unsigned short *)p_ucSrc;
for (lYCounterLocal = 0; lYCounterLocal < h ; lYCounterLocal++)
{
p_destptr = ((unsigned long *)p_info->lfbPtr) + (X>>1) + lPitch * (Y + lYCounterLocal);
p_sourceptr = ((unsigned long *)p_Src + lYCounterLocal * (SrcPitch >>2)) ;
p_sourceptrLast = p_sourceptr + (l>>1);
for (;p_sourceptr < p_sourceptrLast ;p_sourceptr ++,p_destptr ++)
*p_destptr = *p_sourceptr ;
}
}
void GLI_DRV_vWrite16bBitmapToBackBuffer( void *_p_vSourceBuffer, long _lWidth, long _lHeight, long _lDestLeft, long _lDestTop, long _lDestRight, long _lDestBottom )
{
GrLfbInfo_t info;
unsigned short *puw_Tgt, *puw_Src;
info.size = sizeof( GrLfbInfo_t );
if ( !grLfbLock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565 , GR_ORIGIN_UPPER_LEFT, FXFALSE , &info) )
return;
puw_Tgt = (unsigned short *) info.lfbPtr;
puw_Tgt += (info.strideInBytes>> 1) * _lDestTop + _lDestLeft;
puw_Src = (unsigned short *) _p_vSourceBuffer;
GLD_MDRV_vBlitStretched16b( _lDestRight - _lDestLeft + 1, _lDestBottom - _lDestTop + 1, puw_Tgt, info.strideInBytes >> 1, _lWidth, _lHeight, puw_Src );
grLfbUnlock( GR_LFB_WRITE_ONLY , GR_BUFFER_BACKBUFFER);
}
void GLI_vSetFogParams( tdstFogParams *_p_stFogParams )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
float *p_fFogDist, *p_fLast;
long GlideColor;
float xCoefOfCalculation;
GrFog_t *p_xFog;
unsigned char ucFogDensityStart, ucFogDensityEnd;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
xCoefOfCalculation = _p_stFogParams->xDepthEnd - _p_stFogParams->xDepthStart;
if ( xCoefOfCalculation )
xCoefOfCalculation = ( _p_stFogParams->xBlendEnd - _p_stFogParams->xBlendStart) / xCoefOfCalculation;
p_fFogDist = GLI_ga_fFogDist;
p_fLast = p_fFogDist + GLI_g_lNumberOfFogTableEntries;
p_xFog = Gli_C_xFogTable;
ucFogDensityStart = (unsigned char) MTH_M_xRealToLong(_p_stFogParams->xBlendStart);
ucFogDensityEnd = (unsigned char) MTH_M_xRealToLong(_p_stFogParams->xBlendEnd);
while ( (p_fFogDist < p_fLast) && (*p_fFogDist < _p_stFogParams->xDepthStart) )
{
*p_xFog++ = ucFogDensityStart;
p_fFogDist++;
}
while ( (p_fFogDist < p_fLast) && (*p_fFogDist < _p_stFogParams->xDepthEnd) )
{
*p_xFog++ = (unsigned char)MTH_M_xRealToLong((xCoefOfCalculation * (*p_fFogDist++ - _p_stFogParams->xDepthStart)) + _p_stFogParams->xBlendStart);
}
while ( (p_fFogDist < p_fLast) && (*p_fFogDist < _p_stFogParams->xInfinite) )
{
*p_xFog++ = ucFogDensityEnd;
p_fFogDist++;
}
while ( p_fFogDist < p_fLast )
{
*p_xFog++ = 255;
p_fFogDist++;
}
grFogTable( Gli_C_xFogTable );
GlideColor = (long)(_p_stFogParams->stColor.xR * 255.f) +((long)(_p_stFogParams->stColor.xG * 255.f)<<8) +((long)(_p_stFogParams->stColor.xB * 255.f)<<16) ;
grFogColorValue(GlideColor);
}
void GLI_DRV_vComputeFogEffect(GLI_tdstInternalGlobalValuesFor3dEngine *p_stBG )
{
}
#ifdef __cplusplus
} //extern "C"
#endif

View File

@@ -0,0 +1,460 @@
#include "GLD.h"
#include "GEO.h"
#include "TEX.h"
#include "gli_st.h"
#include "textu_st.h"
#include "texture.h"
#define __MSC__
#include <glide.h>
#include "TextuDFX.h"
#include "DLLCom.h"
extern long GLI_gl_MaxTmuAvailable;
short TEXTURETWIDDLED[1024L*1024L];
/*
----------------------------------------------------------------------------------------
Structure for texture memory block (use to load texture into VRam)
----------------------------------------------------------------------------------------
*/
typedef struct tdstTextureMemoryBlock_
{
long lTmu;
long lStart;
long lCurrent;
long lEnd;
} tdstTextureMemoryBlock;
/*
----------------------------------------------------------------------------------------
Description : get total memory size available for texture
----------------------------------------------------------------------------------------
*/
long GLI_fn_lGetTotalTextureMemorySize( void )
{
long i,lSize;
lSize = 0;
for (i = 0 ; i < GLI_gl_MaxTmuAvailable; i++)
lSize += grTexMaxAddress( i ) - grTexMinAddress( i );
return (lSize);
}
/*
----------------------------------------------------------------------------------------
Description : get video memory size taken by a given texture
----------------------------------------------------------------------------------------
*/
long GLI_DRV_lGetSizeOfTexture( GLI_tdstTexture *p_stTexture )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
long lTextureSize;
long lRef, lSize;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
lTextureSize = p_stTexture->lHeight * p_stTexture->lWidth;
/*
* 8 bits
*/
if (!(p_stTexture->lTextureCaps & GLI_C_lPaletteTexture))
lTextureSize <<= 1;
/*
* mipmap
*/
if (p_stTexture ->lNumberOfLod)
{
lRef = (p_stTexture->lWidth > p_stTexture->lHeight) ? p_stTexture->lHeight : p_stTexture->lWidth;
lSize = lTextureSize;
while ( lRef )
{
lSize >>= 2;
lRef >>= 1;
lTextureSize += lSize;
}
}
/*
* alignment
*/
if ( lTextureSize & 0x7 )
{
lTextureSize += 8 - (lTextureSize & 0x7);
}
GLI_MDRV_TEXBENCH_vSetTextureSize( p_stTexture, TEXBENCH_C_cComputedSize, lTextureSize );
return lTextureSize;
}
/*
----------------------------------------------------------------------------------------
Description : get correspondante GRLOd constant
----------------------------------------------------------------------------------------
*/
static long GLI_lFindGrLOD(long lvalue)
{
if (lvalue == 256) return GR_LOD_LOG2_256;
if (lvalue == 128) return GR_LOD_LOG2_128;
if (lvalue == 64) return GR_LOD_LOG2_64;
if (lvalue == 32) return GR_LOD_LOG2_32;
if (lvalue == 16) return GR_LOD_LOG2_16;
if (lvalue == 8) return GR_LOD_LOG2_8;
if (lvalue == 4) return GR_LOD_LOG2_4;
if (lvalue == 2) return GR_LOD_LOG2_2;
if (lvalue == 1) return GR_LOD_LOG2_1;
return 0;// GROSBUG
}
/*
----------------------------------------------------------------------------------------
Description : compute texture aspect ration
----------------------------------------------------------------------------------------
*/
long GLI_lFindAspectRatioAndMultiplySize(GLI_tdstTexture *p_stTexture)
{
long lValue1,lValue2;
GLI_tdstTextureDFX *p_stSpecParam;
p_stSpecParam=p_stTexture->p_stSpecParam;
lValue1 = p_stTexture -> lWidth;
lValue2 = p_stTexture -> lHeight;
if ((lValue1>>3) == lValue2)
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight = 31.0f;
return GR_ASPECT_LOG2_8x1;
}
if ((lValue1>>2) == lValue2)
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight = 63.0f;
return GR_ASPECT_LOG2_4x1;
}
if ((lValue1>>1) == lValue2)
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight =127.0f;
return GR_ASPECT_LOG2_2x1;
}
if ((lValue1) == (lValue2))
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_LOG2_1x1;
}
if ((lValue1) == (lValue2>>1))
{
p_stSpecParam -> lMultiplyWidth = 127.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_LOG2_1x2;
}
if ((lValue1) == (lValue2>>2))
{
p_stSpecParam -> lMultiplyWidth = 63.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_LOG2_1x4;
}
if ((lValue1) == (lValue2>>3))
{
p_stSpecParam -> lMultiplyWidth = 31.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_LOG2_1x8;
}
return 0; /* GROS BUG */
}
/*
----------------------------------------------------------------------------------------
Description : Compress texture and compute mip map levels
----------------------------------------------------------------------------------------
*/
static void GLI_vCompressTex ( GLI_tdstTexture *p_stTexture , GrTexInfo *p_stTexInfo )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
long lCurrentDecalTextureForMipMapping,Verify;
unsigned short *p_Destination;
unsigned char *p_ucDest;
unsigned long *p_ulPalette;
long lNbLod;
unsigned short lWidth, lHeight;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if (p_stTexture == NULL )
return;
lCurrentDecalTextureForMipMapping = 0;
p_Destination = TEXTURETWIDDLED;
p_stTexture->p_vBitMap = GLI_gs_p_ConvertBufferMipMapping;
/*
* load texture
*/
GLI_MDRV_xLoadTextureInTexelField(p_stTexture, GLI_gs_p_ConvertBufferMipMapping, TRUE);
/*
* check for alpha texture
*/
if ((p_stTexture -> lTextureCaps & GLI_C_lAlphaTexture) || (p_stTexture -> lTextureCaps & GLI_C_lNZFilteredTexture))
{
Verify = GLI_MDRV_vVerifyTextureIsRealyAlpha(p_stTexture);
if ((Verify & 0xE0000000) == 0xE0000000)
p_stTexture -> lTextureCaps &= 0xffffffff - GLI_C_lAlphaTexture;
if ((Verify & 0x80000000) == 0x80000000)
p_stTexture -> lTextureCaps &= 0xffffffff - GLI_C_lNZFilteredTexture;
}
p_stTexture->p_vBitMap = GLI_gs_p_ConvertBufferMipMapping;
lNbLod = p_stTexture->lNumberOfLod;
lWidth = p_stTexture->lWidth;
lHeight = p_stTexture->lHeight;
if ( p_stTexture->lTextureCaps & GLI_C_lPaletteTexture )
{
p_ucDest = (char *) p_Destination;
p_ulPalette = (unsigned long *) p_stTexture->p_vColorTable;
((GLI_tdstTextureDFX *) p_stTexture->p_stSpecParam)->stInfoBitmapGlide.format = GR_TEXFMT_P_8;
memcpy( p_ucDest, GLI_gs_p_ConvertBufferMipMapping, p_stTexture->lHeight * p_stTexture->lWidth );
lCurrentDecalTextureForMipMapping = p_stTexture->lHeight * p_stTexture->lWidth ;
while( lNbLod-- )
{
GLI_MDRV_vDivideBitmapSurfaceBy2Palette( (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_ulPalette, p_stTexture->lHeight, p_stTexture->lWidth );
p_stTexture->lHeight >>= 1;
p_stTexture->lWidth >>= 1;
memcpy( p_ucDest + lCurrentDecalTextureForMipMapping, GLI_gs_p_ConvertBufferMipMapping, p_stTexture->lHeight * p_stTexture->lWidth );
lCurrentDecalTextureForMipMapping += p_stTexture->lHeight * p_stTexture->lWidth;
}
}
else if ( p_stTexture->lTextureCaps & GLI_C_lAlphaTest )
{
((GLI_tdstTextureDFX *) p_stTexture->p_stSpecParam)->stInfoBitmapGlide.format = GR_TEXFMT_ARGB_1555;
GLI_MDRV_vCompressTex1555( p_stTexture ,(void *)(p_Destination)) ;
lCurrentDecalTextureForMipMapping = p_stTexture->lHeight * p_stTexture->lWidth ;
while( lNbLod-- )
{
GLI_MDRV_vDivideBitmapSurfaceBy2NonZero((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture->lHeight, p_stTexture->lWidth, p_stTexture->lChromakeyColorRGBA); /* G.CLEMENT 04/08/1999 : added chromakey */
p_stTexture->lHeight >>= 1;
p_stTexture->lWidth >>= 1;
GLI_MDRV_vCompressTex1555( p_stTexture ,(void *)(p_Destination + lCurrentDecalTextureForMipMapping)) ;
lCurrentDecalTextureForMipMapping += p_stTexture->lHeight * p_stTexture->lWidth;
}
}
else if ((!(p_stTexture -> lTextureCaps & GLI_C_lAlphaTexture)) && (p_stTexture -> lTextureCaps & GLI_C_lNZFilteredTexture))
{
((GLI_tdstTextureDFX *) p_stTexture->p_stSpecParam)->stInfoBitmapGlide.format = GR_TEXFMT_ARGB_1555;
GLI_MDRV_vCompressTex1555( p_stTexture ,(void *)(p_Destination)) ;
lCurrentDecalTextureForMipMapping = p_stTexture->lHeight * p_stTexture->lWidth ;
while( lNbLod-- )
{
if (p_stTexture -> lTextureCaps & GLI_C_lNZTexture)
GLI_MDRV_vDivideBitmapSurfaceBy2NonZero((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture -> lHeight, p_stTexture -> lWidth, p_stTexture->lChromakeyColorRGBA); /* G.CLEMENT 04/08/1999 : added chromakey */
else
GLI_MDRV_vDivideBitmapSurfaceBy2((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture -> lHeight, p_stTexture -> lWidth);
p_stTexture->lHeight >>= 1;
p_stTexture->lWidth >>= 1;
GLI_MDRV_vCompressTex1555( p_stTexture ,(void *)(p_Destination + lCurrentDecalTextureForMipMapping)) ;
lCurrentDecalTextureForMipMapping += p_stTexture->lHeight * p_stTexture->lWidth;
}
}
else if (p_stTexture -> lTextureCaps & GLI_C_lAlphaTexture)
{
((GLI_tdstTextureDFX *) p_stTexture->p_stSpecParam)->stInfoBitmapGlide.format = GR_TEXFMT_ARGB_4444;
GLI_MDRV_vCompressTex4444( p_stTexture , (void *)(p_Destination)) ;
lCurrentDecalTextureForMipMapping = p_stTexture->lHeight * p_stTexture->lWidth ;
while( lNbLod-- )
{
if (p_stTexture -> lTextureCaps & GLI_C_lNZTexture)
GLI_MDRV_vDivideBitmapSurfaceBy2NonZero((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture -> lHeight , p_stTexture -> lWidth, p_stTexture->lChromakeyColorRGBA); /* G.CLEMENT 04/08/1999 : added chromakey */
else
GLI_MDRV_vDivideBitmapSurfaceBy2((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture -> lHeight , p_stTexture -> lWidth );
p_stTexture->lHeight >>= 1;
p_stTexture->lWidth >>= 1;
GLI_MDRV_vCompressTex4444( p_stTexture , (void *)(p_Destination + lCurrentDecalTextureForMipMapping)) ;
lCurrentDecalTextureForMipMapping += p_stTexture->lHeight * p_stTexture->lWidth;
}
}
else
{
((GLI_tdstTextureDFX *) p_stTexture->p_stSpecParam)->stInfoBitmapGlide.format = GR_TEXFMT_RGB_565;
GLI_MDRV_vCompressTex565( p_stTexture , (void *)(p_Destination)) ;
lCurrentDecalTextureForMipMapping = p_stTexture->lHeight * p_stTexture->lWidth ;
while( lNbLod-- )
{
if (p_stTexture -> lTextureCaps & GLI_C_lNZTexture)
GLI_MDRV_vDivideBitmapSurfaceBy2NonZero((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture -> lHeight, p_stTexture -> lWidth, p_stTexture->lChromakeyColorRGBA); /* G.CLEMENT 04/08/1999 : added chromakey */
else
GLI_MDRV_vDivideBitmapSurfaceBy2((unsigned long *)GLI_gs_p_ConvertBufferMipMapping , (unsigned long *)GLI_gs_p_ConvertBufferMipMapping , p_stTexture -> lHeight, p_stTexture -> lWidth);
p_stTexture->lHeight >>= 1;
p_stTexture->lWidth >>= 1;
GLI_MDRV_vCompressTex565 ( p_stTexture , (void *)(p_Destination + lCurrentDecalTextureForMipMapping)) ;
lCurrentDecalTextureForMipMapping += p_stTexture->lHeight * p_stTexture->lWidth;
}
}
p_stTexture->lWidth = lWidth;
p_stTexture->lHeight = lHeight;
}
/*
----------------------------------------------------------------------------------------
Description : adjust Tex info parameters
----------------------------------------------------------------------------------------
*/
static void GLI_vComputeGrTexInfo ( GLI_tdstTexture *p_stTexture , GrTexInfo *p_stTexInfo )
{
if (p_stTexture -> lHeight >= p_stTexture -> lWidth)
{
p_stTexInfo -> smallLodLog2 = GLI_lFindGrLOD(p_stTexture -> lHeight >> p_stTexture -> lNumberOfLod);
p_stTexInfo -> largeLodLog2 = GLI_lFindGrLOD(p_stTexture -> lHeight );
} else
{
p_stTexInfo -> smallLodLog2 = GLI_lFindGrLOD(p_stTexture -> lWidth >> p_stTexture -> lNumberOfLod);
p_stTexInfo -> largeLodLog2 = GLI_lFindGrLOD(p_stTexture -> lWidth );
}
p_stTexInfo -> aspectRatioLog2 = GLI_lFindAspectRatioAndMultiplySize(p_stTexture);
p_stTexInfo -> data = TEXTURETWIDDLED;
}
/*
----------------------------------------------------------------------------------------
Description : download textures
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vDownLoadTextures(long bRestore, long _lTextureMode, BOOL bReloading )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstTextureMemoryBlock st_TexMemBlock[6];
tdstTextureMemoryBlock *pst_TexMemBlock;
long lNbTexMemBlocks;
long i;
long lMemoryNeeded;
long lTextureCounter;
GLI_tdstTexture *p_stTexture;
GLI_tdstTextureDFX *p_stSpecParam;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
* init texture block;
*/
lNbTexMemBlocks = 0;
for ( i = 0; i < GLI_gl_MaxTmuAvailable; i++)
{
st_TexMemBlock[ lNbTexMemBlocks ].lTmu = i;
st_TexMemBlock[ lNbTexMemBlocks ].lStart = grTexMinAddress( i );
st_TexMemBlock[ lNbTexMemBlocks ].lCurrent = st_TexMemBlock[ lNbTexMemBlocks ].lStart;
lMemoryNeeded = grTexMaxAddress( i );
if (lMemoryNeeded > 2097152 )
{
st_TexMemBlock[ lNbTexMemBlocks++ ].lEnd = 2097152;
st_TexMemBlock[ lNbTexMemBlocks ].lTmu = i;
st_TexMemBlock[ lNbTexMemBlocks ].lStart = 2097152;
st_TexMemBlock[ lNbTexMemBlocks ].lCurrent = st_TexMemBlock[ lNbTexMemBlocks ].lStart;
}
st_TexMemBlock[ lNbTexMemBlocks++ ].lEnd = lMemoryNeeded;
}
grTexMipMapMode( GR_TMU0, GR_MIPMAP_NEAREST_DITHER, FXFALSE);
grTexMipMapMode( GR_TMU1, GR_MIPMAP_NEAREST_DITHER, FXFALSE);
/*
* load all textures
*/
for (lTextureCounter = 0; lTextureCounter < GLI_C_lNBMaxOfTextures ; lTextureCounter ++)
{
if (gs_aDEFTableOfTextureMemoryChannels[lTextureCounter] == GLI_TEXIsUnallocated )
continue;
p_stTexture = gs_aDEFTableOfTextureAlreadyRead[lTextureCounter];
if (p_stTexture == NULL)
continue;
p_stTexture->p_stSpecParam = (GLI_tdstTextureDFX *) GLI_MDRV_p_vTmpMalloc( sizeof(GLI_tdstTextureDFX) );
p_stSpecParam = p_stTexture->p_stSpecParam;
p_stTexture -> bIsAvailable = 0;
p_stSpecParam -> lMultiplyWidth = 0.0f;
p_stSpecParam -> lMultiplyHeight = 0.0f;
p_stSpecParam -> xEvenOdd = GR_MIPMAPLEVELMASK_BOTH ;
GLI_vComputeGrTexInfo( p_stTexture , &p_stSpecParam->stInfoBitmapGlide ) ;
GLI_vCompressTex( p_stTexture , &p_stSpecParam->stInfoBitmapGlide ) ;
lMemoryNeeded = grTexTextureMemRequired( p_stSpecParam -> xEvenOdd , &p_stSpecParam -> stInfoBitmapGlide );
/*
* search a block that accept current texture
*/
pst_TexMemBlock = st_TexMemBlock;
for ( i = 0; i < lNbTexMemBlocks; i++, pst_TexMemBlock++ )
{
if (lMemoryNeeded < pst_TexMemBlock->lEnd - pst_TexMemBlock->lCurrent )
break;
}
if ( i == lNbTexMemBlocks)
continue;
/* bench texture size */
GLI_MDRV_TEXBENCH_vSetTextureSize( p_stTexture, 1, lMemoryNeeded );
p_stTexture -> bIsAvailable = 1;
p_stSpecParam->xTmuNumber = pst_TexMemBlock->lTmu;
p_stSpecParam->xStartAddress = pst_TexMemBlock->lCurrent;
pst_TexMemBlock->lCurrent += lMemoryNeeded;
grTexDownloadMipMap (p_stSpecParam -> xTmuNumber,p_stSpecParam -> xStartAddress ,p_stSpecParam -> xEvenOdd ,&p_stSpecParam -> stInfoBitmapGlide );
}
}
/*
----------------------------------------------------------------------------------------
Description : unload texture
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vUnLoadTextures()
{
long lTextureCounter;
GLI_tdstTexture *p_stTexture;
for ( lTextureCounter = 0 ; lTextureCounter < C_lMaxNumberOfTexture ;lTextureCounter ++)
{
if (gs_aDEFTableOfTextureMemoryChannels[lTextureCounter] != GLI_TEXIsUnallocated )
{
p_stTexture = gs_aDEFTableOfTextureAlreadyRead[lTextureCounter];
if (p_stTexture != NULL)
{
if (p_stTexture->bIsAvailable)
{
if (p_stTexture-> p_stSpecParam)
GLI_MDRV_vTmpFree( (void *) p_stTexture-> p_stSpecParam );
p_stTexture->bIsAvailable = 0;
}
}
}
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -0,0 +1,774 @@
/*
=======================================================================================
Name : Init_Glide2.c
Author : GliGlou
Description :
=======================================================================================
*/
/*
=======================================================================================
Include
=======================================================================================
*/
#define INITGUID
#include <ddraw.h>
#define __MSC__
#include <glide.h>
#include "init_gli.h"
#include "gli_st.h"
#include "GLI_Defn.h"
#include "light_st.h"
#include "PvObj_st.h"
#include "DLLCom.h"
#include "tmr.h"
#include "prf.h"
#include "Glide2To3.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifdef __cplusplus
extern "C"
{
#endif
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
=======================================================================================
Protos
=======================================================================================
*/
void GLI_DRV_xClearViewingList ( void );
long GLI_fn_lGetTotalTextureMemorySize();
void GLI_fn_vInitRenderParameters( void );
/*
=======================================================================================
Structure
=======================================================================================
*/
typedef struct tdstGlideResolution_
{
long lCode;
unsigned long ulWidth;
unsigned long ulHeight;
long lAlreadyAdded;
} tdstGlideResolution;
/*
=======================================================================================
Globals
=======================================================================================
*/
tdstGlideResolution g_a_stGlideRes[16] =
{
{GR_RESOLUTION_320x200 , 320, 200, 0 },
{GR_RESOLUTION_320x240 , 320, 240, 0 },
{GR_RESOLUTION_400x256 , 400, 256, 0 },
{GR_RESOLUTION_512x384 , 512, 384, 0 },
{GR_RESOLUTION_640x200 , 640, 200, 0 },
{GR_RESOLUTION_640x350 , 640, 350, 0 },
{GR_RESOLUTION_640x400 , 640, 400, 0 },
{GR_RESOLUTION_640x480 , 640, 480, 0 },
{GR_RESOLUTION_800x600 , 800, 600, 0 },
{GR_RESOLUTION_960x720 , 960, 720, 0 },
{GR_RESOLUTION_856x480 , 856, 480, 0 },
{GR_RESOLUTION_512x256 , 512, 256, 0 },
{GR_RESOLUTION_1024x768 ,1024, 768, 0 },
{GR_RESOLUTION_1280x1024,1280,1024, 0 },
{GR_RESOLUTION_1600x1200,1600,1200, 0 },
{GR_RESOLUTION_400x300 , 400, 300, 0 }
};
/*
=======================================================================================
Constants
=======================================================================================
*/
long GLI_gl_MaxTmuAvailable;
long GLI_g_lNumberOfFogTableEntries;
GrContext_t GLI_g_xGlideContext;
long GLI_g_lWDepthMinMaxValue[2];
/*
* for windowed mode
*/
#ifndef RETAIL
static BOOL gs_bIsWindowed = FALSE;
static HWND gs_hWnd = NULL;
static LPDIRECTDRAW gs_lpDD = NULL;
static LPDIRECTDRAW2 gs_lpDD2 = NULL;
static LPDIRECTDRAWSURFACE gs_lpDDSFront = NULL;
static LPDIRECTDRAWSURFACE gs_lpDDSBack = NULL;
static LPDIRECTDRAWCLIPPER gs_lpDDClipper = NULL;
#endif
/*
=======================================================================================
function use for windowed mode
=======================================================================================
*/
BOOL __declspec(dllexport) GLI_DRV_bWindowedModeIsOptimized(void)
{
return FALSE;
}
void __declspec(dllexport) GLI_DRV_vOptimizedWindowedMode(void)
{
return;
}
void __declspec(dllexport) GLI_DRV_vNonOptimizedWindowedMode(void)
{
return;
}
/*
----------------------------------------------------------------------------------------
Description : release directX object created for windowed mode
----------------------------------------------------------------------------------------
*/
void GLI_fn_vReleaseDDObject( void )
{
if (gs_lpDDClipper)
{
gs_lpDDClipper->lpVtbl->Release( gs_lpDDClipper );
gs_lpDDClipper = NULL;
}
if (gs_lpDDSFront)
{
gs_lpDDSBack->lpVtbl->Release( gs_lpDDSBack );
gs_lpDDSBack = NULL;
}
if (gs_lpDDSFront)
{
gs_lpDDSFront->lpVtbl->Release( gs_lpDDSFront );
gs_lpDDSFront = NULL;
}
if (gs_lpDD2)
{
gs_lpDD2->lpVtbl->Release(gs_lpDD2);
gs_lpDD2 = NULL;
}
if (gs_lpDD)
{
gs_lpDD->lpVtbl->Release(gs_lpDD);
gs_lpDD = NULL;
}
}
/*
----------------------------------------------------------------------------------------
Description : prepare display for windowed mode
----------------------------------------------------------------------------------------
*/
BOOL __declspec(dllexport) GLI_DRV_bPrepareForGliWindowed( HWND _hWnd )
{
HRESULT hr;
DDSURFACEDESC ddsd;
RECT rcWindow;
gs_bIsWindowed = TRUE;
gs_hWnd = _hWnd;
// Create Direct draw object
hr = DirectDrawCreate( NULL, &gs_lpDD, NULL );
if( hr != DD_OK )
{
gs_lpDD = NULL;
return FALSE;
}
// Get the DirectDraw2 object
hr = gs_lpDD->lpVtbl->QueryInterface(gs_lpDD, &IID_IDirectDraw2, (LPVOID *)&gs_lpDD2 );
if( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE;
}
// Set cooperative level to normal
hr = gs_lpDD2->lpVtbl->SetCooperativeLevel( gs_lpDD2, _hWnd, DDSCL_NORMAL );
if ( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE; //Can't get normal mode
}
// Creation of primary surface
memset( &ddsd, 0, sizeof( DDSURFACEDESC ) );
ddsd.dwSize = sizeof( DDSURFACEDESC );
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = gs_lpDD2->lpVtbl->CreateSurface(gs_lpDD2, &ddsd, &gs_lpDDSFront, NULL );
if ( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE; //Can't create primary surface
}
// Creation of DirectDraw Clipper
hr = gs_lpDD2->lpVtbl->CreateClipper(gs_lpDD2, 0, &gs_lpDDClipper, NULL );
if ( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE;
}
// Associate clipper with Window
hr = gs_lpDDClipper->lpVtbl->SetHWnd(gs_lpDDClipper, 0, _hWnd );
if( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE; //Can't create clipper
}
hr = gs_lpDDSFront->lpVtbl->SetClipper(gs_lpDDSFront, gs_lpDDClipper );
if ( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE; //Can't create clipper
}
GetClientRect( _hWnd, &rcWindow );
memset( &ddsd, 0, sizeof( DDSURFACEDESC ) );
ddsd.dwSize = sizeof( DDSURFACEDESC );
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
/*pstDevAttrib->dwHeight = */
ddsd.dwHeight = rcWindow.bottom;
//pstDevAttrib->dwWidth =
ddsd.dwWidth = rcWindow.right;
// Back buffer
hr = gs_lpDD2->lpVtbl->CreateSurface(gs_lpDD2, &ddsd, &gs_lpDDSBack, NULL );
if ( hr != DD_OK )
{
GLI_fn_vReleaseDDObject();
return FALSE; //Can't create clipper
}
grDisable ( GR_PASSTHRU );
//GLI3grSstControl( GR_CONTROL_DEACTIVATE);
return TRUE; // BART
}
/*
----------------------------------------------------------------------------------------
Description : prepare display for full screen mode
----------------------------------------------------------------------------------------
*/
void __declspec(dllexport) GLI_DRV_vPrepareForGliFullScreen( HWND _hWnd )
{
GLI_fn_vReleaseDDObject();
gs_bIsWindowed = FALSE;
//GLI3grSstControl( GR_CONTROL_ACTIVATE);
grEnable( GR_PASSTHRU );
}
/*
----------------------------------------------------------------------------------------
Description : copy 3DFX back buffer into D3D back bufer
----------------------------------------------------------------------------------------
*/
void GLI_fn_vCopyBackBufferToD3DBackBuffer()
{
GrLfbInfo_t info;
DDSURFACEDESC ddsd;
unsigned long *p_sourceptr , *p_sourceptrLast , *p_destptr ,lYCounterLocal, lSizeX,lSizeY,lPitch;
HRESULT ddrval;
POINT pt;
RECT rcDest, rcSrc;
memset( &ddsd, 0, sizeof( DDSURFACEDESC ) );
ddsd.dwSize = sizeof( DDSURFACEDESC );
grLfbLock( GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER,GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info);
ddrval = IDirectDrawSurface_Lock(gs_lpDDSBack, NULL, &ddsd, DDLOCK_WAIT, NULL );
if (ddrval == DD_OK)
{
lSizeX = ddsd.dwWidth;
lSizeY =ddsd.dwHeight;
lPitch =ddsd.lPitch;
for (lYCounterLocal = 0; lYCounterLocal < lSizeY ; lYCounterLocal++)
{
p_sourceptr = ((unsigned long *)info.lfbPtr) + 512L /*pitch 3dfx */ * lYCounterLocal ;
p_destptr = ((unsigned long *)ddsd.lpSurface) + (lPitch >>2) * lYCounterLocal ;
p_sourceptrLast = p_sourceptr + (lSizeX >>1);
for (;p_sourceptr < p_sourceptrLast ;p_sourceptr ++,p_destptr ++)
*p_destptr = *p_sourceptr ;
}
IDirectDrawSurface_Unlock(gs_lpDDSBack, ddsd.lpSurface );
}
grLfbUnlock( GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER);
GetClientRect( gs_hWnd, &rcDest );
rcSrc.top = 0;
rcSrc.left = 0;
rcSrc.right = 640;
rcSrc.bottom = 480;
pt.x = pt.y = 0;
ClientToScreen( gs_hWnd, &pt );
OffsetRect( &rcDest, pt.x, pt.y );
ddrval = IDirectDrawSurface_Blt(gs_lpDDSFront, &rcDest, gs_lpDDSBack, &rcSrc, 0, NULL );
}
/*
=======================================================================================
Lock / unlock backbuffer
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : Lock (return pointer on virtual screen and pitch value)
----------------------------------------------------------------------------------------
*/
BOOL GLI_DRV_bLockDevice( void **_pp_vVirtualScreen, long *_p_lPitch )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
GrLfbInfo_t info;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
grLfbLock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info);
*_pp_vVirtualScreen = info.lfbPtr;
*_p_lPitch = info.strideInBytes;
return TRUE;
}
/*
----------------------------------------------------------------------------------------
Description : UnLock
----------------------------------------------------------------------------------------
*/
BOOL GLI_DRV_bUnlockDevice( void )
{
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER);
return TRUE;
}
/*
=======================================================================================
Init / close
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : Set capabilities
----------------------------------------------------------------------------------------
*/
void VD2_fnv_SetCaps( tdstGliCaps *_pst_Caps )
{
memset( _pst_Caps, 0, sizeof( tdstGliCaps ) );
_pst_Caps->ulDriverCaps = GLICAPS_DRV_C_ulIsHardware | GLICAPS_DRV_C_ulCanBeWindowed /*| GLICAPS_DRV_C_ulSupportAlphaTest*/;
_pst_Caps->ulTextureCaps = GLICAPS_TEX_C_ulSupport8P | GLICAPS_TEX_C_ulSupportNonSquare | GLICAPS_TEX_C_ulSupportMipmap;
_pst_Caps->ulTextureMaxSize = 256;
_pst_Caps->ulTotalTextureMemory = GLI_fn_lGetTotalTextureMemorySize();
_pst_Caps->ulTotalAGPMemory = 0;
_pst_Caps->ucPrimarySurfacePixelFormat = GLD_C_xR5G6B5PixelFormat;
}
/*
----------------------------------------------------------------------------------------
Description : open Glide with good resolution
----------------------------------------------------------------------------------------
*/
long fn_lChooseResolution( HWND _hWnd, BOOL _bFullScreen, long _lWidth, long _lHeight, long _lBpp )
{
int iResIndex;
long lContext;
GrScreenResolution_t GrResolutionChoosen;
GrResolutionChoosen = GR_RESOLUTION_NONE;
for (iResIndex = 0; iResIndex < 16; iResIndex++)
{
if ( (g_a_stGlideRes[iResIndex].ulWidth == (unsigned long) _lWidth) && (g_a_stGlideRes[iResIndex].ulHeight == (unsigned long) _lHeight) )
{
GrResolutionChoosen = g_a_stGlideRes[iResIndex].lCode;
break;
}
}
if ( GrResolutionChoosen!= GR_RESOLUTION_NONE)
lContext = grSstWinOpen( (FxU32) _hWnd, GrResolutionChoosen, GR_REFRESH_60Hz, GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1 ) ;
/*
if (lContext)
{
gs_bIsWindowed = (_bFullScreen) ? 0 : 1;
g_lDestWidthInit = _lWidth;
g_lDestHeightInit = _lHeight;
GLI_fn_vActualizeModeDevice();
}
*/
return lContext;
}
/*
----------------------------------------------------------------------------------------
Description : open Glide with good resolution
----------------------------------------------------------------------------------------
*/
void GLI_DRV_xInitDriver( HWND _hWnd, BOOL _bFullScreen, long _lWidth, long _lHeight, long _lBpp )
{
grGlideInit();
grGet( GR_NUM_TMU, 4, &GLI_gl_MaxTmuAvailable );
grGet( GR_FOG_TABLE_ENTRIES, 4, &GLI_g_lNumberOfFogTableEntries );
grGet( GR_WDEPTH_MIN_MAX, 8, (long *) &GLI_g_lWDepthMinMaxValue );
grSstSelect( 0 );
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
//grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
//grSstWinOpen( 0, GR_RESOLUTION_640x480, GR_REFRESH_60Hz, GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1 ) ;
//GLI_g_xGlideContext = grSstWinOpen( (FxU32) _hWnd, GR_RESOLUTION_640x480, GR_REFRESH_60Hz, GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1 ) ;
GLI_g_xGlideContext = fn_lChooseResolution( _hWnd, _bFullScreen, _lWidth, _lHeight, _lBpp );
grDepthBufferMode( GR_DEPTHBUFFER_WBUFFER );
grDepthBufferFunction( GR_CMP_LESS );
grDepthMask( FXTRUE );
MMG_MDRV_vAddMemoryInfo (MMG_C_lTypeGLI , MMG_C_lSubTypeZList , NULL);
GLI_BIG_GLOBALS -> p_TheZListe = (GLI_tdstZListe *) GLI_MDRV_p_vTmpMalloc(sizeof(GLI_tdstZListe));
memset (GLI_BIG_GLOBALS -> p_TheZListe , 0 , sizeof(GLI_tdstZListe));
MMG_MDRV_vAddMemoryInfo(MMG_C_lTypeGLI , MMG_C_lSubTypeZList , NULL);
GLI_BIG_GLOBALS -> p_TheZListe -> p_TableOfPoints = GLI_MDRV_p_vTmpMalloc((3L * sizeof (GLI_tdScreenVertx))<<GLI_MaxZListeTrianglesPO2);
GLI_BIG_GLOBALS -> ulCurrentZTable = 0;
GLI_DRV_xClearViewingList();
grTexFilterMode(0,GR_TEXTUREFILTER_BILINEAR,GR_TEXTUREFILTER_BILINEAR );
grTexFilterMode(1,GR_TEXTUREFILTER_BILINEAR,GR_TEXTUREFILTER_BILINEAR );
grTexLodBiasValue(0, -1.0f );
grTexLodBiasValue(1, -1.0f );
GLI_BIG_GLOBALS -> ulCurrentZTable = 0;
/* get fog distance value */
{
long lIndex;
extern float GLI_ga_fFogDist[ 64 ];
for (lIndex = 0; lIndex < GLI_g_lNumberOfFogTableEntries; lIndex++)
GLI_ga_fFogDist[lIndex] = guFogTableIndexToW(lIndex) * GLI_C_xZClippingNear;
}
/* set format of vertices */
grCoordinateSpace(GR_WINDOW_COORDS);
grViewport((FxU32)0, (FxU32)0, (FxU32)_lWidth, (FxU32)_lHeight);
grDepthRange(0,1);
grRenderBuffer( GR_BUFFER_BACKBUFFER );
/*
* Init render parameters
*/
GLI_fn_vInitRenderParameters();
/*
* Set driver capabilities
*/
VD2_fnv_SetCaps( g_p_stGliCaps );
}
void GLI_DRV_vCloseDriver()
{
grSstWinClose( GLI_g_xGlideContext );
grGlideShutdown();
GLI_MDRV_vTmpFree( GLI_BIG_GLOBALS->p_TheZListe->p_TableOfPoints );
GLI_MDRV_vTmpFree( GLI_BIG_GLOBALS->p_TheZListe );
}
/*
=======================================================================================
Clear
=======================================================================================
*/
void GLI_DRV_vClearZBufferRegion(long lXStart,long lXEnd,long lYStart,long lYEnd)
{
if (!GLI_BIG_GLOBALS->bDrawMirrorSymetric)
GLI_BIG_GLOBALS->lDisplayMenuIsDetected = 1;
}
void GLI_vBeginDrawingTexturedMirrors(void)
{
GLI_BIG_GLOBALS->bDrawMirrorSymetric = 1;
}
void GLI_vBeginDrawingTexturedMirrorsSurfaces()
{
GLI_BIG_GLOBALS->lAMirrorIsDetected = 3;
}
void GLI_vEndDrawingTexturedMirrors()
{
GLI_BIG_GLOBALS->lAMirrorIsDetected &= 1;
GLI_BIG_GLOBALS->bDrawMirrorSymetric = 0;
}
void GLI_DRV_vClearDevice(BOOL ZBuffer, BOOL ColorBuffer, unsigned long Color)
{
if (GLI_MDRV_xIsGliInit())
{
if (ColorBuffer)
grColorMask( FXTRUE, FXFALSE );
else
grColorMask( FXFALSE, FXFALSE );
if (ZBuffer)
grDepthMask( FXTRUE );
else
grDepthMask( FXFALSE );
//GLI3grBufferClear( Color, 0, GR_WDEPTHVALUE_FARTHEST );
grBufferClear( Color, 0, GLI_g_lWDepthMinMaxValue[1] );
grColorMask( FXTRUE, FXFALSE );
grDepthMask( FXTRUE );
}
}
/*
=======================================================================================
Flip
=======================================================================================
*/
void GLI_DRV_vFlipDevice(long lNbFrames)
{
PRF_MDRV_vStartChrono( PRF_C_ulWaitFor3dFx , NULL);
if (!GLI_MDRV_xIsGliInit())
return;
GLI_BIG_GLOBALS->lDisplayMenuIsDetected = 0;
GLI_BIG_GLOBALS->lAMirrorIsDetected = 0;
//grSstIdle();
grFinish();
PRF_MDRV_vStopChrono( PRF_C_ulWaitFor3dFx , NULL);
PRF_MDRV_vStopChrono( PRF_C_ulFctMainLoop , NULL);
PRF_MDRV_lIncIndependantVariable( PRF_C_ulIdpRasterTime, -(long)TMR_fn_ulFastGetInternalCounter() );
GAM_MDRV_vShowRasters();
PRF_MDRV_lIncIndependantVariable( PRF_C_ulIdpRasterTime, TMR_fn_ulFastGetInternalCounter() );
PRF_MDRV_vStartChrono (PRF_C_ulFctFlip , NULL);
grBufferSwap( lNbFrames );
do
{
//lNbFrames = grBufferNumPending();
grGet( GR_PENDING_BUFFERSWAPS, 4, &lNbFrames );
}
while (lNbFrames != 0 );
#ifdef _DEBUG
if ( gs_bIsWindowed )
{
GLI_fn_vCopyBackBufferToD3DBackBuffer();
}
#endif
PRF_MDRV_vStopChrono (PRF_C_ulFctFlip , NULL);
PRF_MDRV_vStartChrono (PRF_C_ulFctMainLoop, NULL);
}
void GLI_DRV_vFlipDeviceWithSyncro( void )
{
GLI_DRV_vFlipDevice( 1 );
}
/*
----------------------------------------------------------------------------------------
Description : Get display statistics
_p_ulPixelSent -> return % of pixel sent / screen size
_p_ulPixelDisplayed -> return % of display pixel / screen size
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vGetStats(unsigned long *_p_ulPixelsSent, unsigned long *_p_ulPixelsDisplayed )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//GrSstPerfStats_t stStats;
unsigned long ulScreenSize;
unsigned long ulPixelsIn, ulPixelsOut;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if (!GLI_MDRV_xIsGliInit())
return;
//grSstPerfStats( &stStats );
grGet( GR_STATS_PIXELS_IN, 4, &ulPixelsIn );
grGet( GR_STATS_PIXELS_OUT, 4, &ulPixelsOut );
ulScreenSize = 480 * 640 / 100;
*_p_ulPixelsSent = ulPixelsIn / ulScreenSize;
*_p_ulPixelsDisplayed = ulPixelsOut / ulScreenSize;
grReset( GR_STATS_PIXELS );
}
/*
----------------------------------------------------------------------------------------
Description : enumerate display mode
----------------------------------------------------------------------------------------
*/
long __declspec(dllexport) GLI_DRV_fnl_EnumModes( char *_sz_DriverName, char *_sz_DeviceName )
{
GrResolution stQuery;
GrResolution *p_stQueryResult;
int iListSize;
int iIndex;
int iResIndex;
/* find all possible modes that include a z-buffer */
grGlideInit();
grSstSelect( 0 );
stQuery.resolution = GR_QUERY_ANY;
stQuery.refresh = GR_REFRESH_60Hz;
stQuery.numColorBuffers = 2;
stQuery.numAuxBuffers = 1;
iListSize = grQueryResolutions( &stQuery, NULL );
p_stQueryResult = malloc( iListSize );
grQueryResolutions( &stQuery, p_stQueryResult );
grGlideShutdown();
iListSize /= sizeof(iListSize);
for (iIndex = 0; iIndex < iListSize; iIndex++)
{
for (iResIndex = 0; iResIndex < 16; iResIndex++)
{
if (p_stQueryResult[iIndex].resolution == g_a_stGlideRes[iResIndex].lCode)
break;
}
if (iResIndex < 16)
{
if ( !g_a_stGlideRes[iResIndex].lAlreadyAdded )
{
g_a_stGlideRes[iResIndex].lAlreadyAdded = 1;
GLI_MDRV_lAddDisplayMode( 1, g_a_stGlideRes[iResIndex].ulWidth, g_a_stGlideRes[iResIndex].ulHeight, 16 );
}
}
}
free( p_stQueryResult );
return 1;
}
/*
----------------------------------------------------------------------------------------
Description : change mode
----------------------------------------------------------------------------------------
*/
HRESULT GLI_DRV_hChangeMode( BOOL _bFullScreen, long _lWidth, long _lHeight, long _lBpp )
{
return 0;
}
long (*gpfnl_AddDisplayInfo) (long, long, long , char*, unsigned long );
long __declspec(dllexport) GLI_DRV_fn_lGetAllDisplayConfig( FARPROC _x_Fct )
{
long l_Disp, l_Dev, l_Mode;
tdstGliCaps stCaps;
gpfnl_AddDisplayInfo = (long (__cdecl *)( long, long, long, char *, unsigned long ) ) _x_Fct;
if ( gpfnl_AddDisplayInfo(0, 0, 0, "miscvoodoodetect", 2) == 0)
return 0;
gpfnl_AddDisplayInfo( 0, 0, 0, "dll_bmp", 1);
l_Disp = gpfnl_AddDisplayInfo( 0, 0, 0, "dispadd", 0 );
gpfnl_AddDisplayInfo( l_Disp, 0, 0, "dispname", (long) "" );
gpfnl_AddDisplayInfo( l_Disp, 0, 0, "dispdesc", (long) "---" );
l_Dev = gpfnl_AddDisplayInfo( l_Disp, 0, 0, "dev_add", 0 );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, 0, "dev_name", (long) "" );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, 0, "dev_desc", (long) "---" );
{
GrResolution stQuery;
GrResolution *p_stQueryResult;
int iListSize;
int iIndex;
int iResIndex;
/* find all possible modes that include a z-buffer */
grGlideInit();
grSstSelect( 0 );
stQuery.resolution = GR_QUERY_ANY;
stQuery.refresh = GR_REFRESH_60Hz;
stQuery.numColorBuffers = 2;
stQuery.numAuxBuffers = 1;
iListSize = grQueryResolutions( &stQuery, NULL );
p_stQueryResult = malloc( iListSize );
grQueryResolutions( &stQuery, p_stQueryResult );
grGlideShutdown();
iListSize /= sizeof(iListSize);
for (iIndex = 0; iIndex < iListSize; iIndex++)
{
for (iResIndex = 0; iResIndex < 16; iResIndex++)
{
if (p_stQueryResult[iIndex].resolution == g_a_stGlideRes[iResIndex].lCode)
break;
}
if (iResIndex < 16)
{
if ( !g_a_stGlideRes[iResIndex].lAlreadyAdded )
{
g_a_stGlideRes[iResIndex].lAlreadyAdded = 1;
l_Mode = gpfnl_AddDisplayInfo( l_Disp, l_Dev, 0, "modeadd", 0 );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, l_Mode, "modefs", 1 );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, l_Mode, "modebpp", 16 );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, l_Mode, "modew", g_a_stGlideRes[iResIndex].ulWidth );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, l_Mode, "modeh", g_a_stGlideRes[iResIndex].ulHeight );
}
}
}
free( p_stQueryResult );
}
VD2_fnv_SetCaps( &stCaps );
gpfnl_AddDisplayInfo( l_Disp, l_Dev, 0, "dev_caps", (long) &stCaps );
return 1;
}
#ifdef __cplusplus
} //extern "C"
#endif

View File

@@ -0,0 +1,45 @@
#ifndef __GLIDE2TO3_H__
#define __GLIDE2TO3_H__
typedef struct
{
float sow; /* s texture ordinate (s over w) */
float tow; /* t texture ordinate (t over w) */
float oow; /* 1/w (used mipmapping - really 0xfff/w) */
} GrTmuVertex;
typedef struct
{
float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
float r, g, b; /* R, G, B, ([0..255.0]) */
float ooz; /* 65535/Z (used for Z-buffering) */
float a; /* Alpha [0..255.0] */
float oow; /* 1/W (used for W-buffering, texturing) */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
} OldGrVertex;
#define GLI_tdScreenVertx OldGrVertex
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
#define GR_VERTEX_Z_OFFSET 2
#define GR_VERTEX_R_OFFSET 3
#define GR_VERTEX_G_OFFSET 4
#define GR_VERTEX_B_OFFSET 5
#define GR_VERTEX_OOZ_OFFSET 6
#define GR_VERTEX_A_OFFSET 7
#define GR_VERTEX_OOW_OFFSET 8
#define GR_VERTEX_SOW_TMU0_OFFSET 9
#define GR_VERTEX_TOW_TMU0_OFFSET 10
#define GR_VERTEX_OOW_TMU0_OFFSET 11
#define GR_VERTEX_SOW_TMU1_OFFSET 12
#define GR_VERTEX_TOW_TMU1_OFFSET 13
#define GR_VERTEX_OOW_TMU1_OFFSET 14
#if (GLIDE_NUM_TMU > 2)
#define GR_VERTEX_SOW_TMU2_OFFSET 15
#define GR_VERTEX_TOW_TMU2_OFFSET 16
#define GR_VERTEX_OOW_TMU2_OFFSET 17
#endif
#endif

View File

@@ -0,0 +1,26 @@
#ifndef GLI_TEXTUDFX_H
#define GLI_TEXTUDFX_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern GrChipID_t GLI_GLIDE1_xTmuNumber;
typedef struct GLI_tdstTextureDFX_
{
float lMultiplyHeight;
float lMultiplyWidth;
long lMultiplyHeightPowerOf2;
long lMultiplyWidthPowerOf2;
GrChipID_t xTmuNumber;
FxU32 xStartAddress;
FxU32 xEvenOdd;
GrTexInfo stInfoBitmapGlide;
} GLI_tdstTextureDFX;
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif // GLI_TEXTUDFX_H

View File

@@ -0,0 +1,9 @@
SCC = This is a Source Code Control file
[Glide3.dsp]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/tempgrp/GliGlou/Drivers/GLIDE3", ZFMAAAAA
[Glide3.mak]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/tempgrp/GliGlou/Drivers/GLIDE3", ZFMAAAAA