Пример #1
0
void wxOgreRenderWindow::setCamera( Ogre::Camera* camera )
{
  viewport_->setCamera( camera );

  setCameraAspectRatio();

  Refresh();
}
void QtOgreRenderWindow::setCamera( Ogre::Camera* camera )
{
  camera_ = camera;
  viewport_->setCamera( camera );

  setCameraAspectRatio();

  update();
}
//------------------------------------------------------------------------------
void QtOgreRenderWindow::resizeEvent( QResizeEvent* event )
{
  RenderWidget::resizeEvent( event );

  if( render_window_ )
  {
    setCameraAspectRatio();

    if( auto_render_ )
    {
      update();
    }
  }
}
QtOgreRenderWindow::QtOgreRenderWindow( QWidget* parent )
  : RenderWidget( RenderSystem::get(), parent )
  , viewport_( 0 )
  , ogre_root_( RenderSystem::get()->root() )
  , ortho_scale_( 1.0f )
  , auto_render_( true )
  , camera_( 0 )
  , overlays_enabled_( true ) // matches the default of Ogre::Viewport.
  , background_color_( Ogre::ColourValue::Black ) // matches the default of Ogre::Viewport.
{
  render_window_->setVisible(true);
  render_window_->setAutoUpdated(true);

  viewport_ = render_window_->addViewport( camera_ );
  viewport_->setOverlaysEnabled( overlays_enabled_ );
  viewport_->setBackgroundColour( background_color_ );

  setCameraAspectRatio();
}
Пример #5
0
//------------------------------------------------------------------------------
void wxOgreRenderWindow::onSize (wxSizeEvent &evt)
{
  if (render_window_)
  {
    // Setting new size;
    int width;
    int height;
    wxSize size = evt.GetSize ();
    width = size.GetWidth ();
    height = size.GetHeight ();

    render_window_->resize (width, height);
    // Letting Ogre know the window has been resized;
    render_window_->windowMovedOrResized ();

    setCameraAspectRatio();

    Refresh();
  }

  evt.Skip();
}
void QtOgreRenderWindow::setOrthoScale( float scale )
{
  ortho_scale_ = scale;

  setCameraAspectRatio();
}
Пример #7
0
void FixAspectRatio(){
	unsigned int cameraNode = findNode("avatar_camera");

	if(cameraNode)
		setCameraAspectRatio(cameraNode, (float)getScreenWidth() / (float)getScreenHeight());
}