Code simplification

Simplify the code a bit as suggested:

1) Use unsigned int instead of signed int, so we can avoid checking the
negative case
2) Merge two lines into a single line so we can inline the
implementation

Correct the js sample file header.

testing done:
- Build locally
- Pass -1 as index from js and the code still can correctly handle the
input.
This commit is contained in:
BOB LONG 2015-09-21 19:11:13 -07:00
parent efc321bc10
commit a23a90bf5f
2 changed files with 5 additions and 5 deletions

View file

@ -1,10 +1,10 @@
//
// coefficients.js
// faceBlendCoefficients.js
//
// version 2.0
//
// Created by Bob Long, 9/14/2015
// A simple panel that can display the blending coefficients of Avatar's face model.
// A simple panel that can select and display the blending coefficient of the Avatar's face model.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html

View file

@ -192,9 +192,9 @@ public:
void setCauterizeBoneSet(const std::unordered_set<int>& boneSet) { _cauterizeBoneSet = boneSet; }
int getBlendshapeCoefficientsNum() const { return _blendshapeCoefficients.size(); }
float getBlendshapeCoefficient(int index) const {
return index >= _blendshapeCoefficients.size() || index < 0 ?
0.0f : _blendshapeCoefficients.at(index); }
float getBlendshapeCoefficient(unsigned int index) const {
return index >= _blendshapeCoefficients.size() ? 0.0f : _blendshapeCoefficients.at(index);
}
protected: