cocos2d-X 节点(CCCamera.h.)API
2013-11-07 18:33
453 查看
本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-X 节点(CCCamera.h.)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记///cocos2d-x-3.0alpha0/cocos2dx #ifndef __COCOS2DX_CAMERA_H__ #define __COCOS2DX_CAMERA_H__ #include <string> #include "cocoa/CCObject.h" #include "ccMacros.h" #include "kazmath/mat4.h" NS_CC_BEGIN /** * @addtogroup base_nodes * @{ */ /** 每个节点都使用了 Camera . 从不同的 camera(角度) 观察一个对象是非常有用的 camera 使用了 OpenGL gluLookAt() 函数 如果对象任意转换 scale(缩放), rotation(旋转、 position 位置属性, 那么它们需要覆盖 camera IMPORTANT: 你不能同时 camera 或者 rotation/scale/position 属性. 如果你同时使用了 camera 和rotation/scale/position那么 World coordinates就不会其作用 Limitations: - 一些节点,你移动它们的 camera(视角) 将不会其作用; 例如 ParallaxNode, Particle (或者它们的祖先) using the camera. - 他对 SpriteBatchNode(批处理节点) 里面的 对象(Sprite) 不起作用 - 建议只在你创建 3D 效果的时候使用它。对于 2D 效果使用的 action 要遵循 position/scale/rotate. */ class CC_DLL Camera : public Object { public: /** returns 眼的 Z 轴坐标 */ static float getZEye(); /** * @js ctor */ Camera(void); /** * @js NA * @lua NA */ ~Camera(void); void init(void); /** * @js NA * @lua NA */ const char* description(void) const; /** sets dirty(是否正在修改视角) 的值 */ inline void setDirty(bool bValue) { _dirty = bValue; } /** get dirty(是否正在修改视角) 的值 */ inline bool isDirty(void) const { return _dirty; } /** sets camera 的默认位置 */ void restore(void); /** Sets camera 调用 gluLookAt 时 eye 所在的 center 、 up_vector */ void locate(void); /** sets eye 的位置坐标 */ void setEye(float fEyeX, float fEyeY, float fEyeZ); /** @过时不再需要建议使用新的 API,使用 setEye() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void setEyeXYZ(float fEyeX, float fEyeY, float fEyeZ){ setEye(fEyeX, fEyeY, fEyeZ);} /** sets 中心点所在的位置 */ void setCenter(float fCenterX, float fCenterY, float fCenterZ); /** @过时不再需要建议使用新的 API 使用 setCenter() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void setCenterXYZ(float fCenterX, float fCenterY, float fCenterZ){ setCenter(fCenterX,fCenterY,fCenterZ);} /** sets 向上的 vector(向量) 值 */ void setUp(float fUpX, float fUpY, float fUpZ); /** @过时不再需要建议使用新的 API 使用 setUp() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void setUpXYZ(float fUpX, float fUpY, float fUpZ){ setUp(fUpX,fUpY,fUpZ); } /** get eye 所在点的 vector(向量)值 * @code * 当这个参数在 js or lua 里面使用时,输入参数会改变 * in js: var getEye() * in lua:local getEye() * @endcode */ void getEye(float *pEyeX, float *pEyeY, float *pEyeZ) const; /** @过时不再需要建议使用新的 API 可以使用 getEye() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void getEyeXYZ(float *pEyeX, float *pEyeY, float *pEyeZ) const { getEye(pEyeX, pEyeY, pEyeZ); } /** get 中心点所在的位置 * 当这个参数在 js or lua 里面使用时,输入参数会改变 * in js: var getCenter() * in lua:local getCenter() */ void getCenter(float *pCenterX, float *pCenterY, float *pCenterZ) const; /** @过时不再需要建议使用新的 API 可以使用 getCenter() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void getCenterXYZ(float *pCenterX, float *pCenterY, float *pCenterZ) const{ getCenter(pCenterX,pCenterY,pCenterZ); } /** get 向上的 vector(向量) 值 * 当这个参数在 js or lua 里面使用时,输入参数会改变 * in js: var getUp() * in lua:local getUp() */ void getUp(float *pUpX, float *pUpY, float *pUpZ) const; /** @过时不再需要建议使用新的 API 建议使用 getUp() 代替 * @js NA * @lua NA */ CC_DEPRECATED_ATTRIBUTE void getUpXYZ(float *pUpX, float *pUpY, float *pUpZ) const{ getUp(pUpX, pUpY, pUpZ); } protected: float _eyeX; float _eyeY; float _eyeZ; float _centerX; float _centerY; float _centerZ; float _upX; float _upY; float _upZ; bool _dirty; kmMat4 _lookupMatrix; private: DISALLOW_COPY_AND_ASSIGN(Camera); }; // end of base_node group /// @} NS_CC_END #endif // __COCOS2DX_CAMERA_H__
相关文章推荐
- cocos2d-x节点(CCActionCamera.h)API
- cocos2d-X 节点(CCMotionStreak.h)API
- cocos2d-x节点(CCTextureAtlas.h)API
- cocos2d-x节点(CCClippingNode.h)API
- cocos2d-x节点(CCEventListener.h)API
- cocos2d-x节点(CCData.h)API
- cocos2d-X 节点(CCActionFrameEasing.h)API
- cocos2d-x节点(CCEventCustom.h)API
- cocos2d-x节点(CCActionProgressTimer.h)API
- cocos2d-X 节点(CCActionFrame.h)API
- cocos2d-x节点(CCParticleExamples.h)API
- cocos2d-x节点(CCEventListenerTouch.h)API
- cocos2d-x节点(CCAutoreleasePool.h)API
- cocos2d-x节点(CCActionTiledGrid.h)API
- cocos2d-X 节点(CCActionManagerEx.h)API
- cocos2d-x节点(CCNotificationCenter.h)API
- cocos2d-x节点(CCParticleBatchNode.h)API
- cocos2d-x节点(CCEventTouch.h)API
- cocos2d-x节点(CCActionTween.h)API
- cocos2d-X 节点(CCAction.h)API