本文整理汇总了C++中CCCamera::getCenterXYZ方法的典型用法代码示例。如果您正苦于以下问题:C++ CCCamera::getCenterXYZ方法的具体用法?C++ CCCamera::getCenterXYZ怎么用?C++ CCCamera::getCenterXYZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCCamera
的用法示例。
在下文中一共展示了CCCamera::getCenterXYZ方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sphericalRadius
void CCOrbitCamera::sphericalRadius(float *newRadius, float *zenith, float *azimuth)
{
float ex, ey, ez, cx, cy, cz, x, y, z;
float r; // radius
float s;
CCCamera* pCamera = m_pTarget->getCamera();
pCamera->getEyeXYZ(&ex, &ey, &ez);
pCamera->getCenterXYZ(&cx, &cy, &cz);
x = ex-cx;
y = ey-cy;
z = ez-cz;
r = sqrtf( powf(x,2) + powf(y,2) + powf(z,2));
s = sqrtf( powf(x,2) + powf(y,2));
if( s == 0.0f )
s = FLT_EPSILON;
if(r==0.0f)
r = FLT_EPSILON;
*zenith = acosf( z/r);
if( x < 0 )
*azimuth= (float)M_PI - asinf(y/s);
else
*azimuth = asinf(y/s);
*newRadius = r / CCCamera::getZEye();
}
示例2: startWithTarget
//
// CameraAction
//
void CCActionCamera::startWithTarget(CCNode *pTarget)
{
CCActionInterval::startWithTarget(pTarget);
CCCamera *camera = pTarget->getCamera();
camera->getCenterXYZ(&m_fCenterXOrig, &m_fCenterYOrig, &m_fCenterZOrig);
camera->getEyeXYZ(&m_fEyeXOrig, &m_fEyeYOrig, &m_fEyeZOrig);
camera->getUpXYZ(&m_fUpXOrig, &m_fUpYOrig, &m_fUpZOrig);
}