Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
}
#endif

DX8Wrapper::Set_Light_Environment(rinfo.light_environment);
Renderer::Set_Light_Environment(rinfo.light_environment);

// Force shaders to update.
m_stageTwoTexture->restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
}
#endif

DX8Wrapper::Set_Light_Environment(rinfo.light_environment);
Renderer::Set_Light_Environment(rinfo.light_environment);

// Force shaders to update.
m_stageTwoTexture->restore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2377,10 +2377,10 @@ void WaterRenderObjClass::renderWaterMesh()
DX8Wrapper::Set_Texture(0,setting->waterTexture);
DX8Wrapper::Set_Texture(1,setting->waterTexture);

DX8Wrapper::Set_Light(0,*m_meshLight);
DX8Wrapper::Set_Light(1,nullptr);
DX8Wrapper::Set_Light(2,nullptr);
DX8Wrapper::Set_Light(3,nullptr);
Renderer::Set_Light(0,*m_meshLight);
Renderer::Clear_Light(1);
Renderer::Clear_Light(2);
Renderer::Clear_Light(3);
/*
DX8Wrapper::Set_DX8_Render_State(D3DRS_AMBIENT,0); //turn off scene ambient
DX8Wrapper::Set_DX8_Render_State(D3DRS_SPECULARENABLE,TRUE);
Expand Down
15 changes: 15 additions & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/Backend/DX8Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,18 @@ void Renderer::Set_Light_Environment(LightEnvironmentClass * light_env)
{
DX8Wrapper::Set_Light_Environment(light_env);
}

void Renderer::Set_Light(unsigned index, const LightClass & light)
{
DX8Wrapper::Set_Light(index, light);
}

void Renderer::Clear_Light(unsigned index)
{
DX8Wrapper::Set_Light(index, nullptr);
}

void Renderer::Set_Fog(bool enable, const Vector3 & color, float start, float end)
{
DX8Wrapper::Set_Fog(enable, color, start, end);
}
4 changes: 4 additions & 0 deletions Core/Libraries/Source/WWVegas/WW3D2/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Forward declarations keep this header includable without pulling in the full
// WW3D2 header graph. All W3D classes below are passed by pointer or reference.

class LightClass;
class LightEnvironmentClass;
class Matrix3D;
class Matrix4x4;
Expand Down Expand Up @@ -93,4 +94,7 @@ class Renderer

static void Set_Ambient(const Vector3 & color);
static void Set_Light_Environment(LightEnvironmentClass * light_env);
static void Set_Light(unsigned index, const LightClass & light);
static void Clear_Light(unsigned index);
static void Set_Fog(bool enable, const Vector3 & color, float start, float end);
};
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ void DX8TextureCategoryClass::Render()
LightEnvironmentClass * lenv = mesh->Get_Lighting_Environment();
if (lenv != nullptr) {
SNAPSHOT_SAY(("LightEnvironment, lights: %d",lenv->Get_Light_Count()));
DX8Wrapper::Set_Light_Environment(lenv);
Renderer::Set_Light_Environment(lenv);
}
else {
SNAPSHOT_SAY(("No light environment"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ void RTS3DScene::updatePlayerColorPasses()
void RTS3DScene::Render(RenderInfoClass & rinfo)
{
//USE_PERF_TIMER(NonTerrainRender)
DX8Wrapper::Set_Fog(FogEnabled, FogColor, FogStart, FogEnd);
Renderer::Set_Fog(FogEnabled, FogColor, FogStart, FogEnd);

//Override the behind building selection if it's not available on current hardware (needs stencil).
TheWritableGlobalData->m_enableBehindBuildingMarkers = TheWritableGlobalData->m_enableBehindBuildingMarkers && Renderer::Has_Stencil();
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ void MeshClass::Render_Material_Pass(MaterialPassClass * pass,IndexBufferClass *
Vector3 oldEmissive(-1,-1,-1);

if (LightEnvironment != nullptr) {
DX8Wrapper::Set_Light_Environment(LightEnvironment);
Renderer::Set_Light_Environment(LightEnvironment);
}

if (Model->Get_Flag(MeshModelClass::SKIN)) {
Expand Down
12 changes: 6 additions & 6 deletions GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void SceneClass::Render(RenderInfoClass & rinfo)
// Any stuff that needs to get done before anything else
Pre_Render_Processing(rinfo);

DX8Wrapper::Set_Fog(FogEnabled, FogColor, FogStart, FogEnd);
Renderer::Set_Fog(FogEnabled, FogColor, FogStart, FogEnd);

if (Get_Extra_Pass_Polygon_Mode()==EXTRA_PASS_DISABLE) {
Customized_Render(rinfo);
Expand Down Expand Up @@ -481,10 +481,10 @@ void SimpleSceneClass::Customized_Render(RenderInfoClass & rinfo)
// derived classes should use light environment
WWASSERT(rinfo.light_environment==nullptr);
// Turn off lights in case we have none
DX8Wrapper::Set_Light(0,nullptr);
DX8Wrapper::Set_Light(1,nullptr);
DX8Wrapper::Set_Light(2,nullptr);
DX8Wrapper::Set_Light(3,nullptr);
Renderer::Clear_Light(0);
Renderer::Clear_Light(1);
Renderer::Clear_Light(2);
Renderer::Clear_Light(3);

// (gth) WWShade only works with light environments. We need to upgrade LightEnvironment to
// support real point lights, etc. It will likely just evolve into "the n most important" lights
Expand All @@ -495,7 +495,7 @@ void SimpleSceneClass::Customized_Render(RenderInfoClass & rinfo)
{
if (count<4)
{
DX8Wrapper::Set_Light(count,*(LightClass*)it.Peek_Obj());
Renderer::Set_Light(count,*(LightClass*)it.Peek_Obj());
} else
{
// Simple scene only supports 4 global lights
Expand Down
Loading