mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-01 08:20:00 +02:00
Pull packBlendshapeOffsets() into separate function
This commit is contained in:
parent
87c680382f
commit
cceff21cd0
1 changed files with 10 additions and 9 deletions
|
@ -1691,10 +1691,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked) {
|
||||||
using packBlendshapeOffsetTo = void(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked);
|
|
||||||
|
|
||||||
void packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10(glm::uvec4& packed, const BlendshapeOffsetUnpacked& unpacked) {
|
|
||||||
float len = glm::compMax(glm::abs(unpacked.positionOffset));
|
float len = glm::compMax(glm::abs(unpacked.positionOffset));
|
||||||
glm::vec3 normalizedPos(unpacked.positionOffset);
|
glm::vec3 normalizedPos(unpacked.positionOffset);
|
||||||
if (len > 0.0f) {
|
if (len > 0.0f) {
|
||||||
|
@ -1711,6 +1708,14 @@ void packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10(glm::uvec4& pac
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void packBlendshapeOffsets(BlendshapeOffsetUnpacked* unpacked, BlendshapeOffsetPacked* packed, int size) {
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10((*packed).packedPosNorTan, (*unpacked));
|
||||||
|
++unpacked;
|
||||||
|
++packed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Blender : public QRunnable {
|
class Blender : public QRunnable {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1795,11 +1800,7 @@ void Blender::run() {
|
||||||
// convert unpackedBlendshapeOffsets into packedBlendshapeOffsets for the gpu.
|
// convert unpackedBlendshapeOffsets into packedBlendshapeOffsets for the gpu.
|
||||||
auto unpacked = unpackedBlendshapeOffsets.data();
|
auto unpacked = unpackedBlendshapeOffsets.data();
|
||||||
auto packed = packedBlendshapeOffsets.data() + offset;
|
auto packed = packedBlendshapeOffsets.data() + offset;
|
||||||
for (int i = 0; i < numVertsInMesh; ++i) {
|
packBlendshapeOffsets(unpacked, packed, numVertsInMesh);
|
||||||
packBlendshapeOffsetTo_Pos_F32_3xSN10_Nor_3xSN10_Tan_3xSN10((*packed).packedPosNorTan, (*unpacked));
|
|
||||||
++unpacked;
|
|
||||||
++packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset += numVertsInMesh;
|
offset += numVertsInMesh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue