mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Merge branch 'master' into 571-sega-shader
This commit is contained in:
commit
9b7846e077
12 changed files with 147 additions and 56 deletions
|
@ -12,8 +12,8 @@ bind "F2" "toggle r_showTris 1 2 0"
|
|||
bind "F3" "toggle r_forceAmbient 0.3 0.5 1.0 0"
|
||||
bind "F4" "toggle r_skipInteractions"
|
||||
bind "F5" "savegame quick"
|
||||
// bind "F6" "toggle r_showLightGrid 1 3 4 0"
|
||||
bind "F6" "toggle r_renderMode 0 1 3 5 7 9 11"
|
||||
bind "F6" "toggle r_showLightGrid 1 3 4 0"
|
||||
//bind "F6" "toggle r_renderMode 0 1 3 5 7 9 11"
|
||||
bind "F7" "toggle r_renderMode 0 1 2 3 4 5 6 7 8 9 10 11"
|
||||
bind "F8" "toggle r_useCRTPostFX 0 1 2 3"
|
||||
bind "F9" "loadgame quick"
|
||||
|
|
|
@ -442,4 +442,17 @@ textures/common/occlusion
|
|||
noshadows
|
||||
occlusion
|
||||
}
|
||||
|
||||
// this one is not invisible and like textures/sfx/black but will also cast shadows
|
||||
// so it works as a blocker for the lightgrid
|
||||
textures/common/black
|
||||
{
|
||||
qer_editorimage textures/common/shadow.tga
|
||||
nonsolid
|
||||
forceshadows
|
||||
forceOpaque
|
||||
noselfshadow
|
||||
|
||||
basecolormap _blackDiffuse
|
||||
}
|
||||
// RB end
|
|
@ -509,6 +509,7 @@ void idInteraction::UnlinkAndFree()
|
|||
{
|
||||
// clear the table pointer
|
||||
idRenderWorldLocal* renderWorld = this->lightDef->world;
|
||||
|
||||
// RB: added check for NULL
|
||||
if( renderWorld->interactionTable != NULL )
|
||||
{
|
||||
|
|
|
@ -3960,7 +3960,7 @@ CONSOLE_COMMAND_SHIP( makeMaterials, "Make .mtr file from a models or textures f
|
|||
return;
|
||||
}
|
||||
|
||||
bool stripFolderFromMaterial = false;
|
||||
bool ueMode = false;
|
||||
|
||||
idStr option;
|
||||
for( int i = 1; i < args.Argc(); i++ )
|
||||
|
@ -3970,7 +3970,7 @@ CONSOLE_COMMAND_SHIP( makeMaterials, "Make .mtr file from a models or textures f
|
|||
|
||||
if( option.IcmpPrefix( "Unreal" ) == 0 )
|
||||
{
|
||||
stripFolderFromMaterial = true;
|
||||
ueMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4043,8 +4043,9 @@ CONSOLE_COMMAND_SHIP( makeMaterials, "Make .mtr file from a models or textures f
|
|||
materialName.CopyRange( baseName.c_str(), 0, baseName.Length() - 2 );
|
||||
}
|
||||
|
||||
if( stripFolderFromMaterial )
|
||||
if( ueMode )
|
||||
{
|
||||
// strip folder from material name
|
||||
idStr matName;
|
||||
materialName.ExtractFileName( matName );
|
||||
materialName = matName;
|
||||
|
@ -4255,6 +4256,52 @@ CONSOLE_COMMAND_SHIP( makeMaterials, "Make .mtr file from a models or textures f
|
|||
}
|
||||
}
|
||||
|
||||
if( ueMode )
|
||||
{
|
||||
// ===============================
|
||||
// test UE4 specular map
|
||||
idStrList specNames = { "_specular" };
|
||||
byte* specPic = NULL;
|
||||
int specWidth = 0;
|
||||
int specHeight = 0;
|
||||
|
||||
for( auto& name : specNames )
|
||||
{
|
||||
ID_TIME_T testStamp;
|
||||
idStr testName = baseName + name + resName;
|
||||
|
||||
R_LoadImage( testName, &specPic, &specWidth, &specHeight, &testStamp, true, NULL );
|
||||
if( testStamp != FILE_NOT_FOUND_TIMESTAMP )
|
||||
{
|
||||
// swap bytes to RMAO order
|
||||
int c = specWidth * specHeight * 4;
|
||||
|
||||
for( int j = 0 ; j < c ; j += 4 )
|
||||
{
|
||||
byte ao = specPic[j + 0];
|
||||
byte roughness = specPic[j + 1];
|
||||
byte metal = specPic[j + 2];
|
||||
|
||||
specPic[j + 0] = roughness;
|
||||
specPic[j + 1] = metal;
|
||||
specPic[j + 2] = ao;
|
||||
|
||||
// put middle 0.5 value into alpha channel for the case we want to add displacement later
|
||||
specPic[j + 3] = 128;
|
||||
}
|
||||
|
||||
idStr mergedName = baseName + "_rmao.png";
|
||||
R_WritePNG( mergedName, static_cast<byte*>( specPic ), 4, specWidth, specHeight, "fs_basepath" );
|
||||
|
||||
mergedName.StripFileExtension();
|
||||
mtrBuffer += va( "\trmaomap %s\n", mergedName.c_str() );
|
||||
|
||||
R_StaticFree( specPic );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( roughPic )
|
||||
{
|
||||
R_StaticFree( roughPic );
|
||||
|
|
|
@ -75,7 +75,7 @@ private:
|
|||
bool fileExclusive;
|
||||
bool hasAnimations;
|
||||
|
||||
float maxJointVertDist; // maximum distance a vertex is separated from a joint
|
||||
float maxJointVertDist = 10.0f; // maximum distance a vertex is separated from a joint
|
||||
idList<int, TAG_MODEL> animIds;
|
||||
idList<int, TAG_MODEL> bones;
|
||||
idList<int, TAG_MODEL> MeshNodeIds;
|
||||
|
|
|
@ -1710,7 +1710,7 @@ void idRenderBackend::RenderInteractions( const drawSurf_t* surfList, const view
|
|||
// are added single-threaded, and there is only a negligable amount
|
||||
// of benefit to trying to sort by materials.
|
||||
//---------------------------------
|
||||
static const int MAX_INTERACTIONS_PER_LIGHT = 1024;
|
||||
static const int MAX_INTERACTIONS_PER_LIGHT = 2048; // 1024 in BFG
|
||||
static const int MAX_COMPLEX_INTERACTIONS_PER_LIGHT = 256;
|
||||
idStaticList< const drawSurf_t*, MAX_INTERACTIONS_PER_LIGHT > allSurfaces;
|
||||
idStaticList< const drawSurf_t*, MAX_COMPLEX_INTERACTIONS_PER_LIGHT > complexSurfaces;
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
idBlockAlloc<areaReference_t, 1024> areaReferenceAllocator;
|
||||
idBlockAlloc<idInteraction, 256> interactionAllocator;
|
||||
|
||||
#ifdef ID_PC
|
||||
#if 1 //def ID_PC
|
||||
static const int MAX_DECAL_SURFACES = 32;
|
||||
#else
|
||||
static const int MAX_DECAL_SURFACES = 16;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2016-2017 Dustin Land
|
||||
Copyright (C) 2020 Robert Beckebans
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
Copyright (C) 2024 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#if 1
|
||||
|
||||
// RB: increased some static memory limits for custom modder content
|
||||
// RB: quadruppled static memory limits for custom content
|
||||
|
||||
const int VERTCACHE_INDEX_MEMORY_PER_FRAME = 31 * 1024 * 1024;
|
||||
const int VERTCACHE_VERTEX_MEMORY_PER_FRAME = 31 * 1024 * 1024;
|
||||
|
@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// there are a lot more static indexes than vertexes, because interactions are just new
|
||||
// index lists that reference existing vertexes
|
||||
const int STATIC_INDEX_MEMORY = 4 * 31 * 1024 * 1024;
|
||||
const int STATIC_VERTEX_MEMORY = 2 * 31 * 1024 * 1024; // make sure it fits in VERTCACHE_OFFSET_MASK!
|
||||
const int STATIC_VERTEX_MEMORY = 4 * 31 * 1024 * 1024; // make sure it fits in VERTCACHE_OFFSET_MASK!
|
||||
|
||||
// vertCacheHandle_t packs size, offset, and frame number into 64 bits
|
||||
typedef uint64 vertCacheHandle_t;
|
||||
|
@ -52,10 +52,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
const int VERTCACHE_SIZE_MASK = 0x7fffff; // 23 bits = 8 megs
|
||||
|
||||
const int VERTCACHE_OFFSET_SHIFT = 24;
|
||||
const int VERTCACHE_OFFSET_MASK = 0x3ffffff; // 26 bits = 64 megs
|
||||
const int VERTCACHE_OFFSET_MASK = 0x7ffffff; // 27 bits = 128 megs
|
||||
|
||||
const int VERTCACHE_FRAME_SHIFT = 50;
|
||||
const int VERTCACHE_FRAME_MASK = 0x3fff; // 14 bits = 16382 frames to wrap around
|
||||
const int VERTCACHE_FRAME_SHIFT = 51;
|
||||
const int VERTCACHE_FRAME_MASK = 0x1fff; // 13 bits = 8191 frames to wrap around
|
||||
|
||||
|
||||
#else
|
||||
|
|
|
@ -177,7 +177,6 @@ idRenderModel* R_EntityDefDynamicModel( idRenderEntityLocal* def )
|
|||
// if we don't have a snapshot of the dynamic model, generate it now
|
||||
if( def->dynamicModel == NULL )
|
||||
{
|
||||
|
||||
SCOPED_PROFILE_EVENT( "InstantiateDynamicModel" );
|
||||
|
||||
// instantiate the snapshot of the dynamic model, possibly reusing memory from the cached snapshot
|
||||
|
@ -709,26 +708,23 @@ void R_AddSingleModel( viewEntity_t* vEntity )
|
|||
tr.pc.c_mocIndexes += 36;
|
||||
tr.pc.c_mocVerts += 8;
|
||||
|
||||
const float size = 16.0f;
|
||||
idBounds debugBounds( idVec3( -size ), idVec3( size ) );
|
||||
//debugBounds = vEntity->entityDef->localReferenceBounds;
|
||||
#if 0
|
||||
idBounds surfaceBounds;
|
||||
#if 1
|
||||
if( gpuSkinned )
|
||||
{
|
||||
//debugBounds = vEntity->entityDef->localReferenceBounds;
|
||||
debugBounds = model->Bounds();
|
||||
surfaceBounds = vEntity->entityDef->localReferenceBounds;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
debugBounds = tri->bounds;
|
||||
surfaceBounds = tri->bounds;
|
||||
}
|
||||
|
||||
idRenderMatrix modelRenderMatrix;
|
||||
idRenderMatrix::CreateFromOriginAxis( renderEntity->origin, renderEntity->axis, modelRenderMatrix );
|
||||
|
||||
idRenderMatrix inverseBaseModelProject;
|
||||
idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, debugBounds, inverseBaseModelProject );
|
||||
idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, surfaceBounds, inverseBaseModelProject );
|
||||
|
||||
idRenderMatrix invProjectMVPMatrix;
|
||||
idRenderMatrix::Multiply( viewDef->worldSpace.unjitteredMVP, inverseBaseModelProject, invProjectMVPMatrix );
|
||||
|
|
|
@ -382,51 +382,80 @@ void R_RenderSingleModel( viewEntity_t* vEntity )
|
|||
#if 0
|
||||
else
|
||||
{
|
||||
idVec4 triVerts[3];
|
||||
unsigned int triIndices[] = { 0, 1, 2 };
|
||||
|
||||
tr.pc.c_mocIndexes += 36;
|
||||
tr.pc.c_mocVerts += 8;
|
||||
|
||||
idBounds surfaceBounds;
|
||||
if( gpuSkinned )
|
||||
{
|
||||
surfaceBounds = vEntity->entityDef->localReferenceBounds;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceBounds = tri->bounds;
|
||||
}
|
||||
|
||||
idRenderMatrix modelRenderMatrix;
|
||||
idRenderMatrix::CreateFromOriginAxis( renderEntity->origin, renderEntity->axis, modelRenderMatrix );
|
||||
|
||||
//const float size = 16.0f;
|
||||
//idBounds debugBounds( idVec3( -size ), idVec3( size ) );
|
||||
idBounds debugBounds;
|
||||
#if 0
|
||||
if( gpuSkinned )
|
||||
{
|
||||
//debugBounds = vEntity->entityDef->localReferenceBounds;
|
||||
debugBounds = model->Bounds();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
debugBounds = tri->bounds;
|
||||
}
|
||||
|
||||
idRenderMatrix inverseBaseModelProject;
|
||||
idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, debugBounds, inverseBaseModelProject );
|
||||
idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, surfaceBounds, inverseBaseModelProject );
|
||||
|
||||
idRenderMatrix invProjectMVPMatrix;
|
||||
idRenderMatrix::Multiply( viewDef->worldSpace.unjitteredMVP, inverseBaseModelProject, invProjectMVPMatrix );
|
||||
|
||||
// NOTE: unit cube instead of zeroToOne cube
|
||||
idVec4* verts = tr.maskedUnitCubeVerts;
|
||||
unsigned int* indexes = tr.maskedZeroOneCubeIndexes;
|
||||
for( int i = 0, face = 0; i < 36; i += 3, face++ )
|
||||
idVec4 triVerts[8];
|
||||
|
||||
for( int i = 0; i < 8; i++ )
|
||||
{
|
||||
const idVec4& v0 = verts[indexes[i + 0]];
|
||||
const idVec4& v1 = verts[indexes[i + 1]];
|
||||
const idVec4& v2 = verts[indexes[i + 2]];
|
||||
|
||||
// transform to clip space
|
||||
invProjectMVPMatrix.TransformPoint( v0, triVerts[0] );
|
||||
invProjectMVPMatrix.TransformPoint( v1, triVerts[1] );
|
||||
invProjectMVPMatrix.TransformPoint( v2, triVerts[2] );
|
||||
invProjectMVPMatrix.TransformPoint( verts[i], triVerts[i] );
|
||||
}
|
||||
|
||||
tr.maskedOcclusionCulling->RenderTriangles( ( float* )triVerts, triIndices, 1, NULL, MaskedOcclusionCulling::BACKFACE_CCW );
|
||||
tr.maskedOcclusionCulling->RenderTriangles( ( float* )triVerts, tr.maskedZeroOneCubeIndexes, 12, NULL, MaskedOcclusionCulling::BACKFACE_CCW );
|
||||
}
|
||||
|
||||
#elif 0
|
||||
else
|
||||
{
|
||||
idBounds surfaceBounds;
|
||||
if( gpuSkinned )
|
||||
{
|
||||
surfaceBounds = vEntity->entityDef->localReferenceBounds;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceBounds = tri->bounds;
|
||||
}
|
||||
|
||||
idRenderMatrix modelRenderMatrix;
|
||||
idRenderMatrix::CreateFromOriginAxis( renderEntity->origin, renderEntity->axis, modelRenderMatrix );
|
||||
|
||||
idRenderMatrix inverseBaseModelProject;
|
||||
idRenderMatrix::OffsetScaleForBounds( modelRenderMatrix, surfaceBounds, inverseBaseModelProject );
|
||||
|
||||
// NOTE: unit cube instead of zeroToOne cube
|
||||
idVec4* verts = tr.maskedUnitCubeVerts;
|
||||
idVec4 triVerts[8];
|
||||
|
||||
for( int i = 0; i < 8; i++ )
|
||||
{
|
||||
// transform to clip space
|
||||
inverseBaseModelProject.TransformPoint( verts[i], triVerts[i] );
|
||||
}
|
||||
|
||||
static idVec4 colors[] = { colorRed, colorGreen, colorBlue, colorYellow, colorMagenta, colorCyan, colorWhite, colorPurple };
|
||||
idVec4 color = colors[surfaceNum & 7];
|
||||
|
||||
// same as idRenderWorldLocal::DebugBox
|
||||
const int lifetime = 0;
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
tr.viewDef->renderWorld->DebugLine( color, triVerts[i].ToVec3(), triVerts[( i + 1 ) & 3].ToVec3(), lifetime );
|
||||
tr.viewDef->renderWorld->DebugLine( color, triVerts[4 + i].ToVec3(), triVerts[4 + ( ( i + 1 ) & 3 )].ToVec3(), lifetime );
|
||||
tr.viewDef->renderWorld->DebugLine( color, triVerts[i].ToVec3(), triVerts[4 + i].ToVec3(), lifetime );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -488,9 +488,14 @@ void Dmap( const idCmdArgs& args )
|
|||
// create AAS files
|
||||
RunAAS_f( args );
|
||||
}
|
||||
|
||||
common->DmapPacifierFilename( passedName, "Done" );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->DmapPacifierFilename( passedName, "Failed due to errors. Quit program." );
|
||||
}
|
||||
|
||||
common->DmapPacifierFilename( passedName, "Done" );
|
||||
|
||||
// free the common .map representation
|
||||
delete dmapGlobals.dmapFile;
|
||||
|
|
|
@ -1234,11 +1234,11 @@ int main( int argc, char** argv )
|
|||
|
||||
Dmap_f( args );
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
// maybe only do this if dmap has a leaked BSP
|
||||
while( true )
|
||||
{
|
||||
bool captureToImage = false;
|
||||
common->UpdateScreen( captureToImage );
|
||||
common->UpdateScreen( false );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue