Upside-down OpenGL reflection fix

This commit is contained in:
Jack Andersen 2018-10-18 13:55:59 -10:00
parent 290c79b57e
commit 27ca93178a
4 changed files with 29 additions and 13 deletions

View File

@ -61,16 +61,16 @@ build_script:
- C:\projects\deps\cmake\cmake-3.10.1-win64-x64\bin\cmake.exe -GNinja ..
- ninja
notifications:
- provider: Slack
incoming_webhook:
secure: uoO0I0PWyCx0KLjBOG6d17aSVuEEvYztB/UiF8J0LmTb2O735mAdWcuZHTImDFUGZxeI34/qzOB2JKqF+h8dZA5yiprSTkWIookqQjUokAM=
- provider: Webhook
url: https://skyhook.glitch.me/api/webhooks/345359672326356993/M8kBYpqr1JyVNhnAHBwNN5TnZmtWy9_msxAQoeOlaa73UhPn8gLU5uYZCjU1qsAi3sGN/appveyor
method: POST
on_build_success: true
on_build_failure: true
on_build_status_changed: false
#notifications:
# - provider: Slack
# incoming_webhook:
# secure: uoO0I0PWyCx0KLjBOG6d17aSVuEEvYztB/UiF8J0LmTb2O735mAdWcuZHTImDFUGZxeI34/qzOB2JKqF+h8dZA5yiprSTkWIookqQjUokAM=
# - provider: Webhook
# url: https://skyhook.glitch.me/api/webhooks/345359672326356993/M8kBYpqr1JyVNhnAHBwNN5TnZmtWy9_msxAQoeOlaa73UhPn8gLU5uYZCjU1qsAi3sGN/appveyor
# method: POST
# on_build_success: true
# on_build_failure: true
# on_build_status_changed: false
# Uncomment this to debug AppVeyor failures.
#on_finish:

View File

@ -729,7 +729,7 @@ CBooRenderer::CBooRenderer(IObjectStore& store, IFactory& resFac)
GenerateFogVolumeRampTex(ctx);
GenerateSphereRampTex(ctx);
m_ballShadowId = ctx.newRenderTexture(m_ballShadowIdW, m_ballShadowIdH, boo::TextureClampMode::Repeat, 1, 0);
x14c_reflectionTex = ctx.newRenderTexture(256, 256, boo::TextureClampMode::Repeat, 1, 0);
x14c_reflectionTex = ctx.newRenderTexture(256, 256, boo::TextureClampMode::ClampToBlack, 1, 0);
GenerateScanLinesVBO(ctx);
return true;
} BooTrace);

View File

@ -64,6 +64,14 @@ static const zeus::CMatrix4f ReflectBaseMtx =
0.f, 0.f, 0.f, 1.f
};
static const zeus::CMatrix4f ReflectPostGL =
{
1.f, 0.f, 0.f, 0.f,
0.f, -1.f, 0.f, 1.f,
0.f, 0.f, 1.f, 0.f,
0.f, 0.f, 0.f, 1.f
};
void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf,
zeus::CMatrix4f* mtxsOut, float& alphaOut)
{
@ -128,6 +136,14 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
mtxsOut[1][3][0] = -surfPos.dot(v2) * f1 + 0.5f;
mtxsOut[1][2][1] = f2;
mtxsOut[1][3][1] = -modelToPlayerLocal.z * f2;
switch (CGraphics::g_BooPlatform)
{
case boo::IGraphicsDataFactory::Platform::OpenGL:
mtxsOut[1] = ReflectPostGL * mtxsOut[1];
break;
default:
break;
}
}
}
@ -1200,7 +1216,7 @@ SShader::BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& ma
hecl::Backend::ReflectionType reflectionType;
if (mat.flags.samusReflectionIndirectTexture())
reflectionType = hecl::Backend::ReflectionType::Indirect;
else if (mat.flags.samusReflection())
else if (mat.flags.samusReflection() || mat.flags.samusReflectionSurfaceEye())
reflectionType = hecl::Backend::ReflectionType::Simple;
else
reflectionType = hecl::Backend::ReflectionType::None;

2
hecl

@ -1 +1 @@
Subproject commit 2ef53263a09a8a99ec73e86b23283d7275db23c0
Subproject commit 2ffa49b8667479c6a5db31d41889d0452183a83b