cocos2d-x  2.2
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCCamera Class Reference

A CCCamera is used in every CCNode. More...

#include <CCCamera.h>

Inheritance diagram for CCCamera:
CCObject CCCopying

Public Member Functions

 CCCamera (void)
 ~CCCamera (void)
void init (void)
const char * description (void)
void setDirty (bool bValue)
 sets the dirty value More...
 
bool isDirty (void)
 get the dirty value More...
 
void restore (void)
 sets the camera in the default position More...
 
void locate (void)
 Sets the camera using gluLookAt using its eye, center and up_vector. More...
 
void setEyeXYZ (float fEyeX, float fEyeY, float fEyeZ)
 sets the eye values in points More...
 
void setCenterXYZ (float fCenterX, float fCenterY, float fCenterZ)
 sets the center values in points More...
 
void setUpXYZ (float fUpX, float fUpY, float fUpZ)
 sets the up values More...
 
void getEyeXYZ (float *pEyeX, float *pEyeY, float *pEyeZ)
 get the eye vector values in points More...
 
void getCenterXYZ (float *pCenterX, float *pCenterY, float *pCenterZ)
 get the center vector values int points More...
 
void getUpXYZ (float *pUpX, float *pUpY, float *pUpZ)
 get the up vector values More...
 
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (void)
bool isSingleReference (void) const
unsigned int retainCount (void) const
virtual bool isEqual (const CCObject *pObject)
virtual void acceptVisitor (CCDataVisitor &visitor)
virtual void update (float dt)
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)

Static Public Member Functions

static float getZEye ()
 returns the Z eye More...
 

Protected Attributes

float m_fEyeX
float m_fEyeY
float m_fEyeZ
float m_fCenterX
float m_fCenterY
float m_fCenterZ
float m_fUpX
float m_fUpY
float m_fUpZ
bool m_bDirty
kmMat4 m_lookupMatrix
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Detailed Description

A CCCamera is used in every CCNode.

Useful to look at the object from different views. The OpenGL gluLookAt() function is used to locate the camera.

If the object is transformed by any of the scale, rotation or position attributes, then they will override the camera.

IMPORTANT: Either your use the camera or the rotation/scale/position properties. You can't use both. World coordinates won't work if you use the camera.

Limitations:

  • Some nodes, like CCParallaxNode, CCParticle uses world node coordinates, and they won't work properly if you move them (or any of their ancestors) using the camera.
  • It doesn't work on batched nodes like CCSprite objects when they are parented to a CCSpriteBatchNode object.
  • It is recommended to use it ONLY if you are going to create 3D effects. For 2D effects, use the action CCFollow or position/scale/rotate.

Constructor & Destructor Documentation

CCCamera ( void  )
~CCCamera ( void  )

Member Function Documentation

const char* description ( void  )
void getCenterXYZ ( float *  pCenterX,
float *  pCenterY,
float *  pCenterZ 
)

get the center vector values int points

void getEyeXYZ ( float *  pEyeX,
float *  pEyeY,
float *  pEyeZ 
)

get the eye vector values in points

void getUpXYZ ( float *  pUpX,
float *  pUpY,
float *  pUpZ 
)

get the up vector values

static float getZEye ( )
static

returns the Z eye

void init ( void  )
bool isDirty ( void  )
inline

get the dirty value

void locate ( void  )

Sets the camera using gluLookAt using its eye, center and up_vector.

void restore ( void  )

sets the camera in the default position

void setCenterXYZ ( float  fCenterX,
float  fCenterY,
float  fCenterZ 
)

sets the center values in points

void setDirty ( bool  bValue)
inline

sets the dirty value

void setEyeXYZ ( float  fEyeX,
float  fEyeY,
float  fEyeZ 
)

sets the eye values in points

void setUpXYZ ( float  fUpX,
float  fUpY,
float  fUpZ 
)

sets the up values

Member Data Documentation

bool m_bDirty
protected
float m_fCenterX
protected
float m_fCenterY
protected
float m_fCenterZ
protected
float m_fEyeX
protected
float m_fEyeY
protected
float m_fEyeZ
protected
float m_fUpX
protected
float m_fUpY
protected
float m_fUpZ
protected
kmMat4 m_lookupMatrix
protected

The documentation for this class was generated from the following file: