mirror of https://github.com/AxioDL/metaforce.git
Arm cannon rendering fixes
This commit is contained in:
parent
89b9a6d7d3
commit
47b3d57c3a
|
@ -18,7 +18,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
||||||
os.format("bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n"
|
os.format("bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n"
|
||||||
"bg_node.inputs[1].default_value = %f\n",
|
"bg_node.inputs[1].default_value = %f\n",
|
||||||
light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||||
light.q / 8.0);
|
light.q / 8.f);
|
||||||
return;
|
return;
|
||||||
case BabeDeadLight::LightType::Directional:
|
case BabeDeadLight::LightType::Directional:
|
||||||
os.format("lamp = bpy.data.lamps.new('LAMP_%01u_%03u', 'SUN')\n"
|
os.format("lamp = bpy.data.lamps.new('LAMP_%01u_%03u', 'SUN')\n"
|
||||||
|
@ -66,7 +66,7 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
|
||||||
"lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n"
|
"lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n"
|
||||||
"lamp_obj.location = (%f,%f,%f)\n"
|
"lamp_obj.location = (%f,%f,%f)\n"
|
||||||
"bpy.context.scene.objects.link(lamp_obj)\n"
|
"bpy.context.scene.objects.link(lamp_obj)\n"
|
||||||
"\n", s, light.lightType, light.q / 8.0,
|
"\n", s, light.lightType, light.q / 8.f,
|
||||||
light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
light.color.vec[0], light.color.vec[1], light.color.vec[2],
|
||||||
light.position.vec[0], light.position.vec[1], light.position.vec[2]);
|
light.position.vec[0], light.position.vec[1], light.position.vec[2]);
|
||||||
|
|
||||||
|
@ -118,8 +118,13 @@ void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::blender:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lightIn.linear > lightIn.constant &&
|
if (lightIn.type == InterType::Ambient)
|
||||||
lightIn.linear > lightIn.quadratic)
|
{
|
||||||
|
lightOut.falloff = BabeDeadLight::Falloff::Constant;
|
||||||
|
lightOut.q = lightIn.energy * 8.f;
|
||||||
|
}
|
||||||
|
else if (lightIn.linear > lightIn.constant &&
|
||||||
|
lightIn.linear > lightIn.quadratic)
|
||||||
{
|
{
|
||||||
lightOut.falloff = BabeDeadLight::Falloff::Linear;
|
lightOut.falloff = BabeDeadLight::Falloff::Linear;
|
||||||
lightOut.q = 1.f / (lightIn.linear / 250.f);
|
lightOut.q = 1.f / (lightIn.linear / 250.f);
|
||||||
|
@ -144,7 +149,7 @@ void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::blender:
|
||||||
lightOut.position.vec[2] = lightIn.sceneXf[2].vec[3];
|
lightOut.position.vec[2] = lightIn.sceneXf[2].vec[3];
|
||||||
|
|
||||||
zeus::CTransform lightXf(&lightIn.sceneXf[0]);
|
zeus::CTransform lightXf(&lightIn.sceneXf[0]);
|
||||||
lightOut.direction = (lightXf.basis * zeus::CVector3f(0.f, 0.f, -1.f)).normalized();
|
lightOut.direction = (lightXf.basis.transposed() * zeus::CVector3f(0.f, 0.f, -1.f)).normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
template void WriteBabeDeadLightFromBlender<DNAMP1::MREA::BabeDeadLight>
|
template void WriteBabeDeadLightFromBlender<DNAMP1::MREA::BabeDeadLight>
|
||||||
|
|
|
@ -395,7 +395,7 @@ void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
head.keyBitmapBitCount = keyBmp.getBitCount();
|
head.keyBitmapBitCount = keyBmp.getBitCount();
|
||||||
head.duration = frameCount * mainInterval;
|
head.duration = frames.back() * mainInterval;
|
||||||
head.boneChannelCount = bones.size();
|
head.boneChannelCount = bones.size();
|
||||||
|
|
||||||
size_t keyframeCount = frameCount - 1;
|
size_t keyframeCount = frameCount - 1;
|
||||||
|
|
|
@ -37,13 +37,13 @@ bool CCameraManager::IsInFirstPersonCamera() const
|
||||||
|
|
||||||
zeus::CVector3f CCameraManager::GetGlobalCameraTranslation(const CStateManager& stateMgr) const
|
zeus::CVector3f CCameraManager::GetGlobalCameraTranslation(const CStateManager& stateMgr) const
|
||||||
{
|
{
|
||||||
TCastToConstPtr<CGameCamera> camera(GetCurrentCamera(stateMgr));
|
const CGameCamera* camera = GetCurrentCamera(stateMgr);
|
||||||
return camera->GetTransform() * x30_shakeOffset;
|
return camera->GetTransform().rotate(x30_shakeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CTransform CCameraManager::GetCurrentCameraTransform(const CStateManager& stateMgr) const
|
zeus::CTransform CCameraManager::GetCurrentCameraTransform(const CStateManager& stateMgr) const
|
||||||
{
|
{
|
||||||
TCastToConstPtr<CGameCamera> camera(GetCurrentCamera(stateMgr));
|
const CGameCamera* camera = GetCurrentCamera(stateMgr);
|
||||||
return camera->GetTransform() * zeus::CTransform::Translate(x30_shakeOffset);
|
return camera->GetTransform() * zeus::CTransform::Translate(x30_shakeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -507,10 +507,6 @@ std::vector<CLight> CActorLights::BuildLightVector() const
|
||||||
{
|
{
|
||||||
std::vector<CLight> lights;
|
std::vector<CLight> lights;
|
||||||
|
|
||||||
zeus::CColor ambColor = x288_ambientColor;
|
|
||||||
ambColor.a = 1.f;
|
|
||||||
lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, ambColor));
|
|
||||||
|
|
||||||
if (x0_areaLights.size())
|
if (x0_areaLights.size())
|
||||||
{
|
{
|
||||||
if (x2dc_brightLightLag && x299_25_useBrightLightLag)
|
if (x2dc_brightLightLag && x299_25_useBrightLightLag)
|
||||||
|
@ -537,6 +533,10 @@ std::vector<CLight> CActorLights::BuildLightVector() const
|
||||||
for (const CLight& light : x144_dynamicLights)
|
for (const CLight& light : x144_dynamicLights)
|
||||||
lights.push_back(light);
|
lights.push_back(light);
|
||||||
|
|
||||||
|
zeus::CColor ambColor = x288_ambientColor;
|
||||||
|
ambColor.a = 1.f;
|
||||||
|
lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, ambColor));
|
||||||
|
|
||||||
return lights;
|
return lights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,12 +303,10 @@ void CBooRenderer::RenderBucketItems(CAreaListItem* item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::HandleUnsortedModel(CAreaListItem* item, CBooModel& model)
|
void CBooRenderer::HandleUnsortedModel(CAreaListItem* item, CBooModel& model, const CModelFlags& flags)
|
||||||
{
|
{
|
||||||
//ActivateLightsForModel(item, model);
|
//ActivateLightsForModel(item, model);
|
||||||
CBooSurface* surf = model.x38_firstUnsortedSurface;
|
CBooSurface* surf = model.x38_firstUnsortedSurface;
|
||||||
CModelFlags flags;
|
|
||||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
|
||||||
while (surf)
|
while (surf)
|
||||||
{
|
{
|
||||||
model.DrawSurface(*surf, flags);
|
model.DrawSurface(*surf, flags);
|
||||||
|
@ -790,12 +788,18 @@ void CBooRenderer::DisablePVS()
|
||||||
xc8_pvs = std::experimental::nullopt;
|
xc8_pvs = std::experimental::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::UpdateAreaUniforms(int areaIdx)
|
void CBooRenderer::UpdateAreaUniforms(int areaIdx, bool shadowRender)
|
||||||
{
|
{
|
||||||
SetupRendererStates();
|
SetupRendererStates();
|
||||||
|
|
||||||
CModelFlags flags;
|
CModelFlags flags;
|
||||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
if (shadowRender)
|
||||||
|
{
|
||||||
|
flags.m_extendedShader = EExtendedShader::SolidColor;
|
||||||
|
flags.x4_color = zeus::CColor::skBlack;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||||
|
|
||||||
for (CAreaListItem& item : x1c_areaListItems)
|
for (CAreaListItem& item : x1c_areaListItems)
|
||||||
{
|
{
|
||||||
|
@ -803,7 +807,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
|
item.m_shaderSet->m_geomLayout->Update(flags, nullptr, nullptr, &item.m_shaderSet->m_matSet,
|
||||||
item.m_shaderSet->m_geomLayout->m_sharedBuffer);
|
item.m_shaderSet->m_geomLayout->m_sharedBuffer[shadowRender]);
|
||||||
|
|
||||||
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
|
for (auto it = item.x10_models.begin(); it != item.x10_models.end(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -811,7 +815,7 @@ void CBooRenderer::UpdateAreaUniforms(int areaIdx)
|
||||||
if (model->TryLockTextures())
|
if (model->TryLockTextures())
|
||||||
{
|
{
|
||||||
ActivateLightsForModel(&item, *model);
|
ActivateLightsForModel(&item, *model);
|
||||||
model->UpdateUniformData(flags, nullptr, nullptr);
|
model->UpdateUniformData(flags, nullptr, nullptr, shadowRender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -863,9 +867,12 @@ void CBooRenderer::DrawAreaGeometry(int areaIdx, int mask, int targetMask)
|
||||||
x318_30_inAreaDraw = false;
|
x318_30_inAreaDraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)
|
void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender)
|
||||||
{
|
{
|
||||||
//SetupRendererStates();
|
//SetupRendererStates();
|
||||||
|
CModelFlags flags;
|
||||||
|
flags.m_extendedShader = shadowRender ? EExtendedShader::SolidColor : EExtendedShader::Lighting;
|
||||||
|
|
||||||
CAreaListItem* lastOctreeItem = nullptr;
|
CAreaListItem* lastOctreeItem = nullptr;
|
||||||
|
|
||||||
for (CAreaListItem& item : x1c_areaListItems)
|
for (CAreaListItem& item : x1c_areaListItems)
|
||||||
|
@ -932,7 +939,7 @@ void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)
|
||||||
}
|
}
|
||||||
|
|
||||||
model->x40_25_modelVisible = true;
|
model->x40_25_modelVisible = true;
|
||||||
HandleUnsortedModel(lastOctreeItem, *model);
|
HandleUnsortedModel(lastOctreeItem, *model, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ class CBooRenderer : public IRenderer
|
||||||
|
|
||||||
void ActivateLightsForModel(CAreaListItem* item, CBooModel& model);
|
void ActivateLightsForModel(CAreaListItem* item, CBooModel& model);
|
||||||
void RenderBucketItems(CAreaListItem* item);
|
void RenderBucketItems(CAreaListItem* item);
|
||||||
void HandleUnsortedModel(CAreaListItem* item, CBooModel& model);
|
void HandleUnsortedModel(CAreaListItem* item, CBooModel& model, const CModelFlags& flags);
|
||||||
static void CalcDrawFogFan(const zeus::CPlane* planes, int numPlanes, const zeus::CVector3f* verts,
|
static void CalcDrawFogFan(const zeus::CPlane* planes, int numPlanes, const zeus::CVector3f* verts,
|
||||||
int numVerts, int iteration, int level, CFogVolumePlaneShader& fogVol);
|
int numVerts, int iteration, int level, CFogVolumePlaneShader& fogVol);
|
||||||
static void DrawFogSlices(const zeus::CPlane* planes, int numPlanes, int iteration,
|
static void DrawFogSlices(const zeus::CPlane* planes, int numPlanes, int iteration,
|
||||||
|
@ -211,10 +211,10 @@ public:
|
||||||
const SShader* shaderSet);
|
const SShader* shaderSet);
|
||||||
void EnablePVS(const CPVSVisSet&, u32);
|
void EnablePVS(const CPVSVisSet&, u32);
|
||||||
void DisablePVS();
|
void DisablePVS();
|
||||||
void UpdateAreaUniforms(int areaIdx);
|
void UpdateAreaUniforms(int areaIdx, bool shadowRender = false);
|
||||||
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*);
|
||||||
void DrawAreaGeometry(int areaIdx, int mask, int targetMask);
|
void DrawAreaGeometry(int areaIdx, int mask, int targetMask);
|
||||||
void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask);
|
void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender = false);
|
||||||
void DrawSortedGeometry(int areaIdx, int mask, int targetMask);
|
void DrawSortedGeometry(int areaIdx, int mask, int targetMask);
|
||||||
void DrawStaticGeometry(int areaIdx, int mask, int targetMask);
|
void DrawStaticGeometry(int areaIdx, int mask, int targetMask);
|
||||||
void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly);
|
void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly);
|
||||||
|
|
|
@ -97,8 +97,8 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rstl::reserved_vector<CLineRenderer::SDrawVertTex, 256> CLineRenderer::g_StaticLineVertsTex = {};
|
rstl::reserved_vector<CLineRenderer::SDrawVertTex, 1024> CLineRenderer::g_StaticLineVertsTex = {};
|
||||||
rstl::reserved_vector<CLineRenderer::SDrawVertNoTex, 256> CLineRenderer::g_StaticLineVertsNoTex = {};
|
rstl::reserved_vector<CLineRenderer::SDrawVertNoTex, 1024> CLineRenderer::g_StaticLineVertsNoTex = {};
|
||||||
|
|
||||||
static zeus::CVector2f IntersectLines(const zeus::CVector2f& pa1, const zeus::CVector2f& pa2,
|
static zeus::CVector2f IntersectLines(const zeus::CVector2f& pa1, const zeus::CVector2f& pa2,
|
||||||
const zeus::CVector2f& pb1, const zeus::CVector2f& pb2)
|
const zeus::CVector2f& pb1, const zeus::CVector2f& pb2)
|
||||||
|
|
|
@ -59,8 +59,8 @@ private:
|
||||||
zeus::CColor m_lastColor;
|
zeus::CColor m_lastColor;
|
||||||
float m_lastWidth;
|
float m_lastWidth;
|
||||||
|
|
||||||
static rstl::reserved_vector<SDrawVertTex, 256> g_StaticLineVertsTex;
|
static rstl::reserved_vector<SDrawVertTex, 1024> g_StaticLineVertsTex;
|
||||||
static rstl::reserved_vector<SDrawVertNoTex, 256> g_StaticLineVertsNoTex;
|
static rstl::reserved_vector<SDrawVertNoTex, 1024> g_StaticLineVertsNoTex;
|
||||||
|
|
||||||
static hecl::VertexBufferPool<SDrawVertTex> s_vertPoolTex;
|
static hecl::VertexBufferPool<SDrawVertTex> s_vertPoolTex;
|
||||||
static hecl::VertexBufferPool<SDrawVertNoTex> s_vertPoolNoTex;
|
static hecl::VertexBufferPool<SDrawVertNoTex> s_vertPoolNoTex;
|
||||||
|
|
|
@ -73,7 +73,7 @@ using UVAnimation = DataSpec::DNAMP1::MaterialSet::Material::UVAnimation;
|
||||||
|
|
||||||
struct GeometryUniformLayout
|
struct GeometryUniformLayout
|
||||||
{
|
{
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_sharedBuffer;
|
boo::ObjToken<boo::IGraphicsBufferD> m_sharedBuffer[2];
|
||||||
size_t m_geomBufferSize = 0;
|
size_t m_geomBufferSize = 0;
|
||||||
size_t m_skinBankCount = 0;
|
size_t m_skinBankCount = 0;
|
||||||
size_t m_weightVecCount = 0;
|
size_t m_weightVecCount = 0;
|
||||||
|
@ -174,7 +174,7 @@ private:
|
||||||
|
|
||||||
boo::ObjToken<boo::ITexture> m_lastDrawnShadowMap;
|
boo::ObjToken<boo::ITexture> m_lastDrawnShadowMap;
|
||||||
|
|
||||||
ModelInstance* PushNewModelInstance();
|
ModelInstance* PushNewModelInstance(int sharedLayoutBuf = -1);
|
||||||
void DrawAlphaSurfaces(const CModelFlags& flags) const;
|
void DrawAlphaSurfaces(const CModelFlags& flags) const;
|
||||||
void DrawNormalSurfaces(const CModelFlags& flags) const;
|
void DrawNormalSurfaces(const CModelFlags& flags) const;
|
||||||
void DrawSurfaces(const CModelFlags& flags) const;
|
void DrawSurfaces(const CModelFlags& flags) const;
|
||||||
|
@ -216,7 +216,8 @@ public:
|
||||||
void VerifyCurrentShader(int shaderIdx);
|
void VerifyCurrentShader(int shaderIdx);
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> UpdateUniformData(const CModelFlags& flags,
|
boo::ObjToken<boo::IGraphicsBufferD> UpdateUniformData(const CModelFlags& flags,
|
||||||
const CSkinRules* cskr,
|
const CSkinRules* cskr,
|
||||||
const CPoseAsTransforms* pose) const;
|
const CPoseAsTransforms* pose,
|
||||||
|
int sharedLayoutBuf = -1) const;
|
||||||
void DrawAlpha(const CModelFlags& flags,
|
void DrawAlpha(const CModelFlags& flags,
|
||||||
const CSkinRules* cskr,
|
const CSkinRules* cskr,
|
||||||
const CPoseAsTransforms* pose) const;
|
const CPoseAsTransforms* pose) const;
|
||||||
|
|
|
@ -270,7 +270,7 @@ GeometryUniformLayout::GeometryUniformLayout(const CModel* model, const Material
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf)
|
||||||
{
|
{
|
||||||
if (!x40_24_texturesLoaded && !g_DummyTextures)
|
if (!x40_24_texturesLoaded && !g_DummyTextures)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -284,8 +284,10 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||||
{
|
{
|
||||||
/* Build geometry uniform buffer if shared not available */
|
/* Build geometry uniform buffer if shared not available */
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> geomUniformBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> geomUniformBuf;
|
||||||
if (m_geomLayout->m_sharedBuffer)
|
if (sharedLayoutBuf >= 0)
|
||||||
geomUniformBuf = m_geomLayout->m_sharedBuffer;
|
{
|
||||||
|
geomUniformBuf = m_geomLayout->m_sharedBuffer[sharedLayoutBuf];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
geomUniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, m_geomLayout->m_geomBufferSize, 1);
|
geomUniformBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, m_geomLayout->m_geomBufferSize, 1);
|
||||||
|
@ -767,9 +769,10 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
|
||||||
texMtxOut.vec[3].zeroOut();
|
texMtxOut.vec[3].zeroOut();
|
||||||
|
|
||||||
postMtxOut.vec[0].x = 0.5f;
|
postMtxOut.vec[0].x = 0.5f;
|
||||||
|
postMtxOut.vec[1].y = 0.f;
|
||||||
postMtxOut.vec[2].y = 0.5f;
|
postMtxOut.vec[2].y = 0.5f;
|
||||||
postMtxOut.vec[3].x = CGraphics::g_GXModelMatrix.origin.x * 0.5f;
|
postMtxOut.vec[3].x = CGraphics::g_GXModelMatrix.origin.x * 0.05f;
|
||||||
postMtxOut.vec[3].y = CGraphics::g_GXModelMatrix.origin.y * 0.5f;
|
postMtxOut.vec[3].y = CGraphics::g_GXModelMatrix.origin.y * 0.05f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UVAnimation::Mode::CylinderEnvironment:
|
case UVAnimation::Mode::CylinderEnvironment:
|
||||||
|
@ -982,7 +985,8 @@ void GeometryUniformLayout::Update(const CModelFlags& flags,
|
||||||
|
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFlags& flags,
|
boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFlags& flags,
|
||||||
const CSkinRules* cskr,
|
const CSkinRules* cskr,
|
||||||
const CPoseAsTransforms* pose) const
|
const CPoseAsTransforms* pose,
|
||||||
|
int sharedLayoutBuf) const
|
||||||
{
|
{
|
||||||
/* Invalidate instances if new shadow being drawn */
|
/* Invalidate instances if new shadow being drawn */
|
||||||
if (flags.m_extendedShader == EExtendedShader::WorldShadow &&
|
if (flags.m_extendedShader == EExtendedShader::WorldShadow &&
|
||||||
|
@ -995,7 +999,7 @@ boo::ObjToken<boo::IGraphicsBufferD> CBooModel::UpdateUniformData(const CModelFl
|
||||||
const ModelInstance* inst;
|
const ModelInstance* inst;
|
||||||
if (m_instances.size() <= m_uniUpdateCount)
|
if (m_instances.size() <= m_uniUpdateCount)
|
||||||
{
|
{
|
||||||
inst = const_cast<CBooModel*>(this)->PushNewModelInstance();
|
inst = const_cast<CBooModel*>(this)->PushNewModelInstance(sharedLayoutBuf);
|
||||||
if (!inst)
|
if (!inst)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,15 @@ void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
|
||||||
{
|
{
|
||||||
if (morphEffect || g_PointGenFunc)
|
if (morphEffect || g_PointGenFunc)
|
||||||
{
|
{
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr);
|
if (boo::ObjToken<boo::IGraphicsBufferD> vertBuf = m_modelInst->UpdateUniformData(drawFlags, nullptr, nullptr))
|
||||||
x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model);
|
{
|
||||||
if (morphEffect)
|
x10_skinRules->TransformVerticesCPU(m_vertWorkspace, pose, *x4_model);
|
||||||
morphEffect->MorphVertices(m_vertWorkspace, morphMagnitudes, x10_skinRules, pose);
|
if (morphEffect)
|
||||||
if (g_PointGenFunc)
|
morphEffect->MorphVertices(m_vertWorkspace, morphMagnitudes, x10_skinRules, pose);
|
||||||
g_PointGenFunc(g_PointGenCtx, m_vertWorkspace);
|
if (g_PointGenFunc)
|
||||||
x4_model->ApplyVerticesCPU(vertBuf, m_vertWorkspace);
|
g_PointGenFunc(g_PointGenCtx, m_vertWorkspace);
|
||||||
|
x4_model->ApplyVerticesCPU(vertBuf, m_vertWorkspace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
virtual void DisablePVS()=0;
|
virtual void DisablePVS()=0;
|
||||||
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*)=0;
|
virtual void RemoveStaticGeometry(const std::vector<CMetroidModelInstance>*)=0;
|
||||||
virtual void DrawAreaGeometry(int areaIdx, int mask, int targetMask)=0;
|
virtual void DrawAreaGeometry(int areaIdx, int mask, int targetMask)=0;
|
||||||
virtual void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask)=0;
|
virtual void DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender = false)=0;
|
||||||
virtual void DrawSortedGeometry(int areaIdx, int mask, int targetMask)=0;
|
virtual void DrawSortedGeometry(int areaIdx, int mask, int targetMask)=0;
|
||||||
virtual void DrawStaticGeometry(int areaIdx, int mask, int targetMask)=0;
|
virtual void DrawStaticGeometry(int areaIdx, int mask, int targetMask)=0;
|
||||||
virtual void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly)=0;
|
virtual void DrawModelFlat(const CModel& model, const CModelFlags& flags, bool unsortedOnly)=0;
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
void drawVerts(const zeus::CColor& color, const Vert verts[4], float lod=0.f);
|
void drawVerts(const zeus::CColor& color, const Vert verts[4], float lod=0.f);
|
||||||
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
|
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
|
||||||
const TLockedToken<CTexture>& GetTex() const { return m_tex; }
|
const TLockedToken<CTexture>& GetTex() const { return m_tex; }
|
||||||
|
const boo::ObjToken<boo::ITexture>& GetBooTex() const { return m_booTex; }
|
||||||
|
|
||||||
using _CLS = CTexturedQuadFilter;
|
using _CLS = CTexturedQuadFilter;
|
||||||
#include "TMultiBlendShaderDecl.hpp"
|
#include "TMultiBlendShaderDecl.hpp"
|
||||||
|
|
|
@ -10,7 +10,7 @@ CWorldShadowShader::CWorldShadowShader(u32 w, u32 h)
|
||||||
{
|
{
|
||||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 16, 4);
|
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 16, 4);
|
||||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||||
m_dataBind = TShader<CWorldShadowShader>::BuildShaderDataBinding(ctx, *this);
|
TShader<CWorldShadowShader>::BuildShaderDataBinding(ctx, *this);
|
||||||
m_tex = ctx.newRenderTexture(m_w, m_h, boo::TextureClampMode::ClampToWhite, 1, 0);
|
m_tex = ctx.newRenderTexture(m_w, m_h, boo::TextureClampMode::ClampToWhite, 1, 0);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -54,7 +54,7 @@ void CWorldShadowShader::blendPreviousShadow()
|
||||||
void CWorldShadowShader::resolveTexture()
|
void CWorldShadowShader::resolveTexture()
|
||||||
{
|
{
|
||||||
boo::SWindowRect rect = {0, 0, int(m_w), int(m_h)};
|
boo::SWindowRect rect = {0, 0, int(m_w), int(m_h)};
|
||||||
CGraphics::g_BooMainCommandQueue->resolveBindTexture(m_tex, rect, false, 0, true, false);
|
CGraphics::g_BooMainCommandQueue->resolveBindTexture(m_tex, rect, false, 0, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
URDE_SPECIALIZE_SHADER(CWorldShadowShader)
|
URDE_SPECIALIZE_SHADER(CWorldShadowShader)
|
||||||
|
|
|
@ -55,10 +55,10 @@ CPlayerGun::CPlayerGun(TUniqueId playerId)
|
||||||
playerId, EMaterialTypes::Player, sGunScale);
|
playerId, EMaterialTypes::Player, sGunScale);
|
||||||
x774_holoTransitionGen = std::make_unique<CElementGen>(
|
x774_holoTransitionGen = std::make_unique<CElementGen>(
|
||||||
g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->x24_holoTransition}));
|
g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), g_tweakGunRes->x24_holoTransition}));
|
||||||
x82c_shadow = std::make_unique<CWorldShadow>(32, 32, true);
|
x82c_shadow = std::make_unique<CWorldShadow>(256, 256, true);
|
||||||
|
|
||||||
x832_31_inRestPose = true;
|
x832_31_inRestPose = true;
|
||||||
x833_24_isFidgeting = true;
|
x833_24_notFidgeting = true;
|
||||||
x833_30_canShowAuxMuzzleEffect = true;
|
x833_30_canShowAuxMuzzleEffect = true;
|
||||||
x6e0_rightHandModel.SetSortThermal(true);
|
x6e0_rightHandModel.SetSortThermal(true);
|
||||||
|
|
||||||
|
@ -1933,7 +1933,7 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
|
||||||
x388_enterFreeLookDelayTimer = 0.f;
|
x388_enterFreeLookDelayTimer = 0.f;
|
||||||
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
|
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed)
|
||||||
{
|
{
|
||||||
x833_24_isFidgeting = (player.GetSurfaceRestraint() != CPlayer::ESurfaceRestraints::Water &&
|
x833_24_notFidgeting = !(player.GetSurfaceRestraint() != CPlayer::ESurfaceRestraints::Water &&
|
||||||
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan &&
|
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan &&
|
||||||
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == EChargePhase::NotCharging &&
|
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == EChargePhase::NotCharging &&
|
||||||
!x832_29_lockedOn && (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
|
!x832_29_lockedOn && (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
|
||||||
|
@ -1944,7 +1944,7 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
|
||||||
player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn &&
|
player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn &&
|
||||||
player.GetGrappleState() == CPlayer::EGrappleState::None && !x834_30_inBigStrike &&
|
player.GetGrappleState() == CPlayer::EGrappleState::None && !x834_30_inBigStrike &&
|
||||||
!x835_25_inPhazonBeam);
|
!x835_25_inPhazonBeam);
|
||||||
if (x833_24_isFidgeting)
|
if (x833_24_notFidgeting)
|
||||||
{
|
{
|
||||||
if (!x834_30_inBigStrike)
|
if (!x834_30_inBigStrike)
|
||||||
{
|
{
|
||||||
|
@ -1966,7 +1966,7 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
|
||||||
if (!doWander || x834_26_animPlaying)
|
if (!doWander || x834_26_animPlaying)
|
||||||
ResetIdle(mgr);
|
ResetIdle(mgr);
|
||||||
}
|
}
|
||||||
if (x394_damageTimer > 0.f)
|
else if (x394_damageTimer > 0.f)
|
||||||
{
|
{
|
||||||
x394_damageTimer -= dt;
|
x394_damageTimer -= dt;
|
||||||
}
|
}
|
||||||
|
@ -2011,7 +2011,7 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
|
||||||
case CFidget::EState::StillMinorFidget:
|
case CFidget::EState::StillMinorFidget:
|
||||||
case CFidget::EState::StillMajorFidget:
|
case CFidget::EState::StillMajorFidget:
|
||||||
x550_camBob.SetState(CPlayerCameraBob::ECameraBobState::Walk, mgr);
|
x550_camBob.SetState(CPlayerCameraBob::ECameraBobState::Walk, mgr);
|
||||||
x833_24_isFidgeting = false;
|
x833_24_notFidgeting = false;
|
||||||
x834_26_animPlaying = x834_25_gunMotionFidgeting ? x73c_gunMotion->IsAnimPlaying() :
|
x834_26_animPlaying = x834_25_gunMotionFidgeting ? x73c_gunMotion->IsAnimPlaying() :
|
||||||
x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, "Whole Body");
|
x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, "Whole Body");
|
||||||
if (!x834_26_animPlaying)
|
if (!x834_26_animPlaying)
|
||||||
|
|
|
@ -284,7 +284,7 @@ private:
|
||||||
bool x832_30_requestReturnToDefault : 1;
|
bool x832_30_requestReturnToDefault : 1;
|
||||||
bool x832_31_inRestPose : 1;
|
bool x832_31_inRestPose : 1;
|
||||||
|
|
||||||
bool x833_24_isFidgeting : 1;
|
bool x833_24_notFidgeting : 1;
|
||||||
bool x833_25_ : 1;
|
bool x833_25_ : 1;
|
||||||
bool x833_26_ : 1;
|
bool x833_26_ : 1;
|
||||||
bool x833_27_ : 1;
|
bool x833_27_ : 1;
|
||||||
|
@ -379,7 +379,7 @@ public:
|
||||||
void AsyncLoadSuit(CStateManager& mgr);
|
void AsyncLoadSuit(CStateManager& mgr);
|
||||||
void TouchModel(const CStateManager& stateMgr);
|
void TouchModel(const CStateManager& stateMgr);
|
||||||
EMissleMode GetMissleMode() const { return x31c_missileMode; }
|
EMissleMode GetMissleMode() const { return x31c_missileMode; }
|
||||||
bool IsFidgeting() const { return x833_24_isFidgeting; }
|
bool IsFidgeting() const { return x833_24_notFidgeting; }
|
||||||
bool IsCharging() const { return x834_24_charging; }
|
bool IsCharging() const { return x834_24_charging; }
|
||||||
float GetChargeBeamFactor() const { return x340_chargeBeamFactor; }
|
float GetChargeBeamFactor() const { return x340_chargeBeamFactor; }
|
||||||
bool IsBombReady() const { return x835_28_bombReady; }
|
bool IsBombReady() const { return x835_28_bombReady; }
|
||||||
|
|
|
@ -164,7 +164,7 @@ void CAreaRenderOctTree::Node::RecursiveBuildOverlaps(u32* bmpOut,
|
||||||
for (u32 c=0 ; c<childCount ; ++c)
|
for (u32 c=0 ; c<childCount ; ++c)
|
||||||
{
|
{
|
||||||
zeus::CAABox childAABB = GetNodeBounds(curAABB, c);
|
zeus::CAABox childAABB = GetNodeBounds(curAABB, c);
|
||||||
reinterpret_cast<Node*>(parent.x38_entries[parent.x34_indirectionTable[x4_children[c]]])->
|
reinterpret_cast<const Node*>(parent.x38_entries + parent.x34_indirectionTable[x4_children[c]])->
|
||||||
RecursiveBuildOverlaps(bmpOut, parent, childAABB, testAABB);
|
RecursiveBuildOverlaps(bmpOut, parent, childAABB, testAABB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,13 +174,13 @@ void CAreaRenderOctTree::Node::RecursiveBuildOverlaps(u32* bmpOut,
|
||||||
void CAreaRenderOctTree::FindOverlappingModels(std::vector<u32>& out, const zeus::CAABox& testAABB) const
|
void CAreaRenderOctTree::FindOverlappingModels(std::vector<u32>& out, const zeus::CAABox& testAABB) const
|
||||||
{
|
{
|
||||||
out.resize(x14_bitmapWordCount);
|
out.resize(x14_bitmapWordCount);
|
||||||
reinterpret_cast<Node*>(x38_entries[x34_indirectionTable[0]])->
|
reinterpret_cast<const Node*>(x38_entries + x34_indirectionTable[0])->
|
||||||
RecursiveBuildOverlaps(out.data(), *this, x18_aabb, testAABB);
|
RecursiveBuildOverlaps(out.data(), *this, x18_aabb, testAABB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAreaRenderOctTree::FindOverlappingModels(u32* out, const zeus::CAABox& testAABB) const
|
void CAreaRenderOctTree::FindOverlappingModels(u32* out, const zeus::CAABox& testAABB) const
|
||||||
{
|
{
|
||||||
reinterpret_cast<Node*>(x38_entries[x34_indirectionTable[0]])->
|
reinterpret_cast<const Node*>(x38_entries + x34_indirectionTable[0])->
|
||||||
RecursiveBuildOverlaps(out, *this, x18_aabb, testAABB);
|
RecursiveBuildOverlaps(out, *this, x18_aabb, testAABB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,9 +1217,10 @@ void CGameArea::FillInStaticGeometry(bool textures)
|
||||||
|
|
||||||
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||||
{
|
{
|
||||||
/* Shared geometry uniform buffer */
|
/* Shared geometry uniform buffer - one for normal render, one for shadow render */
|
||||||
matSet.m_geomLayout->m_sharedBuffer =
|
for (int i=0 ; i<2 ; ++i)
|
||||||
ctx.newDynamicBuffer(boo::BufferUse::Uniform, matSet.m_geomLayout->m_geomBufferSize, 1);
|
matSet.m_geomLayout->m_sharedBuffer[i] =
|
||||||
|
ctx.newDynamicBuffer(boo::BufferUse::Uniform, matSet.m_geomLayout->m_geomBufferSize, 1);
|
||||||
|
|
||||||
/* Models */
|
/* Models */
|
||||||
for (CMetroidModelInstance& inst : x12c_postConstructed->x4c_insts)
|
for (CMetroidModelInstance& inst : x12c_postConstructed->x4c_insts)
|
||||||
|
|
|
@ -88,7 +88,7 @@ CMorphBall::CMorphBall(CPlayer& player, float radius)
|
||||||
x19d0_ballInnerGlowGen = std::make_unique<CElementGen>(x1988_ballInnerGlow);
|
x19d0_ballInnerGlowGen = std::make_unique<CElementGen>(x1988_ballInnerGlow);
|
||||||
x19d4_spiderBallMagnetEffectGen = std::make_unique<CElementGen>(x1990_spiderBallMagnetEffect);
|
x19d4_spiderBallMagnetEffectGen = std::make_unique<CElementGen>(x1990_spiderBallMagnetEffect);
|
||||||
x19d8_boostBallGlowGen = std::make_unique<CElementGen>(x1998_boostBallGlow);
|
x19d8_boostBallGlowGen = std::make_unique<CElementGen>(x1998_boostBallGlow);
|
||||||
x1c14_worldShadow = std::make_unique<CWorldShadow>(16, 16, false);
|
x1c14_worldShadow = std::make_unique<CWorldShadow>(128, 128, false);
|
||||||
x1c18_actorLights = std::make_unique<CActorLights>(8, zeus::CVector3f::skZero, 4, 4, false, false, false, 0.1f);
|
x1c18_actorLights = std::make_unique<CActorLights>(8, zeus::CVector3f::skZero, 4, 4, false, false, false, 0.1f);
|
||||||
x1c1c_rainSplashGen = std::make_unique<CRainSplashGenerator>(x58_ballModel->GetScale(), 40, 2, 0.15f, 0.5f);
|
x1c1c_rainSplashGen = std::make_unique<CRainSplashGenerator>(x58_ballModel->GetScale(), 40, 2, 0.15f, 0.5f);
|
||||||
x1de4_24_inBoost = false;
|
x1de4_24_inBoost = false;
|
||||||
|
|
|
@ -89,7 +89,8 @@ void CWorldShadow::BuildLightShadowTexture(const CStateManager& mgr, TAreaId aid
|
||||||
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
|
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
|
||||||
CBooModel::SetDrawingOccluders(true);
|
CBooModel::SetDrawingOccluders(true);
|
||||||
g_Renderer->PrepareDynamicLights({});
|
g_Renderer->PrepareDynamicLights({});
|
||||||
g_Renderer->DrawUnsortedGeometry(aid, 0, 0);
|
g_Renderer->UpdateAreaUniforms(aid, true);
|
||||||
|
g_Renderer->DrawUnsortedGeometry(aid, 0, 0, true);
|
||||||
CBooModel::SetDrawingOccluders(false);
|
CBooModel::SetDrawingOccluders(false);
|
||||||
|
|
||||||
if (lighten)
|
if (lighten)
|
||||||
|
@ -97,7 +98,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)
|
||||||
|
@ -105,7 +106,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;
|
||||||
|
|
Loading…
Reference in New Issue