Rendering fixes for script nodes and certain UV anim modes
This commit is contained in:
parent
63c8351dcf
commit
3542759c74
|
@ -146,11 +146,22 @@ bool CMaterial::SetCurrent(ERenderOptions Options)
|
||||||
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||||
mPasses[iPass]->SetAnimCurrent(Options, iPass);
|
mPasses[iPass]->SetAnimCurrent(Options, iPass);
|
||||||
|
|
||||||
CGraphics::UpdateVertexBlock();
|
|
||||||
CGraphics::UpdatePixelBlock();
|
|
||||||
sCurrentMaterial = HashParameters();
|
sCurrentMaterial = HashParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the passes are otherwise the same, update UV anims that use the model matrix
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (u32 iPass = 0; iPass < mPasses.size(); iPass++)
|
||||||
|
{
|
||||||
|
EUVAnimMode mode = mPasses[iPass]->AnimMode();
|
||||||
|
|
||||||
|
if ((mode == eInverseMV) || (mode == eInverseMVTranslated) ||
|
||||||
|
(mode == eModelMatrix) || (mode == eSimpleMode))
|
||||||
|
mPasses[iPass]->SetAnimCurrent(Options, iPass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Bind textures
|
// Bind textures
|
||||||
CShader *pShader = CShader::CurrentShader();
|
CShader *pShader = CShader::CurrentShader();
|
||||||
|
|
||||||
|
@ -164,6 +175,11 @@ bool CMaterial::SetCurrent(ERenderOptions Options)
|
||||||
// Bind num lights
|
// Bind num lights
|
||||||
GLuint NumLightsLoc = pShader->GetUniformLocation("NumLights");
|
GLuint NumLightsLoc = pShader->GetUniformLocation("NumLights");
|
||||||
glUniform1i(NumLightsLoc, CGraphics::sNumLights);
|
glUniform1i(NumLightsLoc, CGraphics::sNumLights);
|
||||||
|
|
||||||
|
// Update shader blocks
|
||||||
|
CGraphics::UpdateVertexBlock();
|
||||||
|
CGraphics::UpdatePixelBlock();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,26 +115,29 @@ void CScriptNode::Draw(ERenderOptions Options)
|
||||||
{
|
{
|
||||||
if (!mpInstance) return;
|
if (!mpInstance) return;
|
||||||
|
|
||||||
if (!mpActiveModel)
|
// Set lighting
|
||||||
{
|
LoadModelMatrix();
|
||||||
glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ZERO);
|
LoadLights();
|
||||||
glDepthMask(GL_TRUE);
|
|
||||||
|
|
||||||
LoadModelMatrix();
|
|
||||||
CGraphics::SetDefaultLighting();
|
|
||||||
CGraphics::UpdateLightBlock();
|
|
||||||
CDrawUtil::DrawShadedCube(CColor::skTransparentPurple);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CGraphics::sLightMode == CGraphics::WorldLighting)
|
if (CGraphics::sLightMode == CGraphics::WorldLighting)
|
||||||
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::sAreaAmbientColor.ToVector4f() * CGraphics::sWorldLightMultiplier;
|
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::sAreaAmbientColor.ToVector4f() * CGraphics::sWorldLightMultiplier;
|
||||||
else
|
else
|
||||||
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor.ToVector4f();
|
CGraphics::sVertexBlock.COLOR0_Amb = CGraphics::skDefaultAmbientColor.ToVector4f();
|
||||||
|
|
||||||
LoadModelMatrix();
|
// Default to drawing purple box if no model
|
||||||
LoadLights();
|
if (!mpActiveModel)
|
||||||
|
{
|
||||||
|
glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ZERO);
|
||||||
|
glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
|
LoadModelMatrix();
|
||||||
|
CGraphics::UpdateVertexBlock();
|
||||||
|
CGraphics::UpdateLightBlock();
|
||||||
|
CDrawUtil::DrawShadedCube(CColor::skTransparentPurple);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set tev color (used rarely)
|
||||||
CGraphics::sPixelBlock.TevColor = mpInstance->GetTevColor().ToVector4f();
|
CGraphics::sPixelBlock.TevColor = mpInstance->GetTevColor().ToVector4f();
|
||||||
|
|
||||||
mpActiveModel->Draw(Options, 0);
|
mpActiveModel->Draw(Options, 0);
|
||||||
|
|
Loading…
Reference in New Issue