Moved modified HL SDK to trunk
This commit is contained in:
1723
hlsdk/utils/qrad/lightmap.c
Normal file
1723
hlsdk/utils/qrad/lightmap.c
Normal file
File diff suppressed because it is too large
Load Diff
164
hlsdk/utils/qrad/msvc6/qrad.dsp
Normal file
164
hlsdk/utils/qrad/msvc6/qrad.dsp
Normal file
@ -0,0 +1,164 @@
|
||||
# Microsoft Developer Studio Project File - Name="qrad" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=qrad - Win32 Release
|
||||
!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 "qrad.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 "qrad.mak" CFG="qrad - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "qrad - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "qrad - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""$/SDKSrc/Tools/utils/qrad", FVGBAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "qrad - 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 ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
|
||||
# ADD CPP /nologo /MT /GX /Zi /O2 /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /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:console /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:console /profile /map /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "qrad - 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 ".\Debug"
|
||||
# PROP Intermediate_Dir ".\Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
|
||||
# ADD CPP /nologo /MT /Gm /GX /ZI /Od /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /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:console /debug /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:console /profile /map /debug /machine:I386
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "qrad - Win32 Release"
|
||||
# Name "qrad - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\bspfile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\cmdlib.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\lightmap.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\mathlib.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\polylib.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\qrad.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\scriplib.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\threads.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\trace.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\vismat.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\bspfile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\cmdlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\mathlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\polylib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\qrad.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\scriplib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\threads.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
37
hlsdk/utils/qrad/msvc6/qrad.dsw
Normal file
37
hlsdk/utils/qrad/msvc6/qrad.dsw
Normal file
@ -0,0 +1,37 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "qrad"=.\qrad.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/SDKSrc/Tools/utils/qrad", FVGBAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/SDKSrc/Tools/utils/qrad", FVGBAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
374
hlsdk/utils/qrad/msvc7/qrad.vcproj
Normal file
374
hlsdk/utils/qrad/msvc7/qrad.vcproj
Normal file
@ -0,0 +1,374 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="qrad"
|
||||
ProjectGUID="{08E4D1DC-EEE6-40F6-ADD2-1092F5075F96}"
|
||||
SccProjectName=""$/SDKSrc/Tools/utils/qrad", FVGBAAAA"
|
||||
SccLocalPath=".">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\common"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/qrad.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Debug/qrad.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/qrad.pdb"
|
||||
GenerateMapFile="TRUE"
|
||||
MapFileName=".\Debug/qrad.map"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/qrad.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\common"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/qrad.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Release/qrad.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateMapFile="TRUE"
|
||||
MapFileName=".\Release/qrad.map"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/qrad.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90">
|
||||
<File
|
||||
RelativePath="..\..\common\bspfile.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\cmdlib.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lightmap.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\mathlib.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\polylib.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\qrad.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\scriplib.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\threads.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\trace.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\vismat.c">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;fi;fd">
|
||||
<File
|
||||
RelativePath="..\..\common\bspfile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\cmdlib.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\mathlib.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\polylib.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="qrad.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\scriplib.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\threads.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
496
hlsdk/utils/qrad/msvc8/qrad.vcproj
Normal file
496
hlsdk/utils/qrad/msvc8/qrad.vcproj
Normal file
@ -0,0 +1,496 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="qrad"
|
||||
ProjectGUID="{08E4D1DC-EEE6-40F6-ADD2-1092F5075F96}"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/qrad.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\common"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/qrad.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
BrowseInformation="1"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Debug/qrad.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/qrad.pdb"
|
||||
GenerateMapFile="true"
|
||||
MapFileName=".\Debug/qrad.map"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/qrad.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\common"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/qrad.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Release/qrad.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateMapFile="true"
|
||||
MapFileName=".\Release/qrad.map"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\common\bspfile.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\cmdlib.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lightmap.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\mathlib.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\polylib.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\qrad.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\scriplib.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\threads.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\trace.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\vismat.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;fi;fd"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\common\bspfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\cmdlib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\mathlib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\polylib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="qrad.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\scriplib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\common\threads.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1569
hlsdk/utils/qrad/qrad.c
Normal file
1569
hlsdk/utils/qrad/qrad.c
Normal file
File diff suppressed because it is too large
Load Diff
154
hlsdk/utils/qrad/qrad.h
Normal file
154
hlsdk/utils/qrad/qrad.h
Normal file
@ -0,0 +1,154 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
****/
|
||||
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "mathlib.h"
|
||||
#include "bspfile.h"
|
||||
#include "polylib.h"
|
||||
#include "threads.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#pragma warning(disable: 4142 4028)
|
||||
#include <io.h>
|
||||
#pragma warning(default: 4142 4028)
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <direct.h>
|
||||
#include <ctype.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
emit_surface,
|
||||
emit_point,
|
||||
emit_spotlight,
|
||||
emit_skylight
|
||||
} emittype_t;
|
||||
|
||||
|
||||
|
||||
typedef struct directlight_s
|
||||
{
|
||||
struct directlight_s *next;
|
||||
emittype_t type;
|
||||
int style;
|
||||
vec3_t origin;
|
||||
vec3_t intensity;
|
||||
vec3_t normal; // for surfaces and spotlights
|
||||
float stopdot; // for spotlights
|
||||
float stopdot2; // for spotlights
|
||||
} directlight_t;
|
||||
|
||||
|
||||
#define TRANSFER_SCALE (1.0f/16384)
|
||||
#define INVERSE_TRANSFER_SCALE 16384
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short patch;
|
||||
unsigned short transfer;
|
||||
} transfer_t;
|
||||
|
||||
|
||||
#define MAX_PATCHES 65536
|
||||
|
||||
typedef struct patch_s
|
||||
{
|
||||
winding_t *winding;
|
||||
vec3_t mins, maxs, face_mins, face_maxs;
|
||||
struct patch_s *next; // next in face
|
||||
int numtransfers;
|
||||
transfer_t *transfers;
|
||||
vec3_t origin;
|
||||
vec3_t normal;
|
||||
|
||||
dplane_t *plane;
|
||||
|
||||
float chop; // smallest acceptable width of patch face
|
||||
float scale[2]; // Scaling of texture in s & t
|
||||
|
||||
qboolean sky;
|
||||
|
||||
vec3_t totallight; // accumulated by radiosity
|
||||
// does NOT include light
|
||||
// accounted for by direct lighting
|
||||
vec3_t baselight; // emissivity only
|
||||
vec3_t directlight; // direct light value
|
||||
float area;
|
||||
|
||||
vec3_t reflectivity; // Average RGB of texture, modified by material type.
|
||||
|
||||
vec3_t samplelight;
|
||||
int samples; // for averaging direct light
|
||||
int faceNumber;
|
||||
} patch_t;
|
||||
|
||||
extern patch_t *face_patches[MAX_MAP_FACES];
|
||||
extern entity_t *face_entity[MAX_MAP_FACES];
|
||||
extern vec3_t face_offset[MAX_MAP_FACES]; // for rotating bmodels
|
||||
extern vec3_t face_centroids[MAX_MAP_EDGES];
|
||||
extern patch_t patches[MAX_PATCHES];
|
||||
extern unsigned num_patches;
|
||||
|
||||
extern int leafparents[MAX_MAP_LEAFS];
|
||||
extern int nodeparents[MAX_MAP_NODES];
|
||||
|
||||
extern float lightscale;
|
||||
extern float dlight_threshold;
|
||||
extern float coring;
|
||||
|
||||
void MakeShadowSplits (void);
|
||||
|
||||
//==============================================
|
||||
|
||||
_int64 getfreespace(char *filepath);
|
||||
long getfilesize(char *filename);
|
||||
time_t getfiletime(char *filename);
|
||||
|
||||
void BuildVisMatrix (void);
|
||||
void FreeVisMatrix (void);
|
||||
qboolean CheckVisBit (int p1, int p2);
|
||||
void TouchVMFFile (void);
|
||||
|
||||
//==============================================
|
||||
|
||||
extern qboolean extra;
|
||||
extern vec3_t ambient;
|
||||
extern float maxlight;
|
||||
extern unsigned numbounce;
|
||||
extern directlight_t *directlights[MAX_MAP_LEAFS];
|
||||
extern byte nodehit[MAX_MAP_NODES];
|
||||
extern float gamma;
|
||||
extern float indirect_sun;
|
||||
extern float smoothing_threshold;
|
||||
|
||||
void MakeTnodes (dmodel_t *bm);
|
||||
void PairEdges (void);
|
||||
qboolean IsIncremental(char *filename);
|
||||
int SaveIncremental(char *filename);
|
||||
int PartialHead (void);
|
||||
void BuildFacelights (int facenum);
|
||||
void PrecompLightmapOffsets();
|
||||
void FinalLightFace (int facenum);
|
||||
void PvsForOrigin (vec3_t org, byte *pvs);
|
||||
int TestLine_r (int node, vec3_t start, vec3_t stop);
|
||||
void CreateDirectLights (void);
|
||||
void DeleteDirectLights (void);
|
||||
int ProgressiveRefinement (void);
|
||||
vec_t PatchPlaneDist( patch_t *patch );
|
||||
void GetPhongNormal( int facenum, vec3_t spot, vec3_t phongnormal );
|
||||
|
||||
dleaf_t *PointInLeaf (vec3_t point);
|
320
hlsdk/utils/qrad/trace.c
Normal file
320
hlsdk/utils/qrad/trace.c
Normal file
@ -0,0 +1,320 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
****/
|
||||
|
||||
// trace.c
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "mathlib.h"
|
||||
#include "bspfile.h"
|
||||
#include "polylib.h"
|
||||
|
||||
// #define ON_EPSILON 0.001
|
||||
|
||||
typedef struct tnode_s
|
||||
{
|
||||
int type;
|
||||
vec3_t normal;
|
||||
float dist;
|
||||
int children[2];
|
||||
int pad;
|
||||
} tnode_t;
|
||||
|
||||
tnode_t *tnodes, *tnode_p;
|
||||
|
||||
/*
|
||||
==============
|
||||
MakeTnode
|
||||
|
||||
Converts the disk node structure into the efficient tracing structure
|
||||
==============
|
||||
*/
|
||||
void MakeTnode (int nodenum)
|
||||
{
|
||||
tnode_t *t;
|
||||
dplane_t *plane;
|
||||
int i;
|
||||
dnode_t *node;
|
||||
|
||||
t = tnode_p++;
|
||||
|
||||
node = dnodes + nodenum;
|
||||
plane = dplanes + node->planenum;
|
||||
|
||||
t->type = plane->type;
|
||||
VectorCopy (plane->normal, t->normal);
|
||||
t->dist = plane->dist;
|
||||
|
||||
for (i=0 ; i<2 ; i++)
|
||||
{
|
||||
if (node->children[i] < 0)
|
||||
t->children[i] = dleafs[-node->children[i] - 1].contents;
|
||||
else
|
||||
{
|
||||
t->children[i] = tnode_p - tnodes;
|
||||
MakeTnode (node->children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
MakeTnodes
|
||||
|
||||
Loads the node structure out of a .bsp file to be used for light occlusion
|
||||
=============
|
||||
*/
|
||||
void MakeTnodes (dmodel_t *bm)
|
||||
{
|
||||
// 32 byte align the structs
|
||||
tnodes = calloc( (numnodes+1), sizeof(tnode_t));
|
||||
tnodes = (tnode_t *)(((int)tnodes + 31)&~31);
|
||||
tnode_p = tnodes;
|
||||
|
||||
MakeTnode (0);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================
|
||||
|
||||
byte nodehit[MAX_MAP_NODES];
|
||||
|
||||
/*
|
||||
=============
|
||||
PartialHead
|
||||
|
||||
=============
|
||||
*/
|
||||
int PartialHead (void)
|
||||
{
|
||||
int nodenum;
|
||||
dnode_t *node;
|
||||
|
||||
tnode_p = tnodes;
|
||||
|
||||
// skip single sided nodes from root
|
||||
nodenum = 0;
|
||||
while (nodenum >= 0)
|
||||
{
|
||||
node = &dnodes[nodenum];
|
||||
if ( (node->children[0] < 0) || !nodehit[node->children[0]])
|
||||
nodenum = node->children[1];
|
||||
else if ((node->children[1] < 0) || !nodehit[node->children[1]])
|
||||
nodenum = node->children[0];
|
||||
else
|
||||
break;
|
||||
}
|
||||
return nodenum;
|
||||
}
|
||||
|
||||
//==========================================================
|
||||
|
||||
|
||||
int TestLine_r (int node, vec3_t start, vec3_t stop)
|
||||
{
|
||||
tnode_t *tnode;
|
||||
float front, back;
|
||||
vec3_t mid;
|
||||
float frac;
|
||||
int side;
|
||||
int r;
|
||||
|
||||
if (node == CONTENTS_SOLID)
|
||||
return CONTENTS_SOLID;
|
||||
if (node == CONTENTS_SKY)
|
||||
return CONTENTS_SKY;
|
||||
if (node < 0)
|
||||
return CONTENTS_EMPTY;
|
||||
|
||||
tnode = &tnodes[node];
|
||||
switch (tnode->type)
|
||||
{
|
||||
case PLANE_X:
|
||||
front = start[0] - tnode->dist;
|
||||
back = stop[0] - tnode->dist;
|
||||
break;
|
||||
case PLANE_Y:
|
||||
front = start[1] - tnode->dist;
|
||||
back = stop[1] - tnode->dist;
|
||||
break;
|
||||
case PLANE_Z:
|
||||
front = start[2] - tnode->dist;
|
||||
back = stop[2] - tnode->dist;
|
||||
break;
|
||||
default:
|
||||
front = (start[0]*tnode->normal[0] + start[1]*tnode->normal[1] + start[2]*tnode->normal[2]) - tnode->dist;
|
||||
back = (stop[0]*tnode->normal[0] + stop[1]*tnode->normal[1] + stop[2]*tnode->normal[2]) - tnode->dist;
|
||||
break;
|
||||
}
|
||||
|
||||
if (front >= -ON_EPSILON && back >= -ON_EPSILON)
|
||||
return TestLine_r (tnode->children[0], start, stop);
|
||||
|
||||
if (front < ON_EPSILON && back < ON_EPSILON)
|
||||
return TestLine_r (tnode->children[1], start, stop);
|
||||
|
||||
side = front < 0;
|
||||
|
||||
frac = front / (front-back);
|
||||
|
||||
mid[0] = start[0] + (stop[0] - start[0])*frac;
|
||||
mid[1] = start[1] + (stop[1] - start[1])*frac;
|
||||
mid[2] = start[2] + (stop[2] - start[2])*frac;
|
||||
|
||||
r = TestLine_r (tnode->children[side], start, mid);
|
||||
if (r != CONTENTS_EMPTY)
|
||||
return r;
|
||||
return TestLine_r (tnode->children[!side], mid, stop);
|
||||
}
|
||||
|
||||
int TestLine (vec3_t start, vec3_t stop)
|
||||
{
|
||||
return TestLine_r (0, start, stop);
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
LINE TRACING
|
||||
|
||||
The major lighting operation is a point to point visibility test, performed
|
||||
by recursive subdivision of the line by the BSP tree.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t backpt;
|
||||
int side;
|
||||
int node;
|
||||
} tracestack_t;
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
TestLine
|
||||
==============
|
||||
*/
|
||||
qboolean _TestLine (vec3_t start, vec3_t stop)
|
||||
{
|
||||
int node;
|
||||
float front, back;
|
||||
tracestack_t *tstack_p;
|
||||
int side;
|
||||
float frontx,fronty, frontz, backx, backy, backz;
|
||||
tracestack_t tracestack[64];
|
||||
tnode_t *tnode;
|
||||
|
||||
frontx = start[0];
|
||||
fronty = start[1];
|
||||
frontz = start[2];
|
||||
backx = stop[0];
|
||||
backy = stop[1];
|
||||
backz = stop[2];
|
||||
|
||||
tstack_p = tracestack;
|
||||
node = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (node == CONTENTS_SOLID)
|
||||
{
|
||||
#if 0
|
||||
float d1, d2, d3;
|
||||
|
||||
d1 = backx - frontx;
|
||||
d2 = backy - fronty;
|
||||
d3 = backz - frontz;
|
||||
|
||||
if (d1*d1 + d2*d2 + d3*d3 > 1)
|
||||
#endif
|
||||
return false; // DONE!
|
||||
}
|
||||
|
||||
while (node < 0)
|
||||
{
|
||||
// pop up the stack for a back side
|
||||
tstack_p--;
|
||||
if (tstack_p < tracestack)
|
||||
return true;
|
||||
node = tstack_p->node;
|
||||
|
||||
// set the hit point for this plane
|
||||
|
||||
frontx = backx;
|
||||
fronty = backy;
|
||||
frontz = backz;
|
||||
|
||||
// go down the back side
|
||||
|
||||
backx = tstack_p->backpt[0];
|
||||
backy = tstack_p->backpt[1];
|
||||
backz = tstack_p->backpt[2];
|
||||
|
||||
node = tnodes[tstack_p->node].children[!tstack_p->side];
|
||||
}
|
||||
|
||||
tnode = &tnodes[node];
|
||||
|
||||
switch (tnode->type)
|
||||
{
|
||||
case PLANE_X:
|
||||
front = frontx - tnode->dist;
|
||||
back = backx - tnode->dist;
|
||||
break;
|
||||
case PLANE_Y:
|
||||
front = fronty - tnode->dist;
|
||||
back = backy - tnode->dist;
|
||||
break;
|
||||
case PLANE_Z:
|
||||
front = frontz - tnode->dist;
|
||||
back = backz - tnode->dist;
|
||||
break;
|
||||
default:
|
||||
front = (frontx*tnode->normal[0] + fronty*tnode->normal[1] + frontz*tnode->normal[2]) - tnode->dist;
|
||||
back = (backx*tnode->normal[0] + backy*tnode->normal[1] + backz*tnode->normal[2]) - tnode->dist;
|
||||
break;
|
||||
}
|
||||
|
||||
if (front > -ON_EPSILON && back > -ON_EPSILON)
|
||||
{
|
||||
node = tnode->children[0];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (front < ON_EPSILON && back < ON_EPSILON)
|
||||
{
|
||||
node = tnode->children[1];
|
||||
continue;
|
||||
}
|
||||
|
||||
side = front < 0;
|
||||
|
||||
front = front / (front-back);
|
||||
|
||||
tstack_p->node = node;
|
||||
tstack_p->side = side;
|
||||
tstack_p->backpt[0] = backx;
|
||||
tstack_p->backpt[1] = backy;
|
||||
tstack_p->backpt[2] = backz;
|
||||
|
||||
tstack_p++;
|
||||
|
||||
backx = frontx + front*(backx-frontx);
|
||||
backy = fronty + front*(backy-fronty);
|
||||
backz = frontz + front*(backz-frontz);
|
||||
|
||||
node = tnode->children[side];
|
||||
}
|
||||
}
|
||||
|
||||
|
569
hlsdk/utils/qrad/vismat.c
Normal file
569
hlsdk/utils/qrad/vismat.c
Normal file
@ -0,0 +1,569 @@
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
****/
|
||||
|
||||
#include "qrad.h"
|
||||
|
||||
#define HALFBIT
|
||||
|
||||
extern char source[MAX_PATH];
|
||||
extern char vismatfile[_MAX_PATH];
|
||||
extern char incrementfile[_MAX_PATH];
|
||||
extern qboolean incremental;
|
||||
|
||||
/*
|
||||
===================================================================
|
||||
|
||||
VISIBILITY MATRIX
|
||||
|
||||
Determine which patches can see each other
|
||||
Use the PVS to accelerate if available
|
||||
===================================================================
|
||||
*/
|
||||
byte *vismatrix;
|
||||
|
||||
dleaf_t *PointInLeaf (vec3_t point)
|
||||
{
|
||||
int nodenum;
|
||||
vec_t dist;
|
||||
dnode_t *node;
|
||||
dplane_t *plane;
|
||||
|
||||
nodenum = 0;
|
||||
while (nodenum >= 0)
|
||||
{
|
||||
node = &dnodes[nodenum];
|
||||
plane = &dplanes[node->planenum];
|
||||
dist = DotProduct (point, plane->normal) - plane->dist;
|
||||
if (dist > 0)
|
||||
nodenum = node->children[0];
|
||||
else
|
||||
nodenum = node->children[1];
|
||||
}
|
||||
|
||||
return &dleafs[-nodenum - 1];
|
||||
}
|
||||
|
||||
|
||||
void PvsForOrigin (vec3_t org, byte *pvs)
|
||||
{
|
||||
dleaf_t *leaf;
|
||||
|
||||
if (!visdatasize)
|
||||
{
|
||||
memset (pvs, 255, (numleafs+7)/8 );
|
||||
return;
|
||||
}
|
||||
|
||||
leaf = PointInLeaf (org);
|
||||
if (leaf->visofs == -1)
|
||||
Error ("leaf->visofs == -1");
|
||||
|
||||
DecompressVis (&dvisdata[leaf->visofs], pvs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
PatchPlaneDist
|
||||
|
||||
Fixes up patch planes for brush models with an origin brush
|
||||
==============
|
||||
*/
|
||||
vec_t PatchPlaneDist( patch_t *patch )
|
||||
{
|
||||
return patch->plane->dist + DotProduct( face_offset[ patch->faceNumber ], patch->normal );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
TestPatchToFace
|
||||
|
||||
Sets vis bits for all patches in the face
|
||||
==============
|
||||
*/
|
||||
void TestPatchToFace (unsigned patchnum, int facenum, int head, unsigned bitpos)
|
||||
{
|
||||
patch_t *patch = &patches[patchnum];
|
||||
patch_t *patch2 = face_patches[facenum];
|
||||
|
||||
// if emitter is behind that face plane, skip all patches
|
||||
|
||||
if ( patch2 && DotProduct(patch->origin, patch2->normal) > PatchPlaneDist(patch2)+1.01 )
|
||||
{
|
||||
// we need to do a real test
|
||||
for ( ; patch2 ; patch2 = patch2->next)
|
||||
{
|
||||
unsigned m = patch2 - patches;
|
||||
|
||||
// check vis between patch and patch2
|
||||
// if bit has not already been set
|
||||
// && v2 is not behind light plane
|
||||
// && v2 is visible from v1
|
||||
if ( m > patchnum
|
||||
&& DotProduct (patch2->origin, patch->normal) > PatchPlaneDist(patch)+1.01
|
||||
&& TestLine_r (head, patch->origin, patch2->origin) == CONTENTS_EMPTY )
|
||||
{
|
||||
// patchnum can see patch m
|
||||
int bitset = bitpos+m;
|
||||
vismatrix[ bitset>>3 ] |= 1 << (bitset&7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
BuildVisRow
|
||||
|
||||
Calc vis bits from a single patch
|
||||
==============
|
||||
*/
|
||||
void BuildVisRow (int patchnum, byte *pvs, int head, unsigned bitpos)
|
||||
{
|
||||
int j, k, l;
|
||||
patch_t *patch;
|
||||
byte face_tested[MAX_MAP_FACES];
|
||||
dleaf_t *leaf;
|
||||
|
||||
patch = &patches[patchnum];
|
||||
|
||||
memset (face_tested, 0, numfaces);
|
||||
|
||||
// leaf 0 is the solid leaf (skipped)
|
||||
for (j=1, leaf=dleafs+1 ; j<numleafs ; j++, leaf++)
|
||||
{
|
||||
if ( ! ( pvs[(j-1)>>3] & (1<<((j-1)&7)) ) )
|
||||
continue; // not in pvs
|
||||
for (k=0 ; k<leaf->nummarksurfaces ; k++)
|
||||
{
|
||||
l = dmarksurfaces[leaf->firstmarksurface + k];
|
||||
|
||||
// faces can be marksurfed by multiple leaves, but
|
||||
// don't bother testing again
|
||||
if (face_tested[l])
|
||||
continue;
|
||||
face_tested[l] = 1;
|
||||
|
||||
TestPatchToFace (patchnum, l, head, bitpos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
BuildVisLeafs
|
||||
|
||||
This is run by multiple threads
|
||||
===========
|
||||
*/
|
||||
void BuildVisLeafs (int threadnum)
|
||||
{
|
||||
int i;
|
||||
int lface, facenum, facenum2;
|
||||
byte pvs[(MAX_MAP_LEAFS+7)/8];
|
||||
dleaf_t *srcleaf, *leaf;
|
||||
patch_t *patch;
|
||||
int head;
|
||||
unsigned bitpos;
|
||||
unsigned patchnum;
|
||||
|
||||
while (1)
|
||||
{
|
||||
//
|
||||
// build a minimal BSP tree that only
|
||||
// covers areas relevent to the PVS
|
||||
//
|
||||
i = GetThreadWork ();
|
||||
if (i == -1)
|
||||
break;
|
||||
i++; // skip leaf 0
|
||||
srcleaf = &dleafs[i];
|
||||
DecompressVis (&dvisdata[srcleaf->visofs], pvs);
|
||||
#if 0
|
||||
// is this valid multithreaded???
|
||||
memset (nodehit, 0, numnodes);
|
||||
for (j=1, leaf=dleafs+1 ; j<numleafs ; j++, leaf++)
|
||||
{
|
||||
if ( !( pvs[(j-1)>>3] & (1<<((j-1)&7)) ) )
|
||||
continue;
|
||||
n = leafparents[j];
|
||||
while (n != -1)
|
||||
{
|
||||
nodehit[n] = 1;
|
||||
n = nodeparents[n];
|
||||
}
|
||||
}
|
||||
|
||||
head = PartialHead ();
|
||||
#else
|
||||
head = 0;
|
||||
#endif
|
||||
|
||||
//
|
||||
// go through all the faces inside the
|
||||
// leaf, and process the patches that
|
||||
// actually have origins inside
|
||||
//
|
||||
for (lface = 0 ; lface < srcleaf->nummarksurfaces ; lface++)
|
||||
{
|
||||
facenum = dmarksurfaces[srcleaf->firstmarksurface + lface];
|
||||
for (patch = face_patches[facenum] ; patch ; patch=patch->next)
|
||||
{
|
||||
leaf = PointInLeaf (patch->origin);
|
||||
if (leaf != srcleaf)
|
||||
continue;
|
||||
|
||||
patchnum = patch - patches;
|
||||
|
||||
#ifdef HALFBIT
|
||||
bitpos = patchnum * num_patches - (patchnum*(patchnum+1))/2;
|
||||
#else
|
||||
bitpos = patchnum * num_patches;
|
||||
#endif
|
||||
// build to all other world leafs
|
||||
BuildVisRow (patchnum, pvs, head, bitpos);
|
||||
|
||||
// build to bmodel faces
|
||||
if (nummodels < 2)
|
||||
continue;
|
||||
for (facenum2 = dmodels[1].firstface ; facenum2 < numfaces ; facenum2++)
|
||||
TestPatchToFace (patchnum, facenum2, head, bitpos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
getfiletime
|
||||
==============
|
||||
*/
|
||||
|
||||
time_t
|
||||
getfiletime(char *filename)
|
||||
{
|
||||
time_t filetime = 0;
|
||||
struct _stat filestat;
|
||||
|
||||
if ( _stat(filename, &filestat) == 0 )
|
||||
filetime = max( filestat.st_mtime, filestat.st_ctime );
|
||||
|
||||
return filetime;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
getfilesize
|
||||
==============
|
||||
*/
|
||||
|
||||
long
|
||||
getfilesize(char *filename)
|
||||
{
|
||||
long size = 0;
|
||||
struct _stat filestat;
|
||||
|
||||
if ( _stat(filename, &filestat) == 0 )
|
||||
size = filestat.st_size;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
getfiledata
|
||||
==============
|
||||
*/
|
||||
|
||||
long
|
||||
getfiledata(char *filename, char *buffer, int buffersize)
|
||||
{
|
||||
long size = 0;
|
||||
int handle;
|
||||
time_t start,end;
|
||||
time(&start);
|
||||
|
||||
if ( (handle = _open( filename, _O_RDONLY | _O_BINARY )) != -1 )
|
||||
{
|
||||
int bytesread;
|
||||
printf("%-20s Restoring [%-13s - ", "BuildVisMatrix:", filename );
|
||||
while( ( bytesread = _read( handle, buffer, min( 32*1024, buffersize - size ) ) ) > 0 )
|
||||
{
|
||||
size += bytesread;
|
||||
buffer += bytesread;
|
||||
}
|
||||
_close( handle );
|
||||
time(&end);
|
||||
printf("%10.3fMB] (%d)\n",size/(1024.0*1024.0), end-start);
|
||||
}
|
||||
|
||||
if (buffersize != size)
|
||||
{
|
||||
printf( "Invalid file [%s] found. File will be rebuilt!\n", filename );
|
||||
unlink(filename);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
getfreespace
|
||||
==============
|
||||
*/
|
||||
|
||||
_int64
|
||||
getfreespace(char *filename)
|
||||
{
|
||||
_int64 freespace = 0;
|
||||
int drive = 0;
|
||||
struct _diskfree_t df;
|
||||
|
||||
if ( filename[0] && filename[1] == ':' )
|
||||
drive = toupper(filename[0]) - 'A' + 1;
|
||||
else
|
||||
drive = _getdrive();
|
||||
|
||||
if ( _getdiskfree(drive, &df) == 0 )
|
||||
{
|
||||
freespace = df.avail_clusters;
|
||||
freespace *= df.sectors_per_cluster;
|
||||
freespace *= df.bytes_per_sector;
|
||||
}
|
||||
|
||||
return freespace;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
putfiledata
|
||||
==============
|
||||
*/
|
||||
|
||||
long
|
||||
putfiledata(char *filename, char *buffer, int buffersize)
|
||||
{
|
||||
long size = 0;
|
||||
int handle;
|
||||
|
||||
if ( getfreespace(filename) >= (_int64)(buffersize - getfilesize(filename)) )
|
||||
{
|
||||
if ( (handle = _open( filename, _O_WRONLY | _O_BINARY | _O_CREAT | _O_TRUNC, _S_IREAD | _S_IWRITE )) != -1 )
|
||||
{
|
||||
int byteswritten;
|
||||
qprintf("Writing [%s] with new saved qrad data", filename );
|
||||
while( ( byteswritten = _write( handle, buffer, min( 32*1024, buffersize - size ) ) ) > 0 )
|
||||
{
|
||||
size += byteswritten;
|
||||
buffer += byteswritten;
|
||||
if ( size >= buffersize )
|
||||
break;
|
||||
}
|
||||
qprintf("(%d)\n", size );
|
||||
|
||||
_close( handle );
|
||||
}
|
||||
}
|
||||
else
|
||||
printf("Insufficient disk space(%ld) for 'incremental QRAD save file'!\n",
|
||||
buffersize - getfilesize(filename) );
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
IsIncremental
|
||||
==============
|
||||
*/
|
||||
|
||||
qboolean
|
||||
IsIncremental(char *filename)
|
||||
{
|
||||
qboolean status = false;
|
||||
int sum;
|
||||
int handle;
|
||||
|
||||
if ( (handle = _open( filename, _O_RDONLY | _O_BINARY )) != -1 )
|
||||
{
|
||||
if ( _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dmodels_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dvertexes_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dplanes_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dleafs_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dnodes_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == texinfo_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dclipnodes_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dfaces_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dmarksurfaces_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dsurfedges_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dedges_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dtexdata_checksum
|
||||
&& _read( handle, &sum, sizeof(sum) ) == sizeof(sum) && sum == dvisdata_checksum )
|
||||
status = true;
|
||||
_close( handle );
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SaveIncremental
|
||||
==============
|
||||
*/
|
||||
|
||||
int
|
||||
SaveIncremental(char *filename)
|
||||
{
|
||||
long size = 0;
|
||||
int handle;
|
||||
int expected_size = 13*sizeof(int);
|
||||
|
||||
if ( getfreespace(filename) >= expected_size )
|
||||
{
|
||||
if ( (handle = _open( filename, _O_WRONLY | _O_BINARY | _O_CREAT | _O_TRUNC, _S_IREAD | _S_IWRITE )) != -1 )
|
||||
{
|
||||
qprintf("Writing [%s] with new saved qrad data", filename );
|
||||
|
||||
if ( _write( handle, &dmodels_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dvertexes_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dplanes_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dleafs_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dnodes_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &texinfo_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dclipnodes_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dfaces_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dmarksurfaces_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dsurfedges_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dedges_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dtexdata_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int))
|
||||
&& _write( handle, &dvisdata_checksum, sizeof(int) ) == sizeof(int) && (size += sizeof(int)) )
|
||||
{
|
||||
qprintf("(%d)\n", size );
|
||||
}
|
||||
else
|
||||
{
|
||||
qprintf("...failed!");
|
||||
}
|
||||
_close( handle );
|
||||
}
|
||||
}
|
||||
else
|
||||
printf("Insufficient disk space(%ld) for incremental file[%s]'!\n",
|
||||
expected_size, filename );
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
BuildVisMatrix
|
||||
==============
|
||||
*/
|
||||
void BuildVisMatrix (void)
|
||||
{
|
||||
int c;
|
||||
HANDLE h;
|
||||
|
||||
#ifdef HALFBIT
|
||||
c = ((num_patches+1)*(((num_patches+1)+15)/16));
|
||||
#else
|
||||
c = num_patches*((num_patches+7)/8);
|
||||
#endif
|
||||
|
||||
qprintf ("visibility matrix: %5.1f megs\n", c/(1024*1024.0));
|
||||
|
||||
if ( h = GlobalAlloc( GMEM_FIXED | GMEM_ZEROINIT, c ) )
|
||||
vismatrix = GlobalLock( h );
|
||||
else
|
||||
Error ("vismatrix too big");
|
||||
|
||||
strcpy(vismatfile, source);
|
||||
StripExtension (vismatfile);
|
||||
DefaultExtension(vismatfile, ".r1");
|
||||
|
||||
if ( !incremental
|
||||
|| !IsIncremental(incrementfile)
|
||||
|| getfilesize(vismatfile) != c
|
||||
|| getfiledata(vismatfile,vismatrix, c) != c )
|
||||
{
|
||||
// memset (vismatrix, 0, c);
|
||||
RunThreadsOn (numleafs-1, true, BuildVisLeafs);
|
||||
}
|
||||
// Get rid of any old _bogus_ r1 files; we never read them!
|
||||
unlink(vismatfile);
|
||||
}
|
||||
|
||||
void FreeVisMatrix (void)
|
||||
{
|
||||
if ( vismatrix )
|
||||
{
|
||||
HANDLE h = GlobalHandle(vismatrix);
|
||||
GlobalUnlock(h);
|
||||
GlobalFree(h);
|
||||
vismatrix = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
touchfile
|
||||
=============
|
||||
*/
|
||||
|
||||
void
|
||||
TouchFile(char *filename)
|
||||
{
|
||||
int handle;
|
||||
if ( (handle = _open( filename, _O_RDWR | _O_BINARY )) != -1 )
|
||||
{
|
||||
char bytebuffer;
|
||||
qprintf("Updating saved qrad data <%s> with current time.\n", filename);
|
||||
_read( handle, &bytebuffer, sizeof(bytebuffer));
|
||||
_lseek(handle,0,SEEK_SET);
|
||||
_write( handle, &bytebuffer, sizeof(bytebuffer));
|
||||
_close( handle );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
CheckVisBit
|
||||
==============
|
||||
*/
|
||||
qboolean CheckVisBit (int p1, int p2)
|
||||
{
|
||||
int t;
|
||||
int bitpos;
|
||||
|
||||
if (p1 > p2)
|
||||
{
|
||||
t = p1;
|
||||
p1 = p2;
|
||||
p2 = t;
|
||||
}
|
||||
|
||||
#ifdef HALFBIT
|
||||
bitpos = p1 * num_patches - (p1*(p1+1))/2 + p2;
|
||||
#else
|
||||
bitpos = p1 * num_patches + p2;
|
||||
#endif
|
||||
|
||||
if (vismatrix[bitpos>>3] & (1<<(bitpos&7)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user