Changed bone weight data format in mesh
This commit is contained in:
parent
2188aa4998
commit
5839a2b80d
|
@ -99,20 +99,8 @@ namespace SH_COMP
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::vector<SHVec4>weights;
|
FetchData(primitive.attributes.at(ATT_WEIGHTS.data()), meshIn.weights);
|
||||||
std::vector<SHVec4i>joints;
|
FetchData(primitive.attributes.at(ATT_JOINT.data()), meshIn.joints);
|
||||||
FetchData(primitive.attributes.at(ATT_WEIGHTS.data()), weights);
|
|
||||||
FetchData(primitive.attributes.at(ATT_JOINT.data()), joints);
|
|
||||||
meshIn.weights.resize(weights.size());
|
|
||||||
std::ranges::transform(
|
|
||||||
weights,
|
|
||||||
joints,
|
|
||||||
meshIn.weights.begin(),
|
|
||||||
[](SHVec4 const& weights, SHVec4i const& joints) ->VertexWeights
|
|
||||||
{
|
|
||||||
return { weights, joints };
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
std::cout << "hi\n";
|
std::cout << "hi\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,16 @@ namespace SH_COMP
|
||||||
);
|
);
|
||||||
|
|
||||||
if (header.hasWeights)
|
if (header.hasWeights)
|
||||||
file.write(
|
{
|
||||||
reinterpret_cast<char const*>(asset.weights.data()),
|
file.write(
|
||||||
sizeof(VertexWeights) * header.vertexCount
|
reinterpret_cast<char const*>(asset.weights.data()),
|
||||||
);
|
sizeof(SHVec4) * header.vertexCount
|
||||||
|
);
|
||||||
|
file.write(
|
||||||
|
reinterpret_cast<char const*>(asset.joints.data()),
|
||||||
|
sizeof(SHVec4i) * header.vertexCount
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,6 @@ namespace SH_COMP
|
||||||
bool hasWeights;
|
bool hasWeights;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VertexWeights
|
|
||||||
{
|
|
||||||
SHVec4 weights;
|
|
||||||
SHVec4i joints;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MeshData
|
struct MeshData
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -32,6 +26,7 @@ namespace SH_COMP
|
||||||
std::vector<IndexType> indices;
|
std::vector<IndexType> indices;
|
||||||
|
|
||||||
//Variable data
|
//Variable data
|
||||||
std::vector<VertexWeights> weights;
|
std::vector<SHVec4> weights;
|
||||||
|
std::vector<SHVec4i> joints;
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue