Animation WIP merge #321
|
@ -73,7 +73,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
Handle<SHRig::Node> SHRig::recurseCreateNode(const SHRigAsset& asset, const RigNode* sourceNode)
|
||||
Handle<SHRig::Node> SHRig::recurseCreateNode(const SHRigAsset& asset, const SHRigNode* sourceNode)
|
||||
{
|
||||
// Construct the node
|
||||
auto newNode = nodeStore.Create();
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace SHADE
|
|||
/* Forward Declarations */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
struct SHRigAsset;
|
||||
struct RigNode;
|
||||
struct SHRigNode;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
|
@ -99,6 +99,6 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Handle<Node> recurseCreateNode(const SHRigAsset& asset, const RigNode* sourceNode);
|
||||
Handle<Node> recurseCreateNode(const SHRigAsset& asset, const SHRigNode* sourceNode);
|
||||
};
|
||||
}
|
|
@ -24,18 +24,43 @@ namespace SHADE
|
|||
sizeof(asset.header)
|
||||
);
|
||||
|
||||
if (asset.header.meshCount > 0)
|
||||
{
|
||||
asset.meshHeaders.resize(asset.header.meshCount);
|
||||
asset.animHeaders.resize(asset.header.animCount);
|
||||
|
||||
file.read(
|
||||
reinterpret_cast<char*>(asset.meshHeaders.data()),
|
||||
sizeof(asset.header.meshCount) * sizeof(SHMeshDataHeader)
|
||||
asset.header.meshCount * sizeof(SHMeshDataHeader)
|
||||
);
|
||||
}
|
||||
|
||||
if (asset.header.animCount > 0)
|
||||
{
|
||||
asset.animHeaders.resize(asset.header.animCount);
|
||||
for (auto i {0}; i < asset.header.animCount; ++i)
|
||||
{
|
||||
auto& animHeader = asset.animHeaders[i];
|
||||
file.read(
|
||||
reinterpret_cast<char*>(&animHeader.charCount),
|
||||
sizeof(uint32_t)
|
||||
);
|
||||
|
||||
file.read(
|
||||
reinterpret_cast<char*>(asset.animHeaders.data()),
|
||||
sizeof(asset.header.animCount) * sizeof(SHAnimDataHeader)
|
||||
reinterpret_cast<char*>(&animHeader.animNodeCount),
|
||||
sizeof(uint32_t)
|
||||
);
|
||||
|
||||
animHeader.nodeHeaders.resize(animHeader.animNodeCount);
|
||||
for (auto j {0}; j < animHeader.animNodeCount; ++j)
|
||||
{
|
||||
auto& nodeHeader = animHeader.nodeHeaders[j];
|
||||
|
||||
file.read(
|
||||
reinterpret_cast<char*>(&nodeHeader),
|
||||
sizeof(SHAnimNodeInfo)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SHModelLoader::ReadData(FileReference file, SHModelAsset& asset)
|
||||
|
@ -209,6 +234,7 @@ namespace SHADE
|
|||
auto const& header = headers[i];
|
||||
auto& animAsset = *new SHAnimAsset;
|
||||
|
||||
animAsset.name.resize(header.charCount);
|
||||
file.read(
|
||||
animAsset.name.data(),
|
||||
header.charCount
|
||||
|
@ -242,11 +268,9 @@ namespace SHADE
|
|||
if (!file.is_open())
|
||||
{
|
||||
SHLOG_ERROR("[Model Loader] Unable to open SHModel File: {}", path.string());
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
file.seekg(0);
|
||||
|
||||
ReadHeaders(file, *result);
|
||||
ReadData(file, *result);
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace SHADE
|
|||
return;
|
||||
}
|
||||
|
||||
if (genMeta)
|
||||
if (true)
|
||||
{
|
||||
GenerateNewMeta(newPath);
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ namespace SHADE
|
|||
for(auto const& subMesh : data->meshes)
|
||||
{
|
||||
SHAsset subAsset{
|
||||
.name = subMesh->header.name,
|
||||
.name = subMesh->name,
|
||||
.id = GenerateAssetID(AssetType::MESH),
|
||||
.type = AssetType::MESH,
|
||||
.isSubAsset = true,
|
||||
|
|
Loading…
Reference in New Issue