- fix shader timer not always being applied correctly

This commit is contained in:
Magnus Norddahl 2019-04-18 17:14:26 +02:00
parent 47f056e882
commit 47fa7dafe3
2 changed files with 4 additions and 6 deletions

View File

@ -325,7 +325,10 @@ void VkRenderState::ApplyStreamData()
mStreamData.uVertexColor = mColor.vec; mStreamData.uVertexColor = mColor.vec;
mStreamData.uVertexNormal = mNormal.vec; mStreamData.uVertexNormal = mNormal.vec;
mStreamData.timer = static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mShaderTimer / 1000.); if (mMaterial.mMaterial && mMaterial.mMaterial->tex)
mStreamData.timer = static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mMaterial.mMaterial->tex->shaderspeed / 1000.);
else
mStreamData.timer = 0.0f;
if (mGlowEnabled) if (mGlowEnabled)
{ {
@ -507,9 +510,6 @@ void VkRenderState::ApplyMaterial()
mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->GetPipelineLayout(mRenderPassKey.NumTextureLayers), 1, base->GetDescriptorSet(mMaterial)); mCommandBuffer->bindDescriptorSet(VK_PIPELINE_BIND_POINT_GRAPHICS, passManager->GetPipelineLayout(mRenderPassKey.NumTextureLayers), 1, base->GetDescriptorSet(mMaterial));
} }
if (mMaterial.mMaterial && mMaterial.mMaterial->tex)
mShaderTimer = mMaterial.mMaterial->tex->shaderspeed;
mMaterial.mChanged = false; mMaterial.mChanged = false;
} }
} }

View File

@ -87,8 +87,6 @@ protected:
int mColorMask = 15; int mColorMask = 15;
int mCullMode = 0; int mCullMode = 0;
float mShaderTimer = 0.0f;
MatricesUBO mMatrices = {}; MatricesUBO mMatrices = {};
StreamData mStreamData = {}; StreamData mStreamData = {};
PushConstants mPushConstants = {}; PushConstants mPushConstants = {};