From d4d39a39447cb105b8a04075bcd89f2a481fd02f Mon Sep 17 00:00:00 2001 From: turanszkij Date: Mon, 22 May 2017 10:57:25 +0200 Subject: [PATCH] update impostor rendering --- WickedEngine/wiRenderer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 78f2465e8..b18c39b15 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -4005,14 +4005,14 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle GetDevice()->BindVertexLayout(vertexLayouts[VLTYPE_OBJECT_ALL], threadID); } - GetDevice()->BindResourcePS(mesh->impostorTarget.GetTexture(0), TEXSLOT_ONDEMAND0, threadID); - if (!easyTextureBind) - { - GetDevice()->BindResourcePS(mesh->impostorTarget.GetTexture(1), TEXSLOT_ONDEMAND1, threadID); - GetDevice()->BindResourcePS(mesh->impostorTarget.GetTexture(2), TEXSLOT_ONDEMAND2, threadID); - GetDevice()->BindResourcePS(mesh->impostorTarget.GetTexture(3), TEXSLOT_ONDEMAND3, threadID); - GetDevice()->BindResourcePS(mesh->impostorTarget.GetTexture(4), TEXSLOT_ONDEMAND4, threadID); - } + const GPUResource* res[] = { + static_cast(mesh->impostorTarget.GetTexture(0)), + static_cast(mesh->impostorTarget.GetTexture(1)), + static_cast(mesh->impostorTarget.GetTexture(2)), + static_cast(mesh->impostorTarget.GetTexture(3)), + static_cast(mesh->impostorTarget.GetTexture(4)), + }; + GetDevice()->BindResourcesPS(res, TEXSLOT_ONDEMAND0, (easyTextureBind ? 1 : ARRAYSIZE(res)), threadID); GetDevice()->BindVS(vertexShaders[VSTYPE_OBJECT_SIMPLE], threadID); @@ -4049,6 +4049,9 @@ void wiRenderer::RenderMeshes(const XMFLOAT3& eye, const CulledCollection& culle } SetAlphaRef(0.75f, threadID); GetDevice()->DrawInstanced(6 * 6, k, threadID); // 6 * 6: see Mesh::CreateImpostorVB function + prevVL = VLTYPE_NULL; + prevVS = VSTYPE_NULL; + prevPS = PSTYPE_NULL; } }