Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
refactor(w3ddevice): bake the smoke tuning, drop its temporary switches
Olcay Seygand116a632b812
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex f0b9dc6ab..a6dfe70c9 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -201,17 +201,6 @@ public:Bool m_shadowsForParticles; // "ShadowsForParticles": big alpha-blended particle clouds drop a soft blob on the groundBool m_volumetricSmokeShadows; // "VolumetricSmokeShadows": smoke and dust shade the world and themselves through the sun's map (Direct3D 11)Bool m_smokeFireLighting; // "SmokeFireLighting": smoke takes light from the fire beside it- // Temporary tuning switches for the two above, client-only and read every frame; below zero means- // the build's own figure. See the -smoke... switches in CommandLine.cpp.- Real m_smokeSelfShadowGain; // "-smokeselfshadow"- Real m_smokeSelfShadowCurve; // "-smokeselfcurve"- Real m_smokeGroundShadow; // "-smokegroundshadow"- Real m_smokeShadowDensity; // "-smokedensity"- Real m_smokeFireGain; // "-smokefiregain"- Real m_smokeFireRadius; // "-smokefireradius"- Real m_smokeFireCap; // "-smokefirecap"- Real m_smokeFireFullWeight; // "-smokefirefull"- Real m_smokeFireHeight; // "-smokefireheight"Bool m_classicGraphics; // "ClassicGraphics": the game's own art, tile, shadows and picture; read at startupBool m_shadowMap; // "-shadowmap": draw the casters into the sun's depth buffer as wellBool m_shadowMapReport; // "-shadowmapreport": log what ended up in that buffer, once a seconddiff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cppindex f8f17071f..31c026d3b 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp@@ -1009,88 +1009,6 @@ Int parseNoSmokeFireLight(char *args[], int)return 1;}-/* Temporary: the smoke's light and shade swept from the command line without a rebuild. Each takes- one number, clamped to its range; a switch with no number, or one never given, leaves the build's- own figure (the field stays below zero). All of it is client-side colour and shade, read by the- renderer every frame, so a network game and a replay are untouched.- -smokeselfshadow <0..1> how dark a particle on a plume's far side goes (0.8)- -smokeselfcurve <0.25..32> how fast that shade grows from the plume's sun side (16: the- sun side keeps its brightness, the back takes it all)- -smokegroundshadow <0..1> how dark the thickest smoke leaves the ground and units (0.4)- -smokedensity <0..10> scale on every particle's thickness to the sun (1)- -smokefiregain <0..4> fire light a full-strength fire puts on the smoke just above- it (0.7)- -smokefireradius <1..1000> reach of a fire's light sideways past its own flames, world- units (35)- -smokefireheight <1..2000> height over the flames at which the light is gone (90)- -smokefirecap <0..1> most fire light any particle takes (0.9)- -smokefirefull <1..10000> flame brightness times size at which a fire lights at full- strength; a smaller fire lights at its share of it (120) */-static Int parseSmokeTuning(char *args[], int num, Real *field, Real lo, Real hi)-{- if (num > 1 && args[1][0] != '-')- {- Real value = (Real)atof(args[1]);- *field = value < lo ? lo : (value > hi ? hi : value);- return 2;- }- return 1;-}--Int parseSmokeSelfShadow(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeSelfShadowGain, 0.0f, 1.0f) : 1;-}--Int parseSmokeSelfCurve(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeSelfShadowCurve, 0.25f, 32.0f) : 1;-}--Int parseSmokeGroundShadow(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeGroundShadow, 0.0f, 1.0f) : 1;-}--Int parseSmokeDensity(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeShadowDensity, 0.0f, 10.0f) : 1;-}--Int parseSmokeFireGain(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeFireGain, 0.0f, 4.0f) : 1;-}--Int parseSmokeFireRadius(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeFireRadius, 1.0f, 1000.0f) : 1;-}--Int parseSmokeFireCap(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeFireCap, 0.0f, 1.0f) : 1;-}--Int parseSmokeFireHeight(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeFireHeight, 1.0f, 2000.0f) : 1;-}--Int parseSmokeFireFull(char *args[], int num)-{- return TheWritableGlobalData- ? parseSmokeTuning(args, num, &TheWritableGlobalData->m_smokeFireFullWeight, 1.0f, 10000.0f) : 1;-}-Int parseNoShaders(char *args[], int){if (TheWritableGlobalData)@@ -2488,15 +2406,6 @@ static CommandLineParam params[] ={ "-noparticleshadows", parseNoParticleShadows },{ "-novolumetricsmoke", parseNoVolumetricSmoke },{ "-nosmokefirelight", parseNoSmokeFireLight },- { "-smokeselfshadow", parseSmokeSelfShadow },- { "-smokeselfcurve", parseSmokeSelfCurve },- { "-smokegroundshadow", parseSmokeGroundShadow },- { "-smokedensity", parseSmokeDensity },- { "-smokefiregain", parseSmokeFireGain },- { "-smokefireradius", parseSmokeFireRadius },- { "-smokefirecap", parseSmokeFireCap },- { "-smokefirefull", parseSmokeFireFull },- { "-smokefireheight", parseSmokeFireHeight },{ "-quickstart", parseQuickStart },/* In every build: EA kept them to Debug and Internal, so a Release run could not skip the logo or themovies. */diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 9804bfcbe..5e1fca97e 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -689,15 +689,6 @@ GlobalData::GlobalData()m_shadowsForParticles = TRUE; //on by default: the shipped INI has no entry for itm_volumetricSmokeShadows = TRUE;m_smokeFireLighting = TRUE;- m_smokeSelfShadowGain = -1.0f; //below zero: the build's own figure- m_smokeSelfShadowCurve = -1.0f;- m_smokeGroundShadow = -1.0f;- m_smokeShadowDensity = -1.0f;- m_smokeFireGain = -1.0f;- m_smokeFireRadius = -1.0f;- m_smokeFireCap = -1.0f;- m_smokeFireFullWeight = -1.0f;- m_smokeFireHeight = -1.0f;m_classicGraphics = FALSE;m_shadowMap = TRUE; //the sun's own shadows are what the game draws with nowm_shadowMapOnly = TRUE; //and they replace the stencil volumes rather than joining themdiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cppindex 1cfbc2ea1..69a48c39f 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp@@ -139,26 +139,10 @@ const Real cosAngleToCare = cos ((0.2 * PI) / 180.0); //1.5 degree difference#define SHADOW_MAP_SKY_FILL 0.12f// The smoke in the sun's light. The strength is how dark the thickest cloud leaves the ground and// the smoke behind it, under the solid casters' 0.45 because the sky still lights the ground under a-// cloud and the smoke itself scatters some of the sun on. How thick each particle is to the sun is-// particleSunMapOpticalDepth's. The self-shade is a particle's own: how dark one on its plume's far-// side goes, and the power that keeps the sun side lit (ffshader.h, smoke_reaching). The ground-// figure held up on Golden Oasis on 2026-10-03. The self-shade's 0.8 and 16 are the 2026-10-04-// re-sweep's, with the shade measured from the plume's front: white smoke's sun side 6.2% under the-// unshaded plume and its far side 0.85 of the sun side, soot 2.4% and 0.87. At 8 white lost 10.8%-// on its sun side; at 32 soot went flat.-// -smokegroundshadow, -smokeselfshadow, -smokeselfcurve and -smokedensity overrule them for a run.+// cloud and the smoke itself scatters some of the sun on; it held up on Golden Oasis on 2026-10-03.+// How thick each particle is to the sun is particleSunMapOpticalDepth's, and how a particle shades+// itself is the backend's (SMOKE_SELF_SHADOW_* in dx11backend.cpp).#define SMOKE_SHADOW_STRENGTH 0.4f-#define SMOKE_SELF_SHADOW_GAIN 0.8f-#define SMOKE_SELF_SHADOW_CURVE 16.0f--// W3DParticleSys.cpp: the fire light values the last particle pass used.-extern void W3DSmokeFireTuningInForce( Real *gain, Real *radius, Real *height, Real *cap, Real *fullWeight );--/** A tuning switch's value, or the build's own figure when it was not given (below zero). */-static inline Real smokeTuning( Real given, Real builtIn )-{- return given >= 0.0f ? given : builtIn;-}// Whether the sun's map took this frame. The volumes read it to know whether to stand down, and it// is false on a machine with no Direct3D 11 device, which is what keeps that machine's shadows.@@ -3887,7 +3871,7 @@ static void fillSmokeMap( const Matrix3D &sunTransform, const Vector3 &focus ){static std::vector<SmokeCaster> found; // kept: a burning base is thousands of particles every framestatic std::vector<Real> packed;- static Int systemsLastReport = -1;+ static Bool reported = FALSE;static UnsignedInt nextReportFrame = 0;const size_t mostCasters = 16384; // the backend's own SMOKE_MOST_CASTERS@@ -3895,8 +3879,7 @@ static void fillSmokeMap( const Matrix3D &sunTransform, const Vector3 &focus )found.clear();packed.clear();- const Real density = smokeTuning( TheGlobalData->m_smokeShadowDensity, 1.0f );- if (TheGlobalData->m_volumetricSmokeShadows && TheParticleSystemManager != NULL && density > 0.0f)+ if (TheGlobalData->m_volumetricSmokeShadows && TheParticleSystemManager != NULL){ParticleSystemManager::ParticleSystemList &systems = TheParticleSystemManager->getAllParticleSystems();for (ParticleSystemManager::ParticleSystemListIt it = systems.begin(); it != systems.end(); ++it)@@ -3912,7 +3895,7 @@ static void fillSmokeMap( const Matrix3D &sunTransform, const Vector3 &focus )const UnsignedInt layers = sys->getVolumeParticleDepth();for (Particle *p = sys->getFirstParticle(); p; p = p->m_systemNext){- const Real opticalDepth = particleSunMapOpticalDepth( p->getAlpha(), layers ) * density;+ const Real opticalDepth = particleSunMapOpticalDepth( p->getAlpha(), layers );if (opticalDepth <= 0.0f)continue;const Coord3D *pos = p->getPosition();@@ -3960,10 +3943,8 @@ static void fillSmokeMap( const Matrix3D &sunTransform, const Vector3 &focus )packed.push_back( found[ i ].opticalDepth );}- Direct3D11_Set_Smoke_Self_Shadow( smokeTuning( TheGlobalData->m_smokeSelfShadowGain, SMOKE_SELF_SHADOW_GAIN ),- smokeTuning( TheGlobalData->m_smokeSelfShadowCurve, SMOKE_SELF_SHADOW_CURVE ) );const Bool held = Direct3D11_Fill_Smoke_Map( packed.empty() ? NULL : &packed[ 0 ],- (unsigned)found.size(), smokeTuning( TheGlobalData->m_smokeGroundShadow, SMOKE_SHADOW_STRENGTH ) );+ (unsigned)found.size(), SMOKE_SHADOW_STRENGTH );if (!held)return;@@ -3980,21 +3961,14 @@ static void fillSmokeMap( const Matrix3D &sunTransform, const Vector3 &focus )// A run's log says whether the smoke was in the map at all: the first frame it held any, and// every ten seconds while it does.const UnsignedInt frame = TheGameLogic ? TheGameLogic->getFrame() : 0;- if (!found.empty() && (systemsLastReport < 0 || frame >= nextReportFrame))+ if (!found.empty() && (!reported || frame >= nextReportFrame)){nextReportFrame = frame + 10 * LOGICFRAMES_PER_SECOND;- systemsLastReport = systemsHeld;- Real fireGain, fireRadius, fireHeight, fireCap, fireFull;- W3DSmokeFireTuningInForce( &fireGain, &fireRadius, &fireHeight, &fireCap, &fireFull );+ reported = TRUE;DEBUG_LOG(("SMOKEMAP: frame %u, %d casters from %d systems in the sun's map, %d more past its limit;"- " ground %.2f self %.2f curve %.2f density %.2f; fire light %s gain %.2f radius %.0f height %.0f"- " cap %.2f full %.0f\n",+ " fire light %s\n",frame, (Int)found.size(), systemsHeld, (Int)( inBox - found.size() ),- smokeTuning( TheGlobalData->m_smokeGroundShadow, SMOKE_SHADOW_STRENGTH ),- smokeTuning( TheGlobalData->m_smokeSelfShadowGain, SMOKE_SELF_SHADOW_GAIN ),- smokeTuning( TheGlobalData->m_smokeSelfShadowCurve, SMOKE_SELF_SHADOW_CURVE ), density,- TheGlobalData->m_smokeFireLighting ? "on" : "off", fireGain, fireRadius, fireHeight, fireCap,- fireFull));+ TheGlobalData->m_smokeFireLighting ? "on" : "off"));}}diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cppindex f6b65d7e0..b17228f24 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp@@ -111,41 +111,6 @@ static const Real SMOKE_LIGHT_SOOT_SHARE = 0.35f; ///< share of the light evestatic const Real SMOKE_LIGHT_THIN_ALPHA = 0.25f; ///< a particle thinner than this takes its share of the lightstatic const Real FIRE_LIGHT_RED = 1.0f, FIRE_LIGHT_GREEN = 0.55f, FIRE_LIGHT_BLUE = 0.24f; ///< 255,140,60-/** The figures above that -smokefiregain, -smokefireradius, -smokefireheight, -smokefirecap and- * -smokefirefull overrule for a run, taken once a frame before the jobs start and only read by- * them. The gain scales the pulses' light too, and the radius the cap on a big fire's reach. The- * full weight is the one a fire's size is judged against, and a small fire well under it lights at- * that fraction of the gain. */-struct SmokeFireTuning-{- Real gain, pulseGain, radius, maxRadius, height, cap, fullWeight;-};-static SmokeFireTuning theSmokeFire = { FIRE_LIGHT_GAIN, PULSE_LIGHT_GAIN, FIRE_LIGHT_RADIUS,- FIRE_LIGHT_MAX_RADIUS, FIRE_LIGHT_HEIGHT, SMOKE_LIGHT_MAX_GLOW, FIRE_LIGHT_FULL_WEIGHT };--static void refreshSmokeFireTuning( void )-{- const Real gain = TheGlobalData->m_smokeFireGain >= 0.0f ? TheGlobalData->m_smokeFireGain : FIRE_LIGHT_GAIN;- const Real radius = TheGlobalData->m_smokeFireRadius >= 0.0f ? TheGlobalData->m_smokeFireRadius : FIRE_LIGHT_RADIUS;- theSmokeFire.gain = gain;- theSmokeFire.pulseGain = PULSE_LIGHT_GAIN * gain / FIRE_LIGHT_GAIN;- theSmokeFire.radius = radius;- theSmokeFire.maxRadius = FIRE_LIGHT_MAX_RADIUS * radius / FIRE_LIGHT_RADIUS;- theSmokeFire.height = TheGlobalData->m_smokeFireHeight >= 1.0f ? TheGlobalData->m_smokeFireHeight : FIRE_LIGHT_HEIGHT;- theSmokeFire.cap = TheGlobalData->m_smokeFireCap >= 0.0f ? TheGlobalData->m_smokeFireCap : SMOKE_LIGHT_MAX_GLOW;- theSmokeFire.fullWeight = TheGlobalData->m_smokeFireFullWeight >= 1.0f- ? TheGlobalData->m_smokeFireFullWeight : FIRE_LIGHT_FULL_WEIGHT;-}--/** The fire light values in force this frame, for the SMOKEMAP line in the log. */-void W3DSmokeFireTuningInForce( Real *gain, Real *radius, Real *height, Real *cap, Real *fullWeight )-{- *gain = theSmokeFire.gain;- *radius = theSmokeFire.radius;- *height = theSmokeFire.height;- *cap = theSmokeFire.cap;- *fullWeight = theSmokeFire.fullWeight;-}/** A light as the smoke sees it: its colour is already scaled by its strength and gain. A fire's* reaches its radius sideways, its height upwards and a share of the radius downwards; a pulse's@@ -205,11 +170,11 @@ static void gatherFireLight( ParticleSystem *sys, SmokeLight *lights, Int &countlight.y = y * inv;light.z = z * inv;const Real variance = sq * inv - (light.x * light.x + light.y * light.y + light.z * light.z);- Real radius = theSmokeFire.radius + FIRE_LIGHT_SPREAD_SCALE * (variance > 0.0f ? sqrtf( variance ) : 0.0f);- if (radius > theSmokeFire.maxRadius)- radius = theSmokeFire.maxRadius;+ Real radius = FIRE_LIGHT_RADIUS + FIRE_LIGHT_SPREAD_SCALE * (variance > 0.0f ? sqrtf( variance ) : 0.0f);+ if (radius > FIRE_LIGHT_MAX_RADIUS)+ radius = FIRE_LIGHT_MAX_RADIUS;- const Real height = theSmokeFire.height;+ const Real height = FIRE_LIGHT_HEIGHT;const Real reach = radius > height ? radius : height;if (WWMath::Fabs( light.x - view.Center.X ) > view.Extent.X + reach|| WWMath::Fabs( light.y - view.Center.Y ) > view.Extent.Y + reach@@ -217,8 +182,8 @@ static void gatherFireLight( ParticleSystem *sys, SmokeLight *lights, Int &countreturn;// fire's own colour, and the strength from how much of the flames there is- light.strength = w < theSmokeFire.fullWeight ? w / theSmokeFire.fullWeight : 1.0f;- const Real scale = light.strength * theSmokeFire.gain;+ light.strength = w < FIRE_LIGHT_FULL_WEIGHT ? w / FIRE_LIGHT_FULL_WEIGHT : 1.0f;+ const Real scale = light.strength * FIRE_LIGHT_GAIN;light.r = FIRE_LIGHT_RED * scale;light.g = FIRE_LIGHT_GREEN * scale;light.b = FIRE_LIGHT_BLUE * scale;@@ -265,9 +230,9 @@ static void gatherPulseLights( SmokeLight *lights, Int &count, const AABoxClasslight.invHeight = 0.0f; // a balllight.invBelow = 0.0f;light.reachSq = light.radiusSq;- light.r = diffuse.X * theSmokeFire.pulseGain;- light.g = diffuse.Y * theSmokeFire.pulseGain;- light.b = diffuse.Z * theSmokeFire.pulseGain;+ light.r = diffuse.X * PULSE_LIGHT_GAIN;+ light.g = diffuse.Y * PULSE_LIGHT_GAIN;+ light.b = diffuse.Z * PULSE_LIGHT_GAIN;light.strength = WWMath::Max( diffuse.X, WWMath::Max( diffuse.Y, diffuse.Z ) );if (light.strength > 0.0f)addSmokeLight( lights, count, light );@@ -371,7 +336,7 @@ static inline void lightSmoke( const Coord3D *pos, Real alpha, const SmokeLightReal peak = WWMath::Max( r, WWMath::Max( g, b ) );if (peak <= 0.0f)return;- Real scale = (peak > theSmokeFire.cap) ? theSmokeFire.cap / peak : 1.0f;+ Real scale = (peak > SMOKE_LIGHT_MAX_GLOW) ? SMOKE_LIGHT_MAX_GLOW / peak : 1.0f;if (alpha < SMOKE_LIGHT_THIN_ALPHA)scale *= alpha / SMOKE_LIGHT_THIN_ALPHA;@@ -604,7 +569,6 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo)fillJob.extentX = beX;fillJob.extentY = beY;fillJob.extentZ = beZ;- refreshSmokeFireTuning();fillJob.lightCount = TheGlobalData->m_smokeFireLighting ? gatherSmokeLights( fillJob.lights, bbox ) : 0;JobSystem::parallel_for( (Int)m_billboardFills.size(), BILLBOARD_FILLS_PER_CLAIM, fillBillboards, &fillJob );size_t nextFill = 0;diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cppindex 539d3ebd3..42cf0cbeb 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp@@ -320,8 +320,6 @@ DX11BackendClass::DX11BackendClass()SmokeMapRefused = false;SmokeMapFilled = false;SmokeStrength = 0.0f;- SmokeSelfGain = 0.8f;- SmokeSelfCurve = 16.0f;for (unsigned stage = 0; stage < DX11_BACKEND_TEXTURE_STAGES; ++stage) {set_identity(TextureTransforms[stage]);}@@ -615,6 +613,13 @@ static const unsigned SMOKE_MAP_TEXELS = 512;static const unsigned SMOKE_MAP_SLOT = DX11_BACKEND_TEXTURE_STAGES + 2; ///< t6 and s6, after the depth map'sstatic const unsigned SMOKE_SPLAT_FLOATS = 6; ///< per caster: sun clip x, y, z, radius, optical depth, depth spreadstatic const unsigned SMOKE_MOST_CASTERS = 16384;+// How a smoke particle shades itself (VOLUMETRIC_SAMPLING, smoke_reaching): how dark one on its+// plume's far side goes, and the power on the share of the plume ahead of it that keeps the sun+// side lit. The 2026-10-04 sweep: at 16 white smoke's sun side came out 6.2% under the unshaded+// plume and its far side 0.85 of the sun side, soot 2.4% and 0.87; at 8 white lost 10.8% on its sun+// side, and at 32 soot went flat.+static const float SMOKE_SELF_SHADOW_GAIN = 0.8f;+static const float SMOKE_SELF_SHADOW_CURVE = 16.0f;// Each caster is a disc facing the sun, drawn as a four corner strip whose corners come from the// vertex number, so the only buffer is the one holding the casters.@@ -779,7 +784,7 @@ bool DX11BackendClass::Fill_Smoke_Map(const float * casters, unsigned count, flo}// Nothing to draw is not a reason to make the map; whether it could be made is answered the// first time there is. A ground strength of nought still fills it for the smoke's own shade.- if (casters == NULL || count == 0 || (strength <= 0.0f && SmokeSelfGain <= 0.0f)) {+ if (casters == NULL || count == 0) {return !SmokeMapRefused;}if (!Make_Smoke_Map()) {@@ -915,15 +920,6 @@ void DX11BackendClass::Set_Scene_View(const float view[16])}}-void DX11BackendClass::Set_Smoke_Self_Shadow(float gain, float curve)-{- if (gain != SmokeSelfGain || curve != SmokeSelfCurve) {- SmokeSelfGain = gain;- SmokeSelfCurve = curve;- ConstantsChanged = true;- }-}-bool DX11BackendClass::Views_Current_Target(unsigned stage, ID3D11ShaderResourceView * texture) const{if (texture == NULL || CurrentTarget == NULL) {@@ -2121,9 +2117,9 @@ void DX11BackendClass::Upload_Constants()}}pixel_block.VolumeParameters[0] = SmokeMapFilled ? SmokeStrength : 0.0f;- pixel_block.VolumeParameters[1] = SmokeMapFilled ? SmokeSelfGain : 0.0f;+ pixel_block.VolumeParameters[1] = SmokeMapFilled ? SMOKE_SELF_SHADOW_GAIN : 0.0f;pixel_block.VolumeParameters[2] = camera_space ? 1.0f : 0.0f;- pixel_block.VolumeParameters[3] = SmokeSelfCurve;+ pixel_block.VolumeParameters[3] = SMOKE_SELF_SHADOW_CURVE;memcpy(pixel_block.ShadowFromClip, ShadowFromClip, sizeof(pixel_block.ShadowFromClip));pixel_block.ShadowParameters[0] = (ShadowMapSize > 0)? 1.0f / static_cast<float>(ShadowMapSize) : 0.0f;diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.hindex 176321abf..1f6bad932 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.h@@ -203,11 +203,6 @@ public:// frame's camera is back; until the first one, such a draw uses the view it was drawn with.void Set_Scene_View(const float view[16]);- // How a smoke particle shades itself, apart from what the smoke does to the ground: how dark a- // particle on its plume's far side goes, and the power the share of the plume in front of it is- // raised to, which keeps the sun side lit (VOLUMETRIC_SAMPLING, smoke_reaching).- void Set_Smoke_Self_Shadow(float gain, float curve);-// What is in the map, read back through a staging copy: how much of it was drawn into and how// near the nearest thing is. A caster pass that drew nothing leaves a map that is all one// value, and no draw count tells that apart from a pass that drew the world.@@ -452,8 +447,6 @@ private:bool SmokeMapRefused;bool SmokeMapFilled;float SmokeStrength;- float SmokeSelfGain;- float SmokeSelfCurve;bool Make_Smoke_Map();void Release_Smoke_Map();diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cppindex 27c137bfe..6904b6d2f 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cpp@@ -327,13 +327,6 @@ bool Direct3D11_Fill_Smoke_Map(const float * casters, unsigned count, float strereturn Active ? Backend.Fill_Smoke_Map(casters, count, strength) : false;}-void Direct3D11_Set_Smoke_Self_Shadow(float gain, float curve)-{- if (Active) {- Backend.Set_Smoke_Self_Shadow(gain, curve);- }-}-void Direct3D11_Set_Scene_View(const float view[16]){if (Active) {diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.hindex 990713fd6..2d9a8ae36 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.h@@ -152,10 +152,6 @@ bool Direct3D11_Fill_Smoke_Map(const float * casters, unsigned count, float stre// looks its shadow up through it.void Direct3D11_Set_Scene_View(const float view[16]);-// How a smoke particle shades itself: the darkness on its plume's far side and the power on the-// share of the plume in front of it. Set every frame the smoke map is filled.-void Direct3D11_Set_Smoke_Self_Shadow(float gain, float curve);-// The CPU has just written this surface. The next bind of its texture fills the Direct3D 11 copy// again. A no-op when the backend is not running.void Direct3D11_Mark_Surface_Dirty(struct IDirect3DSurface9 * surface);diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime_posix.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime_posix.cppindex 4c584c86f..c4f4e732c 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime_posix.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime_posix.cpp@@ -73,7 +73,6 @@ void Direct3D11_Set_Shadow_Parameters(float, float, float, float, float, float,void Direct3D11_Clear_Shadow_Parameters() {}bool Direct3D11_Fill_Smoke_Map(const float *, unsigned, float) { return false; }void Direct3D11_Set_Scene_View(const float [16]) {}-void Direct3D11_Set_Smoke_Self_Shadow(float, float) {}void Direct3D11_Mark_Surface_Dirty(struct IDirect3DSurface9 *) {}void Direct3D11_Mirror_Render_Target(struct IDirect3DSurface9 *) {}