Fixes for extended shaders

This commit is contained in:
Jack Andersen 2016-07-30 18:46:03 -10:00
parent 95033d3988
commit 05a52c00be
6 changed files with 19 additions and 9 deletions

View File

@ -75,7 +75,11 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
if (m_vm.m_modelTest.IsLoaded())
{
CModelFlags flags;
flags.m_extendedShaderIdx = 1;
flags.addColor.r = 0.0f;
flags.m_extendedShaderIdx = 2;
if (std::fmod(m_theta, M_PIF) < M_PIF / 2.f)
flags.m_extendedShaderIdx = 1;
m_theta += 0.01f;
CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta) * zeus::CTransform::Scale(10.f));

View File

@ -584,6 +584,11 @@ void CBooRenderer::DrawSpaceWarp(const zeus::CVector3f& pt, float strength)
void CBooRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& mulCol, const zeus::CColor& addCol)
{
CModelFlags flags;
flags.m_extendedShaderIdx = 2;
flags.color = mulCol;
flags.addColor = addCol;
model.Draw(flags);
}
void CBooRenderer::DrawXRayOutline(const CModel&, const float*, const float*)

View File

@ -25,7 +25,7 @@ struct CModelFlags
u8 m_extendedShaderIdx = 0; /* 0 for shadeless, 1 for lighting, others defined in CModelShaders */
u16 m_flags = 0; /* Flags */
zeus::CColor color; /* Set into kcolor slot specified by material */
zeus::CColor addColor;
zeus::CColor addColor = zeus::CColor::skClear;
CModelFlags() = default;
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)

View File

@ -450,7 +450,7 @@ void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet
u8* bufOrig = bufOut;
for (const UVAnimation& anim : mat.uvAnims)
ProcessAnimation(bufOut, anim);
bufOut = bufOrig + sizeof(zeus::CMatrix4f) * 2;
bufOut = bufOrig + sizeof(zeus::CMatrix4f) * 2 * 8;
PadOutBuffer(start, bufOut);
}
}

View File

@ -50,10 +50,9 @@ static const char* ThermalPostGLSL =
" vec4 mulColor;\n"
" vec4 addColor;\n"
"};\n"
"TBINDING7 uniform sampler2D thermalLookup;\n"
"vec4 ThermalPostFunc(vec4 colorIn)\n"
"{\n"
" return texture(thermalLookup, vtf.extTcgs[0]).rrrr * mulColor + addColor;\n"
" return texture(tex7, vtf.extTcgs[0]).rrrr * mulColor + addColor;\n"
"}\n"
"\n";
@ -67,7 +66,7 @@ static const char* ThermalBlockNames[] = {HECL_GLSL_VERT_UNIFORM_BLOCK_NAME,
static const hecl::Backend::TextureInfo ThermalTextures[] =
{
{hecl::Backend::TexGenSrc::Normal, 0, 7, true}
{hecl::Backend::TexGenSrc::Normal, 7, 0, 7, true}
};
hecl::Runtime::ShaderCacheExtensions
@ -76,10 +75,12 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
hecl::Runtime::ShaderCacheExtensions ext(plat);
/* Normal lit shading */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {}, 3, BlockNames, 0, nullptr);
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {}, 3, BlockNames, 0, nullptr,
hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original);
/* Thermal Visor shading */
ext.registerExtensionSlot({}, {ThermalPostGLSL, "ThermalPostFunc"}, 3, ThermalBlockNames, 1, ThermalTextures);
ext.registerExtensionSlot({}, {ThermalPostGLSL, "ThermalPostFunc"}, 3, ThermalBlockNames, 1, ThermalTextures,
hecl::Backend::BlendFactor::One, hecl::Backend::BlendFactor::One);
return ext;
}

2
hecl

@ -1 +1 @@
Subproject commit 956e4874dd95c06bf7d9ebd675774143c59db4b7
Subproject commit 3f47a0524451e46c73915e81de85e0a926a29e12