Exemplo n.º 1
0
bool Camera::initOrthographic(float zoomX, float zoomY, float nearPlane, float farPlane)
{
    _zoom[0] = zoomX;
    _zoom[1] = zoomY;
    _nearPlane = nearPlane;
    _farPlane = farPlane;
    Mat4::createOrthographicOffCenter(0, _zoom[0], 0, _zoom[1], _nearPlane, _farPlane, &_projection);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
    //if needed, we need to add a rotation for Landscape orientations on Windows Phone 8 since it is always in Portrait Mode
    GLView* view = Director::getInstance()->getOpenGLView();
    if(view != nullptr)
    {
        setAdditionalProjection(view->getOrientationMatrix());
    }
#endif
    _viewProjectionDirty = true;
    
    return true;
}
Exemplo n.º 2
0
bool Camera::initPerspective(float fieldOfView, float aspectRatio, float nearPlane, float farPlane)
{
    _fieldOfView = fieldOfView;
    _aspectRatio = aspectRatio;
    _nearPlane = nearPlane;
    _farPlane = farPlane;
    Mat4::createPerspective(_fieldOfView, _aspectRatio, _nearPlane, _farPlane, &_projection);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
    //if needed, we need to add a rotation for Landscape orientations on Windows Phone 8 since it is always in Portrait Mode
    GLView* view = Director::getInstance()->getOpenGLView();
    if(view != nullptr)
    {
        setAdditionalProjection(view->getOrientationMatrix());
    }
#endif
    _viewProjectionDirty = true;
    
    return true;
}