mirror of https://github.com/AxioDL/metaforce.git
CWorldShadow OpenGL fixes; discord-rpc integration
This commit is contained in:
parent
030e80d843
commit
669b3d6942
|
@ -28,3 +28,9 @@
|
||||||
[submodule "cotire"]
|
[submodule "cotire"]
|
||||||
path = cotire
|
path = cotire
|
||||||
url = https://github.com/sakra/cotire.git
|
url = https://github.com/sakra/cotire.git
|
||||||
|
[submodule "discord-rpc"]
|
||||||
|
path = discord-rpc
|
||||||
|
url = https://github.com/discordapp/discord-rpc.git
|
||||||
|
[submodule "rapidjson"]
|
||||||
|
path = rapidjson
|
||||||
|
url = https://github.com/Tencent/rapidjson.git
|
||||||
|
|
|
@ -130,6 +130,12 @@ if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add discord-rpc here
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include)
|
||||||
|
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
|
||||||
|
add_subdirectory(discord-rpc/src)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc/include)
|
||||||
|
|
||||||
set(HECL_DLPACKAGE ${URDE_DLPACKAGE})
|
set(HECL_DLPACKAGE ${URDE_DLPACKAGE})
|
||||||
|
|
||||||
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/boo/include)
|
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/boo/include)
|
||||||
|
|
|
@ -102,7 +102,7 @@ target_link_libraries(urde
|
||||||
hecl-full hecl-blender-addon
|
hecl-full hecl-blender-addon
|
||||||
athena-core nod logvisor athena-libyaml amuse boo
|
athena-core nod logvisor athena-libyaml amuse boo
|
||||||
${PNG_LIB} libjpeg-turbo squish xxhash zeus
|
${PNG_LIB} libjpeg-turbo squish xxhash zeus
|
||||||
kabufuda jbus ${ZLIB_LIBRARIES} ${LZO_LIB}
|
kabufuda jbus discord-rpc ${ZLIB_LIBRARIES} ${LZO_LIB}
|
||||||
${BOO_SYS_LIBS})
|
${BOO_SYS_LIBS})
|
||||||
if(COMMAND add_sanitizers)
|
if(COMMAND add_sanitizers)
|
||||||
add_sanitizers(urde)
|
add_sanitizers(urde)
|
||||||
|
|
|
@ -143,6 +143,11 @@ struct Application : boo::IApplicationCallback
|
||||||
return m_cvarCommons.getAnisotropy();
|
return m_cvarCommons.getAnisotropy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getDeepColor() const
|
||||||
|
{
|
||||||
|
return m_cvarCommons.getDeepColor();
|
||||||
|
}
|
||||||
|
|
||||||
void quit(hecl::Console* con = nullptr, const std::vector<std::string>& arg = std::vector<std::string>())
|
void quit(hecl::Console* con = nullptr, const std::vector<std::string>& arg = std::vector<std::string>())
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
@ -214,7 +219,7 @@ int main(int argc, const boo::SystemChar** argv)
|
||||||
urde::Application appCb;
|
urde::Application appCb;
|
||||||
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
||||||
appCb, _S("urde"), _S("URDE"), argc, argv, appCb.getGraphicsApi(),
|
appCb, _S("urde"), _S("URDE"), argc, argv, appCb.getGraphicsApi(),
|
||||||
appCb.getSamples(), appCb.getAnisotropy(), false);
|
appCb.getSamples(), appCb.getAnisotropy(), appCb.getDeepColor(), false);
|
||||||
//printf("IM DYING!!\n");
|
//printf("IM DYING!!\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "World/CScriptWater.hpp"
|
#include "World/CScriptWater.hpp"
|
||||||
#include "World/CScriptDoor.hpp"
|
#include "World/CScriptDoor.hpp"
|
||||||
#include "Input/ControlMapper.hpp"
|
#include "Input/ControlMapper.hpp"
|
||||||
|
#include "MP1/MP1.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -205,7 +206,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
||||||
x90c_loaderFuncs[int(EScriptObjectType::ShadowProjector)] = ScriptLoader::LoadShadowProjector;
|
x90c_loaderFuncs[int(EScriptObjectType::ShadowProjector)] = ScriptLoader::LoadShadowProjector;
|
||||||
x90c_loaderFuncs[int(EScriptObjectType::EnergyBall)] = ScriptLoader::LoadEnergyBall;
|
x90c_loaderFuncs[int(EScriptObjectType::EnergyBall)] = ScriptLoader::LoadEnergyBall;
|
||||||
|
|
||||||
CGameCollision::InitCollision();
|
//CGameCollision::InitCollision();
|
||||||
ControlMapper::ResetCommandFilters();
|
ControlMapper::ResetCommandFilters();
|
||||||
x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
||||||
}
|
}
|
||||||
|
@ -1837,6 +1838,8 @@ void CStateManager::UpdateGraphicsTiming(float dt)
|
||||||
|
|
||||||
void CStateManager::Update(float dt)
|
void CStateManager::Update(float dt)
|
||||||
{
|
{
|
||||||
|
MP1::CMain::UpdateDiscordPresence(GetWorld()->IGetStringTableAssetId());
|
||||||
|
|
||||||
CElementGen::SetGlobalSeed(x8d8_updateFrameIdx);
|
CElementGen::SetGlobalSeed(x8d8_updateFrameIdx);
|
||||||
CParticleElectric::SetGlobalSeed(x8d8_updateFrameIdx);
|
CParticleElectric::SetGlobalSeed(x8d8_updateFrameIdx);
|
||||||
CDecal::SetGlobalSeed(x8d8_updateFrameIdx);
|
CDecal::SetGlobalSeed(x8d8_updateFrameIdx);
|
||||||
|
|
|
@ -125,7 +125,7 @@ public:
|
||||||
private:
|
private:
|
||||||
CBooModel* m_next = nullptr;
|
CBooModel* m_next = nullptr;
|
||||||
CBooModel* m_prev = nullptr;
|
CBooModel* m_prev = nullptr;
|
||||||
size_t m_uniUpdateCount = 0;
|
int m_uniUpdateCount = 0;
|
||||||
TToken<CModel> m_modelTok;
|
TToken<CModel> m_modelTok;
|
||||||
CModel* m_model;
|
CModel* m_model;
|
||||||
std::vector<CBooSurface>* x0_surfaces;
|
std::vector<CBooSurface>* x0_surfaces;
|
||||||
|
|
|
@ -754,13 +754,13 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
||||||
case UVAnimation::Mode::HStrip:
|
case UVAnimation::Mode::HStrip:
|
||||||
{
|
{
|
||||||
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
|
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
|
||||||
texMtxOut.vec[3].x = (float)(short)(float)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
texMtxOut.vec[3].x = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UVAnimation::Mode::VStrip:
|
case UVAnimation::Mode::VStrip:
|
||||||
{
|
{
|
||||||
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
|
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
|
||||||
texMtxOut.vec[3].y = (float)(short)(float)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
texMtxOut.vec[3].y = (float)(short)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UVAnimation::Mode::Model:
|
case UVAnimation::Mode::Model:
|
||||||
|
@ -997,6 +997,23 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
||||||
}
|
}
|
||||||
|
|
||||||
const ModelInstance* inst;
|
const ModelInstance* inst;
|
||||||
|
if (sharedLayoutBuf >= 0)
|
||||||
|
{
|
||||||
|
if (m_instances.size() <= sharedLayoutBuf)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
inst = const_cast<CBooModel*>(this)->PushNewModelInstance(m_instances.size());
|
||||||
|
if (!inst)
|
||||||
|
return nullptr;
|
||||||
|
} while (m_instances.size() <= sharedLayoutBuf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
inst = &m_instances[sharedLayoutBuf];
|
||||||
|
const_cast<CBooModel*>(this)->m_uniUpdateCount = sharedLayoutBuf + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (m_instances.size() <= m_uniUpdateCount)
|
if (m_instances.size() <= m_uniUpdateCount)
|
||||||
{
|
{
|
||||||
inst = const_cast<CBooModel*>(this)->PushNewModelInstance(sharedLayoutBuf);
|
inst = const_cast<CBooModel*>(this)->PushNewModelInstance(sharedLayoutBuf);
|
||||||
|
@ -1006,6 +1023,7 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
||||||
else
|
else
|
||||||
inst = &m_instances[m_uniUpdateCount];
|
inst = &m_instances[m_uniUpdateCount];
|
||||||
++const_cast<CBooModel*>(this)->m_uniUpdateCount;
|
++const_cast<CBooModel*>(this)->m_uniUpdateCount;
|
||||||
|
}
|
||||||
|
|
||||||
if (inst->m_geomUniformBuffer)
|
if (inst->m_geomUniformBuffer)
|
||||||
m_geomLayout->Update(flags, cskr, pose, x4_matSet, inst->m_geomUniformBuffer);
|
m_geomLayout->Update(flags, cskr, pose, x4_matSet, inst->m_geomUniformBuffer);
|
||||||
|
@ -1139,7 +1157,7 @@ SShader::BuildShader(const hecl::HMDLMeta& meta, const MaterialSet::Material& ma
|
||||||
reflectionType = hecl::Backend::ReflectionType::None;
|
reflectionType = hecl::Backend::ReflectionType::None;
|
||||||
hecl::Runtime::ShaderTag tag(mat.heclIr,
|
hecl::Runtime::ShaderTag tag(mat.heclIr,
|
||||||
meta.colorCount, meta.uvCount, meta.weightCount,
|
meta.colorCount, meta.uvCount, meta.weightCount,
|
||||||
meta.weightCount * 4, 8, boo::Primitive(meta.topology),
|
meta.weightCount * 4, boo::Primitive(meta.topology),
|
||||||
reflectionType, true, true, true);
|
reflectionType, true, true, true);
|
||||||
return CModelShaders::g_ModelShaders->buildExtendedShader
|
return CModelShaders::g_ModelShaders->buildExtendedShader
|
||||||
(tag, mat.heclIr, "CMDL", *CGraphics::g_BooFactory);
|
(tag, mat.heclIr, "CMDL", *CGraphics::g_BooFactory);
|
||||||
|
|
|
@ -81,6 +81,9 @@ static const char* LightingShadowGLSL =
|
||||||
"\n"
|
"\n"
|
||||||
"vec4 LightingShadowFunc(vec4 mvPosIn, vec4 mvNormIn)\n"
|
"vec4 LightingShadowFunc(vec4 mvPosIn, vec4 mvNormIn)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
" vec2 shadowUV = vtf.extTcgs[0];\n"
|
||||||
|
" shadowUV.y = 1.0 - shadowUV.y;\n"
|
||||||
|
" \n"
|
||||||
" vec4 ret = ambient;\n"
|
" vec4 ret = ambient;\n"
|
||||||
" \n"
|
" \n"
|
||||||
" vec3 delta = mvPosIn.xyz - lights[0].pos.xyz;\n"
|
" vec3 delta = mvPosIn.xyz - lights[0].pos.xyz;\n"
|
||||||
|
@ -93,7 +96,7 @@ static const char* LightingShadowGLSL =
|
||||||
" lights[0].angAtt[1] * angDot +\n"
|
" lights[0].angAtt[1] * angDot +\n"
|
||||||
" lights[0].angAtt[0];\n"
|
" lights[0].angAtt[0];\n"
|
||||||
" ret += lights[0].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0) *\n"
|
" ret += lights[0].color * clamp(angAtt, 0.0, 1.0) * att * clamp(dot(normalize(-delta), mvNormIn.xyz), 0.0, 1.0) *\n"
|
||||||
" texture(extTex7, vtf.extTcgs[0]).r;\n"
|
" texture(extTex7, shadowUV).r;\n"
|
||||||
" \n"
|
" \n"
|
||||||
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
|
|
|
@ -93,7 +93,7 @@ static const char* LightingShadowMetal =
|
||||||
" lu.lights[0].angAtt[1] * angDot +\n"
|
" lu.lights[0].angAtt[1] * angDot +\n"
|
||||||
" lu.lights[0].angAtt[0];\n"
|
" lu.lights[0].angAtt[0];\n"
|
||||||
" ret += lu.lights[0].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn.xyz)) *\n"
|
" ret += lu.lights[0].color * saturate(angAtt) * att * saturate(dot(normalize(-delta), mvNormIn.xyz)) *\n"
|
||||||
" extTex7.sample(clampSamp, vtf.extTcgs0);\n"
|
" extTex7.sample(clampSamp, vtf.extTcgs0).r;\n"
|
||||||
" \n"
|
" \n"
|
||||||
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
" for (int i=1 ; i<" _XSTR(URDE_MAX_LIGHTS) " ; ++i)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
|
|
|
@ -48,7 +48,8 @@ void CWorldShadowShader::blendPreviousShadow()
|
||||||
{
|
{
|
||||||
if (!m_prevQuad)
|
if (!m_prevQuad)
|
||||||
m_prevQuad.emplace(EFilterType::Blend, m_tex.get());
|
m_prevQuad.emplace(EFilterType::Blend, m_tex.get());
|
||||||
m_prevQuad->draw({1.f, 0.85f}, 1.f);
|
zeus::CRectangle rect(0.f, 1.f, 1.f, -1.f);
|
||||||
|
m_prevQuad->draw({1.f, 0.85f}, 1.f, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldShadowShader::resolveTexture()
|
void CWorldShadowShader::resolveTexture()
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
#include "CDependencyGroup.hpp"
|
#include "CDependencyGroup.hpp"
|
||||||
#include "MP1OriginalIDs.hpp"
|
#include "MP1OriginalIDs.hpp"
|
||||||
|
|
||||||
|
#include <discord-rpc.h>
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
URDE_DECL_SPECIALIZE_SHADER(CParticleSwooshShaders)
|
URDE_DECL_SPECIALIZE_SHADER(CParticleSwooshShaders)
|
||||||
|
@ -437,12 +439,94 @@ void CMain::StreamNewGameState(CBitStreamReader& r, u32 idx)
|
||||||
g_GameState->HintOptions().SetNextHintTime();
|
g_GameState->HintOptions().SetNextHintTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static logvisor::Module DiscordLog("Discord");
|
||||||
|
static const char* DISCORD_APPLICATION_ID = "402571593815031819";
|
||||||
|
static int64_t DiscordStartTime;
|
||||||
|
static CAssetId DiscordWorldSTRG;
|
||||||
|
static TLockedToken<CStringTable> DiscordWorldSTRGObj;
|
||||||
|
static std::string DiscordWorldName;
|
||||||
|
static u32 DiscordItemPercent = 0xffffffff;
|
||||||
|
static std::string DiscordState;
|
||||||
|
|
||||||
|
void CMain::InitializeDiscord()
|
||||||
|
{
|
||||||
|
DiscordStartTime = time(0);
|
||||||
|
DiscordEventHandlers handlers = {};
|
||||||
|
handlers.ready = HandleDiscordReady;
|
||||||
|
handlers.disconnected = HandleDiscordDisconnected;
|
||||||
|
handlers.errored = HandleDiscordErrored;
|
||||||
|
Discord_Initialize(DISCORD_APPLICATION_ID, &handlers, 1, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMain::ShutdownDiscord()
|
||||||
|
{
|
||||||
|
DiscordWorldSTRGObj = TLockedToken<CStringTable>();
|
||||||
|
Discord_Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMain::UpdateDiscordPresence(CAssetId worldSTRG)
|
||||||
|
{
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
|
if (worldSTRG != DiscordWorldSTRG)
|
||||||
|
{
|
||||||
|
DiscordWorldSTRG = worldSTRG;
|
||||||
|
DiscordWorldSTRGObj = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), worldSTRG});
|
||||||
|
}
|
||||||
|
if (DiscordWorldSTRGObj.IsLoaded())
|
||||||
|
{
|
||||||
|
DiscordWorldName = hecl::Char16ToUTF8(DiscordWorldSTRGObj->GetString(0));
|
||||||
|
DiscordWorldSTRGObj = TLockedToken<CStringTable>();
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_GameState)
|
||||||
|
{
|
||||||
|
if (CPlayerState* pState = g_GameState->GetPlayerState().get())
|
||||||
|
{
|
||||||
|
u32 itemPercent = u32(std::ceil(pState->CalculateItemCollectionRate() * 100.f /
|
||||||
|
pState->GetPickupTotal()));
|
||||||
|
if (DiscordItemPercent != itemPercent)
|
||||||
|
{
|
||||||
|
DiscordItemPercent = itemPercent;
|
||||||
|
DiscordState = hecl::Format("%d%%", itemPercent);
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updated)
|
||||||
|
{
|
||||||
|
DiscordRichPresence discordPresence = {};
|
||||||
|
discordPresence.state = DiscordState.c_str();
|
||||||
|
discordPresence.details = DiscordWorldName.c_str();
|
||||||
|
discordPresence.startTimestamp = DiscordStartTime;
|
||||||
|
Discord_UpdatePresence(&discordPresence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMain::HandleDiscordReady()
|
||||||
|
{
|
||||||
|
DiscordLog.report(logvisor::Info, "Discord Ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMain::HandleDiscordDisconnected(int errorCode, const char* message)
|
||||||
|
{
|
||||||
|
DiscordLog.report(logvisor::Warning, "Discord Disconnected: %s", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMain::HandleDiscordErrored(int errorCode, const char* message)
|
||||||
|
{
|
||||||
|
DiscordLog.report(logvisor::Error, "Discord Error: %s", message);
|
||||||
|
}
|
||||||
|
|
||||||
void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
||||||
hecl::CVarManager* cvarMgr,
|
hecl::CVarManager* cvarMgr,
|
||||||
boo::IWindow* window,
|
boo::IWindow* window,
|
||||||
boo::IAudioVoiceEngine* voiceEngine,
|
boo::IAudioVoiceEngine* voiceEngine,
|
||||||
amuse::IBackendVoiceAllocator& backend)
|
amuse::IBackendVoiceAllocator& backend)
|
||||||
{
|
{
|
||||||
|
InitializeDiscord();
|
||||||
m_mainWindow = window;
|
m_mainWindow = window;
|
||||||
m_cvarMgr = cvarMgr;
|
m_cvarMgr = cvarMgr;
|
||||||
m_console = std::make_unique<hecl::Console>(m_cvarMgr);
|
m_console = std::make_unique<hecl::Console>(m_cvarMgr);
|
||||||
|
@ -524,6 +608,9 @@ bool CMain::Proc()
|
||||||
*/
|
*/
|
||||||
x160_24_finished = true;
|
x160_24_finished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Discord_RunCallbacks();
|
||||||
|
|
||||||
return x160_24_finished;
|
return x160_24_finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,6 +693,7 @@ void CMain::Shutdown()
|
||||||
TMultiBlendShader<CRandomStaticFilter>::Shutdown();
|
TMultiBlendShader<CRandomStaticFilter>::Shutdown();
|
||||||
CFluidPlaneShader::Shutdown();
|
CFluidPlaneShader::Shutdown();
|
||||||
CGraphics::ShutdownBoo();
|
CGraphics::ShutdownBoo();
|
||||||
|
ShutdownDiscord();
|
||||||
}
|
}
|
||||||
|
|
||||||
boo::IWindow* CMain::GetMainWindow() const
|
boo::IWindow* CMain::GetMainWindow() const
|
||||||
|
|
|
@ -262,6 +262,11 @@ private:
|
||||||
bool m_needsWarmupClear = false;
|
bool m_needsWarmupClear = false;
|
||||||
|
|
||||||
void InitializeSubsystems(const hecl::Runtime::FileStoreManager& storeMgr);
|
void InitializeSubsystems(const hecl::Runtime::FileStoreManager& storeMgr);
|
||||||
|
static void InitializeDiscord();
|
||||||
|
static void ShutdownDiscord();
|
||||||
|
static void HandleDiscordReady();
|
||||||
|
static void HandleDiscordDisconnected(int errorCode, const char* message);
|
||||||
|
static void HandleDiscordErrored(int errorCode, const char* message);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMain(IFactory* resFactory, CSimplePool* resStore,
|
CMain(IFactory* resFactory, CSimplePool* resStore,
|
||||||
|
@ -276,6 +281,8 @@ public:
|
||||||
void SetMFGameBuilt(bool b) { x160_25_mfGameBuilt = b; }
|
void SetMFGameBuilt(bool b) { x160_25_mfGameBuilt = b; }
|
||||||
void SetScreenFading(bool b) { x160_26_screenFading = b; }
|
void SetScreenFading(bool b) { x160_26_screenFading = b; }
|
||||||
|
|
||||||
|
static void UpdateDiscordPresence(CAssetId worldSTRG = {});
|
||||||
|
|
||||||
//int RsMain(int argc, const boo::SystemChar* argv[]);
|
//int RsMain(int argc, const boo::SystemChar* argv[]);
|
||||||
void Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
void Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
||||||
hecl::CVarManager* cvarManager,
|
hecl::CVarManager* cvarManager,
|
||||||
|
|
|
@ -2922,9 +2922,9 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
|
||||||
CActor::AcceptScriptMsg(msg, sender, mgr);
|
CActor::AcceptScriptMsg(msg, sender, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::SetVisorSteam(float f1, float f2, float f3, CAssetId txtr, bool affectsThermal)
|
void CPlayer::SetVisorSteam(float targetAlpha, float alphaInDur, float alphaOutDur, CAssetId txtr, bool affectsThermal)
|
||||||
{
|
{
|
||||||
x7a0_visorSteam.SetSteam(f1, f2, f3, txtr, affectsThermal);
|
x7a0_visorSteam.SetSteam(targetAlpha, alphaInDur, alphaOutDur, txtr, affectsThermal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u16 skLeftStepSounds[] =
|
static const u16 skLeftStepSounds[] =
|
||||||
|
|
|
@ -18,6 +18,14 @@ void CWorldShadow::EnableModelProjectedShadow(const zeus::CTransform& pos, s32 l
|
||||||
texTransform = (texTransform * zeus::CTransform::Scale(float(M_SQRT2) * x64_objHalfExtent * f1)).inverse();
|
texTransform = (texTransform * zeus::CTransform::Scale(float(M_SQRT2) * x64_objHalfExtent * f1)).inverse();
|
||||||
texTransform = zeus::CTransform::Translate(0.5f, 0.f, 0.5f) * texTransform;
|
texTransform = zeus::CTransform::Translate(0.5f, 0.f, 0.5f) * texTransform;
|
||||||
CBooModel::EnableShadowMaps(m_shader.GetTexture().get(), texTransform);
|
CBooModel::EnableShadowMaps(m_shader.GetTexture().get(), texTransform);
|
||||||
|
|
||||||
|
#if CWORLDSHADOW_FEEDBACK
|
||||||
|
if (!m_feedback)
|
||||||
|
m_feedback.emplace(EFilterType::Blend, m_shader.GetTexture().get());
|
||||||
|
|
||||||
|
zeus::CRectangle rect(0.4f, 0.4f, 0.2f, 0.2f);
|
||||||
|
m_feedback->draw(zeus::CColor::skWhite, 1.f, rect);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldShadow::DisableModelProjectedShadow()
|
void CWorldShadow::DisableModelProjectedShadow()
|
||||||
|
@ -78,9 +86,6 @@ void CWorldShadow::BuildLightShadowTexture(const CStateManager& mgr, TAreaId aid
|
||||||
x34_model = zeus::lookAt(centerPoint - zeus::CVector3f(0.f, 0.f, 0.1f), light.GetPosition());
|
x34_model = zeus::lookAt(centerPoint - zeus::CVector3f(0.f, 0.f, 0.1f), light.GetPosition());
|
||||||
CGraphics::SetModelMatrix(x34_model);
|
CGraphics::SetModelMatrix(x34_model);
|
||||||
|
|
||||||
m_shadowViewProj = CGraphics::GetPerspectiveProjectionMatrix(false) *
|
|
||||||
CGraphics::g_CameraMatrix.toMatrix4f();
|
|
||||||
|
|
||||||
float extent = float(M_SQRT2) * x64_objHalfExtent;
|
float extent = float(M_SQRT2) * x64_objHalfExtent;
|
||||||
/* Depth test and write */
|
/* Depth test and write */
|
||||||
/* Color white 100% alpha */
|
/* Color white 100% alpha */
|
||||||
|
@ -98,7 +103,7 @@ void CWorldShadow::BuildLightShadowTexture(const CStateManager& mgr, TAreaId aid
|
||||||
CGraphics::SetModelMatrix(x34_model);
|
CGraphics::SetModelMatrix(x34_model);
|
||||||
/* No depth test or write */
|
/* No depth test or write */
|
||||||
/* Color white 25% alpha */
|
/* Color white 25% alpha */
|
||||||
//m_shader.lightenShadow();
|
m_shader.lightenShadow();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (motionBlur && !x88_blurReset)
|
if (motionBlur && !x88_blurReset)
|
||||||
|
@ -106,7 +111,7 @@ void CWorldShadow::BuildLightShadowTexture(const CStateManager& mgr, TAreaId aid
|
||||||
/* No depth test or write */
|
/* No depth test or write */
|
||||||
/* Color white 85% alpha */
|
/* Color white 85% alpha */
|
||||||
/* Draw in shadow texture */
|
/* Draw in shadow texture */
|
||||||
//m_shader.blendPreviousShadow();
|
m_shader.blendPreviousShadow();
|
||||||
}
|
}
|
||||||
|
|
||||||
x88_blurReset = false;
|
x88_blurReset = false;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "zeus/CAABox.hpp"
|
#include "zeus/CAABox.hpp"
|
||||||
#include "Graphics/Shaders/CWorldShadowShader.hpp"
|
#include "Graphics/Shaders/CWorldShadowShader.hpp"
|
||||||
|
|
||||||
|
#define CWORLDSHADOW_FEEDBACK 0
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CStateManager;
|
class CStateManager;
|
||||||
|
@ -20,7 +22,9 @@ class CWorldShadow
|
||||||
TAreaId x80_aid;
|
TAreaId x80_aid;
|
||||||
s32 x84_lightIdx = -1;
|
s32 x84_lightIdx = -1;
|
||||||
bool x88_blurReset = true;
|
bool x88_blurReset = true;
|
||||||
zeus::CMatrix4f m_shadowViewProj;
|
#if CWORLDSHADOW_FEEDBACK
|
||||||
|
std::experimental::optional<CTexturedQuadFilter> m_feedback;
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
CWorldShadow(u32 w, u32 h, bool rgba8);
|
CWorldShadow(u32 w, u32 h, bool rgba8);
|
||||||
void EnableModelProjectedShadow(const zeus::CTransform& pos, s32 lightIdx, float f1);
|
void EnableModelProjectedShadow(const zeus::CTransform& pos, s32 lightIdx, float f1);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit b85758ec19ab37a317662eb93d7208eaae129e84
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit b9f410a2f87eb837ffc5937ed6a7cc637d91ac79
|
Subproject commit 49cd887849d90aa17751d4388309c624aa6599a3
|
2
hecl-gui
2
hecl-gui
|
@ -1 +1 @@
|
||||||
Subproject commit b9a0bec10b812738cbfdaa14ebef2e570b8c800d
|
Subproject commit 3b70f8267645ba99f44e2f2a9f58a2fad7a27c36
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 2fb78f9cee01996f020d5af7592b37c5a0693b31
|
Loading…
Reference in New Issue