本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
Camera 助手类,设置camera在球面坐标系中的运动范围
///cocos2d-x-3.0alpha0/cocos2dx/actions //Camera 助手类,设置camera 在球面坐标系中的运动范围 #ifndef __CCCAMERA_ACTION_H__ #define __CCCAMERA_ACTION_H__ #include "CCActionInterval.h" NS_CC_BEGIN class Camera; /** * @addtogroup actions * @{ */ /** @brief 有关 Camera 动作的基础类 @ingroup Actions */ class CC_DLL ActionCamera : public ActionInterval //<NSCopying> { public: /** * @js ctor */ ActionCamera() :_centerXOrig(0) ,_centerYOrig(0) ,_centerZOrig(0) ,_eyeXOrig(0) ,_eyeYOrig(0) ,_eyeZOrig(0) ,_upXOrig(0) ,_upYOrig(0) ,_upZOrig(0) {} /** * @js NA * @lua NA */ virtual ~ActionCamera(){} // Overrides virtual void startWithTarget(Node *target) override; virtual ActionCamera * reverse() const override; virtual ActionCamera *clone() const override; protected: float _centerXOrig; float _centerYOrig; float _centerZOrig; float _eyeXOrig; float _eyeYOrig; float _eyeZOrig; float _upXOrig; float _upYOrig; float _upZOrig; }; /** @brief OrbitCamera(轨道摄像机) action camera 绕在球面坐标系中心的轨道 @ingroup Actions //圈内动作 */ class CC_DLL OrbitCamera : public ActionCamera //<NSCopying> { public: /** 使用 radius, delta-radius, z, deltaZ, x, deltaX 创建一个OrbitCamera action */ static OrbitCamera* create(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX); /** * @js ctor */ OrbitCamera() : _radius(0.0) , _deltaRadius(0.0) , _angleZ(0.0) , _deltaAngleZ(0.0) , _angleX(0.0) , _deltaAngleX(0.0) , _radZ(0.0) , _radDeltaZ(0.0) , _radX(0.0) , _radDeltaX(0.0) {} /** * @js NA * @lua NA */ ~OrbitCamera(){} /** 使用 radius, delta-radius, z, deltaZ, x, deltaX 初始化一个OrbitCamera action */ bool initWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX); /** camera 在球面坐标系中的位置 */ void sphericalRadius(float *r, float *zenith, float *azimuth); // Overrides OrbitCamera *clone() const override; virtual void startWithTarget(Node *target) override; virtual void update(float time) override; protected: float _radius; float _deltaRadius; float _angleZ; float _deltaAngleZ; float _angleX; float _deltaAngleX; float _radZ; float _radDeltaZ; float _radX; float _radDeltaX; }; // end of actions group /// @} NS_CC_END #endif //__CCCAMERA_ACTION_H__