mirror of https://github.com/AxioDL/metaforce.git
Working space warp effect for charge beam
This commit is contained in:
parent
e263345b0a
commit
74ce62726d
|
@ -65,9 +65,10 @@ zeus::CVector3f CGameCamera::ConvertToScreenSpace(const zeus::CVector3f& v) cons
|
|||
{
|
||||
zeus::CVector3f rVec = x34_transform.transposeRotate(v - x34_transform.origin);
|
||||
|
||||
if (rVec.x == 0.f && rVec.y == 0.f && rVec.z == 0.f)
|
||||
if (rVec.isZero())
|
||||
return {-1.f, -1.f, 1.f};
|
||||
|
||||
rVec = zeus::CVector3f(rVec.x, rVec.z, -rVec.y);
|
||||
zeus::CMatrix4f mtx = GetPerspectiveMatrix();
|
||||
return mtx.multiplyOneOverW(rVec);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace urde
|
|||
CParticleDatabase::CParticleDatabase()
|
||||
{
|
||||
xb4_24_active = true;
|
||||
xb4_25_drawingEnds = false;
|
||||
xb4_25_anySystemsDrawnWithModel = false;
|
||||
}
|
||||
|
||||
void CParticleDatabase::CacheParticleDesc(const SObjectTag &tag)
|
||||
|
@ -237,7 +237,7 @@ void CParticleDatabase::Update(float dt, const CPoseAsTransforms& pose, const CC
|
|||
UpdateParticleGenDB(dt, pose, charInfo, xf, scale, stateMgr, x8c_firstDraw, false);
|
||||
UpdateParticleGenDB(dt, pose, charInfo, xf, scale, stateMgr, xa0_lastDraw, false);
|
||||
|
||||
xb4_25_drawingEnds = (x50_firstDrawLoop.size() || x64_lastDrawLoop.size() || x8c_firstDraw.size() || xa0_lastDraw.size());
|
||||
xb4_25_anySystemsDrawnWithModel = (x50_firstDrawLoop.size() || x64_lastDrawLoop.size() || x8c_firstDraw.size() || xa0_lastDraw.size());
|
||||
}
|
||||
|
||||
void CParticleDatabase::RenderParticleGenMap(const std::map<std::string, std::unique_ptr<CParticleGenInfo>>& map)
|
||||
|
@ -513,7 +513,7 @@ void CParticleDatabase::InsertParticleGen(bool oneShot, int flags, std::string_v
|
|||
useMap->insert(std::make_pair(std::string(name), std::move(gen)));
|
||||
|
||||
if (flags & 0x60)
|
||||
xb4_25_drawingEnds = true;
|
||||
xb4_25_anySystemsDrawnWithModel = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class CParticleDatabase
|
|||
std::map<std::string, std::unique_ptr<CParticleGenInfo>> x8c_firstDraw;
|
||||
std::map<std::string, std::unique_ptr<CParticleGenInfo>> xa0_lastDraw;
|
||||
bool xb4_24_active : 1;
|
||||
bool xb4_25_drawingEnds : 1;
|
||||
bool xb4_25_anySystemsDrawnWithModel : 1;
|
||||
|
||||
static void SetModulationColorAllActiveEffectsForParticleDB(const zeus::CColor& color,
|
||||
std::map<std::string, std::unique_ptr<CParticleGenInfo>>& map);
|
||||
|
@ -69,6 +69,7 @@ public:
|
|||
const zeus::CVector3f& scale, CStateManager& mgr, TAreaId aid, bool oneShot, int lightId);
|
||||
void InsertParticleGen(bool oneShot, int flags, std::string_view name,
|
||||
std::unique_ptr<CParticleGenInfo>&& gen);
|
||||
bool AreAnySystemsDrawnWithModel() const { return xb4_25_anySystemsDrawnWithModel; }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -141,6 +141,7 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt)
|
|||
|
||||
clipRect.x4_left += CGraphics::g_CroppedViewport.x4_left;
|
||||
clipRect.x8_top += CGraphics::g_CroppedViewport.x8_top;
|
||||
clipRect.x8_top = g_Viewport.xc_height - clipRect.x10_height - clipRect.x8_top;
|
||||
CGraphics::ResolveSpareTexture(clipRect);
|
||||
|
||||
m_uniform.m_strength.x = m_uniform.m_matrix[0][0] * m_strength * 0.5f *
|
||||
|
|
|
@ -48,7 +48,8 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING1 uniform sampler2D indTex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" colorOut = texture(sceneTex, vtf.sceneUv + (texture(indTex, vtf.indUv).xy * vec2(2.0) - vec2(1.0 - 1.0 / 256.0)) * vtf.strength.xy);\n"
|
||||
" vec2 indUv = texture(indTex, vtf.indUv).xy * vec2(2.0) - vec2(1.0 - 1.0 / 256.0);\n"
|
||||
" colorOut = vec4(texture(sceneTex, vtf.sceneUv + indUv * vtf.strength.xy).rgb, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||
|
|
|
@ -50,7 +50,8 @@ static const char* FS =
|
|||
"\n"
|
||||
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||
"{\n"
|
||||
" return sceneTex.Sample(samp, vtf.sceneUv + (indTex.Sample(samp, vtf.indUv).xy * float2(2.0, 2.0) - float2(1.0 - 1.0 / 256.0, 1.0 - 1.0 / 256.0)) * vtf.strength.xy);\n"
|
||||
" float2 indUv = indTex.Sample(samp, vtf.indUv).xy * float2(2.0, 2.0) - float2(1.0 - 1.0 / 256.0, 1.0 - 1.0 / 256.0);\n"
|
||||
" return float4(sceneTex.Sample(samp, vtf.sceneUv + indUv * vtf.strength.xy).rgb, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||
|
|
|
@ -54,7 +54,8 @@ static const char* FS =
|
|||
" texture2d<float> sceneTex [[ texture(0) ]],\n"
|
||||
" texture2d<float> indTex [[ texture(1) ]])\n"
|
||||
"{\n"
|
||||
" return sceneTex.sample(samp, vtf.sceneUv + (indTex.sample(samp, vtf.indUv).xy * float2(2.0) - float2(1.0 - 1.0 / 256.0)) * vtf.strength.xy);\n"
|
||||
" float2 indUv = indTex.sample(samp, vtf.indUv).xy * float2(2.0) - float2(1.0 - 1.0 / 256.0);\n"
|
||||
" return float4(sceneTex.sample(samp, vtf.sceneUv + indUv * vtf.strength.xy).rgb, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||
|
|
|
@ -9,10 +9,11 @@ namespace urde
|
|||
|
||||
CWeapon::CWeapon(TUniqueId uid, TAreaId aid, bool active, TUniqueId owner, EWeaponType type,
|
||||
std::string_view name, const zeus::CTransform& xf, const CMaterialFilter& filter,
|
||||
const CMaterialList& mList, const CDamageInfo&, EProjectileAttrib attribs, CModelData&& mData)
|
||||
const CMaterialList& mList, const CDamageInfo& dInfo, EProjectileAttrib attribs, CModelData&& mData)
|
||||
: CActor(uid, active, name, CEntityInfo(aid, CEntity::NullConnectionList), xf, std::move(mData), mList,
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xf8_filter(filter)
|
||||
CActorParameters::None(), kInvalidUniqueId),
|
||||
xe8_projectileAttribs(attribs), xec_ownerId(owner), xf0_weaponType(type), xf8_filter(filter),
|
||||
x110_origDamageInfo(dInfo), x12c_curDamageInfo(dInfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,15 +14,13 @@ protected:
|
|||
EProjectileAttrib xe8_projectileAttribs;
|
||||
TUniqueId xec_ownerId;
|
||||
EWeaponType xf0_weaponType;
|
||||
u32 xf4_;
|
||||
CMaterialFilter xf8_filter;
|
||||
u32 x10c_;
|
||||
CDamageInfo x110_origDamageInfo;
|
||||
CDamageInfo x12c_curDamageInfo;
|
||||
float x148_curTime;
|
||||
float x14c_damageFalloffSpeed;
|
||||
float x150_damageDuration;
|
||||
float x154_interferenceDuration;
|
||||
float x148_curTime = 0.f;
|
||||
float x14c_damageFalloffSpeed = 0.f;
|
||||
float x150_damageDuration = 0.f;
|
||||
float x154_interferenceDuration = 0.f;
|
||||
public:
|
||||
CWeapon(TUniqueId uid, TAreaId aid, bool active, TUniqueId owner, EWeaponType type,
|
||||
std::string_view name, const zeus::CTransform& xf, const CMaterialFilter& filter,
|
||||
|
|
|
@ -45,10 +45,10 @@ CActor::CActor(TUniqueId uid, bool active, std::string_view name, const CEntityI
|
|||
xe4_31_lightsDirty = true;
|
||||
xe5_27_useInSortedLists = true;
|
||||
xe5_28_callTouch = true;
|
||||
xe5_29_globalTimeProvider = params.x58_24_;
|
||||
xe5_30_ = params.x58_26_;
|
||||
xe5_29_globalTimeProvider = params.x58_24_globalTimeProvider;
|
||||
xe5_30_renderUnsorted = params.x58_26_renderUnsorted;
|
||||
xe6_27_thermalVisorFlags = u8(params.x58_25_thermalHeat ? 2 : 1);
|
||||
xe6_29_prePostParticles = true;
|
||||
xe6_29_renderParticleDBInside = true;
|
||||
xe6_31_targetableVisorFlags = params.GetVisorParameters().GetMask();
|
||||
xe7_27_enableRender = true;
|
||||
xe7_29_actorActive = active;
|
||||
|
@ -205,7 +205,7 @@ void CActor::AddToRenderer(const zeus::CFrustum& planes, const CStateManager& mg
|
|||
if (!x64_modelData || x64_modelData->IsNull())
|
||||
return;
|
||||
|
||||
if (xe6_29_prePostParticles)
|
||||
if (xe6_29_renderParticleDBInside)
|
||||
x64_modelData->RenderParticles(planes);
|
||||
|
||||
if (!xe4_30_outOfFrustum)
|
||||
|
@ -270,11 +270,22 @@ void CActor::RenderInternal(const CStateManager& mgr) const
|
|||
x64_modelData->Render(which, x34_transform, x90_actorLights.get(), xb4_drawFlags);
|
||||
}
|
||||
|
||||
bool CActor::IsModelOpaque(const CStateManager& mgr) const
|
||||
{
|
||||
if (xe5_31_pointGeneratorParticles)
|
||||
return false;
|
||||
if (!x64_modelData || x64_modelData->IsNull())
|
||||
return true;
|
||||
if (xb4_drawFlags.x0_blendMode > 4)
|
||||
return false;
|
||||
return x64_modelData->IsDefinitelyOpaque(CModelData::GetRenderingModel(mgr));
|
||||
}
|
||||
|
||||
void CActor::Render(const CStateManager& mgr) const
|
||||
{
|
||||
if (x64_modelData && !x64_modelData->IsNull())
|
||||
{
|
||||
bool renderPrePostParticles = xe6_29_prePostParticles && x64_modelData && x64_modelData->HasAnimData();
|
||||
bool renderPrePostParticles = xe6_29_renderParticleDBInside && x64_modelData && x64_modelData->HasAnimData();
|
||||
if (renderPrePostParticles)
|
||||
x64_modelData->AnimationData()->GetParticleDB().RenderSystemsToBeDrawnFirst();
|
||||
|
||||
|
@ -306,8 +317,14 @@ void CActor::Render(const CStateManager& mgr) const
|
|||
DrawTouchBounds();
|
||||
}
|
||||
|
||||
bool CActor::CanRenderUnsorted(const CStateManager&) const
|
||||
bool CActor::CanRenderUnsorted(const CStateManager& mgr) const
|
||||
{
|
||||
if (x64_modelData && x64_modelData->HasAnimData() &&
|
||||
x64_modelData->GetAnimationData()->GetParticleDB().AreAnySystemsDrawnWithModel() &&
|
||||
xe6_29_renderParticleDBInside)
|
||||
return false;
|
||||
else if (xe5_30_renderUnsorted || IsModelOpaque(mgr))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -321,12 +338,15 @@ void CActor::CalculateRenderBounds()
|
|||
|
||||
CHealthInfo* CActor::HealthInfo(CStateManager&) { return nullptr; }
|
||||
|
||||
const CDamageVulnerability* CActor::GetDamageVulnerability() const { return nullptr; }
|
||||
const CDamageVulnerability* CActor::GetDamageVulnerability() const
|
||||
{
|
||||
return &CDamageVulnerability::NormalVulnerabilty();
|
||||
}
|
||||
|
||||
const CDamageVulnerability* CActor::GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
const CDamageInfo&) const
|
||||
{
|
||||
return nullptr;
|
||||
return GetDamageVulnerability();
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CActor::GetTouchBounds() const { return {}; }
|
||||
|
@ -339,7 +359,16 @@ zeus::CVector3f CActor::GetAimPosition(const CStateManager&, float) const { retu
|
|||
|
||||
zeus::CVector3f CActor::GetHomingPosition(const CStateManager& mgr, float f) const { return GetAimPosition(mgr, f); }
|
||||
|
||||
zeus::CVector3f CActor::GetScanObjectIndicatorPosition(const CStateManager&) const { return {}; }
|
||||
zeus::CVector3f CActor::GetScanObjectIndicatorPosition(const CStateManager& mgr) const
|
||||
{
|
||||
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
|
||||
zeus::CVector3f orbitPos = GetOrbitPosition(mgr);
|
||||
float camToOrbitPos = (cam->GetTranslation() - orbitPos).magnitude();
|
||||
zeus::CVector3f boundsExtent = x9c_renderBounds.max - x9c_renderBounds.min;
|
||||
float distFac = std::min(std::max(boundsExtent.x, std::max(boundsExtent.y, boundsExtent.z)) * 0.5f,
|
||||
camToOrbitPos - cam->GetNearClipDistance() - 0.1f);
|
||||
return orbitPos - (orbitPos - cam->GetTranslation()).normalized() * distFac;
|
||||
}
|
||||
|
||||
void CActor::RemoveEmitter()
|
||||
{
|
||||
|
|
|
@ -65,11 +65,11 @@ protected:
|
|||
bool xe5_27_useInSortedLists : 1;
|
||||
bool xe5_28_callTouch : 1;
|
||||
bool xe5_29_globalTimeProvider : 1;
|
||||
bool xe5_30_ : 1;
|
||||
bool xe5_30_renderUnsorted : 1;
|
||||
bool xe5_31_pointGeneratorParticles : 1;
|
||||
u8 xe6_24_fluidCounter : 3;
|
||||
u8 xe6_27_thermalVisorFlags : 2; // 1: thermal cold, 2: thermal hot
|
||||
bool xe6_29_prePostParticles : 1;
|
||||
bool xe6_29_renderParticleDBInside : 1;
|
||||
bool xe6_30_enablePitchBend : 1;
|
||||
u8 xe6_31_targetableVisorFlags : 4;
|
||||
bool xe7_27_enableRender : 1;
|
||||
|
@ -84,6 +84,7 @@ protected:
|
|||
void UpdateSfxEmitters();
|
||||
void DrawTouchBounds() const;
|
||||
void RenderInternal(const CStateManager& mgr) const;
|
||||
bool IsModelOpaque(const CStateManager& mgr) const;
|
||||
|
||||
public:
|
||||
enum class EFluidState
|
||||
|
|
|
@ -21,9 +21,9 @@ class CActorParameters
|
|||
{
|
||||
struct
|
||||
{
|
||||
bool x58_24_ : 1;
|
||||
bool x58_24_globalTimeProvider : 1;
|
||||
bool x58_25_thermalHeat : 1;
|
||||
bool x58_26_ : 1;
|
||||
bool x58_26_renderUnsorted : 1;
|
||||
bool x58_27_noSortThermal : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
|
@ -33,19 +33,22 @@ class CActorParameters
|
|||
float x64_thermalMag = 0.f;
|
||||
|
||||
public:
|
||||
CActorParameters() : x58_24_(true), x58_25_thermalHeat(false), x58_26_(false), x58_27_noSortThermal(false) {}
|
||||
CActorParameters() : x58_24_globalTimeProvider(true), x58_25_thermalHeat(false),
|
||||
x58_26_renderUnsorted(false), x58_27_noSortThermal(false) {}
|
||||
CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms,
|
||||
const std::pair<CAssetId, CAssetId>& xrayAssets, const std::pair<CAssetId, CAssetId>& thermalAssets,
|
||||
const CVisorParameters& visorParms, bool b1, bool thermalHeat, bool c, bool d)
|
||||
const std::pair<CAssetId, CAssetId>& xrayAssets,
|
||||
const std::pair<CAssetId, CAssetId>& thermalAssets,
|
||||
const CVisorParameters& visorParms, bool globalTimeProvider, bool thermalHeat,
|
||||
bool renderUnsorted, bool noSortThermal)
|
||||
: x0_lightParms(lightParms)
|
||||
, x40_scanParms(scanParms)
|
||||
, x44_xrayAssets(xrayAssets)
|
||||
, x4c_thermalAssets(thermalAssets)
|
||||
, x54_visorParms(visorParms)
|
||||
, x58_24_(b1)
|
||||
, x58_24_globalTimeProvider(globalTimeProvider)
|
||||
, x58_25_thermalHeat(thermalHeat)
|
||||
, x58_26_(c)
|
||||
, x58_27_noSortThermal(d)
|
||||
, x58_26_renderUnsorted(renderUnsorted)
|
||||
, x58_27_noSortThermal(noSortThermal)
|
||||
{
|
||||
}
|
||||
CActorParameters Scannable(const CScannableParameters& sParms) const
|
||||
|
|
Loading…
Reference in New Issue