mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
rbdmap.exe compiles but does not run yet
This commit is contained in:
parent
9337596fa8
commit
b0abbe4d35
22 changed files with 1148 additions and 113 deletions
|
@ -340,6 +340,7 @@ else (RAPIDJSON_FOUND)
|
|||
endif (RAPIDJSON_FOUND)
|
||||
|
||||
include_directories("libs/imgui")
|
||||
include_directories("libs/mikktspace")
|
||||
|
||||
macro(SET_OPTION option value)
|
||||
set(${option} ${value} CACHE "" INTERNAL FORCE)
|
||||
|
|
|
@ -69,7 +69,7 @@ END_CLASS
|
|||
|
||||
/*
|
||||
================
|
||||
idGameEdit::ParseSpawnArgsToRenderLight
|
||||
idGameEdit::ParseSpawnArgsToRenderEnvprobe
|
||||
|
||||
parse the light parameters
|
||||
this is the canonical renderLight parm parsing,
|
||||
|
|
|
@ -349,6 +349,14 @@ public:
|
|||
virtual void SwitchToGame( currentGame_t newGame ) = 0;
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
virtual void LoadPacifierBinarizeFilename( const char* filename, const char* reason ) = 0;
|
||||
virtual void LoadPacifierBinarizeInfo( const char* info ) = 0;
|
||||
virtual void LoadPacifierBinarizeMiplevel( int level, int maxLevel ) = 0;
|
||||
virtual void LoadPacifierBinarizeProgress( float progress ) = 0;
|
||||
virtual void LoadPacifierBinarizeEnd() = 0;
|
||||
virtual void LoadPacifierBinarizeProgressTotal( int total ) = 0;
|
||||
virtual void LoadPacifierBinarizeProgressIncrement( int step ) = 0;
|
||||
};
|
||||
|
||||
extern idCommon* common;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
// RB: avoid problems with SourceAnnotations.h
|
||||
#define VERIFY_FORMAT_STRING
|
||||
#ifndef TYPEINFOPROJECT
|
||||
#if !defined( TYPEINFOPROJECT ) && !defined( DMAP )
|
||||
#include "idlib/sys/sys_defines.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014-2021 Robert Beckebans
|
||||
Copyright (C) 2014-2024 Robert Beckebans
|
||||
Copyright (C) 2014-2016 Kot in Action Creative Artel
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
@ -29,7 +29,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
#include "framework/Common_local.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
@ -61,7 +62,7 @@ void idBinaryImage::Load2DFromMemory( int width, int height, const byte* pic_con
|
|||
fileData.height = height;
|
||||
fileData.numLevels = numLevels;
|
||||
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d)", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d)", width, height ) );
|
||||
|
||||
byte* pic = ( byte* )Mem_Alloc( width * height * 4, TAG_TEMP );
|
||||
memcpy( pic, pic_const, width * height * 4 );
|
||||
|
@ -102,7 +103,7 @@ void idBinaryImage::Load2DFromMemory( int width, int height, const byte* pic_con
|
|||
{
|
||||
idBinaryImageData& img = images[ level ];
|
||||
|
||||
commonLocal.LoadPacifierBinarizeMiplevel( level + 1, numLevels );
|
||||
common->LoadPacifierBinarizeMiplevel( level + 1, numLevels );
|
||||
|
||||
// Images that are going to be DXT compressed and aren't multiples of 4 need to be
|
||||
// padded out before compressing.
|
||||
|
@ -141,13 +142,13 @@ void idBinaryImage::Load2DFromMemory( int width, int height, const byte* pic_con
|
|||
img.Alloc( dxtWidth * dxtHeight / 2 );
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT1HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT1Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -160,13 +161,13 @@ void idBinaryImage::Load2DFromMemory( int width, int height, const byte* pic_con
|
|||
{
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5HQ", width, height ) );
|
||||
|
||||
dxt.CompressNormalMapDXT5HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5Fast", width, height ) );
|
||||
|
||||
dxt.CompressNormalMapDXT5Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -175,13 +176,13 @@ void idBinaryImage::Load2DFromMemory( int width, int height, const byte* pic_con
|
|||
{
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5HQ", width, height ) );
|
||||
|
||||
dxt.CompressYCoCgDXT5HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5Fast", width, height ) );
|
||||
|
||||
dxt.CompressYCoCgDXT5Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -191,13 +192,13 @@ void idBinaryImage::Load2DFromMemory( int width, int height, const byte* pic_con
|
|||
fileData.colorFormat = colorFormat = CFM_DEFAULT;
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT5HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT5Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -321,7 +322,7 @@ void idBinaryImage::Load2DAtlasMipchainFromMemory( int width, int height, const
|
|||
fileData.height = height;
|
||||
fileData.numLevels = numLevels;
|
||||
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d)", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d)", width, height ) );
|
||||
|
||||
byte* sourcePic = ( byte* )Mem_Alloc( width * height * 4, TAG_TEMP );
|
||||
memcpy( sourcePic, pic_const, width * height * 4 );
|
||||
|
@ -414,7 +415,7 @@ void idBinaryImage::Load2DAtlasMipchainFromMemory( int width, int height, const
|
|||
}
|
||||
// RB end
|
||||
|
||||
commonLocal.LoadPacifierBinarizeMiplevel( level + 1, numLevels );
|
||||
common->LoadPacifierBinarizeMiplevel( level + 1, numLevels );
|
||||
|
||||
// Images that are going to be DXT compressed and aren't multiples of 4 need to be
|
||||
// padded out before compressing.
|
||||
|
@ -453,13 +454,13 @@ void idBinaryImage::Load2DAtlasMipchainFromMemory( int width, int height, const
|
|||
img.Alloc( dxtWidth * dxtHeight / 2 );
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT1HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT1Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -472,13 +473,13 @@ void idBinaryImage::Load2DAtlasMipchainFromMemory( int width, int height, const
|
|||
{
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5HQ", width, height ) );
|
||||
|
||||
dxt.CompressNormalMapDXT5HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - NormalMapDXT5Fast", width, height ) );
|
||||
|
||||
dxt.CompressNormalMapDXT5Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -487,13 +488,13 @@ void idBinaryImage::Load2DAtlasMipchainFromMemory( int width, int height, const
|
|||
{
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5HQ", width, height ) );
|
||||
|
||||
dxt.CompressYCoCgDXT5HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - YCoCgDXT5Fast", width, height ) );
|
||||
|
||||
dxt.CompressYCoCgDXT5Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -503,13 +504,13 @@ void idBinaryImage::Load2DAtlasMipchainFromMemory( int width, int height, const
|
|||
fileData.colorFormat = colorFormat = CFM_DEFAULT;
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT5HQ( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, height ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, height ) );
|
||||
|
||||
dxt.CompressImageDXT5Fast( dxtPic, img.data, dxtWidth, dxtHeight );
|
||||
}
|
||||
|
@ -653,7 +654,7 @@ idBinaryImage::LoadCubeFromMemory
|
|||
*/
|
||||
void idBinaryImage::LoadCubeFromMemory( int width, const byte* pics[6], int numLevels, textureFormat_t& textureFormat, bool gammaMips )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "cube (%d)", width ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "cube (%d)", width ) );
|
||||
|
||||
fileData.textureType = TT_CUBIC;
|
||||
fileData.format = textureFormat;
|
||||
|
@ -674,7 +675,7 @@ void idBinaryImage::LoadCubeFromMemory( int width, const byte* pics[6], int numL
|
|||
// compress data or convert floats as necessary
|
||||
idBinaryImageData& img = images[ level * 6 + side ];
|
||||
|
||||
commonLocal.LoadPacifierBinarizeMiplevel( level, fileData.numLevels );
|
||||
common->LoadPacifierBinarizeMiplevel( level, fileData.numLevels );
|
||||
|
||||
// handle padding blocks less than 4x4 for the DXT compressors
|
||||
ALIGN16( byte padBlock[64] );
|
||||
|
@ -703,13 +704,13 @@ void idBinaryImage::LoadCubeFromMemory( int width, const byte* pics[6], int numL
|
|||
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, width ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1HQ", width, width ) );
|
||||
|
||||
dxt.CompressImageDXT1HQ( padSrc, img.data, padSize, padSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, width ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT1Fast", width, width ) );
|
||||
|
||||
dxt.CompressImageDXT1Fast( padSrc, img.data, padSize, padSize );
|
||||
}
|
||||
|
@ -721,13 +722,13 @@ void idBinaryImage::LoadCubeFromMemory( int width, const byte* pics[6], int numL
|
|||
|
||||
if( image_highQualityCompression.GetBool() )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, width ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5HQ", width, width ) );
|
||||
|
||||
dxt.CompressImageDXT5HQ( padSrc, img.data, padSize, padSize );
|
||||
}
|
||||
else
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, width ) );
|
||||
common->LoadPacifierBinarizeInfo( va( "(%d x %d) - DXT5Fast", width, width ) );
|
||||
|
||||
dxt.CompressImageDXT5Fast( padSrc, img.data, padSize, padSize );
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
#include "framework/Common_local.h"
|
||||
|
||||
#include "DXTCodec_local.h"
|
||||
#include "DXTCodec.h"
|
||||
|
||||
|
@ -2211,7 +2211,7 @@ void idDxtEncoder::CompressImageDXT1HQ( const byte* inBuf, byte* outBuf, int wid
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ void idDxtEncoder::CompressImageDXT5HQ( const byte* inBuf, byte* outBuf, int wid
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -2393,7 +2393,7 @@ void idDxtEncoder::CompressImageCTX1HQ( const byte* inBuf, byte* outBuf, int wid
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -2887,7 +2887,7 @@ void idDxtEncoder::CompressYCoCgDXT5HQ( const byte* inBuf, byte* outBuf, int wid
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
ScaleYCoCg( block );
|
||||
|
@ -2994,7 +2994,7 @@ void idDxtEncoder::CompressYCoCgCTX1DXT5AHQ( const byte* inBuf, byte* outBuf, in
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -3143,7 +3143,7 @@ void idDxtEncoder::CompressNormalMapDXT1HQ( const byte* inBuf, byte* outBuf, int
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -3213,7 +3213,7 @@ void idDxtEncoder::CompressNormalMapDXT1RenormalizeHQ( const byte* inBuf, byte*
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -3476,7 +3476,7 @@ void idDxtEncoder::CompressNormalMapDXT5HQ( const byte* inBuf, byte* outBuf, int
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -3588,7 +3588,7 @@ void idDxtEncoder::CompressNormalMapDXT5RenormalizeHQ( const byte* inBuf, byte*
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -3675,7 +3675,7 @@ void idDxtEncoder::CompressNormalMapDXN2HQ( const byte* inBuf, byte* outBuf, int
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -4437,7 +4437,7 @@ void idDxtEncoder::CompressImageDXT1Fast_Generic( const byte* inBuf, byte* outBu
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -4482,7 +4482,7 @@ void idDxtEncoder::CompressImageDXT1AlphaFast_Generic( const byte* inBuf, byte*
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -4536,7 +4536,7 @@ void idDxtEncoder::CompressImageDXT5Fast_Generic( const byte* inBuf, byte* outBu
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -4887,7 +4887,7 @@ void idDxtEncoder::CompressYCoCgDXT5Fast_Generic( const byte* inBuf, byte* outBu
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -4942,7 +4942,7 @@ void idDxtEncoder::CompressYCoCgAlphaDXT5Fast( const byte* inBuf, byte* outBuf,
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -5010,7 +5010,7 @@ void idDxtEncoder::CompressYCoCgCTX1DXT5AFast_Generic( const byte* inBuf, byte*
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -5204,7 +5204,7 @@ void idDxtEncoder::CompressNormalMapDXT5Fast_Generic( const byte* inBuf, byte* o
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -5253,7 +5253,7 @@ void idDxtEncoder::CompressImageDXN1Fast_Generic( const byte* inBuf, byte* outBu
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -5297,7 +5297,7 @@ void idDxtEncoder::CompressNormalMapDXN2Fast_Generic( const byte* inBuf, byte* o
|
|||
{
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
ExtractBlock( inBuf + i * 4, width, block );
|
||||
|
||||
|
@ -5460,7 +5460,7 @@ void idDxtEncoder::ConvertNormalMapDXN2_DXT5( const byte* inBuf, byte* outBuf, i
|
|||
{
|
||||
for( int i = 0; i < width; i += 4, inBuf += 16, outBuf += 16 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
// decode normal Y stored as a DXT5 alpha channel
|
||||
DecodeDXNAlphaValues( inBuf + 0, values );
|
||||
|
@ -5612,7 +5612,7 @@ void idDxtEncoder::ConvertNormalMapDXT5_DXN2( const byte* inBuf, byte* outBuf, i
|
|||
{
|
||||
for( int i = 0; i < width; i += 4, inBuf += 16, outBuf += 16 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
// decode normal Y stored as a DXT5 alpha channel
|
||||
DecodeNormalYValues( inBuf + 8, minNormalY, maxNormalY, values );
|
||||
|
@ -5664,7 +5664,7 @@ void idDxtEncoder::ConvertImageDXN1_DXT1( const byte* inBuf, byte* outBuf, int w
|
|||
{
|
||||
for( int i = 0; i < width; i += 4, inBuf += 8, outBuf += 8 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( 16 );
|
||||
|
||||
// decode single channel stored as a DXT5 alpha channel
|
||||
DecodeDXNAlphaValues( inBuf + 0, values );
|
||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
#include "framework/Common_local.h"
|
||||
|
||||
#include "DXTCodec_local.h"
|
||||
#include "DXTCodec.h"
|
||||
|
||||
|
@ -956,7 +956,7 @@ void idDxtEncoder::CompressImageDXT1Fast_SSE2( const byte* inBuf, byte* outBuf,
|
|||
|
||||
for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
|
@ -1019,7 +1019,7 @@ void idDxtEncoder::CompressImageDXT1AlphaFast_SSE2( const byte* inBuf, byte* out
|
|||
|
||||
for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
ExtractBlock_SSE2( inBuf + i * 4, width, block );
|
||||
|
@ -1366,7 +1366,7 @@ void idDxtEncoder::CompressYCoCgDXT5Fast_SSE2( const byte* inBuf, byte* outBuf,
|
|||
|
||||
for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
|
@ -1591,7 +1591,7 @@ void idDxtEncoder::CompressNormalMapDXT5Fast_SSE2( const byte* inBuf, byte* outB
|
|||
|
||||
for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 )
|
||||
{
|
||||
commonLocal.LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
common->LoadPacifierBinarizeProgressIncrement( width * 4 );
|
||||
|
||||
for( int i = 0; i < width; i += 4 )
|
||||
{
|
||||
|
|
|
@ -211,6 +211,7 @@ R_GlobalToNormalizedDeviceCoordinates
|
|||
-1 to 1 range in x, y, and z
|
||||
==========================
|
||||
*/
|
||||
#if !defined( DMAP )
|
||||
void R_GlobalToNormalizedDeviceCoordinates( const idVec3& global, idVec3& ndc )
|
||||
{
|
||||
idPlane view;
|
||||
|
@ -240,6 +241,7 @@ void R_GlobalToNormalizedDeviceCoordinates( const idVec3& global, idVec3& ndc )
|
|||
ndc[1] = clip[1] * invW;
|
||||
ndc[2] = clip[2] * invW; // NOTE: in D3D this is in the range [0,1]
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
======================
|
||||
|
@ -471,6 +473,8 @@ void ModifyProjectionMatrix( viewDef_t* viewDef, const idPlane& clipPlane )
|
|||
memcpy( viewDef->projectionMatrix, matrix, sizeof( float ) * 16 );
|
||||
}
|
||||
|
||||
#if !defined( DMAP )
|
||||
|
||||
void R_SetupProjectionMatrix( viewDef_t* viewDef, bool doJitter )
|
||||
{
|
||||
// random jittering is usefull when multiple
|
||||
|
@ -678,6 +682,8 @@ void R_SetupUnprojection( viewDef_t* viewDef )
|
|||
idRenderMatrix::Transpose( *( idRenderMatrix* )viewDef->unprojectionToWorldMatrix, viewDef->unprojectionToWorldRenderMatrix );
|
||||
}
|
||||
|
||||
#endif // #if !defined( DMAP )
|
||||
|
||||
void R_MatrixFullInverse( const float a[16], float r[16] )
|
||||
{
|
||||
idMat4 am;
|
||||
|
|
|
@ -32,16 +32,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#include "RenderCommon.h"
|
||||
#include <sys/DeviceManager.h>
|
||||
|
||||
#if !defined( DMAP )
|
||||
#include <sys/DeviceManager.h>
|
||||
extern DeviceManager* deviceManager;
|
||||
extern idCVar r_vkUploadBufferSizeMB;
|
||||
#endif
|
||||
|
||||
// do this with a pointer, in case we want to make the actual manager
|
||||
// a private virtual subclass
|
||||
idImageManager imageManager;
|
||||
idImageManager* globalImages = &imageManager;
|
||||
|
||||
extern DeviceManager* deviceManager;
|
||||
extern idCVar r_vkUploadBufferSizeMB;
|
||||
|
||||
idCVar preLoad_Images( "preLoad_Images", "1", CVAR_SYSTEM | CVAR_BOOL, "preload images during beginlevelload" );
|
||||
|
||||
/*
|
||||
|
@ -56,6 +58,7 @@ New r_texturesize/r_texturedepth variables will take effect on reload
|
|||
reloadImages <all>
|
||||
===============
|
||||
*/
|
||||
#if !defined( DMAP )
|
||||
void R_ReloadImages_f( const idCmdArgs& args )
|
||||
{
|
||||
bool all = false;
|
||||
|
@ -81,6 +84,7 @@ void R_ReloadImages_f( const idCmdArgs& args )
|
|||
// Images (including the framebuffer images) were reloaded, reinitialize the framebuffers.
|
||||
Framebuffer::ResizeFramebuffers();
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -756,9 +760,11 @@ void idImageManager::Init()
|
|||
images.Resize( 1024, 1024 );
|
||||
imageHash.ResizeIndex( 1024 );
|
||||
|
||||
#if !defined( DMAP )
|
||||
CreateIntrinsicImages();
|
||||
|
||||
cmdSystem->AddCommand( "reloadImages", R_ReloadImages_f, CMD_FL_RENDERER, "reloads images" );
|
||||
#endif
|
||||
cmdSystem->AddCommand( "listImages", R_ListImages_f, CMD_FL_RENDERER, "lists images" );
|
||||
cmdSystem->AddCommand( "combineCubeImages", R_CombineCubeImages_f, CMD_FL_RENDERER, "combines six images for roq compression" );
|
||||
|
||||
|
@ -877,6 +883,7 @@ void idImageManager::Preload( const idPreloadManifest& manifest, const bool& map
|
|||
idImageManager::LoadLevelImages
|
||||
===============
|
||||
*/
|
||||
#if !defined( DMAP )
|
||||
int idImageManager::LoadLevelImages( bool pacifier )
|
||||
{
|
||||
if( !commandList )
|
||||
|
@ -923,12 +930,14 @@ int idImageManager::LoadLevelImages( bool pacifier )
|
|||
|
||||
return loadCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
===============
|
||||
idImageManager::EndLevelLoad
|
||||
===============
|
||||
*/
|
||||
#if !defined( DMAP )
|
||||
void idImageManager::EndLevelLoad()
|
||||
{
|
||||
insideLevelLoad = false;
|
||||
|
@ -942,6 +951,7 @@ void idImageManager::EndLevelLoad()
|
|||
idLib::Printf( "----------------------------------------\n" );
|
||||
//R_ListImages_f( idCmdArgs( "sorted sorted", false ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -1002,6 +1012,7 @@ void idImageManager::PrintMemInfo( MemInfo_t* mi )
|
|||
|
||||
void idImageManager::LoadDeferredImages( nvrhi::ICommandList* _commandList )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
if( !commandList )
|
||||
{
|
||||
nvrhi::CommandListParameters params = {};
|
||||
|
@ -1027,12 +1038,23 @@ void idImageManager::LoadDeferredImages( nvrhi::ICommandList* _commandList )
|
|||
// This is a "deferred" load of textures to the gpu.
|
||||
globalImages->imagesToLoad[i]->FinalizeImage( false, thisCmdList );
|
||||
}
|
||||
#else
|
||||
for( int i = 0; i < globalImages->imagesToLoad.Num(); i++ )
|
||||
{
|
||||
// This is a "deferred" load of textures to the gpu.
|
||||
globalImages->imagesToLoad[i]->FinalizeImage( false, NULL );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined( DMAP )
|
||||
if( !_commandList )
|
||||
{
|
||||
thisCmdList->close();
|
||||
deviceManager->GetDevice()->executeCommandList( thisCmdList );
|
||||
}
|
||||
#endif
|
||||
|
||||
globalImages->imagesToLoad.Clear();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2021 Robert Beckebans
|
||||
Copyright (C) 2013-2024 Robert Beckebans
|
||||
Copyright (C) 2014-2016 Kot in Action Creative Artel
|
||||
Copyright (C) 2016-2017 Dustin Land
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "framework/Common_local.h"
|
||||
#include "../framework/Common_local.h"
|
||||
#include "RenderCommon.h"
|
||||
|
||||
/*
|
||||
|
@ -592,7 +592,7 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
|
|||
idTempArray<byte> clear( opts.width * opts.height * 4 );
|
||||
memset( clear.Ptr(), 0, clear.Size() );
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#if defined( USE_NVRHI ) && !defined( DMAP )
|
||||
const nvrhi::FormatInfo& info = nvrhi::getFormatInfo( texture->getDesc().format );
|
||||
|
||||
commandList->beginTrackingTextureState( texture, nvrhi::AllSubresources, nvrhi::ResourceStates::Common );
|
||||
|
@ -603,10 +603,12 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
|
|||
commandList->setPermanentTextureState( texture, nvrhi::ResourceStates::ShaderResource );
|
||||
commandList->commitBarriers();
|
||||
#else
|
||||
/*
|
||||
for( int level = 0; level < opts.numLevels; level++ )
|
||||
{
|
||||
SubImageUpload( level, 0, 0, 0, opts.width >> level, opts.height >> level, clear.Ptr() );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
isLoaded = true;
|
||||
return;
|
||||
|
@ -673,7 +675,7 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
|
|||
|
||||
AllocImage();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#if defined( USE_NVRHI ) && !defined( DMAP )
|
||||
const nvrhi::FormatInfo& info = nvrhi::getFormatInfo( texture->getDesc().format );
|
||||
const int bytesPerPixel = info.bytesPerBlock / info.blockSize;
|
||||
|
||||
|
@ -727,12 +729,14 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
|
|||
commandList->setPermanentTextureState( texture, nvrhi::ResourceStates::ShaderResource );
|
||||
commandList->commitBarriers();
|
||||
#else
|
||||
/*
|
||||
for( int i = 0; i < im.NumImages(); i++ )
|
||||
{
|
||||
const bimageImage_t& img = im.GetImageHeader( i );
|
||||
const byte* data = im.GetImageData( i );
|
||||
SubImageUpload( img.level, 0, 0, img.destZ, img.width, img.height, data );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
isLoaded = true;
|
||||
|
@ -994,7 +998,7 @@ void idImage::GenerateImage( const byte* pic, int width, int height, textureFilt
|
|||
|
||||
AllocImage();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#if defined( USE_NVRHI ) && !defined( DMAP )
|
||||
if( commandList )
|
||||
{
|
||||
const nvrhi::FormatInfo& info = nvrhi::getFormatInfo( texture->getDesc().format );
|
||||
|
@ -1015,12 +1019,14 @@ void idImage::GenerateImage( const byte* pic, int width, int height, textureFilt
|
|||
commandList->commitBarriers();
|
||||
}
|
||||
#else
|
||||
/*
|
||||
for( int i = 0; i < im.NumImages(); i++ )
|
||||
{
|
||||
const bimageImage_t& img = im.GetImageHeader( i );
|
||||
const byte* data = im.GetImageData( i );
|
||||
SubImageUpload( img.level, 0, 0, img.destZ, img.width, img.height, data );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
isLoaded = true;
|
||||
|
@ -1054,10 +1060,12 @@ void idImage::GenerateCubeImage( const byte* pic[6], int size, textureFilter_t f
|
|||
// have filled in the parms. We must have the values set, or
|
||||
// an image match from a shader before the render starts would miss
|
||||
// the generated texture
|
||||
#if !defined( DMAP )
|
||||
if( !tr.IsInitialized() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
idBinaryImage im( GetName() );
|
||||
|
||||
|
@ -1078,7 +1086,7 @@ void idImage::GenerateCubeImage( const byte* pic[6], int size, textureFilter_t f
|
|||
|
||||
AllocImage();
|
||||
|
||||
#if defined( USE_NVRHI )
|
||||
#if defined( USE_NVRHI ) && !defined( DMAP )
|
||||
int numChannels = 4;
|
||||
int bytesPerPixel = numChannels;
|
||||
if( opts.format == FMT_ALPHA || opts.format == FMT_DXT1 || opts.format == FMT_INT8 || opts.format == FMT_R8 )
|
||||
|
@ -1102,13 +1110,14 @@ void idImage::GenerateCubeImage( const byte* pic[6], int size, textureFilter_t f
|
|||
commandList->setPermanentTextureState( texture, nvrhi::ResourceStates::ShaderResource );
|
||||
commandList->commitBarriers();
|
||||
#else
|
||||
|
||||
/*
|
||||
for( int i = 0; i < im.NumImages(); i++ )
|
||||
{
|
||||
const bimageImage_t& img = im.GetImageHeader( i );
|
||||
const byte* data = im.GetImageData( i );
|
||||
SubImageUpload( img.level, 0, 0, img.destZ, img.width, img.height, data );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
isLoaded = true;
|
||||
|
@ -1150,6 +1159,8 @@ if rows = cols * 6, assume it is a cube map animation
|
|||
*/
|
||||
void idImage::UploadScratch( const byte* data, int cols, int rows, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
|
||||
// if rows = cols * 6, assume it is a cube map animation
|
||||
if( rows == cols * 6 )
|
||||
{
|
||||
|
@ -1204,10 +1215,12 @@ void idImage::UploadScratch( const byte* data, int cols, int rows, nvrhi::IComma
|
|||
commandList->setPermanentTextureState( texture, nvrhi::ResourceStates::ShaderResource );
|
||||
commandList->commitBarriers();
|
||||
#else
|
||||
/*
|
||||
for( int i = 0; i < 6; i++ )
|
||||
{
|
||||
SubImageUpload( 0, 0, 0, i, opts.width, opts.height, pic[i] );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -1269,4 +1282,6 @@ void idImage::UploadScratch( const byte* data, int cols, int rows, nvrhi::IComma
|
|||
}
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -32,9 +32,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
#include "RenderCommon.h"
|
||||
|
||||
idCVar r_useConstantMaterials( "r_useConstantMaterials", "1", CVAR_RENDERER | CVAR_BOOL, "use pre-calculated material registers if possible" );
|
||||
|
||||
/*
|
||||
|
||||
Any errors during parsing just set MF_DEFAULTED and return, rather than throwing
|
||||
|
@ -1767,8 +1768,10 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
continue;
|
||||
}
|
||||
}
|
||||
#if !defined( DMAP )
|
||||
ts->cinematic = idCinematic::Alloc();
|
||||
ts->cinematic->InitFromFile( token.c_str(), loop, NULL );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1779,8 +1782,10 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
common->Warning( "missing parameter for 'soundmap' keyword in material '%s'", GetName() );
|
||||
continue;
|
||||
}
|
||||
#if !defined( DMAP )
|
||||
ts->cinematic = new( TAG_MATERIAL ) idSndWindow();
|
||||
ts->cinematic->InitFromFile( token.c_str(), true, NULL );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2139,9 +2144,11 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
{
|
||||
if( src.ReadTokenOnLine( &token ) )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
idList<shaderMacro_t> macros = { { "USE_GPU_SKINNING", "0" } };
|
||||
newStage.vertexProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_VERTEX, "", macros, false );
|
||||
newStage.fragmentProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_FRAGMENT, "", macros, false );
|
||||
#endif
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2149,8 +2156,10 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
{
|
||||
if( src.ReadTokenOnLine( &token ) )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
idList<shaderMacro_t> macros = { { "USE_GPU_SKINNING", "0" } };
|
||||
newStage.fragmentProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_FRAGMENT, "", macros, false );
|
||||
#endif
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2158,8 +2167,10 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
{
|
||||
if( src.ReadTokenOnLine( &token ) )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
idList<shaderMacro_t> macros = { { "USE_GPU_SKINNING", "0" } };
|
||||
newStage.vertexProgram = renderProgManager.FindShader( token.c_str(), SHADER_STAGE_VERTEX, "", macros, false );
|
||||
#endif
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2202,7 +2213,9 @@ void idMaterial::ParseStage( idLexer& src, const textureRepeat_t trpDefault )
|
|||
// if we are using newStage, allocate a copy of it
|
||||
if( newStage.fragmentProgram || newStage.vertexProgram )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
newStage.glslProgram = renderProgManager.FindProgram( GetName(), newStage.vertexProgram, newStage.fragmentProgram, BINDING_LAYOUT_POST_PROCESS_INGAME );
|
||||
#endif
|
||||
ss->newStage = ( newShaderStage_t* )Mem_Alloc( sizeof( newStage ), TAG_MATERIAL );
|
||||
*( ss->newStage ) = newStage;
|
||||
}
|
||||
|
@ -2777,7 +2790,9 @@ void idMaterial::ParseMaterial( idLexer& src )
|
|||
}
|
||||
else
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
gui = uiManager->FindGui( token.c_str(), true );
|
||||
#endif
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2975,7 +2990,9 @@ idMaterial::SetGui
|
|||
*/
|
||||
void idMaterial::SetGui( const char* _gui ) const
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
gui = uiManager->FindGui( _gui, true, false, true );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3720,6 +3737,7 @@ const shaderStage_t* idMaterial::GetBumpStage() const
|
|||
idMaterial::ReloadImages
|
||||
===================
|
||||
*/
|
||||
#if !defined( DMAP )
|
||||
void idMaterial::ReloadImages( bool force, nvrhi::ICommandList* commandList ) const
|
||||
{
|
||||
for( int i = 0 ; i < numStages ; i++ )
|
||||
|
@ -3740,6 +3758,7 @@ void idMaterial::ReloadImages( bool force, nvrhi::ICommandList* commandList ) co
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -3919,6 +3938,8 @@ class NWPrincipledPreferences(bpy.types.PropertyGroup):
|
|||
description='Naming Components for AO maps')
|
||||
*/
|
||||
|
||||
#if !defined( DMAP )
|
||||
|
||||
// RB: completely rewritten from IcedTech1 and adjusted to generate PBR materials for typical asset store conventions
|
||||
// this also supports file suffices used by Blender's Node Wranger addon
|
||||
CONSOLE_COMMAND_SHIP( makeMaterials, "Make .mtr file from a models or textures folder using PBR conventions", idCmdSystem::ArgCompletion_ImageName )
|
||||
|
@ -4218,4 +4239,6 @@ CONSOLE_COMMAND_SHIP( makeMaterials, "Make .mtr file from a models or textures f
|
|||
|
||||
fileSystem->WriteFile( mtrName.c_str(), mtrBuffer.c_str(), mtrBuffer.Length(), "fs_basepath" );
|
||||
}
|
||||
|
||||
#endif // #if !defined( DMAP )
|
||||
// RB end
|
|
@ -96,8 +96,7 @@ idCVar r_useViewBypass( "r_useViewBypass", "1", CVAR_RENDERER | CVAR_INTEGER, "b
|
|||
idCVar r_useLightPortalFlow( "r_useLightPortalFlow", "1", CVAR_RENDERER | CVAR_BOOL, "use a more precise area reference determination" );
|
||||
idCVar r_singleTriangle( "r_singleTriangle", "0", CVAR_RENDERER | CVAR_BOOL, "only draw a single triangle per primitive" );
|
||||
idCVar r_checkBounds( "r_checkBounds", "0", CVAR_RENDERER | CVAR_BOOL, "compare all surface bounds with precalculated ones" );
|
||||
idCVar r_useConstantMaterials( "r_useConstantMaterials", "1", CVAR_RENDERER | CVAR_BOOL, "use pre-calculated material registers if possible" );
|
||||
idCVar r_useSilRemap( "r_useSilRemap", "1", CVAR_RENDERER | CVAR_BOOL, "consider verts with the same XYZ, but different ST the same for shadows" );
|
||||
|
||||
idCVar r_useNodeCommonChildren( "r_useNodeCommonChildren", "1", CVAR_RENDERER | CVAR_BOOL, "stop pushing reference bounds early when possible" );
|
||||
idCVar r_useShadowSurfaceScissor( "r_useShadowSurfaceScissor", "1", CVAR_RENDERER | CVAR_BOOL, "scissor shadows by the scissor rect of the interaction surfaces" );
|
||||
idCVar r_useCachedDynamicModels( "r_useCachedDynamicModels", "1", CVAR_RENDERER | CVAR_BOOL, "cache snapshots of dynamic models" );
|
||||
|
|
|
@ -32,7 +32,62 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "RenderCommon.h"
|
||||
|
||||
#include "libs/mikktspace/mikktspace.h"
|
||||
#include <mikktspace.h>
|
||||
|
||||
idCVar r_useSilRemap( "r_useSilRemap", "1", CVAR_RENDERER | CVAR_BOOL, "consider verts with the same XYZ, but different ST the same for shadows" );
|
||||
|
||||
#if defined( DMAP )
|
||||
/*
|
||||
==========================================================================================
|
||||
|
||||
FONT-END STATIC MEMORY ALLOCATION
|
||||
|
||||
==========================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
=================
|
||||
R_StaticAlloc
|
||||
=================
|
||||
*/
|
||||
void* R_StaticAlloc( int bytes, const memTag_t tag )
|
||||
{
|
||||
//tr.pc.c_alloc++;
|
||||
|
||||
void* buf = Mem_Alloc( bytes, tag );
|
||||
|
||||
// don't exit on failure on zero length allocations since the old code didn't
|
||||
if( buf == NULL && bytes != 0 )
|
||||
{
|
||||
common->FatalError( "R_StaticAlloc failed on %i bytes", bytes );
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_ClearedStaticAlloc
|
||||
=================
|
||||
*/
|
||||
void* R_ClearedStaticAlloc( int bytes )
|
||||
{
|
||||
void* buf = R_StaticAlloc( bytes );
|
||||
memset( buf, 0, bytes );
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_StaticFree
|
||||
=================
|
||||
*/
|
||||
void R_StaticFree( void* data )
|
||||
{
|
||||
//tr.pc.c_free++;
|
||||
Mem_Free( data );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
@ -1392,7 +1447,9 @@ void R_DeriveTangents( srfTriangles_t* tri )
|
|||
return;
|
||||
}
|
||||
|
||||
#if !defined( DMAP )
|
||||
tr.pc.c_tangentIndexes += tri->numIndexes;
|
||||
#endif
|
||||
|
||||
if( tri->dominantTris != NULL )
|
||||
{
|
||||
|
@ -1819,8 +1876,10 @@ Uploads static vertices to the vertex cache.
|
|||
*/
|
||||
void R_CreateDeformStaticVertices( deformInfo_t* deform, nvrhi::ICommandList* commandList )
|
||||
{
|
||||
#if !defined( DMAP )
|
||||
deform->staticAmbientCache = vertexCache.AllocStaticVertex( deform->verts, deform->numOutputVerts * sizeof( idDrawVert ), commandList );
|
||||
deform->staticIndexCache = vertexCache.AllocStaticIndex( deform->indexes, deform->numIndexes * sizeof( triIndex_t ), commandList );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1895,6 +1954,8 @@ VERTEX / INDEX CACHING
|
|||
===================================================================================
|
||||
*/
|
||||
|
||||
#if !defined( DMAP )
|
||||
|
||||
/*
|
||||
===================
|
||||
R_InitDrawSurfFromTri
|
||||
|
@ -1958,6 +2019,8 @@ void R_CreateStaticBuffersForTri( srfTriangles_t& tri, nvrhi::ICommandList* comm
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// SP begin
|
||||
static void* mkAlloc( int bytes )
|
||||
{
|
||||
|
|
201
neo/stub/Image_stub.cpp
Normal file
201
neo/stub/Image_stub.cpp
Normal file
|
@ -0,0 +1,201 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2023 Robert Beckebans
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
idCVar image_pixelLook( "image_pixelLook", "0", CVAR_BOOL | CVAR_ARCHIVE, "Turn off linear filtering on most textures to achieve the 90s software renderer look" );
|
||||
|
||||
#include "../renderer/RenderCommon.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
idImage::idImage
|
||||
====================
|
||||
*/
|
||||
idImage::idImage( const char* name ) : imgName( name )
|
||||
{
|
||||
texture.Reset();
|
||||
|
||||
generatorFunction = NULL;
|
||||
filter = TF_DEFAULT;
|
||||
repeat = TR_REPEAT;
|
||||
usage = TD_DEFAULT;
|
||||
cubeFiles = CF_2D;
|
||||
cubeMapSize = 0;
|
||||
isLoaded = false;
|
||||
|
||||
referencedOutsideLevelLoad = false;
|
||||
levelLoadReferenced = false;
|
||||
defaulted = false;
|
||||
sourceFileTime = FILE_NOT_FOUND_TIMESTAMP;
|
||||
binaryFileTime = FILE_NOT_FOUND_TIMESTAMP;
|
||||
refCount = 0;
|
||||
|
||||
DeferredLoadImage();
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
idImage::~idImage
|
||||
====================
|
||||
*/
|
||||
idImage::~idImage()
|
||||
{
|
||||
PurgeImage();
|
||||
|
||||
// SRS - if image found in deferred load list, remove it now to avoid problems later
|
||||
DeferredPurgeImage();
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
idImage::IsLoaded
|
||||
====================
|
||||
*/
|
||||
bool idImage::IsLoaded() const
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
void idImage::CreateSampler()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
Bind
|
||||
|
||||
Automatically enables 2D mapping or cube mapping if needed
|
||||
==============
|
||||
*/
|
||||
void idImage::Bind()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CopyFramebuffer
|
||||
====================
|
||||
*/
|
||||
void idImage::CopyFramebuffer( int x, int y, int imageWidth, int imageHeight )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CopyDepthbuffer
|
||||
====================
|
||||
*/
|
||||
void idImage::CopyDepthbuffer( int x, int y, int imageWidth, int imageHeight )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::SubImageUpload
|
||||
========================
|
||||
*/
|
||||
void idImage::SubImageUpload( int mipLevel, int x, int y, int z, int width, int height, const void* pic, nvrhi::ICommandList* commandList, int pixelPitch )
|
||||
{
|
||||
assert( x >= 0 && y >= 0 && mipLevel >= 0 && width >= 0 && height >= 0 && mipLevel < opts.numLevels );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::SetSamplerState
|
||||
========================
|
||||
*/
|
||||
void idImage::SetSamplerState( textureFilter_t tf, textureRepeat_t tr )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::SetTexParameters
|
||||
========================
|
||||
*/
|
||||
void idImage::SetTexParameters()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::GetSampler
|
||||
========================
|
||||
*/
|
||||
void* idImage::GetSampler( SamplerCache& samplerCache )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::AllocImage
|
||||
|
||||
Every image will pass through this function. Allocates all the necessary MipMap levels for the
|
||||
Image, but doesn't put anything in them.
|
||||
|
||||
This should not be done during normal game-play, if you can avoid it.
|
||||
========================
|
||||
*/
|
||||
void idImage::AllocImage()
|
||||
{
|
||||
PurgeImage();
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::PurgeImage
|
||||
========================
|
||||
*/
|
||||
void idImage::PurgeImage()
|
||||
{
|
||||
isLoaded = false;
|
||||
defaulted = false;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idImage::Resize
|
||||
========================
|
||||
*/
|
||||
void idImage::Resize( int width, int height )
|
||||
{
|
||||
if( opts.width == width && opts.height == height )
|
||||
{
|
||||
return;
|
||||
}
|
||||
opts.width = width;
|
||||
opts.height = height;
|
||||
AllocImage();
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
add_definitions(-DDMAP -D__DOOM_DLL__)
|
||||
|
||||
set(TP_INCLUDES
|
||||
set(BSPT_INCLUDES
|
||||
#TypeInfoGen.h
|
||||
)
|
||||
set(TP_SOURCES
|
||||
set(BSPT_SOURCES
|
||||
#TypeInfoGen.cpp
|
||||
#main.cpp
|
||||
precompiled.cpp
|
||||
|
@ -14,12 +14,12 @@ file(GLOB DMAP_INCLUDES dmap/*.h)
|
|||
file(GLOB DMAP_SOURCES dmap/*.cpp)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND TP_SOURCES ../../stub/EngineStub.cpp)
|
||||
list(APPEND BSPT_SOURCES main.cpp)
|
||||
else()
|
||||
list(APPEND TP_SOURCES ../../stub/EngineStubPosix.cpp)
|
||||
list(APPEND BSPT_SOURCES ../../stub/EngineStubPosix.cpp)
|
||||
endif()
|
||||
|
||||
set(TP_FRAMEWORK_INCLUDES
|
||||
set(BSPT_FRAMEWORK_INCLUDES
|
||||
../../framework/CmdSystem.h
|
||||
../../framework/CVarSystem.h
|
||||
../../framework/File.h
|
||||
|
@ -27,53 +27,173 @@ set(TP_FRAMEWORK_INCLUDES
|
|||
../../framework/File_Resource.h
|
||||
../../framework/FileSystem.h
|
||||
../../framework/Licensee.h
|
||||
../../framework/DeclTable.h
|
||||
../../idlib/precompiled.h
|
||||
)
|
||||
set(TP_FRAMEWORK_SOURCES
|
||||
set(BSPT_FRAMEWORK_SOURCES
|
||||
../../framework/CmdSystem.cpp
|
||||
../../framework/CVarSystem.cpp
|
||||
../../framework/File.cpp
|
||||
../../framework/File_Manifest.cpp
|
||||
../../framework/File_Resource.cpp
|
||||
../../framework/FileSystem.cpp
|
||||
../../framework/DeclTable.cpp
|
||||
)
|
||||
|
||||
set(BSPT_RENDERER_INCLUDES
|
||||
../../renderer/BinaryImage.h
|
||||
../../renderer/Color/ColorSpace.h
|
||||
../../renderer/Image.h
|
||||
../../renderer/Material.h
|
||||
../../renderer/VertexCache.h
|
||||
)
|
||||
set(BSPT_RENDERER_SOURCES
|
||||
../../renderer/BinaryImage.cpp
|
||||
../../renderer/Color/ColorSpace.cpp
|
||||
../../renderer/DXT/DXTEncoder.cpp
|
||||
../../renderer/DXT/DXTEncoder_SSE2.cpp
|
||||
../../renderer/GLMatrix.cpp
|
||||
../../renderer/ImageManager.cpp
|
||||
../../renderer/Image_files.cpp
|
||||
#../../renderer/Image_intrinsic.cpp TODO
|
||||
../../renderer/Image_load.cpp
|
||||
../../renderer/Image_process.cpp
|
||||
../../renderer/Image_program.cpp
|
||||
../../stub/Image_stub.cpp
|
||||
../../renderer/Material.cpp
|
||||
../../renderer/tr_trisurf.cpp
|
||||
#../../renderer/VertexCache.cpp
|
||||
)
|
||||
|
||||
#if(NOT ZLIB_FOUND)
|
||||
# file(GLOB TP_ZLIB_INCLUDES ../../libs/zlib/*.h)
|
||||
# file(GLOB TP_ZLIB_SOURCES ../../libs/zlib/*.c)
|
||||
# list(APPEND TP_ZLIB_SOURCES ../../libs/zlib/minizip/unzip.cpp)
|
||||
# list(APPEND TP_ZLIB_SOURCES ../../libs/zlib/minizip/ioapi.c)
|
||||
#else (NOT ZLIB_FOUND)
|
||||
# set(TP_ZLIB_INCLUDES "")
|
||||
# set(TP_ZLIB_SOURCES "")
|
||||
#endif()
|
||||
file(GLOB MIKKTSPACE_INCLUDES ../../libs/mikktspace/*.h)
|
||||
file(GLOB MIKKTSPACE_SOURCES ../../libs/mikktspace/*.c)
|
||||
|
||||
if (NOT JPEG_FOUND)
|
||||
set(JPEG_INCLUDES
|
||||
../../libs/jpeg-6/jchuff.h
|
||||
../../libs/jpeg-6/jconfig.h
|
||||
../../libs/jpeg-6/jdct.h
|
||||
../../libs/jpeg-6/jdhuff.h
|
||||
../../libs/jpeg-6/jerror.h
|
||||
../../libs/jpeg-6/jinclude.h
|
||||
../../libs/jpeg-6/jmemsys.h
|
||||
../../libs/jpeg-6/jmorecfg.h
|
||||
../../libs/jpeg-6/jpegint.h
|
||||
../../libs/jpeg-6/jpeglib.h
|
||||
../../libs/jpeg-6/jversion.h)
|
||||
|
||||
set(JPEG_SOURCES
|
||||
../../libs/jpeg-6/jcapimin.cpp
|
||||
../../libs/jpeg-6/jcapistd.cpp
|
||||
../../libs/jpeg-6/jccoefct.cpp
|
||||
../../libs/jpeg-6/jccolor.cpp
|
||||
../../libs/jpeg-6/jcdctmgr.cpp
|
||||
../../libs/jpeg-6/jchuff.cpp
|
||||
../../libs/jpeg-6/jcinit.cpp
|
||||
../../libs/jpeg-6/jcmainct.cpp
|
||||
../../libs/jpeg-6/jcmarker.cpp
|
||||
../../libs/jpeg-6/jcmaster.cpp
|
||||
../../libs/jpeg-6/jcomapi.cpp
|
||||
../../libs/jpeg-6/jcparam.cpp
|
||||
../../libs/jpeg-6/jcphuff.cpp
|
||||
../../libs/jpeg-6/jcprepct.cpp
|
||||
../../libs/jpeg-6/jcsample.cpp
|
||||
../../libs/jpeg-6/jctrans.cpp
|
||||
../../libs/jpeg-6/jdapimin.cpp
|
||||
../../libs/jpeg-6/jdapistd.cpp
|
||||
../../libs/jpeg-6/jdatadst.cpp
|
||||
../../libs/jpeg-6/jdatasrc.cpp
|
||||
../../libs/jpeg-6/jdcoefct.cpp
|
||||
../../libs/jpeg-6/jdcolor.cpp
|
||||
../../libs/jpeg-6/jddctmgr.cpp
|
||||
../../libs/jpeg-6/jdhuff.cpp
|
||||
../../libs/jpeg-6/jdinput.cpp
|
||||
../../libs/jpeg-6/jdmainct.cpp
|
||||
../../libs/jpeg-6/jdmarker.cpp
|
||||
../../libs/jpeg-6/jdmaster.cpp
|
||||
../../libs/jpeg-6/jdmerge.cpp
|
||||
../../libs/jpeg-6/jdphuff.cpp
|
||||
../../libs/jpeg-6/jdpostct.cpp
|
||||
../../libs/jpeg-6/jdsample.cpp
|
||||
../../libs/jpeg-6/jdtrans.cpp
|
||||
../../libs/jpeg-6/jerror.cpp
|
||||
../../libs/jpeg-6/jfdctflt.cpp
|
||||
../../libs/jpeg-6/jfdctfst.cpp
|
||||
../../libs/jpeg-6/jfdctint.cpp
|
||||
../../libs/jpeg-6/jidctflt.cpp
|
||||
../../libs/jpeg-6/jidctfst.cpp
|
||||
../../libs/jpeg-6/jidctint.cpp
|
||||
../../libs/jpeg-6/jidctred.cpp
|
||||
../../#libs/jpeg-6/jload.cpp
|
||||
../../libs/jpeg-6/jmemmgr.cpp
|
||||
../../libs/jpeg-6/jmemnobs.cpp
|
||||
../../#libs/jpeg-6/jpegtran.cpp
|
||||
../../libs/jpeg-6/jquant1.cpp
|
||||
../../libs/jpeg-6/jquant2.cpp
|
||||
../../libs/jpeg-6/jutils.cpp)
|
||||
else (NOT JPEG_FOUND)
|
||||
set(JPEG_INCLUDES "")
|
||||
set(JPEG_SOURCES "")
|
||||
endif (NOT JPEG_FOUND)
|
||||
|
||||
if (NOT PNG_FOUND)
|
||||
file(GLOB PNG_INCLUDES ../../libs/png/*.h)
|
||||
file(GLOB PNG_SOURCES ../../libs/png/*.c)
|
||||
else (NOT PNG_FOUND)
|
||||
set(PNG_INCLUDES "")
|
||||
set(PNG_SOURCES "")
|
||||
endif (NOT PNG_FOUND)
|
||||
|
||||
|
||||
set(TP_INCLUDES_ALL
|
||||
${TP_INCLUDES}
|
||||
${TP_FRAMEWORK_INCLUDES}
|
||||
${TP_ZLIB_INCLUDES}
|
||||
if(NOT ZLIB_FOUND)
|
||||
file(GLOB BSPT_ZLIB_INCLUDES ../../libs/zlib/*.h)
|
||||
file(GLOB BSPT_ZLIB_SOURCES ../../libs/zlib/*.c)
|
||||
# list(APPEND BSPT_ZLIB_SOURCES ../../libs/zlib/minizip/unzip.cpp)
|
||||
# list(APPEND BSPT_ZLIB_SOURCES ../../libs/zlib/minizip/ioapi.c)
|
||||
endif()
|
||||
|
||||
|
||||
set(BSPT_INCLUDES_ALL
|
||||
${BSPT_INCLUDES}
|
||||
${BSPT_FRAMEWORK_INCLUDES}
|
||||
${BSPT_RENDERER_INCLUDES}
|
||||
${DMAP_INCLUDES}
|
||||
${MIKKTSPACE_INCLUDES}
|
||||
${JPG_INCLUDES}
|
||||
${PNG_INCLUDES}
|
||||
${BSPT_ZLIB_INCLUDES}
|
||||
)
|
||||
|
||||
set(TP_SOURCES_ALL
|
||||
${TP_SOURCES}
|
||||
${TP_FRAMEWORK_SOURCES}
|
||||
${TP_ZLIB_SOURCES}
|
||||
set(BSPT_SOURCES_ALL
|
||||
${BSPT_SOURCES}
|
||||
${BSPT_FRAMEWORK_SOURCES}
|
||||
${BSPT_RENDERER_SOURCES}
|
||||
${DMAP_SOURCES}
|
||||
${MIKKTSPACE_SOURCES}
|
||||
${JPEG_SOURCES}
|
||||
${PNG_SOURCES}
|
||||
${BSPT_ZLIB_SOURCES}
|
||||
)
|
||||
|
||||
source_group("main" FILES ${TP_INCLUDES})
|
||||
source_group("main" FILES ${TP_SOURCES})
|
||||
source_group("main" FILES ${BSPT_INCLUDES})
|
||||
source_group("main" FILES ${BSPT_SOURCES})
|
||||
source_group("dmap" FILES ${DMAP_INCLUDES})
|
||||
source_group("dmap" FILES ${DMAP_SOURCES})
|
||||
source_group("framework" FILES ${TP_FRAMEWORK_INCLUDES})
|
||||
source_group("framework" FILES ${TP_FRAMEWORK_SOURCES})
|
||||
#source_group("zlib" FILES ${TP_ZLIB_INCLUDES})
|
||||
#source_group("zlib" FILES ${TP_ZLIB_SOURCES})
|
||||
source_group("framework" FILES ${BSPT_FRAMEWORK_INCLUDES})
|
||||
source_group("framework" FILES ${BSPT_FRAMEWORK_SOURCES})
|
||||
source_group("renderer" FILES ${BSPT_RENDERER_INCLUDES})
|
||||
source_group("renderer" FILES ${BSPT_RENDERER_SOURCES})
|
||||
source_group("libs\\mikktspace" FILES ${MIKKTSPACE_INCLUDES})
|
||||
source_group("libs\\mikktspace" FILES ${MIKKTSPACE_SOURCES})
|
||||
source_group("libs\\jpeg-6" FILES ${JPEG_INCLUDES})
|
||||
source_group("libs\\jpeg-6" FILES ${JPEG_SOURCES})
|
||||
source_group("libs\\png" FILES ${PNG_INCLUDES})
|
||||
source_group("libs\\png" FILES ${PNG_SOURCES})
|
||||
#source_group("zlib" FILES ${BSPT_ZLIB_INCLUDES})
|
||||
#source_group("zlib" FILES ${BSPT_ZLIB_SOURCES})
|
||||
|
||||
set(TP_PRECOMPILED_SOURCES ${TP_SOURCES_ALL})
|
||||
#list(REMOVE_ITEM TP_PRECOMPILED_SOURCES ${TP_ZLIB_SOURCES})
|
||||
set(BSPT_PRECOMPILED_SOURCES ${BSPT_SOURCES_ALL})
|
||||
list(REMOVE_ITEM BSPT_PRECOMPILED_SOURCES ${BSPT_ZLIB_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${MIKKTSPACE_SOURCES})
|
||||
|
||||
include_directories(
|
||||
.
|
||||
|
@ -82,9 +202,10 @@ include_directories(
|
|||
)
|
||||
|
||||
if(MSVC)
|
||||
list(REMOVE_ITEM TP_PRECOMPILED_SOURCES precompiled.cpp)
|
||||
|
||||
#foreach( src_file ${TP_PRECOMPILED_SOURCES} )
|
||||
list(REMOVE_ITEM BSPT_PRECOMPILED_SOURCES precompiled.cpp)
|
||||
|
||||
#foreach( src_file ${BSPT_PRECOMPILED_SOURCES} )
|
||||
# message(STATUS "-include precompiled.h for ${src_file}")
|
||||
#endforeach()
|
||||
|
||||
|
@ -96,19 +217,24 @@ if(MSVC)
|
|||
)
|
||||
|
||||
set_source_files_properties(
|
||||
${TP_PRECOMPILED_SOURCES}
|
||||
${BSPT_PRECOMPILED_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "/Yuprecompiled.h"
|
||||
OBJECT_DEPENDS "precompiled.pch"
|
||||
)
|
||||
|
||||
add_executable(rbdmap ${TP_SOURCES_ALL} ${TP_INCLUDES_ALL})
|
||||
add_executable(rbdmap ${BSPT_SOURCES_ALL} ${BSPT_INCLUDES_ALL})
|
||||
add_dependencies(rbdmap idlib)
|
||||
target_link_libraries(rbdmap idlib winmm)
|
||||
|
||||
# set MSVC default debug directory on executable
|
||||
if(CMAKE_MAJOR_VERSION EQUAL 3 AND CMAKE_MINOR_VERSION GREATER_EQUAL 8)
|
||||
set_target_properties(rbdmap PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/../../..")
|
||||
endif()
|
||||
|
||||
else()
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
foreach( src_file ${TP_PRECOMPILED_SOURCES} )
|
||||
foreach( src_file ${BSPT_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
set_source_files_properties(
|
||||
${src_file}
|
||||
|
@ -143,7 +269,7 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
add_executable(typeinfogen ${TP_SOURCES_ALL} ${TP_INCLUDES_ALL})
|
||||
add_executable(typeinfogen ${BSPT_SOURCES_ALL} ${BSPT_INCLUDES_ALL})
|
||||
add_dependencies(typeinfogen idlib)
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
add_dependencies(typeinfogen precomp_header_typeinfo)
|
||||
|
|
|
@ -445,6 +445,7 @@ void Dmap( const idCmdArgs& args )
|
|||
common->Printf( "-----------------------\n" );
|
||||
common->Printf( "%5.0f seconds for dmap\n", ( end - start ) * 0.001f );
|
||||
|
||||
#if 0 // DMAP TODO
|
||||
if( !leaked )
|
||||
{
|
||||
if( !noCM )
|
||||
|
@ -470,6 +471,7 @@ void Dmap( const idCmdArgs& args )
|
|||
RunAAS_f( args );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// free the common .map representation
|
||||
delete dmapGlobals.dmapFile;
|
||||
|
@ -485,7 +487,6 @@ Dmap_f
|
|||
*/
|
||||
void Dmap_f( const idCmdArgs& args )
|
||||
{
|
||||
|
||||
common->ClearWarnings( "running dmap" );
|
||||
|
||||
// refresh the screen each time we print so it doesn't look
|
||||
|
|
|
@ -29,6 +29,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "../../../renderer/RenderCommon.h"
|
||||
|
||||
// DMAP TODO
|
||||
#define DMAP_INLINE_MODELS 0
|
||||
|
||||
typedef struct primitive_s
|
||||
{
|
||||
|
|
|
@ -622,6 +622,134 @@ static bool ProcessMapEntity( idMapEntity* mapEnt )
|
|||
|
||||
//===================================================================
|
||||
|
||||
#if defined( DMAP )
|
||||
/*
|
||||
================
|
||||
idGameEdit::ParseSpawnArgsToRenderLight
|
||||
|
||||
parse the light parameters
|
||||
this is the canonical renderLight parm parsing,
|
||||
which should be used by dmap and the editor
|
||||
================
|
||||
*/
|
||||
static void ParseSpawnArgsToRenderLight( const idDict* args, renderLight_t* renderLight )
|
||||
{
|
||||
bool gotTarget, gotUp, gotRight;
|
||||
const char* texture;
|
||||
idVec3 color;
|
||||
|
||||
memset( renderLight, 0, sizeof( *renderLight ) );
|
||||
|
||||
if( !args->GetVector( "light_origin", "", renderLight->origin ) )
|
||||
{
|
||||
args->GetVector( "origin", "", renderLight->origin );
|
||||
}
|
||||
|
||||
gotTarget = args->GetVector( "light_target", "", renderLight->target );
|
||||
gotUp = args->GetVector( "light_up", "", renderLight->up );
|
||||
gotRight = args->GetVector( "light_right", "", renderLight->right );
|
||||
args->GetVector( "light_start", "0 0 0", renderLight->start );
|
||||
if( !args->GetVector( "light_end", "", renderLight->end ) )
|
||||
{
|
||||
renderLight->end = renderLight->target;
|
||||
}
|
||||
|
||||
// we should have all of the target/right/up or none of them
|
||||
if( ( gotTarget || gotUp || gotRight ) != ( gotTarget && gotUp && gotRight ) )
|
||||
{
|
||||
idLib::Printf( "Light at (%f,%f,%f) has bad target info\n",
|
||||
renderLight->origin[0], renderLight->origin[1], renderLight->origin[2] );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !gotTarget )
|
||||
{
|
||||
renderLight->pointLight = true;
|
||||
|
||||
// allow an optional relative center of light and shadow offset
|
||||
args->GetVector( "light_center", "0 0 0", renderLight->lightCenter );
|
||||
|
||||
// create a point light
|
||||
if( !args->GetVector( "light_radius", "300 300 300", renderLight->lightRadius ) )
|
||||
{
|
||||
float radius;
|
||||
|
||||
args->GetFloat( "light", "300", radius );
|
||||
renderLight->lightRadius[0] = renderLight->lightRadius[1] = renderLight->lightRadius[2] = radius;
|
||||
}
|
||||
}
|
||||
|
||||
// get the rotation matrix in either full form, or single angle form
|
||||
idAngles angles;
|
||||
idMat3 mat;
|
||||
if( !args->GetMatrix( "light_rotation", "1 0 0 0 1 0 0 0 1", mat ) )
|
||||
{
|
||||
if( !args->GetMatrix( "rotation", "1 0 0 0 1 0 0 0 1", mat ) )
|
||||
{
|
||||
// RB: light_angles is specific for lights that have been modified by the editLights command
|
||||
// these lights have a static model and are not proper grouped using func_group
|
||||
if( args->GetAngles( "light_angles", "0 0 0", angles ) )
|
||||
{
|
||||
angles[ 0 ] = idMath::AngleNormalize360( angles[ 0 ] );
|
||||
angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] );
|
||||
angles[ 2 ] = idMath::AngleNormalize360( angles[ 2 ] );
|
||||
|
||||
mat = angles.ToMat3();
|
||||
}
|
||||
// RB: TrenchBroom interop
|
||||
// support "angles" like in Quake 3
|
||||
else if( args->GetAngles( "angles", "0 0 0", angles ) )
|
||||
{
|
||||
angles[ 0 ] = idMath::AngleNormalize360( angles[ 0 ] );
|
||||
angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] );
|
||||
angles[ 2 ] = idMath::AngleNormalize360( angles[ 2 ] );
|
||||
|
||||
mat = angles.ToMat3();
|
||||
}
|
||||
else
|
||||
{
|
||||
args->GetFloat( "angle", "0", angles[ 1 ] );
|
||||
angles[ 0 ] = 0;
|
||||
angles[ 1 ] = idMath::AngleNormalize360( angles[ 1 ] );
|
||||
angles[ 2 ] = 0;
|
||||
mat = angles.ToMat3();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fix degenerate identity matrices
|
||||
mat[0].FixDegenerateNormal();
|
||||
mat[1].FixDegenerateNormal();
|
||||
mat[2].FixDegenerateNormal();
|
||||
|
||||
renderLight->axis = mat;
|
||||
|
||||
// check for other attributes
|
||||
args->GetVector( "_color", "1 1 1", color );
|
||||
renderLight->shaderParms[ SHADERPARM_RED ] = color[0];
|
||||
renderLight->shaderParms[ SHADERPARM_GREEN ] = color[1];
|
||||
renderLight->shaderParms[ SHADERPARM_BLUE ] = color[2];
|
||||
args->GetFloat( "shaderParm3", "1", renderLight->shaderParms[ SHADERPARM_TIMESCALE ] );
|
||||
if( !args->GetFloat( "shaderParm4", "0", renderLight->shaderParms[ SHADERPARM_TIMEOFFSET ] ) )
|
||||
{
|
||||
// offset the start time of the shader to sync it to the game time
|
||||
renderLight->shaderParms[ SHADERPARM_TIMEOFFSET ] = 0; //-MS2SEC( gameLocal.time );
|
||||
}
|
||||
|
||||
args->GetFloat( "shaderParm5", "0", renderLight->shaderParms[5] );
|
||||
args->GetFloat( "shaderParm6", "0", renderLight->shaderParms[6] );
|
||||
args->GetFloat( "shaderParm7", "0", renderLight->shaderParms[ SHADERPARM_MODE ] );
|
||||
args->GetBool( "noshadows", "0", renderLight->noShadows );
|
||||
args->GetBool( "nospecular", "0", renderLight->noSpecular );
|
||||
args->GetBool( "parallel", "0", renderLight->parallel );
|
||||
|
||||
args->GetString( "texture", "lights/squarelight1", &texture );
|
||||
|
||||
// allow this to be NULL
|
||||
renderLight->shader = declManager->FindMaterial( texture, false );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
==============
|
||||
CreateMapLight
|
||||
|
@ -647,7 +775,11 @@ static void CreateMapLight( const idMapEntity* mapEnt )
|
|||
// parse parms exactly as the game do
|
||||
// use the game's epair parsing code so
|
||||
// we can use the same renderLight generation
|
||||
#if defined( DMAP )
|
||||
ParseSpawnArgsToRenderLight( &mapEnt->epairs, &light->def.parms );
|
||||
#else
|
||||
gameEdit->ParseSpawnArgsToRenderLight( &mapEnt->epairs, &light->def.parms );
|
||||
#endif
|
||||
|
||||
R_DeriveLightData( &light->def );
|
||||
|
||||
|
|
346
neo/tools/compilers/dmap/renderlight.cpp
Normal file
346
neo/tools/compilers/dmap/renderlight.cpp
Normal file
|
@ -0,0 +1,346 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2013-2024 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "dmap.h"
|
||||
|
||||
#ifdef DMAP
|
||||
|
||||
idRenderLightLocal::idRenderLightLocal()
|
||||
{
|
||||
memset( &parms, 0, sizeof( parms ) );
|
||||
memset( lightProject, 0, sizeof( lightProject ) );
|
||||
|
||||
lightHasMoved = false;
|
||||
world = NULL;
|
||||
index = 0;
|
||||
areaNum = 0;
|
||||
lastModifiedFrameNum = 0;
|
||||
archived = false;
|
||||
lightShader = NULL;
|
||||
falloffImage = NULL;
|
||||
globalLightOrigin = vec3_zero;
|
||||
viewCount = 0;
|
||||
viewLight = NULL;
|
||||
references = NULL;
|
||||
foggedPortals = NULL;
|
||||
firstInteraction = NULL;
|
||||
lastInteraction = NULL;
|
||||
|
||||
baseLightProject.Zero();
|
||||
inverseBaseLightProject.Zero();
|
||||
}
|
||||
|
||||
void idRenderLightLocal::FreeRenderLight()
|
||||
{
|
||||
}
|
||||
void idRenderLightLocal::UpdateRenderLight( const renderLight_t* re, bool forceUpdate )
|
||||
{
|
||||
}
|
||||
void idRenderLightLocal::GetRenderLight( renderLight_t* re )
|
||||
{
|
||||
}
|
||||
void idRenderLightLocal::ForceUpdate()
|
||||
{
|
||||
}
|
||||
int idRenderLightLocal::GetIndex()
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
=================================================================================
|
||||
|
||||
LIGHT DEFS
|
||||
|
||||
=================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
========================
|
||||
R_ComputePointLightProjectionMatrix
|
||||
|
||||
Computes the light projection matrix for a point light.
|
||||
========================
|
||||
*/
|
||||
static float R_ComputePointLightProjectionMatrix( idRenderLightLocal* light, idRenderMatrix& localProject )
|
||||
{
|
||||
assert( light->parms.pointLight );
|
||||
|
||||
// A point light uses a box projection.
|
||||
// This projects into the 0.0 - 1.0 texture range instead of -1.0 to 1.0 clip space range.
|
||||
localProject.Zero();
|
||||
localProject[0][0] = 0.5f / light->parms.lightRadius[0];
|
||||
localProject[1][1] = 0.5f / light->parms.lightRadius[1];
|
||||
localProject[2][2] = 0.5f / light->parms.lightRadius[2];
|
||||
localProject[0][3] = 0.5f;
|
||||
localProject[1][3] = 0.5f;
|
||||
localProject[2][3] = 0.5f;
|
||||
localProject[3][3] = 1.0f; // identity perspective
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
static const float SPOT_LIGHT_MIN_Z_NEAR = 8.0f;
|
||||
static const float SPOT_LIGHT_MIN_Z_FAR = 16.0f;
|
||||
|
||||
/*
|
||||
========================
|
||||
R_ComputeSpotLightProjectionMatrix
|
||||
|
||||
Computes the light projection matrix for a spot light.
|
||||
========================
|
||||
*/
|
||||
static float R_ComputeSpotLightProjectionMatrix( idRenderLightLocal* light, idRenderMatrix& localProject )
|
||||
{
|
||||
const float targetDistSqr = light->parms.target.LengthSqr();
|
||||
const float invTargetDist = idMath::InvSqrt( targetDistSqr );
|
||||
const float targetDist = invTargetDist * targetDistSqr;
|
||||
|
||||
const idVec3 normalizedTarget = light->parms.target * invTargetDist;
|
||||
const idVec3 normalizedRight = light->parms.right * ( 0.5f * targetDist / light->parms.right.LengthSqr() );
|
||||
const idVec3 normalizedUp = light->parms.up * ( -0.5f * targetDist / light->parms.up.LengthSqr() );
|
||||
|
||||
localProject[0][0] = normalizedRight[0];
|
||||
localProject[0][1] = normalizedRight[1];
|
||||
localProject[0][2] = normalizedRight[2];
|
||||
localProject[0][3] = 0.0f;
|
||||
|
||||
localProject[1][0] = normalizedUp[0];
|
||||
localProject[1][1] = normalizedUp[1];
|
||||
localProject[1][2] = normalizedUp[2];
|
||||
localProject[1][3] = 0.0f;
|
||||
|
||||
localProject[3][0] = normalizedTarget[0];
|
||||
localProject[3][1] = normalizedTarget[1];
|
||||
localProject[3][2] = normalizedTarget[2];
|
||||
localProject[3][3] = 0.0f;
|
||||
|
||||
// Set the falloff vector.
|
||||
// This is similar to the Z calculation for depth buffering, which means that the
|
||||
// mapped texture is going to be perspective distorted heavily towards the zero end.
|
||||
const float zNear = Max( light->parms.start * normalizedTarget, SPOT_LIGHT_MIN_Z_NEAR );
|
||||
const float zFar = Max( light->parms.end * normalizedTarget, SPOT_LIGHT_MIN_Z_FAR );
|
||||
const float zScale = ( zNear + zFar ) / zFar;
|
||||
|
||||
localProject[2][0] = normalizedTarget[0] * zScale;
|
||||
localProject[2][1] = normalizedTarget[1] * zScale;
|
||||
localProject[2][2] = normalizedTarget[2] * zScale;
|
||||
localProject[2][3] = - zNear * zScale;
|
||||
|
||||
// now offset to the 0.0 - 1.0 texture range instead of -1.0 to 1.0 clip space range
|
||||
idVec4 projectedTarget;
|
||||
localProject.TransformPoint( light->parms.target, projectedTarget );
|
||||
|
||||
const float ofs0 = 0.5f - projectedTarget[0] / projectedTarget[3];
|
||||
localProject[0][0] += ofs0 * localProject[3][0];
|
||||
localProject[0][1] += ofs0 * localProject[3][1];
|
||||
localProject[0][2] += ofs0 * localProject[3][2];
|
||||
localProject[0][3] += ofs0 * localProject[3][3];
|
||||
|
||||
const float ofs1 = 0.5f - projectedTarget[1] / projectedTarget[3];
|
||||
localProject[1][0] += ofs1 * localProject[3][0];
|
||||
localProject[1][1] += ofs1 * localProject[3][1];
|
||||
localProject[1][2] += ofs1 * localProject[3][2];
|
||||
localProject[1][3] += ofs1 * localProject[3][3];
|
||||
|
||||
return 1.0f / ( zNear + zFar );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
R_ComputeParallelLightProjectionMatrix
|
||||
|
||||
Computes the light projection matrix for a parallel light.
|
||||
========================
|
||||
*/
|
||||
static float R_ComputeParallelLightProjectionMatrix( idRenderLightLocal* light, idRenderMatrix& localProject )
|
||||
{
|
||||
assert( light->parms.parallel );
|
||||
|
||||
// A parallel light uses a box projection.
|
||||
// This projects into the 0.0 - 1.0 texture range instead of -1.0 to 1.0 clip space range.
|
||||
localProject.Zero();
|
||||
localProject[0][0] = 0.5f / light->parms.lightRadius[0];
|
||||
localProject[1][1] = 0.5f / light->parms.lightRadius[1];
|
||||
localProject[2][2] = 0.5f / light->parms.lightRadius[2];
|
||||
localProject[0][3] = 0.5f;
|
||||
localProject[1][3] = 0.5f;
|
||||
localProject[2][3] = 0.5f;
|
||||
localProject[3][3] = 1.0f; // identity perspective
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_DeriveLightData
|
||||
|
||||
Fills everything in based on light->parms
|
||||
=================
|
||||
*/
|
||||
void R_DeriveLightData( idRenderLightLocal* light )
|
||||
{
|
||||
// RB: skip the light shader stuff for dmap
|
||||
|
||||
// ------------------------------------
|
||||
// compute the light projection matrix
|
||||
// ------------------------------------
|
||||
|
||||
idRenderMatrix localProject;
|
||||
float zScale = 1.0f;
|
||||
if( light->parms.parallel )
|
||||
{
|
||||
zScale = R_ComputeParallelLightProjectionMatrix( light, localProject );
|
||||
}
|
||||
else if( light->parms.pointLight )
|
||||
{
|
||||
zScale = R_ComputePointLightProjectionMatrix( light, localProject );
|
||||
}
|
||||
else
|
||||
{
|
||||
zScale = R_ComputeSpotLightProjectionMatrix( light, localProject );
|
||||
}
|
||||
|
||||
// set the old style light projection where Z and W are flipped and
|
||||
// for projected lights lightProject[3] is divided by ( zNear + zFar )
|
||||
light->lightProject[0][0] = localProject[0][0];
|
||||
light->lightProject[0][1] = localProject[0][1];
|
||||
light->lightProject[0][2] = localProject[0][2];
|
||||
light->lightProject[0][3] = localProject[0][3];
|
||||
|
||||
light->lightProject[1][0] = localProject[1][0];
|
||||
light->lightProject[1][1] = localProject[1][1];
|
||||
light->lightProject[1][2] = localProject[1][2];
|
||||
light->lightProject[1][3] = localProject[1][3];
|
||||
|
||||
light->lightProject[2][0] = localProject[3][0];
|
||||
light->lightProject[2][1] = localProject[3][1];
|
||||
light->lightProject[2][2] = localProject[3][2];
|
||||
light->lightProject[2][3] = localProject[3][3];
|
||||
|
||||
light->lightProject[3][0] = localProject[2][0] * zScale;
|
||||
light->lightProject[3][1] = localProject[2][1] * zScale;
|
||||
light->lightProject[3][2] = localProject[2][2] * zScale;
|
||||
light->lightProject[3][3] = localProject[2][3] * zScale;
|
||||
|
||||
// transform the lightProject
|
||||
float lightTransform[16];
|
||||
R_AxisToModelMatrix( light->parms.axis, light->parms.origin, lightTransform );
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
idPlane temp = light->lightProject[i];
|
||||
R_LocalPlaneToGlobal( lightTransform, temp, light->lightProject[i] );
|
||||
}
|
||||
|
||||
// adjust global light origin for off center projections and parallel projections
|
||||
// we are just faking parallel by making it a very far off center for now
|
||||
if( light->parms.parallel )
|
||||
{
|
||||
idVec3 dir = light->parms.lightCenter;
|
||||
if( dir.Normalize() == 0.0f )
|
||||
{
|
||||
// make point straight up if not specified
|
||||
dir[2] = 1.0f;
|
||||
}
|
||||
light->globalLightOrigin = light->parms.origin + dir * 100000.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
light->globalLightOrigin = light->parms.origin + light->parms.axis * light->parms.lightCenter;
|
||||
}
|
||||
|
||||
// Rotate and translate the light projection by the light matrix.
|
||||
// 99% of lights remain axis aligned in world space.
|
||||
idRenderMatrix lightMatrix;
|
||||
idRenderMatrix::CreateFromOriginAxis( light->parms.origin, light->parms.axis, lightMatrix );
|
||||
|
||||
idRenderMatrix inverseLightMatrix;
|
||||
if( !idRenderMatrix::Inverse( lightMatrix, inverseLightMatrix ) )
|
||||
{
|
||||
idLib::Warning( "lightMatrix invert failed" );
|
||||
}
|
||||
|
||||
// 'baseLightProject' goes from global space -> light local space -> light projective space
|
||||
idRenderMatrix::Multiply( localProject, inverseLightMatrix, light->baseLightProject );
|
||||
|
||||
// Invert the light projection so we can deform zero-to-one cubes into
|
||||
// the light model and calculate global bounds.
|
||||
if( !idRenderMatrix::Inverse( light->baseLightProject, light->inverseBaseLightProject ) )
|
||||
{
|
||||
idLib::Warning( "baseLightProject invert failed" );
|
||||
}
|
||||
|
||||
// calculate the global light bounds by inverse projecting the zero to one cube with the 'inverseBaseLightProject'
|
||||
idRenderMatrix::ProjectedBounds( light->globalLightBounds, light->inverseBaseLightProject, bounds_zeroOneCube, false );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
R_FreeLightDefDerivedData
|
||||
|
||||
Frees all references and lit surfaces from the light
|
||||
====================
|
||||
*/
|
||||
void R_FreeLightDefDerivedData( idRenderLightLocal* ldef )
|
||||
{
|
||||
// remove any portal fog references
|
||||
for( doublePortal_t* dp = ldef->foggedPortals; dp != NULL; dp = dp->nextFoggedPortal )
|
||||
{
|
||||
dp->fogLight = NULL;
|
||||
}
|
||||
|
||||
// free all the interactions
|
||||
/*
|
||||
while( ldef->firstInteraction != NULL )
|
||||
{
|
||||
ldef->firstInteraction->UnlinkAndFree();
|
||||
}
|
||||
*/
|
||||
|
||||
// free all the references to the light
|
||||
areaReference_t* nextRef = NULL;
|
||||
for( areaReference_t* lref = ldef->references; lref != NULL; lref = nextRef )
|
||||
{
|
||||
nextRef = lref->ownerNext;
|
||||
|
||||
// unlink from the area
|
||||
lref->areaNext->areaPrev = lref->areaPrev;
|
||||
lref->areaPrev->areaNext = lref->areaNext;
|
||||
|
||||
// put it back on the free list for reuse
|
||||
ldef->world->areaReferenceAllocator.Free( lref );
|
||||
}
|
||||
ldef->references = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -662,6 +662,7 @@ void FixGlobalTjunctions( uEntity_t* e )
|
|||
}
|
||||
}
|
||||
|
||||
#if DMAP_INLINE_MODELS
|
||||
// add all the func_static model vertexes to the hash buckets
|
||||
// optionally inline some of the func_static models
|
||||
if( dmapGlobals.entityNum == 0 )
|
||||
|
@ -728,8 +729,7 @@ void FixGlobalTjunctions( uEntity_t* e )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// now fix each area
|
||||
for( areaNum = 0 ; areaNum < e->numAreas ; areaNum++ )
|
||||
|
|
|
@ -758,6 +758,7 @@ void PutPrimitivesInAreas( uEntity_t* e )
|
|||
}
|
||||
}
|
||||
|
||||
#if DMAP_INLINE_MODELS
|
||||
|
||||
// optionally inline some of the func_static models
|
||||
if( dmapGlobals.entityNum == 0 )
|
||||
|
@ -831,6 +832,7 @@ void PutPrimitivesInAreas( uEntity_t* e )
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -1,3 +1,31 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "../sys/sys_local.h"
|
||||
#include "../framework/EventLoop.h"
|
||||
|
@ -22,6 +50,15 @@ idSys* sys = NULL;
|
|||
idCVar com_productionMode( "com_productionMode", "0", CVAR_SYSTEM | CVAR_BOOL, "0 - no special behavior, 1 - building a production build, 2 - running a production build" );
|
||||
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
idSys
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
Sys_Mkdir
|
||||
|
@ -225,6 +262,14 @@ int Sys_Milliseconds()
|
|||
return timeGetTime() - sys_timeBase;
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
idCommon
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
|
||||
class idCommonLocal : public idCommon
|
||||
{
|
||||
public:
|
||||
|
@ -458,7 +503,49 @@ public:
|
|||
// return DOOM_CLASSIC;
|
||||
//};
|
||||
//virtual void SwitchToGame(currentGame_t newGame) { };
|
||||
|
||||
void LoadPacifierBinarizeFilename( const char* filename, const char* reason ) { };
|
||||
void LoadPacifierBinarizeInfo( const char* info ) { };
|
||||
void LoadPacifierBinarizeMiplevel( int level, int maxLevel ) { };
|
||||
void LoadPacifierBinarizeProgress( float progress ) { };
|
||||
void LoadPacifierBinarizeEnd() { };
|
||||
// for images in particular we can measure more accurately this way (to deal with mipmaps)
|
||||
void LoadPacifierBinarizeProgressTotal( int total ) { };
|
||||
void LoadPacifierBinarizeProgressIncrement( int step ) { };
|
||||
};
|
||||
|
||||
//idCVar com_developer( "developer", "0", CVAR_BOOL|CVAR_SYSTEM, "developer mode" );
|
||||
|
||||
idCommonLocal commonLocal;
|
||||
idCommon* common = &commonLocal;
|
||||
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
main
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
idLib::common = common;
|
||||
idLib::cvarSystem = cvarSystem;
|
||||
idLib::fileSystem = fileSystem;
|
||||
idLib::sys = sys;
|
||||
|
||||
idLib::Init();
|
||||
cmdSystem->Init();
|
||||
cvarSystem->Init();
|
||||
idCVar::RegisterStaticVars();
|
||||
fileSystem->Init();
|
||||
|
||||
idCmdArgs args;
|
||||
for( int i = 0; i < argc; i++ )
|
||||
{
|
||||
args.AppendArg( argv[i] );
|
||||
}
|
||||
|
||||
Dmap_f( args );
|
||||
}
|
Loading…
Reference in a new issue