From b150ab7e75eca81d881ed2c33968484a069db58d Mon Sep 17 00:00:00 2001 From: vladislavbelov Date: Sun, 12 Mar 2023 13:01:51 +0000 Subject: [PATCH] Fixes decals with default normal texture. Differential Revision: https://code.wildfiregames.com/D4966 This was SVN commit r27576. --- source/graphics/ObjectEntry.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 84e8be3312..714e36de31 100644 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -34,6 +34,7 @@ #include "graphics/TextureManager.h" #include "lib/rand.h" #include "ps/CLogger.h" +#include "ps/CStrInternStatic.h" #include "ps/Game.h" #include "ps/World.h" #include "renderer/Renderer.h" @@ -84,7 +85,12 @@ bool CObjectEntry::BuildVariation(const std::vector*>& comp for (const CObjectBase::Samp& samp : m_Samplers) { CTextureProperties textureProps(samp.m_SamplerFile); - textureProps.SetAddressMode(Renderer::Backend::Sampler::AddressMode::CLAMP_TO_BORDER); + // TODO: replace all samplers by CLAMP_TO_EDGE after decals + // refactoring. Also we need to avoid custom border colors. + textureProps.SetAddressMode( + samp.m_SamplerName == str_baseTex + ? Renderer::Backend::Sampler::AddressMode::CLAMP_TO_BORDER + : Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE); CTexturePtr texture = g_Renderer.GetTextureManager().CreateTexture(textureProps); // TODO: Should check which renderpath is selected and only preload the necessary textures. texture->Prefetch();