modify animate 3d quality to bool

This commit is contained in:
lvlong 2015-03-30 15:57:58 +08:00
parent 6fe9f0d1c8
commit 5032194e98
4 changed files with 28 additions and 29 deletions

View File

@ -69,7 +69,7 @@ bool Animate3D::init(Animation3D* animation)
animation->retain();
setDuration(animation->getDuration());
setOriginInterval(animation->getDuration());
setAnimateQuality(Configuration::getInstance()->getAnimate3DQuality());
setHighAnimateQuality(Configuration::getInstance()->getHighAnimate3DQuality());
return true;
}
@ -85,7 +85,7 @@ bool Animate3D::init(Animation3D* animation, float fromTime, float duration)
setOriginInterval(duration);
_animation = animation;
animation->retain();
setAnimateQuality(Configuration::getInstance()->getAnimate3DQuality());
setHighAnimateQuality(Configuration::getInstance()->getHighAnimate3DQuality());
return true;
}
@ -384,26 +384,26 @@ void Animate3D::setOriginInterval(float interval)
_originInterval = interval;
}
void Animate3D::setAnimateQuality(int qualityLevel)
void Animate3D::setHighAnimateQuality(bool useHighAnimateQuality)
{
if (qualityLevel == 0)
{
_translateEvaluate = EvaluateType::INT_NEAR;
_roteEvaluate = EvaluateType::INT_NEAR;
_scaleEvaluate = EvaluateType::INT_NEAR;
}
else
if (useHighAnimateQuality)
{
_translateEvaluate = EvaluateType::INT_LINEAR;
_roteEvaluate = EvaluateType::INT_QUAT_SLERP;
_scaleEvaluate = EvaluateType::INT_LINEAR;
}
_animateQuality = qualityLevel;
else
{
_translateEvaluate = EvaluateType::INT_NEAR;
_roteEvaluate = EvaluateType::INT_NEAR;
_scaleEvaluate = EvaluateType::INT_NEAR;
}
_useHighAnimateQuality = useHighAnimateQuality;
}
int Animate3D::getAnimateQuality() const
bool Animate3D::getHighAnimateQuality() const
{
return _animateQuality;
return _useHighAnimateQuality;
}
Animate3D::Animate3D()
@ -417,12 +417,8 @@ Animate3D::Animate3D()
, _accTransTime(0.0f)
, _lastTime(0.0f)
, _originInterval(0.0f)
, _translateEvaluate(EvaluateType::INT_LINEAR)
, _roteEvaluate(EvaluateType::INT_QUAT_SLERP)
, _scaleEvaluate(EvaluateType::INT_LINEAR)
, _animateQuality(1)
{
setHighAnimateQuality(true);
}
Animate3D::~Animate3D()
{

View File

@ -99,8 +99,11 @@ public:
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
void setAnimateQuality(int qualityLevel);
int getAnimateQuality() const;
/**get & set high animate quality
* @param true: is high quality, false: is low quality
*/
void setHighAnimateQuality(bool useHighAnimateQuality);
bool getHighAnimateQuality() const;
CC_CONSTRUCTOR_ACCESS:
@ -139,7 +142,7 @@ protected:
EvaluateType _translateEvaluate;
EvaluateType _roteEvaluate;
EvaluateType _scaleEvaluate;
int _animateQuality; // 0: is low quality 1: is hight quality
bool _useHighAnimateQuality; // true: is high quality, false: is low quality
std::unordered_map<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref
std::unordered_map<Node*, Animation3D::Curve*> _nodeCurves;

View File

@ -50,7 +50,7 @@ Configuration::Configuration()
, _maxDirLightInShader(1)
, _maxPointLightInShader(1)
, _maxSpotLightInShader(1)
, _animate3DQuality(1)
, _highAnimate3DQuality(true)
{
}
@ -263,9 +263,9 @@ int Configuration::getMaxSupportSpotLightInShader() const
return _maxSpotLightInShader;
}
int Configuration::getAnimate3DQuality() const
bool Configuration::getHighAnimate3DQuality() const
{
return _animate3DQuality;
return _highAnimate3DQuality;
}
//
@ -359,9 +359,9 @@ void Configuration::loadConfigFile(const std::string& filename)
name = "cocos2d.x.3d.animate_3d_quality";
if (_valueDict.find(name) != _valueDict.end())
_animate3DQuality = _valueDict[name].asInt();
_highAnimate3DQuality = _valueDict[name].asInt();
else
_valueDict[name] = Value(_animate3DQuality);
_valueDict[name] = Value(_highAnimate3DQuality);
}
NS_CC_END

View File

@ -165,9 +165,9 @@ public:
int getMaxSupportSpotLightInShader() const;
/** get 3d animate quality
* @return 0: is low quality 1: is hight quality
* @return true: is high quality, false: is low quality
*/
int getAnimate3DQuality() const;
bool getHighAnimate3DQuality() const;
/** Returns whether or not an OpenGL is supported.
*
@ -235,7 +235,7 @@ protected:
int _maxDirLightInShader; //max support directional light in shader
int _maxPointLightInShader; // max support point light in shader
int _maxSpotLightInShader; // max support spot light in shader
int _animate3DQuality; // 3d animation quality; 0: is low quality 1: is hight quality
bool _highAnimate3DQuality; // animation 3d quality, true: is high quality, false: is low quality
ValueMap _valueDict;
};