mirror of https://github.com/AxioDL/metaforce.git
Initial CScriptPlatform imps, minor cleanup, and RandomStatic GLSL fixes
This commit is contained in:
parent
2d2a3dcf1c
commit
46c70ecf11
|
@ -42,6 +42,17 @@ public:
|
||||||
class CBaseSfxWrapper;
|
class CBaseSfxWrapper;
|
||||||
using CSfxHandle = std::shared_ptr<CBaseSfxWrapper>;
|
using CSfxHandle = std::shared_ptr<CBaseSfxWrapper>;
|
||||||
|
|
||||||
|
/* Original imp, kept for reference
|
||||||
|
class CSfxHandle
|
||||||
|
{
|
||||||
|
static u32 mRefCount;
|
||||||
|
u32 x0_idx;
|
||||||
|
public:
|
||||||
|
CSfxHandle(u32 id)
|
||||||
|
: x0_idx(++mRefCount << 14 | (id & 0xFFFF)) {}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
class CSfxChannel
|
class CSfxChannel
|
||||||
{
|
{
|
||||||
friend class CSfxManager;
|
friend class CSfxManager;
|
||||||
|
|
|
@ -15,9 +15,9 @@ void CHierarchyPoseBuilder::BuildIntoHierarchy(const CCharLayoutInfo& layout,
|
||||||
{
|
{
|
||||||
xcec_rootId = boneId;
|
xcec_rootId = boneId;
|
||||||
xcf0_hasRoot = true;
|
xcf0_hasRoot = true;
|
||||||
//zeus::CVector3f origin = layout.GetFromParentUnrotated(boneId);
|
zeus::CVector3f origin = layout.GetFromParentUnrotated(boneId);
|
||||||
//CTreeNode& node = x38_treeMap[boneId];
|
CTreeNode& node = x38_treeMap[boneId];
|
||||||
//node.x14_offset = origin;
|
node.x14_offset = origin;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@ enum class EMaterialTypes
|
||||||
Sand = 17,
|
Sand = 17,
|
||||||
ProjectilePassthrough = 18,
|
ProjectilePassthrough = 18,
|
||||||
Solid = 19,
|
Solid = 19,
|
||||||
|
Twenty = 20,
|
||||||
CameraPassthrough = 21,
|
CameraPassthrough = 21,
|
||||||
Wood = 22,
|
Wood = 22,
|
||||||
Organic = 23,
|
Organic = 23,
|
||||||
|
|
|
@ -48,7 +48,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
" float discardThres;\n"
|
" float discardThres;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"vec2i Lookup8BPP(in vec2 uv, in float randOff)\n"
|
"ivec2 Lookup8BPP(in vec2 uv, in float randOff)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float bx;\n"
|
" float bx;\n"
|
||||||
" float rx = modf(uv.x / 8.0, bx) * 8.0;\n"
|
" float rx = modf(uv.x / 8.0, bx) * 8.0;\n"
|
||||||
|
@ -58,7 +58,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
" float addr = bidx * 32.0 + ry * 8.0 + rx + randOff;\n"
|
" float addr = bidx * 32.0 + ry * 8.0 + rx + randOff;\n"
|
||||||
" float y;\n"
|
" float y;\n"
|
||||||
" float x = modf(addr / 1024.0, y) * 1024.0;\n"
|
" float x = modf(addr / 1024.0, y) * 1024.0;\n"
|
||||||
" return vec2i(x, y);\n"
|
" return ivec2(x, y);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"SBINDING(0) in VertToFrag vtf;\n"
|
"SBINDING(0) in VertToFrag vtf;\n"
|
||||||
|
@ -66,7 +66,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
"TBINDING0 uniform sampler2D tex;\n"
|
"TBINDING0 uniform sampler2D tex;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" colorOut = texelFetch(tex, Lookup8BPP(vtf.uv, vtf.randOff)) * vtf.color;\n"
|
" colorOut = texelFetch(tex, Lookup8BPP(vtf.uv, vtf.randOff), 0) * vtf.color;\n"
|
||||||
" colorOut.a = vtf.color.a;\n"
|
" colorOut.a = vtf.color.a;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
" float discardThres;\n"
|
" float discardThres;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"vec2i Lookup8BPP(in vec2 uv, in float randOff)\n"
|
"ivec2 Lookup8BPP(in vec2 uv, in float randOff)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" float bx;\n"
|
" float bx;\n"
|
||||||
" float rx = modf(uv.x / 8.0, bx) * 8.0;\n"
|
" float rx = modf(uv.x / 8.0, bx) * 8.0;\n"
|
||||||
|
@ -91,7 +91,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
" float addr = bidx * 32.0 + ry * 8.0 + rx + randOff;\n"
|
" float addr = bidx * 32.0 + ry * 8.0 + rx + randOff;\n"
|
||||||
" float y;\n"
|
" float y;\n"
|
||||||
" float x = modf(addr / 1024.0, y) * 1024.0;\n"
|
" float x = modf(addr / 1024.0, y) * 1024.0;\n"
|
||||||
" return vec2i(x, y);\n"
|
" return ivec2(x, y);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"SBINDING(0) in VertToFrag vtf;\n"
|
"SBINDING(0) in VertToFrag vtf;\n"
|
||||||
|
@ -99,7 +99,7 @@ BOO_GLSL_BINDING_HEAD
|
||||||
"TBINDING0 uniform sampler2D tex;\n"
|
"TBINDING0 uniform sampler2D tex;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" colorOut = texelFetch(tex, Lookup8BPP(vtf.uv, vtf.randOff)) * vtf.color;\n"
|
" colorOut = texelFetch(tex, Lookup8BPP(vtf.uv, vtf.randOff), 0) * vtf.color;\n"
|
||||||
" if (colorOut.a < vtf.discardThres)\n"
|
" if (colorOut.a < vtf.discardThres)\n"
|
||||||
" discard;\n"
|
" discard;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "CScriptPlatform.hpp"
|
#include "CScriptPlatform.hpp"
|
||||||
#include "Collision/CMaterialList.hpp"
|
#include "Collision/CMaterialList.hpp"
|
||||||
|
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
||||||
#include "TCastTo.hpp"
|
#include "TCastTo.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
|
@ -17,18 +18,31 @@ static CMaterialList MakePlatformMaterialList()
|
||||||
|
|
||||||
CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||||
const zeus::CAABox& aabb, float, bool, float, bool active, const CHealthInfo& hInfo,
|
const zeus::CAABox& aabb, float f1, bool, float f2, bool active,
|
||||||
const CDamageVulnerability& dInfo,
|
const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||||
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32,
|
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
|
||||||
u32)
|
bool, u32, u32)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
|
||||||
actParms, 0.3f, 0.1f)
|
actParms, 0.3f, 0.1f)
|
||||||
|
, x28c_(hInfo)
|
||||||
|
, x294_(hInfo)
|
||||||
|
, x29c_(dVuln)
|
||||||
|
, x304_treeGroupContainer(dcln)
|
||||||
{
|
{
|
||||||
|
CActor::SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
|
||||||
|
CMaterialList(EMaterialTypes::Solid),
|
||||||
|
CMaterialList(EMaterialTypes::ThirtyEight, EMaterialTypes::Twenty, EMaterialTypes::Platform)));
|
||||||
|
if (x304_treeGroupContainer)
|
||||||
|
x314_treeGroup = std::make_unique<CCollidableOBBTreeGroup>(x304_treeGroupContainer->GetObj(), x68_material);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptPlatform::Accept(IVisitor& visitor)
|
void CScriptPlatform::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
{
|
|
||||||
visitor.Visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
rstl::optional_object<zeus::CAABox> CScriptPlatform::GetTouchBounds() const
|
||||||
|
{
|
||||||
|
if (x314_treeGroup)
|
||||||
|
return {x314_treeGroup->CalculateAABox(GetTransform())};
|
||||||
|
|
||||||
|
return {CPhysicsActor::GetBoundingBox()};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,67 @@
|
||||||
#include "CPhysicsActor.hpp"
|
#include "CPhysicsActor.hpp"
|
||||||
#include "optional.hpp"
|
#include "optional.hpp"
|
||||||
#include "CToken.hpp"
|
#include "CToken.hpp"
|
||||||
|
#include "CHealthInfo.hpp"
|
||||||
|
#include "CDamageVulnerability.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CCollidableOBBTreeGroup;
|
class CCollidableOBBTreeGroup;
|
||||||
|
class CCollidableOBBTreeGroupContainer;
|
||||||
|
|
||||||
|
struct SRiders
|
||||||
|
{
|
||||||
|
TUniqueId x0_uid;
|
||||||
|
u32 x4_;
|
||||||
|
zeus::CTransform x8_transform;
|
||||||
|
};
|
||||||
|
|
||||||
class CScriptPlatform : public CPhysicsActor
|
class CScriptPlatform : public CPhysicsActor
|
||||||
{
|
{
|
||||||
|
u32 x254_;
|
||||||
|
TUniqueId x258_ = kInvalidUniqueId;
|
||||||
|
TUniqueId x25a_ = kInvalidUniqueId;
|
||||||
|
float x25c_;
|
||||||
|
float x260_;
|
||||||
|
float x264_;
|
||||||
|
float x268_;
|
||||||
|
float x26c_;
|
||||||
|
zeus::CVector3f x270_;
|
||||||
|
zeus::CQuaternion x27c_;
|
||||||
|
CHealthInfo x28c_;
|
||||||
|
CHealthInfo x294_;
|
||||||
|
CDamageVulnerability x29c_;
|
||||||
|
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>> x304_treeGroupContainer;
|
||||||
|
std::unique_ptr<CCollidableOBBTreeGroup> x314_treeGroup;
|
||||||
|
std::vector<SRiders> x318_riders;
|
||||||
|
float x348_;
|
||||||
|
u32 x34c_;
|
||||||
|
u32 x350_;
|
||||||
|
TUniqueId x354_;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool x356_24_ : 1;
|
||||||
|
bool x356_25_ : 1;
|
||||||
|
bool x356_26_ : 1;
|
||||||
|
bool x356_27_ : 1;
|
||||||
|
bool x356_28_ : 1;
|
||||||
|
bool x356_29_ : 1;
|
||||||
|
bool x356_30_ : 1;
|
||||||
|
bool x356_31_ : 1;
|
||||||
|
};
|
||||||
|
u32 x356_dummy = 0;
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float, bool, float,
|
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float, bool, float,
|
||||||
bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
|
bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
|
||||||
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32, u32);
|
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln, bool, u32, u32);
|
||||||
|
|
||||||
void Accept(IVisitor& visitor);
|
void Accept(IVisitor& visitor);
|
||||||
|
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,7 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr
|
||||||
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid);
|
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid);
|
||||||
|
|
||||||
FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId);
|
FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId);
|
||||||
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>> dclnToken;
|
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
|
||||||
if (dclnType)
|
if (dclnType)
|
||||||
{
|
{
|
||||||
dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId}));
|
dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId}));
|
||||||
|
|
Loading…
Reference in New Issue