mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 03:47:56 +02:00
Clear blendshapes without memset
Avoids warning due to glm::vec3 not being trivially copyable
This commit is contained in:
parent
194eebf57c
commit
189f91b05d
2 changed files with 22 additions and 1 deletions
|
@ -1949,7 +1949,9 @@ void Blender::run() {
|
||||||
blendedMeshSizes.push_back(numVertsInMesh);
|
blendedMeshSizes.push_back(numVertsInMesh);
|
||||||
|
|
||||||
// initialize offsets to zero
|
// initialize offsets to zero
|
||||||
memset(unpackedBlendshapeOffsets.data(), 0, numVertsInMesh * sizeof(BlendshapeOffsetUnpacked));
|
for(BlendshapeOffsetUnpacked &bou : unpackedBlendshapeOffsets) {
|
||||||
|
bou.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// for each blendshape in this mesh, accumulate the offsets into unpackedBlendshapeOffsets.
|
// for each blendshape in this mesh, accumulate the offsets into unpackedBlendshapeOffsets.
|
||||||
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
|
const float NORMAL_COEFFICIENT_SCALE = 0.01f;
|
||||||
|
|
|
@ -122,6 +122,25 @@ struct BlendshapeOffsetUnpacked {
|
||||||
float positionOffsetX, positionOffsetY, positionOffsetZ;
|
float positionOffsetX, positionOffsetY, positionOffsetZ;
|
||||||
float normalOffsetX, normalOffsetY, normalOffsetZ;
|
float normalOffsetX, normalOffsetY, normalOffsetZ;
|
||||||
float tangentOffsetX, tangentOffsetY, tangentOffsetZ;
|
float tangentOffsetX, tangentOffsetY, tangentOffsetZ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set all components of all the offsets to zero
|
||||||
|
*
|
||||||
|
* @note glm::vec3 is not trivially copyable, so it's not correct to clear it with memset.
|
||||||
|
*/
|
||||||
|
void clear() {
|
||||||
|
positionOffsetX = 0.0f;
|
||||||
|
positionOffsetY = 0.0f;
|
||||||
|
positionOffsetZ = 0.0f;
|
||||||
|
|
||||||
|
normalOffsetX = 0.0f;
|
||||||
|
normalOffsetY = 0.0f;
|
||||||
|
normalOffsetZ = 0.0f;
|
||||||
|
|
||||||
|
tangentOffsetX = 0.0f;
|
||||||
|
tangentOffsetY = 0.0f;
|
||||||
|
tangentOffsetZ = 0.0f;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using BlendshapeOffset = BlendshapeOffsetPacked;
|
using BlendshapeOffset = BlendshapeOffsetPacked;
|
||||||
|
|
Loading…
Reference in a new issue