Cleans up ShapeAsset of some unnecessary/redundant elements like extra material and animations tracking

Removed the old SHAPE_ASSET macros
Implements AssetRef struct that acts as a universal wrapper for an templated AssetPtr and AssetId pair
Adds Type handling for AssetRef for ShapeAsset to unify handling in classes that utilize a shapeAsset, so assigning an assetPtr or an assetId will keep a record of the assignment in the event the assetPtr is invalid.
Update all classes that utilized the old SHAPE_ASSET macros to utilize the AssetRef struct and updated the class code to utilize it to provide much more clean and concise code that isn't blocked behind macro definitions
Added a new example class: shapeDatablockExample which allows render of a simple shape object utilizing a simple example datablock.
This commit is contained in:
JeffR 2026-05-31 01:19:26 -05:00
parent c2c5674fe9
commit b44158cb89
52 changed files with 1860 additions and 1086 deletions

View file

@ -43,7 +43,7 @@ struct afxModelData : public GameBaseData, protected AssetPtrCallback
{
typedef GameBaseData Parent;
DECLARE_SHAPEASSET_REFACTOR(afxModelData, Shape)
AssetRef<ShapeAsset> shapeAssetRef;
StringTableEntry sequence;
@ -155,9 +155,21 @@ public:
void setSequenceRateFactor(F32 factor);
void setSortPriority(S8 priority) { sort_priority = priority; }
const char* getShapeFileName() const { return mDataBlock->getShapeFile(); }
const char* getShapeFileName() const
{
if (mDataBlock->shapeAssetRef.isNull())
return "";
return mDataBlock->shapeAssetRef.assetPtr->getShapeFile();
}
void setVisibility(bool flag) { is_visible = flag; }
TSShape* getTSShape() { return mDataBlock->getShape(); }
TSShape* getTSShape()
{
if (mDataBlock->shapeAssetRef.isNull())
return nullptr;
return mDataBlock->shapeAssetRef.assetPtr->getShape();
}
TSShapeInstance* getTSShapeInstance() { return shape_inst; }
U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans);