mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 03:33:25 +02:00
copy into new vector
This commit is contained in:
parent
06c5fa0585
commit
ffdbc12968
2 changed files with 19 additions and 5 deletions
|
@ -39,8 +39,9 @@ HeadData::HeadData(AvatarData* owningAvatar) :
|
|||
_rightEyeBlink(0.0f),
|
||||
_averageLoudness(0.0f),
|
||||
_browAudioLift(0.0f),
|
||||
_owningAvatar(owningAvatar),
|
||||
_baseBlendshapeCoefficients(QVector<float>(0, 0))
|
||||
_baseBlendshapeCoefficients(QVector<float>(0, 0.0f)),
|
||||
_currBlendShapeCoefficients(QVector<float>(0, 0.0f)),
|
||||
_owningAvatar(owningAvatar)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -89,10 +90,22 @@ static const QMap<QString, int>& getBlendshapesLookupMap() {
|
|||
}
|
||||
|
||||
const QVector<float>& HeadData::getSummedBlendshapeCoefficients() {
|
||||
for (int i = 0; i < _baseBlendshapeCoefficients.size(); i++) {
|
||||
_blendshapeCoefficients[i] += _baseBlendshapeCoefficients[i];
|
||||
int maxSize = std::max(_baseBlendshapeCoefficients.size(), _blendshapeCoefficients.size());
|
||||
if (_currBlendShapeCoefficients.size() != maxSize) {
|
||||
_currBlendShapeCoefficients.resize(maxSize);
|
||||
}
|
||||
return _blendshapeCoefficients;
|
||||
|
||||
for (int i = 0; i < maxSize; i++) {
|
||||
if (i >= _baseBlendshapeCoefficients.size()) {
|
||||
_currBlendShapeCoefficients[i] = _blendshapeCoefficients[i];
|
||||
} else if (i >= _blendshapeCoefficients.size()) {
|
||||
_currBlendShapeCoefficients[i] = _baseBlendshapeCoefficients[i];
|
||||
} else {
|
||||
_currBlendShapeCoefficients[i] = _baseBlendshapeCoefficients[i] + _blendshapeCoefficients[i];
|
||||
}
|
||||
}
|
||||
|
||||
return _currBlendShapeCoefficients;
|
||||
}
|
||||
|
||||
void HeadData::setBlendshape(QString name, float val) {
|
||||
|
|
|
@ -94,6 +94,7 @@ protected:
|
|||
|
||||
QVector<float> _blendshapeCoefficients;
|
||||
QVector<float> _baseBlendshapeCoefficients;
|
||||
QVector<float> _currBlendShapeCoefficients;
|
||||
AvatarData* _owningAvatar;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue