Skip to content

Commit

Permalink
consistent sampling for main and depth passes
Browse files Browse the repository at this point in the history
  • Loading branch information
Try committed Feb 18, 2024
1 parent 78da17d commit a4b98a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
3 changes: 1 addition & 2 deletions game/graphics/drawcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

using namespace Tempest;


bool DrawCommands::DrawCmd::isForwardShading() const {
return Material::isForwardShading(alpha);
}
Expand Down Expand Up @@ -245,7 +244,7 @@ void DrawCommands::updateCommandUniforms() {
if(cx.isBindless())
desc[v].set(L_Diffuse, tex); else
desc[v].set(L_Diffuse, *tex[bId]);
auto smp = (v==SceneGlobals::V_Main) ? Sampler::anisotrophy() : Sampler::trillinear();
auto smp = SceneGlobals::isShadowView(SceneGlobals::VisCamera(v)) ? Sampler::trillinear() : Sampler::anisotrophy();
desc[v].set(L_Sampler, smp);
}

Expand Down
2 changes: 1 addition & 1 deletion game/graphics/pfx/pfxbucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void PfxBucket::Draw::prepareUniforms(const SceneGlobals& scene, const Material&
continue;
ubo.set(L_Scene, scene.uboGlobal[view]);
if(view==SceneGlobals::V_Main || mat.isTextureInShadowPass()) {
auto smp = (view==SceneGlobals::V_Main) ? Sampler::anisotrophy() : Sampler::trillinear();
auto smp = SceneGlobals::isShadowView(SceneGlobals::VisCamera(view)) ? Sampler::trillinear() : Sampler::anisotrophy();
ubo.set(L_Diffuse, *mat.tex);
ubo.set(L_Sampler, smp);
}
Expand Down
13 changes: 13 additions & 0 deletions game/graphics/sceneglobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ SceneGlobals::~SceneGlobals() {
Gothic::inst().onSettingsChanged.ubind(this,&SceneGlobals::initSettings);
}

bool SceneGlobals::isShadowView(VisCamera v) {
switch (v) {
case V_Shadow0:
case V_Shadow1:
return true;
case V_Main:
case V_HiZ:
case V_Count:
return false;
}
return false;
}

void SceneGlobals::initSettings() {
zWindEnabled = Gothic::inst().settingsGetI("ENGINE","zWindEnabled")!=0;

Expand Down
2 changes: 2 additions & 0 deletions game/graphics/sceneglobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class SceneGlobals final {
V_Count
};

static bool isShadowView(VisCamera v);

void setViewProject(const Tempest::Matrix4x4& view, const Tempest::Matrix4x4& proj,
float zNear, float zFar,
const Tempest::Matrix4x4 *sh);
Expand Down

0 comments on commit a4b98a7

Please sign in to comment.