From 5032194e987fb79a6295e82de52b34cb5a39b5bd Mon Sep 17 00:00:00 2001 From: lvlong Date: Mon, 30 Mar 2015 15:57:58 +0800 Subject: [PATCH] modify animate 3d quality to bool --- cocos/3d/CCAnimate3D.cpp | 32 ++++++++++++++------------------ cocos/3d/CCAnimate3D.h | 9 ++++++--- cocos/base/CCConfiguration.cpp | 10 +++++----- cocos/base/CCConfiguration.h | 6 +++--- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index 2fbb882635..6e360a72b2 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -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() { diff --git a/cocos/3d/CCAnimate3D.h b/cocos/3d/CCAnimate3D.h index 152dc83374..51c64d75b7 100644 --- a/cocos/3d/CCAnimate3D.h +++ b/cocos/3d/CCAnimate3D.h @@ -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 _boneCurves; //weak ref std::unordered_map _nodeCurves; diff --git a/cocos/base/CCConfiguration.cpp b/cocos/base/CCConfiguration.cpp index c89726af3e..47a9c9ff0e 100644 --- a/cocos/base/CCConfiguration.cpp +++ b/cocos/base/CCConfiguration.cpp @@ -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 diff --git a/cocos/base/CCConfiguration.h b/cocos/base/CCConfiguration.h index 63d10c4df7..329e1544aa 100644 --- a/cocos/base/CCConfiguration.h +++ b/cocos/base/CCConfiguration.h @@ -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; };