コード例 #1
0
osg::Camera* createInvertedYOrthoCamera(float width, float height) {
	osg::Camera* camera = createOrthoCamera(width, height);

	camera->setProjectionMatrix(createInvertedYOrthoProjectionMatrix(width, height));

	return camera;
}
コード例 #2
0
ファイル: ViewerEventHandlers.cpp プロジェクト: joevandyk/osg
bool ResizeHandler::handle(
    const osgGA::GUIEventAdapter& gea,
    osgGA::GUIActionAdapter&      gaa,
    osg::Object*                  obj,
    osg::NodeVisitor*             nv
) {
    osgGA::GUIEventAdapter::EventType ev = gea.getEventType();

    if(ev != osgGA::GUIEventAdapter::RESIZE) return false;

    osg::Matrix::value_type w = gea.getWindowWidth();
    osg::Matrix::value_type h = gea.getWindowHeight();

    if(_wm->isInvertedY()) _camera->setProjectionMatrix(
        createInvertedYOrthoProjectionMatrix(w, h)
    );

    else _camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0f, w, 0.0f, h));
    
    _wm->setSize(w, h);
    _wm->resizeAllWindows();

    return true;
}