This commit is contained in:
Vladislav Khorev committed 2026-05-01 20:26:50 +03:00
1 parent 519d780b3c
commit e04fcbb9bd
11 files changed
+91 -1463

No files matched your search

+51 -1
View File
@@ -13,7 +13,21 @@ namespace ZL
using std::max;
#endif
extern int getIndexByValue(const std::string& name, const std::vector<std::string>& words);
int getIndexByValue(const std::string& name, const std::vector<std::string>& words)
{
for (int i = 0; i < words.size(); i++)
{
if (words[i] == name)
{
return i;
}
}
std::cout << "Bone name not found: " << name << std::endl;
throw std::runtime_error("Bone name not found: " + name);
return -1;
}
static std::string trimRight(const std::string& s)
{
@@ -23,6 +37,42 @@ namespace ZL
return s.substr(0, end);
}
void GpuBoneData::PrepareGpuSkinningData(const std::vector<std::array<BoneWeight, MAX_BONE_COUNT>>& verticesBoneWeight)
{
size_t vertexCount = verticesBoneWeight.size();
boneIndices0.resize(vertexCount);
boneIndices1.resize(vertexCount);
boneWeights0.resize(vertexCount);
boneWeights1.resize(vertexCount);
for (size_t i = 0; i < vertexCount; i++)
{
boneIndices0[i] = Vector4f(
static_cast<float>(max(0, verticesBoneWeight[i][0].boneIndex)),
static_cast<float>(max(0, verticesBoneWeight[i][1].boneIndex)),
static_cast<float>(max(0, verticesBoneWeight[i][2].boneIndex)),
static_cast<float>(max(0, verticesBoneWeight[i][3].boneIndex))
);
boneIndices1[i] = Vector2f(
static_cast<float>(max(0, verticesBoneWeight[i][4].boneIndex)),
static_cast<float>(max(0, verticesBoneWeight[i][5].boneIndex))
);
boneWeights0[i] = Vector4f(
verticesBoneWeight[i][0].weight,
verticesBoneWeight[i][1].weight,
verticesBoneWeight[i][2].weight,
verticesBoneWeight[i][3].weight
);
boneWeights1[i] = Vector2f(
verticesBoneWeight[i][4].weight,
verticesBoneWeight[i][5].weight
);
}
prepared = true;
}
void BoneSystemNew::LoadFromFile(const std::string& fileName, const std::string& ZIPFileName)
{
std::ifstream filestream;