Merge branch 'master' of ssh://gitlab.axiodl.com:6431/AxioDL/urde

This commit is contained in:
Phillip Stephens 2018-01-21 18:46:04 -08:00
commit a29cca3c47
7 changed files with 59 additions and 11 deletions

View File

@ -11,6 +11,7 @@
#include "Audio/CStreamAudioManager.hpp"
#include "Graphics/CMoviePlayer.hpp"
#include "CStateManager.hpp"
#include "hecl/CVarManager.hpp"
namespace urde
{
@ -26,7 +27,8 @@ static const SGameOption VisorOpts[] =
static const SGameOption DisplayOpts[] =
{
{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
//{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
{EGameOption::ScreenBrightness, 25, -100.f, 100.f, 1.f, EOptionType::Float},
{EGameOption::ScreenOffsetX, 26, -30.f, 30.f, 1.f, EOptionType::Float},
{EGameOption::ScreenOffsetY, 27, -30.f, 30.f, 1.f, EOptionType::Float},
{EGameOption::ScreenStretch, 28, -10.f, 10.f, 1.f, EOptionType::Float},
@ -243,14 +245,32 @@ void CGameOptions::InitSoundMode()
/* If system is mono, force x44 to mono, otherwise honor user preference */
}
static float BrightnessCopyFilter = 0.f;
void CGameOptions::SetScreenBrightness(s32 val, bool b)
void CGameOptions::SetScreenBrightness(s32 val, bool apply)
{
x48_screenBrightness = zeus::clamp(0, val, 8);
if (b)
if (apply)
BrightnessCopyFilter = TuneScreenBrightness();
}
void CGameOptions::ApplyGamma()
{
float gammaT = -m_gamma / 100.f + 1.f;
if (gammaT < 1.f)
gammaT = gammaT * 0.5f + 0.5f;
if (zeus::close_enough(gammaT, 1.f, 0.05f))
gammaT = 1.f;
CGraphics::g_BooFactory->setDisplayGamma(gammaT);
}
void CGameOptions::SetGamma(s32 val, bool apply)
{
m_gamma = zeus::clamp(-100, val, 100);
if (apply)
ApplyGamma();
}
void CGameOptions::SetScreenPositionX(s32 pos, bool apply)
{
x4c_screenXOffset = zeus::clamp(-30, pos, 30);
@ -414,6 +434,7 @@ void CGameOptions::ResetControllerAssets(int controls)
void CGameOptions::EnsureSettings()
{
SetScreenBrightness(x48_screenBrightness, true);
SetGamma(m_gamma, true);
SetScreenPositionX(x4c_screenXOffset, true);
SetScreenPositionY(x50_screenYOffset, true);
SetScreenStretch(x54_screenStretch, true);
@ -462,6 +483,7 @@ void CGameOptions::TryRestoreDefaults(const CFinalInput& input, int category,
case 1:
gameOptions.SetScreenBrightness(4, true);
gameOptions.SetGamma(0, true);
gameOptions.SetScreenPositionX(0, true);
gameOptions.SetScreenPositionY(0, true);
gameOptions.SetScreenStretch(0, true);
@ -502,7 +524,7 @@ void CGameOptions::SetOption(EGameOption option, int value)
options.SetIsHintSystemEnabled(value);
break;
case EGameOption::ScreenBrightness:
options.SetScreenBrightness(value, true);
options.SetGamma(value, true);
break;
case EGameOption::ScreenOffsetX:
options.SetScreenPositionX(value, true);
@ -550,7 +572,7 @@ int CGameOptions::GetOption(EGameOption option)
case EGameOption::HintSystem:
return options.GetIsHintSystemEnabled();
case EGameOption::ScreenBrightness:
return options.GetScreenBrightness();
return options.GetGamma();
case EGameOption::ScreenOffsetX:
return options.GetScreenPositionX();
case EGameOption::ScreenOffsetY:

View File

@ -129,6 +129,8 @@ class CGameOptions
u32 x60_hudAlpha = 0xff;
u32 x64_helmetAlpha = 0xff;
s32 m_gamma = 0;
union
{
struct
@ -155,6 +157,9 @@ public:
float TuneScreenBrightness();
void SetScreenBrightness(s32, bool);
s32 GetScreenBrightness() const { return x48_screenBrightness; }
void ApplyGamma();
void SetGamma(s32, bool);
s32 GetGamma() const { return m_gamma; }
void SetScreenPositionX(s32, bool);
s32 GetScreenPositionX() const { return x4c_screenXOffset; }
void SetScreenPositionY(s32, bool);

View File

@ -793,13 +793,18 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
SetupRendererStates();
CModelFlags flags;
int bufIdx;
if (shadowRender)
{
flags.m_extendedShader = EExtendedShader::SolidColor;
flags.x4_color = zeus::CColor::skBlack;
bufIdx = 1;
}
else
{
flags.m_extendedShader = EExtendedShader::Lighting;
bufIdx = 0;
}
for (CAreaListItem& item : x1c_areaListItems)
{
@ -807,7 +812,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
continue;
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
item.m_shaderSet->m_geomLayout->m_sharedBuffer[shadowRender]);
item.m_shaderSet->m_geomLayout->m_sharedBuffer[bufIdx]);
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
{
@ -815,7 +820,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
if (model->TryLockTextures())
{
ActivateLightsForModel(&item, *model);
model->UpdateUniformData(flags, nullptr, nullptr, shadowRender);
model->UpdateUniformData(flags, nullptr, nullptr, bufIdx);
}
}
}

View File

@ -104,6 +104,7 @@ private:
zeus::CMatrix4f m_proj;
zeus::CMatrix4f m_texMtxs[9]; // Pad out to 768 bytes
CModelShaders::LightingUniform m_lighting;
zeus::CVector3f m_pad; // Pad out to 768 bytes
};
std::experimental::optional<TLockedToken<CTexture>> m_patternTex1;

View File

@ -7,11 +7,13 @@ namespace urde
CTexturedQuadFilter::CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex)
: m_booTex(tex)
{
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
}
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const boo::ObjToken<boo::ITexture>& tex, bool gequal)
: m_booTex(tex), m_gequal(gequal)
{
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
tex->setClampMode(boo::TextureClampMode::ClampToEdge);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
@ -26,6 +28,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type,
TLockedToken<CTexture> tex)
: CTexturedQuadFilter(type, (tex ? tex->GetBooTexture() : nullptr))
{
m_flipRect = CGraphics::g_BooFactory->platform() == boo::IGraphicsDataFactory::Platform::Vulkan;
m_tex = tex;
}
@ -40,10 +43,20 @@ void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const z
};
m_vbo->load(verts, sizeof(verts));
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
if (!m_flipRect)
{
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
}
else
{
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
m_uniform.m_matrix[1][1] = rect.size.y * -2.f;
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
m_uniform.m_matrix[3][1] = rect.position.y * -2.f + 1.f;
}
m_uniform.m_color = color;
m_uniBuf->load(&m_uniform, sizeof(m_uniform));

View File

@ -36,6 +36,7 @@ protected:
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
Uniform m_uniform;
bool m_gequal;
bool m_flipRect = false;
CTexturedQuadFilter(const boo::ObjToken<boo::ITexture>& tex);

View File

@ -500,6 +500,7 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG)
DiscordRichPresence discordPresence = {};
discordPresence.state = DiscordState.c_str();
discordPresence.details = DiscordWorldName.c_str();
discordPresence.largeImageKey = "default";
discordPresence.startTimestamp = DiscordStartTime;
Discord_UpdatePresence(&discordPresence);
}