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;
|
||||
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
|
||||
{
|
||||
friend class CSfxManager;
|
||||
|
|
|
@ -15,9 +15,9 @@ void CHierarchyPoseBuilder::BuildIntoHierarchy(const CCharLayoutInfo& layout,
|
|||
{
|
||||
xcec_rootId = boneId;
|
||||
xcf0_hasRoot = true;
|
||||
//zeus::CVector3f origin = layout.GetFromParentUnrotated(boneId);
|
||||
//CTreeNode& node = x38_treeMap[boneId];
|
||||
//node.x14_offset = origin;
|
||||
zeus::CVector3f origin = layout.GetFromParentUnrotated(boneId);
|
||||
CTreeNode& node = x38_treeMap[boneId];
|
||||
node.x14_offset = origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ enum class EMaterialTypes
|
|||
Sand = 17,
|
||||
ProjectilePassthrough = 18,
|
||||
Solid = 19,
|
||||
Twenty = 20,
|
||||
CameraPassthrough = 21,
|
||||
Wood = 22,
|
||||
Organic = 23,
|
||||
|
|
|
@ -48,7 +48,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
" float discardThres;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"vec2i Lookup8BPP(in vec2 uv, in float randOff)\n"
|
||||
"ivec2 Lookup8BPP(in vec2 uv, in float randOff)\n"
|
||||
"{\n"
|
||||
" float bx;\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 y;\n"
|
||||
" float x = modf(addr / 1024.0, y) * 1024.0;\n"
|
||||
" return vec2i(x, y);\n"
|
||||
" return ivec2(x, y);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"SBINDING(0) in VertToFrag vtf;\n"
|
||||
|
@ -66,7 +66,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING0 uniform sampler2D tex;\n"
|
||||
"void main()\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"
|
||||
"}\n";
|
||||
|
||||
|
@ -81,7 +81,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
" float discardThres;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"vec2i Lookup8BPP(in vec2 uv, in float randOff)\n"
|
||||
"ivec2 Lookup8BPP(in vec2 uv, in float randOff)\n"
|
||||
"{\n"
|
||||
" float bx;\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 y;\n"
|
||||
" float x = modf(addr / 1024.0, y) * 1024.0;\n"
|
||||
" return vec2i(x, y);\n"
|
||||
" return ivec2(x, y);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"SBINDING(0) in VertToFrag vtf;\n"
|
||||
|
@ -99,7 +99,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING0 uniform sampler2D tex;\n"
|
||||
"void main()\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"
|
||||
" discard;\n"
|
||||
"}\n";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "CScriptPlatform.hpp"
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
namespace urde
|
||||
|
@ -17,18 +18,31 @@ static CMaterialList MakePlatformMaterialList()
|
|||
|
||||
CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||
const zeus::CAABox& aabb, float, bool, float, bool active, const CHealthInfo& hInfo,
|
||||
const CDamageVulnerability& dInfo,
|
||||
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>>& dcln, bool, u32,
|
||||
u32)
|
||||
const zeus::CAABox& aabb, float f1, bool, float f2, bool active,
|
||||
const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
|
||||
bool, u32, u32)
|
||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
|
||||
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)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
void CScriptPlatform::Accept(IVisitor& visitor) { 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 "optional.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "CHealthInfo.hpp"
|
||||
#include "CDamageVulnerability.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CCollidableOBBTreeGroup;
|
||||
class CCollidableOBBTreeGroupContainer;
|
||||
|
||||
struct SRiders
|
||||
{
|
||||
TUniqueId x0_uid;
|
||||
u32 x4_;
|
||||
zeus::CTransform x8_transform;
|
||||
};
|
||||
|
||||
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:
|
||||
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,
|
||||
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);
|
||||
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);
|
||||
|
||||
FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId);
|
||||
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroup>> dclnToken;
|
||||
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
|
||||
if (dclnType)
|
||||
{
|
||||
dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId}));
|
||||
|
|
Loading…
Reference in New Issue