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,218 @@
# Microsoft Developer Studio Project File - Name="Glide2" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=Glide2 - 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 "Glide2.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 "Glide2.mak" CFG="Glide2 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Glide2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Glide2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Glide2 - Win32 Retail" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/GliGlou/Drivers/GLIDE2", MVPAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Glide2 - 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:\3dFX\GLIDE\SRC\SST1\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 "..\\" /I "t:\mssdk\include" /D "NDEBUG" /D "_WINDOWS" /D "USE_PROFILER" /D "GLIDE2" /D "WIN32" /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\GliVD1vr.dll"
!ELSEIF "$(CFG)" == "Glide2 - 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:\3dFX\GLIDE\SRC\SST1\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 "..\\" /I "t:\mssdk\include" /D "_DEBUG" /D "VISUAL" /D "USE_PROFILER" /D "MTH_CHECK" /D "CPA_WANTS_EXPORT" /D "GLIDE2" /D "WIN32" /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\GliVD1vd.dll" /pdbtype:sept
!ELSEIF "$(CFG)" == "Glide2 - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Glide2__"
# PROP BASE Intermediate_Dir "Glide2__"
# 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\GLIDE\SRC\SST1\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 "GLIDE2" /D "WIN32" /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\GliVd1vf.dll"
!ENDIF
# Begin Target
# Name "Glide2 - Win32 Release"
# Name "Glide2 - Win32 Debug"
# Name "Glide2 - Win32 Retail"
# Begin Group "Src"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Acces_ALL.c
!IF "$(CFG)" == "Glide2 - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "Glide2 - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "Glide2 - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\Src\Acces_GLIDE2.c
!IF "$(CFG)" == "Glide2 - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "Glide2 - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "Glide2 - 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\Domat_GLIDE2.c
# End Source File
# Begin Source File
SOURCE=.\Src\Glide2_Dll.c
# End Source File
# Begin Source File
SOURCE=..\GliDLL.def
# End Source File
# Begin Source File
SOURCE=.\Src\HdwTx_GL2.c
# End Source File
# Begin Source File
SOURCE=.\Src\Init_Glide2.c
# 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\TextuDFX.h
# End Source File
# End Group
# Begin Group "lib"
# PROP Default_Filter ""
# Begin Source File
SOURCE=T:\dxsdk\sdk\lib\ddraw.lib
# End Source File
# Begin Source File
SOURCE=T:\3Dfx\Glide\Lib\Win32\glide2x.lib
# End Source File
# End Group
# Begin Source File
SOURCE=.\Glide2.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glide2", "Glide2.vcproj", "{56221F12-25E8-4E3F-9531-D243ABEB657C}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 1
SccProjectUniqueName0 = Glide2.vcproj
SccProjectName0 = \u0022$/cpa/tempgrp/GliGlou/Drivers/GLIDE2\u0022,\u0020MVPAAAAA
SccLocalPath0 = .
SccProvider0 = MSSCCI:NXN\u0020alienbrain
EndGlobalSection
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
Retail = Retail
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{56221F12-25E8-4E3F-9531-D243ABEB657C}.Debug.ActiveCfg = Debug|Win32
{56221F12-25E8-4E3F-9531-D243ABEB657C}.Debug.Build.0 = Debug|Win32
{56221F12-25E8-4E3F-9531-D243ABEB657C}.Release.ActiveCfg = Release|Win32
{56221F12-25E8-4E3F-9531-D243ABEB657C}.Release.Build.0 = Release|Win32
{56221F12-25E8-4E3F-9531-D243ABEB657C}.Retail.ActiveCfg = Retail|Win32
{56221F12-25E8-4E3F-9531-D243ABEB657C}.Retail.Build.0 = Retail|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,472 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Glide2"
ProjectGUID="{56221F12-25E8-4E3F-9531-D243ABEB657C}"
SccProjectName="&quot;$/cpa/tempgrp/GliGlou/Drivers/GLIDE2&quot;, MVPAAAAA"
SccLocalPath=".">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\temp\Debug"
IntermediateDirectory=".\temp\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="c:\3dFX\GLIDE\SRC\SST1\INCLUDE,x:\cpa\public,x:\cpa\public\gli,x:\cpa\public\geo,inc,x:\cpa\tempgrp\gliglou\multidrv\inc,..\"
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\temp\Debug/Glide2.pch"
AssemblerListingLocation=".\temp\Debug/"
ObjectFile=".\temp\Debug/"
ProgramDataBaseFileName=".\temp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"
UndefinePreprocessorDefinitions="t:\3dFX\GLIDE\SRC\SST1\INCLUDE,x:\cpa\public,x:\cpa\public\gli,x:\cpa\public\geo,inc,x:\cpa\tempgrp\gliglou\multidrv\inc,..\,t:\mssdk\include"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ddraw.lib glide2x.lib"
OutputFile="x:\cpa\exe\main\dll\GliVD1vd.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="C:\3Dfx\Glide\Lib\Win32"
ModuleDefinitionFile="..\GliDLL.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\temp\Debug/GliVD1vd.pdb"
SubSystem="2"
ImportLibrary=".\temp\Debug/GliVD1vd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\temp\Debug/Glide2.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\temp\Release"
IntermediateDirectory=".\temp\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="t:\3dFX\GLIDE\SRC\SST1\INCLUDE,x:\cpa\public,x:\cpa\public\gli,x:\cpa\public\geo,inc,x:\cpa\tempgrp\gliglou\multidrv\inc,..\,t:\mssdk\include"
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\temp\Release/Glide2.pch"
AssemblerListingLocation=".\temp\Release/"
ObjectFile=".\temp\Release/"
ProgramDataBaseFileName=".\temp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="x:\cpa\exe\main\dll\GliVD1vr.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile="..\GliDLL.def"
ProgramDatabaseFile=".\temp\Release/GliVD1vr.pdb"
SubSystem="2"
ImportLibrary=".\temp\Release/GliVD1vr.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\temp\Release/Glide2.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Retail|Win32"
OutputDirectory=".\Temp\Retail"
IntermediateDirectory=".\Temp\Retail"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="t:\3dFX\GLIDE\SRC\SST1\INCLUDE,x:\cpa\public,x:\cpa\public\gli,x:\cpa\public\geo,inc,x:\cpa\tempgrp\gliglou\multidrv\inc,..\"
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Temp\Retail/Glide2.pch"
AssemblerListingLocation=".\Temp\Retail/"
ObjectFile=".\Temp\Retail/"
ProgramDataBaseFileName=".\Temp\Retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="x:\cpa\exe\main\dll\GliVd1vf.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile="..\GliDLL.def"
ProgramDatabaseFile=".\Temp\Retail/GliVd1vf.pdb"
SubSystem="2"
ImportLibrary=".\Temp\Retail/GliVd1vf.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Temp\Retail/Glide2.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Src"
Filter="">
<File
RelativePath="..\Acces_ALL.c">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="Src\Acces_GLIDE2.c">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="..\ClipTRIANGLES.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="..\DllCom.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="Src\Domat_GLIDE2.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="Src\Glide2_Dll.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="..\GliDLL.def">
</File>
<File
RelativePath="Src\HdwTx_GL2.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="Src\Init_Glide2.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="_DEBUG;VISUAL;USE_PROFILER;MTH_CHECK;CPA_WANTS_EXPORT;GLIDE2;WIN32;$(NoInherit)"
UndefinePreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;USE_PROFILER;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="NDEBUG;_WINDOWS;RETAIL;GLIDE2;WIN32;$(NoInherit)"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="inc"
Filter="">
<File
RelativePath="..\DllCom.h">
</File>
<File
RelativePath="inc\TextuDFX.h">
</File>
</Filter>
<Filter
Name="lib"
Filter="">
</Filter>
<File
RelativePath="Glide2.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,838 @@
/*
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Macro and function that manage with Glide2 vertex
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#define __MSC__
#include <GLIDE.H>
#include "TextuDFX.h"
#include "PRF.h"
#include "GliBench.h"
/* #include "drawflags.h" */
/* Globals */
#define GLI_GLIDE1_CurrentTmu 0
GrChipID_t GLI_GLIDE1_xTmuNumber = 0;
void GLI_DRV_xSendSpriteToClip_TRIANGLES
(
GLI_tdstAligned2DVector *a4_st2DVertex,
GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT
);
#define GLI_tdScreenVertx GrVertex
GrVertex CurrentDestXYZ[4];
#define GLI_C_3dfxBugConstant 65536.0f * 8.0f
/* Vertex Access Macros */
/*
===================================================================================================
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
/*$F #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 */
#ifdef GLI_BENCH
void BENCH_M_Triangle( GrVertex *a, GrVertex *b, GrVertex *c )
{
/*
* compute triangle surface
*/
float xb, xc, yb, yc;
long surface;
xb = GetX( (*b) ) - GetX( (*a) );
yb = GetY( (*b) ) - GetY( (*a) );
xc = GetX( (*c) ) - GetX( (*a) );
yc = GetY( (*c) ) - GetY( (*a) );
surface = (long) ceil((fabs( (xb * yc) - (xc * yb) ) / 2));
if (surface> 1023)
surface= 1023;
GLI_MDRV_g_p_stBench->lTrianglePerSurface[ surface ]++;
}
#else
#define BENCH_M_Triangle(a,b,c)
#endif
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
#define M_grDrawTriangle(a, b, c) \
{ \
BENCH_M_Triangle( (a), (b), (c) );\
grDrawTriangle((a), (b), (c)); \
PRF_MDRV_vSetIndependantVariable(PRF_C_ulIdpDisplayedTriangle, 1); \
}
#else
#define M_grDrawTriangle grDrawTriangle
#endif
#define GLI_M_RestoreCW()
/*
===================================================================================================
function called before displayind severall triangle with same render states
===================================================================================================
*/
void GLI_BeforeDraw(void)
{
};
/*
===================================================================================================
function called after displaying severall triangle with same render states
===================================================================================================
*/
void GLI_AfterDraw(void)
{
}
#define GLI_M_Correct3DFXBug2(a) \
{ \
a.x -= GLI_C_3dfxBugConstant; \
a.y -= GLI_C_3dfxBugConstant; \
}
#define GLI_M_Correct3DFXBug1(a) \
{ \
a.x += GLI_C_3dfxBugConstant; \
a.y += GLI_C_3dfxBugConstant; \
}
/*
===================================================================================================
Correct Glide 2 bug
===================================================================================================
*/
void GLI_fn_vCorrect3DFXBug1(GrVertex *a)
{
a->x += GLI_C_3dfxBugConstant;
a->y += GLI_C_3dfxBugConstant;
}
#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; \
}
/*
===================================================================================================
Draw normal triangle
===================================================================================================
*/
GLI_FuncNodeBegin(GLI_vDrawTriangle)
{
/* 3DFX BUG */
GLI_M_Correct3DFXBug2(CurrentDestXYZ[0]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[1]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[2]);
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]);
}
/*
===================================================================================================
draw wired triangle
===================================================================================================
*/
GLI_FuncNodeBegin(GLI_vDrawWiredTriangle)
{
/* 3DFX BUG */
GLI_M_Correct3DFXBug2(CurrentDestXYZ[0]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[1]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[2]);
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]);
}
/*
===================================================================================================
correct Glide2 bug
===================================================================================================
*/
GLI_FuncNodeBegin(GLI_vCorrect3DFXBug1)
{
/* 3DFX BUG */
GLI_M_Correct3DFXBug1(CurrentDestXYZ[0]);
GLI_M_Correct3DFXBug1(CurrentDestXYZ[1]);
GLI_M_Correct3DFXBug1(CurrentDestXYZ[2]);
GLI_M_CallNextFunc();
}
/*
===================================================================================================
sort translucent triangle
===================================================================================================
*/
GLI_FuncNodeBegin(GLI_vZSortTriangle)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
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(GrVertex)) - 3L * sizeof(GrVertex)
)
return;
/* 3DFX BUG */
GLI_M_Correct3DFXBug2(CurrentDestXYZ[0]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[1]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[2]);
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(GrVertex) * 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(GrVertex) * 3L;
#if !defined(PRESS_DEMO)
PRF_MDRV_vSetIndependantVariable(PRF_C_ulIdpDisplayedTriangle, 1);
#endif /* PRESS_DEMO */
}
/*$F
===================================================================================================
Description:: draw a quad stored in CurrentDestXYZ array or add it in Z list
1 0
| /| Send two triangle:: 0 1 2 and 3 2 0
| / |
|/ |
2 3
===================================================================================================
*/
void GLI_DrawQuad(void)
{
/* Draw 2 triangles */
GLI_fn_vCorrect3DFXBug1(&CurrentDestXYZ[0]);
GLI_fn_vCorrect3DFXBug1(&CurrentDestXYZ[1]);
GLI_fn_vCorrect3DFXBug1(&CurrentDestXYZ[2]);
GLI_fn_vCorrect3DFXBug1(&CurrentDestXYZ[3]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[0]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[1]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[2]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[3]);
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(GrVertex)) - 4L * sizeof(GrVertex)
)
return;
memcpy(GLI_BIG_GLOBALS->p_TheZListe->p_CurrentPoint, CurrentDestXYZ, sizeof(GrVertex) * 4L);
GLI_v_AddNodeInZList(GetZ(CurrentDestXYZ[0]));
(unsigned long) GLI_BIG_GLOBALS->p_TheZListe->p_CurrentPoint += sizeof(GrVertex) * 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]);
#if !defined(PRESS_DEMO)
PRF_MDRV_vIncreaseVariable
(
PRF_C_ulVarFaces + PRF_MDRV_lGetIndependantVariable(PRF_C_ulIdpDynOrSta),
PRF_C_pvDisplayed,
2
);
PRF_MDRV_vSetIndependantVariable(PRF_C_ulIdpDisplayedFaces, 1);
#endif /* PRESS_DEMO */
}
}
/*
===================================================================================================
Description:: Draw a line
===================================================================================================
*/
void GLI_DrawLine(void)
{
GLI_fn_vCorrect3DFXBug1(&CurrentDestXYZ[0]);
GLI_fn_vCorrect3DFXBug1(&CurrentDestXYZ[1]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[0]);
GLI_M_Correct3DFXBug2(CurrentDestXYZ[1]);
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]);
}
/*
===================================================================================================
Description:: draw Zsorted triangle
===================================================================================================
*/
void GLI_vDrawZSortedTriangle(void *p_3Point)
{
#ifdef GLI_DEBUG_TESTALLVERTICES
if
(
(((GrVertex *) p_3Point)->y < 0.0f) ||
(((GrVertex *) p_3Point + 1)->y < 0.0f) ||
(((GrVertex *) p_3Point + 2)->y < 0.0f) ||
(((GrVertex *) p_3Point)->y > 480.0f) ||
(((GrVertex *) p_3Point + 1)->y > 480.0f) ||
(((GrVertex *) p_3Point + 2)->y > 480.0f) ||
(((GrVertex *) p_3Point)->x < 0.0f) ||
(((GrVertex *) p_3Point + 1)->x < 0.0f) ||
(((GrVertex *) p_3Point + 2)->x < 0.0f) ||
(((GrVertex *) p_3Point)->x > 640.0f) ||
(((GrVertex *) p_3Point + 1)->x > 640.0f) ||
(((GrVertex *) p_3Point + 2)->x > 640.0f)
) return;
#endif
//grDrawTriangle((GrVertex *) p_3Point, ((GrVertex *) p_3Point) + 1, ((GrVertex *) p_3Point) + 2);
M_grDrawTriangle((GrVertex *) p_3Point, ((GrVertex *) p_3Point) + 1, ((GrVertex *) p_3Point) + 2);
}
/*
===================================================================================================
Description:: draw ZSorted quad
===================================================================================================
*/
void GLI_vDrawZSortedQuad(void *p_3Point)
{
#ifdef GLI_DEBUG_TESTALLVERTICES
if
(
(((GrVertex *) p_3Point)->y < 0.0f) ||
(((GrVertex *) p_3Point + 1)->y < 0.0f) ||
(((GrVertex *) p_3Point + 2)->y < 0.0f) ||
(((GrVertex *) p_3Point + 3)->y < 0.0f) ||
(((GrVertex *) p_3Point)->y > 480.0f) ||
(((GrVertex *) p_3Point + 1)->y > 480.0f) ||
(((GrVertex *) p_3Point + 2)->y > 480.0f) ||
(((GrVertex *) p_3Point + 3)->y > 480.0f) ||
(((GrVertex *) p_3Point)->x < 0.0f) ||
(((GrVertex *) p_3Point + 1)->x < 0.0f) ||
(((GrVertex *) p_3Point + 2)->x < 0.0f) ||
(((GrVertex *) p_3Point + 3)->x < 0.0f) ||
(((GrVertex *) p_3Point)->x > 640.0f) ||
(((GrVertex *) p_3Point + 1)->x > 640.0f) ||
(((GrVertex *) p_3Point + 2)->x > 640.0f) ||
(((GrVertex *) p_3Point + 3)->x > 640.0f)
) return;
#endif
M_grDrawTriangle((GrVertex *) p_3Point, ((GrVertex *) p_3Point) + 1, ((GrVertex *) p_3Point) + 2);
M_grDrawTriangle
(
((GrVertex *) p_3Point) + 3,
((GrVertex *) p_3Point) + 2,
((GrVertex *) p_3Point) + 0
);
}
/*
===================================================================================================
Description:: choose good drawing function
===================================================================================================
*/
void GLI_vAddDrawFunc(void)
{
GLI_M_AddFunc(GLI_vCorrect3DFXBug1);
ulFuncMask |= Flag_GLI_vCorrect3DFXBug1;
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;
}
}
/*
===================================================================================================
Description:: compute clipping mask
===================================================================================================
*/
void GLI_ReComputeClippingMask(void)
{
*(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;
*(float *) &fYMax_CLIP_Optimize = GLI_BIG_GLOBALS->fYMaxClipping;
GLI_BIG_GLOBALS->lClippingModeMask |= (GLI_BIG_GLOBALS->lClippingModeMask & GLI_C_lCLIP_ALL) << 4;
}
/*
===================================================================================================
Description:: clip a sprite
===================================================================================================
*/
void GLI_DRV_vSendSpriteToClip
(
GLI_tdstAligned2DVector *a4_st2DVertex,
MTH_tdxReal xZ,
GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT
)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
float fClipYMax, fClipYMin, fClipXMax, fClipXMin;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
if(*(long *) &GLI_BIG_GLOBALS->xWaterPlaneDistance != 0)
{
GLI_DRV_xSendSpriteToClip_TRIANGLES(a4_st2DVertex, p_stGlobaleMT);
return;
}
GLI_BeforeDraw();
if(a4_st2DVertex[0].xY == a4_st2DVertex[1].xY) /* Aligned sprite */
{
/* If (xZ < 0) */
/* Return; */
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();
}
/*
===================================================================================================
Description:: clip a sprite that have UV coordinates (it seems to be unused)
===================================================================================================
*/
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();
}
/*
===================================================================================================
Description:: clip a line and draw it.
===================================================================================================
*/
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;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
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);
guColorCombineFunction( GR_COLORCOMBINE_ITRGB );
/* Z clipping */
if( p_st2DVertex1->xOoZ < p_st2DVertex2->xOoZ )
{
stP1 = *p_st2DVertex1;
st3DP1 = *p_stVertex1;
stP2 = *p_st2DVertex2;
st3DP2 = *p_stVertex2;
}
else
{
stP2 = *p_st2DVertex1;
st3DP2 = *p_stVertex1;
stP1 = *p_st2DVertex2;
st3DP1 = *p_stVertex2;
}
if ( (*(unsigned long *)&stP2.xOoZ & 0x80000000) )
return;
// At least one point out ?
if ( (*(unsigned long *)&stP1.xOoZ & 0x80000000) )
{
// The point 1 (smallest xOoZ) is out.
fFactor = ( p_stGlobaleMT->p_stCurrentCamera->xNear - st3DP2.xZ ) / (st3DP1.xZ - st3DP2.xZ);
st3DP1.xX = st3DP2.xX + (st3DP1.xX - st3DP2.xX) * fFactor;
st3DP1.xY = st3DP2.xY + (st3DP1.xY - st3DP2.xY) * fFactor;
st3DP1.xZ = GLI_BIG_GLOBALS -> fZClipping;
GLI_MDRV_vSerialProjection( GLI_BIG_GLOBALS -> p_stCurrentCamera , 1 , &st3DP1 , &stP1 );
}
/* XClipping */
if(stP1.xX < stP2.xX)
{
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->xX < GLI_BIG_GLOBALS->fXMinClipping) || (p_st2DVertex1->xX > GLI_BIG_GLOBALS->fXMaxClipping)) return;
if(p_st2DVertex1->xX < GLI_BIG_GLOBALS->fXMinClipping)
{
fFactor = (p_st2DVertex2->xX - GLI_BIG_GLOBALS->fXMinClipping) / (p_st2DVertex2->xX - p_st2DVertex1->xX);
p_st2DVertex1->xY = p_st2DVertex2->xY - (p_st2DVertex2->xY - p_st2DVertex1->xY) * fFactor;
p_stVertex1->xZ = p_stVertex2->xZ - (p_stVertex2->xY - p_stVertex1->xY) * fFactor;
p_st2DVertex1->xX = GLI_BIG_GLOBALS->fXMinClipping;
}
if(p_st2DVertex2->xX > GLI_BIG_GLOBALS->fXMaxClipping)
{
fFactor = (p_st2DVertex1->xX - GLI_BIG_GLOBALS->fXMaxClipping) / (p_st2DVertex2->xX - p_st2DVertex1->xX);
p_st2DVertex2->xY = p_st2DVertex1->xY - (p_st2DVertex2->xY - p_st2DVertex1->xY) * fFactor;
p_stVertex2->xZ = p_stVertex1->xZ - (p_stVertex2->xY - p_stVertex1->xY) * fFactor;
p_st2DVertex2->xX = GLI_BIG_GLOBALS->fXMaxClipping;
}
/* 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 < GLI_BIG_GLOBALS->fYMinClipping) || (p_st2DVertex1->xY > GLI_BIG_GLOBALS->fYMaxClipping)) return;
if(p_st2DVertex1->xY < GLI_BIG_GLOBALS->fYMinClipping)
{
fFactor = ( p_st2DVertex2->xY - GLI_BIG_GLOBALS->fYMinClipping )/ (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 = GLI_BIG_GLOBALS->fYMinClipping;
}
if(p_st2DVertex2->xY > GLI_BIG_GLOBALS->fYMaxClipping)
{
fFactor = (p_st2DVertex1->xY - GLI_BIG_GLOBALS->fYMaxClipping) / (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 = GLI_BIG_GLOBALS->fYMaxClipping;
}
#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,834 @@
/******************************************************************************************
FILE : DoMat Glide2
Do render parameters settings for texture/material/fog
Dispay black triangles for window smaller than screen
*******************************************************************************************/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#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 "TEX.h"
#include "light.h"
#include "GliBench.h"
#define __MSC__
#include <GLIDE.H>
#include "TextuDFX.h"
#include "DLLCom.h"
#include "PRF.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifdef __cplusplus
extern "C"
{
#endif
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
=======================================================================================
Globals
=======================================================================================
*/
/*
* render parameters
*/
static long bIsWriteEnable = 1;
static ACP_tdxIndex xSaveFogIsOn = 0;
static GrChipID_t xSaveTmuNumber = -1;
static unsigned char ucSaveCyclingMode[2] = {-1, -1};
static unsigned char ucSaveFunction = -1;
static unsigned long gs_ulDepthBufferTestEnabled = 0;
/*
* Fog table
*/
GrFog_t Gli_C_xFogTable[ GR_FOG_TABLE_SIZE ];
float GLI_ga_fFogDist[ GR_FOG_TABLE_SIZE ];
/*
* Black triangles
*/
GrVertex g_stBlackTriangle[16];
long g_lNumberOfBlackTriangles = 0;
/*
=======================================================================================
Special function for displaying black polygon
it's for cinematic scene to hide non black for color
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : reinit list of black triangles
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vNoBlackPolygon()
{
g_lNumberOfBlackTriangles = 0;
}
/*
----------------------------------------------------------------------------------------
Description : Add a black triangles to list
Assume that list is large enough (no test)
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vAddBlackPolygon( long _lLeft, long _lTop, long _lRight, long _lBottom )
{
GrVertex *p_stVertex;
p_stVertex = g_stBlackTriangle + g_lNumberOfBlackTriangles;
memset( p_stVertex, 0, 4 * sizeof( GrVertex ) );
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;
}
/*
----------------------------------------------------------------------------------------
Description : Draw black triangles
----------------------------------------------------------------------------------------
*/
void GLI_vSendBlackPolygon()
{
GrVertex *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);
guColorCombineFunction( GR_COLORCOMBINE_ITRGB );
grFogMode( GR_FOG_DISABLE);
xSaveFogIsOn = 0;
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 );
}
}
/*
=======================================================================================
Function for Fog
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : Set render parameter for given fog parameters
----------------------------------------------------------------------------------------
*/
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 + GR_FOG_TABLE_SIZE;
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);
}
/*
----------------------------------------------------------------------------------------
Description : compute fog effect on vertex color (nothing to do for Glide2)
----------------------------------------------------------------------------------------
*/
void GLI_DRV_vComputeFogEffect(GLI_tdstInternalGlobalValuesFor3dEngine *p_stBG )
{
}
/*
=======================================================================================
ZBuffer function
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : To enable write to ZBuffer
----------------------------------------------------------------------------------------
*/
static void GLI_fn_vEnableWriteToZBuffer()
{
if (bIsWriteEnable)
return;
grDepthMask(FXTRUE);
bIsWriteEnable = 1;
}
/*
----------------------------------------------------------------------------------------
Description : To disable write to ZBuffer
----------------------------------------------------------------------------------------
*/
static void GLI_fn_vDisableWriteToZBuffer()
{
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;
}
/*
=======================================================================================
Main render parameter setting functions
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : Macro to set chromakey
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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
----------------------------------------------------------------------------------------
*/
#define M_vChromakey()\
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & GLI_C_lNZTexture)\
{\
unsigned long ulChromakey;\
grChromakeyMode( GR_CHROMAKEY_ENABLE );\
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 );\
}
/*
----------------------------------------------------------------------------------------
Description : Macro to change fog rendering
----------------------------------------------------------------------------------------
*/
#define M_vFog()\
if (GLI_BIG_GLOBALS->xFogIsOn == 1)\
{\
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 != 1)\
{\
grFogMode( GR_FOG_WITH_TABLE);\
xSaveFogIsOn = 1;\
}\
}\
else if (GLI_BIG_GLOBALS->xFogIsOn == 2)\
{\
if( xSaveFogIsOn != 2 ) \
{ \
grFogMode( GR_FOG_WITH_ITERATED_ALPHA ); \
xSaveFogIsOn = 2; \
} \
}\
else if (xSaveFogIsOn)\
{\
grFogMode( GR_FOG_DISABLE);\
xSaveFogIsOn = 0;\
}
/*
----------------------------------------------------------------------------------------
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);
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
grAlphaTestFunction( GR_CMP_ALWAYS );
grAlphaTestReferenceValue( 0xC0 );
ucSaveFunction = 4;
GLI_fn_vEnableWriteToZBuffer();
}
/*
----------------------------------------------------------------------------------------
Description : called before the rendering of any triangle
----------------------------------------------------------------------------------------
*/
BOOL GLI_DRV_bBeginScene()
{
GLI_BIG_GLOBALS->GLD_RenderingCounter = *GLD_p_lRenderingCounter;
GLI_vSendBlackPolygon();
grAlphaTestFunction( GR_CMP_LESS );
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);
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
grAlphaTestFunction( GR_CMP_ALWAYS );
grAlphaTestReferenceValue( 0xC0 );
ucSaveFunction = 4;
return TRUE;
}
/*
----------------------------------------------------------------------------------------
Description : called after the rendering of all triangles
----------------------------------------------------------------------------------------
*/
BOOL GLI_DRV_bEndScene()
{
return TRUE;
}
/*
----------------------------------------------------------------------------------------
Description : Called for all object before drawn.
Set some general parameters and set render parameter for opaque texture only
----------------------------------------------------------------------------------------
*/
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();
grAlphaTestFunction( GR_CMP_LESS );
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);
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
grAlphaTestFunction( GR_CMP_ALWAYS );
grAlphaTestReferenceValue( 0xC0 );
ucSaveFunction = 4;
}
*/
if (p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsWriteZBuffer)
GLI_fn_vEnableWriteToZBuffer();
else
GLI_fn_vDisableWriteToZBuffer();
// GLI_fn_vEnableWriteToZBuffer();
if ( p_stGlobaleMT->lCurrentDrawMask & GLI_C_lIsEnableZSorting )
GLI_DRV_vEnableDepthTest();
else
GLI_DRV_vDisableDepthTest();
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;
}
/*
* test if triangle will be transparent if so do not set render parameters
*/
if (GLI_BIG_GLOBALS->lAMirrorIsDetected)
GLI_BIG_GLOBALS->lAMirrorIsDetected = 3;
if (
( !(GLI_BIG_GLOBALS->lAMirrorIsDetected) && 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;
/*
* fog
*/
M_vFog();
{
if ( bTexture )
{
if (p_stGlobaleMT -> p_stCurrentTexture -> lTextureCaps & GLI_C_lAlphaTest)
{
if (ucSaveFunction != 5)
{
if ( ucSaveFunction == 2 )
GLI_fn_vSetRenderParametersBeforeOpaqueFace() ;
grAlphaTestFunction( GR_CMP_GEQUAL );
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
ucSaveFunction = 5;
}
}
else if (GLI_BIG_GLOBALS->lAMirrorIsDetected & 2)
{
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,GR_BLEND_ONE_MINUS_SRC_ALPHA,GR_BLEND_ONE ,GR_BLEND_ZERO );
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FXFALSE);
ucSaveFunction = 2;
}
else
{
if (ucSaveFunction != 4)
{
if ( ucSaveFunction == 2 )
GLI_fn_vSetRenderParametersBeforeOpaqueFace() ;
grAlphaTestFunction( GR_CMP_ALWAYS );
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
ucSaveFunction = 4;
}
}
/*
* Chromakey
*/
M_vChromakey();
/*
* 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)
{
grTexCombineFunction((GLI_GLIDE1_xTmuNumber+1) & 0x1, GR_TEXTURECOMBINE_OTHER);
grTexCombineFunction(GLI_GLIDE1_xTmuNumber, GR_TEXTURECOMBINE_DECAL);
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( GLI_GLIDE1_xTmuNumber, 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);
grAlphaCombine( GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_ONE,GR_COMBINE_LOCAL_NONE,GR_COMBINE_OTHER_TEXTURE,FXFALSE);
grAlphaTestFunction( GR_CMP_ALWAYS );
guColorCombineFunction( GR_COLORCOMBINE_ITRGB );
ucSaveFunction = 0;
}
}
}
}
/*
----------------------------------------------------------------------------------------
Description : set render parameters that will work for all transparency faces
----------------------------------------------------------------------------------------
*/
void GLI_fn_vSetRenderParametersBeforeTransparencyFace( void )
{
grAlphaTestFunction( GR_CMP_ALWAYS );
GLI_fn_vDisableWriteToZBuffer();
}
/*
----------------------------------------------------------------------------------------
Description : set render parameters for transparent triangles
----------------------------------------------------------------------------------------
*/
void GLI_vDoTransparentTextureSelection(GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT)
{
GLI_tdstTextureDFX *p_stSpecParam;
/*grAlphaTestFunction( GR_CMP_ALWAYS );*/
/*
* write to Z buffer ?
*/
/*
if (p_stGlobaleMT -> lCurrentDrawMask & GLI_C_lIsWriteZBuffer)
GLI_fn_vEnableWriteToZBuffer();
else
GLI_fn_vDisableWriteToZBuffer();
*/
/* Test Z-Buffer ? */
if ( p_stGlobaleMT->lCurrentDrawMask & GLI_C_lIsEnableZSorting )
GLI_DRV_vEnableDepthTest();
else
GLI_DRV_vDisableDepthTest();
/*
* fog
*/
M_vFog();
/*
* 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_lAlphaTest | 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 );
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA);
grAlphaCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,GR_COMBINE_FACTOR_LOCAL,GR_COMBINE_LOCAL_ITERATED,GR_COMBINE_OTHER_TEXTURE,FXFALSE);
ucSaveFunction = 1;
}
/* No fog With This;*/
if (xSaveFogIsOn)
{
grFogMode( GR_FOG_DISABLE);
xSaveFogIsOn = 0;
}
}
/*VL AAA texture*/
/*
else if (p_stGlobaleMT->p_stCurrentTexture->lTextureCaps & GLI_C_lAAATexture )
{
if (ucSaveFunction != 6)
{
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_CONSTANT, FXFALSE );
ucSaveFunction = 6;
}
//test
{
unsigned long ulColor;
ulColor = (long) (p_stGlobaleMT->hCurrentMaterial->stAmbient.xR * 255) & 0xFF;
ulColor |= ((long) (p_stGlobaleMT->hCurrentMaterial->stAmbient.xG * 255) & 0xFF) << 8;
ulColor |= ((long) (p_stGlobaleMT->hCurrentMaterial->stAmbient.xB * 255) & 0xFF) << 16;
grConstantColorValue( ulColor );
}
}
*/
else if (ucSaveFunction != 2)
{
/* Trans ALPHA*/
grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,GR_BLEND_ONE_MINUS_SRC_ALPHA,GR_BLEND_ONE ,GR_BLEND_ZERO );
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
grAlphaCombine(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);/* */
guColorCombineFunction( GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB);
ucSaveFunction = 3;
}
}
/*
* Chromakey
*/
M_vChromakey();
/*
* 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)
{
grTexCombineFunction((GLI_GLIDE1_xTmuNumber + 1) & 0x1, GR_TEXTURECOMBINE_OTHER);
grTexCombineFunction(GLI_GLIDE1_xTmuNumber, GR_TEXTURECOMBINE_DECAL);
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);/* */
guAlphaSource(GR_ALPHASOURCE_ITERATED_ALPHA);
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);
}
guColorCombineFunction( GR_COLORCOMBINE_ITRGB );
ucSaveFunction = 0;
}
}
}
/*
=======================================================================================
Write bitmap into backbuffer
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : write bitmap part into backbuffer
----------------------------------------------------------------------------------------
*/
void GLI_fn_vWriteRegion3DFX(long X, long Y, long l, long h, unsigned char *p_ucSrc, long SrcPitch , GrLfbInfo_t *p_info)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
long lPitch;
long *p_sourceptr , *p_sourceptrLast , *p_destptr ,lYCounterLocal;
short *p_Src;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_Src = (unsigned short *)p_ucSrc;
lPitch = p_info->strideInBytes/4;
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 ;
}
}
/*
----------------------------------------------------------------------------------------
Description : Write a 16 bit bitmap in the back buffer
_p_vSourceBuffer -> bitmap
_lWidth, _lHeight -> dimension of bitmap
_lDestX, _lDestY -> where the bitmap have to be copied in the backbuffer
----------------------------------------------------------------------------------------
*/
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);
}
#ifdef __cplusplus
} /*extern "C"*/
#endif

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 =
{
"Glide2",
"Driver for Voodoo1 and voodoo2 graphic card",
"1.0.0",
0,
};
void fn_vInitDllIdentity( void )
{
memcpy( &g_stGliDrvId, &stGlide2Id, sizeof( tdstGliDriverIdentity ) );
}

View File

@@ -0,0 +1,482 @@
#include "GLD.h"
#include "GEO.h"
#include "TEX.h"
#include "gli_st.h"
#include "textu_st.h"
#include "texture.h"
#include "FIL.h"
#define __MSC__
#include <glide.h>
#include "TextuDFX.h"
#include "DLLCom.h"
extern GrHwConfiguration hwconfig;
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;
/*
* If aspect ratio is too big, texture will waste memory (8:1 is the max aspect ratio for voodoo)
*/
{
unsigned long ulRatio;
if( p_stTexture->lHeight > p_stTexture->lWidth )
ulRatio = p_stTexture->lHeight / p_stTexture->lWidth;
else
ulRatio = p_stTexture->lWidth / p_stTexture->lHeight;
if( ulRatio > 8 )
lTextureSize <<= ulRatio >> 4;
}
/*
* 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_256;
if (lvalue == 128) return GR_LOD_128;
if (lvalue == 64) return GR_LOD_64;
if (lvalue == 32) return GR_LOD_32;
if (lvalue == 16) return GR_LOD_16;
if (lvalue == 8) return GR_LOD_8;
if (lvalue == 4) return GR_LOD_4;
if (lvalue == 2) return GR_LOD_2;
if (lvalue == 1) return GR_LOD_1;
return 0;
}
/*
----------------------------------------------------------------------------------------
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_8x1;
}
if ((lValue1>>2) == lValue2)
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight = 63.0f;
return GR_ASPECT_4x1;
}
if ((lValue1>>1) == lValue2)
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight =127.0f;
return GR_ASPECT_2x1;
}
if ((lValue1) == (lValue2))
{
p_stSpecParam -> lMultiplyWidth = 255.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_1x1;
}
if ((lValue1) == (lValue2>>1))
{
p_stSpecParam -> lMultiplyWidth = 127.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_1x2;
}
if ((lValue1) == (lValue2>>2))
{
p_stSpecParam -> lMultiplyWidth = 63.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_1x4;
}
if ((lValue1) == (lValue2>>3))
{
p_stSpecParam -> lMultiplyWidth = 31.0f;
p_stSpecParam -> lMultiplyHeight =255.0f;
return GR_ASPECT_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;
}
}
/* TEST sur nouveau traitement sur texture NZ : marche pas bien pour l'instant */
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 -> smallLod = GLI_lFindGrLOD(p_stTexture -> lHeight >> p_stTexture -> lNumberOfLod);
p_stTexInfo -> largeLod = GLI_lFindGrLOD(p_stTexture -> lHeight );
} else
{
p_stTexInfo -> smallLod = GLI_lFindGrLOD(p_stTexture -> lWidth >> p_stTexture -> lNumberOfLod);
p_stTexInfo -> largeLod = GLI_lFindGrLOD(p_stTexture -> lWidth );
}
p_stTexInfo -> aspectRatio = GLI_lFindAspectRatioAndMultiplySize(p_stTexture);
p_stTexInfo -> data = TEXTURETWIDDLED;
}
/*
----------------------------------------------------------------------------------------
Description : get total memory size available for texture
----------------------------------------------------------------------------------------
*/
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 : get total memory size available for 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

File diff suppressed because it is too large Load Diff

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,74 @@
/* only macros needed to get/set attributes of a screen vertex*/
#ifndef GLI_VTX_GLIDE2
#define __MSC__
#include <GLIDE.H>
#include "drawflags.h"
#define GLI_GLIDE1_CurrentTmu 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_CurrentTmu].sow
#define GetV(a) a->tmuvtx[GLI_GLIDE1_CurrentTmu].tow
#define GetRed(pVtx) pVtx->r
#define GetGreen(pVtx) pVtx->g
#define GetBlue(pVtx) pVtx->b
#define GetAlpha(pVtx) pVtx->a
/* 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
/* don't bother packing and unpacking colors*/
#define SetRGBA(pVtx, red, green, bleu, alpha) \
pVtx->r = (float) red; \
pVtx->g = (float) green; \
pVtx->b = (float) bleu; \
pVtx->a = (float) alpha;
#define SetPackedSpecular(a,b)
#define SetU(a,b) a->tmuvtx[GLI_GLIDE1_CurrentTmu].sow = b
#define SetV(a,b) a->tmuvtx[GLI_GLIDE1_CurrentTmu].tow = b
#define SetU_Cpy(a,b) *(unsigned long *)&a->tmuvtx[GLI_GLIDE1_CurrentTmu].sow = *(unsigned long *)&b
#define SetV_Cpy(a,b) *(unsigned long *)&a->tmuvtx[GLI_GLIDE1_CurrentTmu].tow = *(unsigned long *)&b
/* GET*/
#define GetXSt(a) a.x
#define GetYSt(a) a.y
#define GetZSt(a) a.oow
#define GetPackedColorSt(a) *(unsigned long *)&(a.r)
#define GetPackedSpecularSt(a,b)
#define GetUSt(a) a.tmuvtx[GLI_GLIDE1_CurrentTmu].sow
#define GetVSt(a) a.tmuvtx[GLI_GLIDE1_CurrentTmu].tow
#define GetRedSt(pVtx) pVtx.r
#define GetGreenSt(pVtx) pVtx.g
#define GetBlueSt(pVtx) pVtx.b
#define GetAlphaSt(pVtx) pVtx.a
/* SET*/
#define SetXSt(a,b) a.x = b
#define SetYSt(a,b) a.y = b
#define SetZSt(a,b) a.oow = b
#define SetPackedColorSt(a,b) *(unsigned long *)&(a.r) = b
/* don't bother packing and unpacking colors*/
#define SetRGBASt(pVtx, red, green, bleu, alpha) \
pVtx.r = (float) red; \
pVtx.g = (float) green; \
pVtx.b = (float) bleu; \
pVtx.a = (float) alpha;
#define SetPackedSpecularSt(a,b)
#define SetUSt(a,b) a.tmuvtx[GLI_GLIDE1_CurrentTmu].sow = b
#define SetVSt(a,b) a.tmuvtx[GLI_GLIDE1_CurrentTmu].tow = b
#define SetU_CpySt(a,b) *(unsigned long *)&a.tmuvtx[GLI_GLIDE1_CurrentTmu].sow = *(unsigned long *)&b
#define SetV_CpySt(a,b) *(unsigned long *)&a.tmuvtx[GLI_GLIDE1_CurrentTmu].tow = *(unsigned long *)&b
/* Fond de roulement GLIDE1*/
/* GLOBALS*/
#define GLI_tdScreenVertx GrVertex
#endif /* GLI_VTX_GLIDE2*/

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[Glide2.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project