- Pass vertex color and normal via uniform buffer when the attribute isn't available

This commit is contained in:
Magnus Norddahl 2019-03-02 01:56:08 +01:00
commit 05a6896d4f
8 changed files with 38 additions and 14 deletions

View file

@ -62,6 +62,7 @@ bool VkRenderState::SetDepthClamp(bool on)
void VkRenderState::SetDepthMask(bool on)
{
mDepthWrite = on;
}
void VkRenderState::SetDepthFunc(int func)
@ -181,7 +182,6 @@ void VkRenderState::SetViewport(int x, int y, int w, int h)
void VkRenderState::EnableDepthTest(bool on)
{
mDepthTest = on;
mDepthWrite = on;
}
void VkRenderState::EnableMultisampling(bool on)
@ -301,9 +301,6 @@ void VkRenderState::Apply(int dt)
const float normScale = 1.0f / 255.0f;
//glVertexAttrib4fv(VATTR_COLOR, mColor.vec);
//glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
int fogset = 0;
if (mFogEnabled)
@ -329,7 +326,11 @@ void VkRenderState::Apply(int dt)
mColors.uDynLightColor = mDynColor.vec;
mColors.uInterpolationFactor = mInterpolationFactor;
//activeShader->muTimer.Set((double)(screen->FrameTime - firstFrame) * (double)mShaderTimer / 1000.);
mColors.useVertexData = passManager->VertexFormats[static_cast<VKVertexBuffer*>(mVertexBuffer)->VertexFormat].UseVertexData;
mColors.uVertexColor = mColor.vec;
mColors.uVertexNormal = mNormal.vec;
mColors.timer = 0.0f; // static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mShaderTimer / 1000.);
int tempTM = TM_NORMAL;
if (mMaterial.mMaterial && mMaterial.mMaterial->tex->isHardwareCanvas())