From 3f3e258d7769aa3522602687aea1119f32f3c589 Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 29 Jul 2021 19:41:38 +0200 Subject: CVisibilityPlugins, CRenderer, some fixes --- src/extras/custompipes_d3d9.cpp | 9 +++++++-- src/extras/custompipes_gl.cpp | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/extras') diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index cb5fcadc..dd3a95b7 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -16,6 +16,7 @@ #include "TxdStore.h" #include "Renderer.h" #include "World.h" +#include "VisibilityPlugins.h" #include "custompipes.h" #ifndef LIBRW @@ -464,9 +465,13 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) else d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this - setMaterial(m->color, m->surfaceProps, WorldPipeSwitch == WORLDPIPE_PS2 ? 0.5f : 1.0f); + rw::RGBA color = m->color; +#ifdef VIS_DISTANCE_ALPHA + color.alpha = (color.alpha * CVisibilityPlugins::GetObjectDistanceAlpha((RwObject*)atomic))/255.0f; +#endif + setMaterial(color, m->surfaceProps, WorldPipeSwitch == WORLDPIPE_PS2 ? 0.5f : 1.0f); - SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); + SetRenderState(VERTEXALPHA, inst->vertexAlpha || color.alpha != 255); drawInst(header, inst); inst++; diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index e70bd6db..ed6a529a 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -15,6 +15,7 @@ #include "TxdStore.h" #include "Renderer.h" #include "World.h" +#include "VisibilityPlugins.h" #include "custompipes.h" #ifndef LIBRW @@ -457,9 +458,13 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) setTexture(0, m->texture); - setMaterial(m->color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f); + rw::RGBA color = m->color; +#ifdef VIS_DISTANCE_ALPHA + color.alpha = (color.alpha * CVisibilityPlugins::GetObjectDistanceAlpha((RwObject*)atomic))/255.0f; +#endif + setMaterial(color, m->surfaceProps, CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 ? 0.5f : 1.0f); - rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); + rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || color.alpha != 0xFF); drawInst(header, inst); inst++; -- cgit v1.2.3