for (CameraMap::iterator ii = cameras.begin(); ii != cameras.end(); ++ii ) {
float f = ii->second.scaleFactor;
if ( f == 0.0f ) continue;
- ii->second.camera->getViewport()->setViewport(x*f, y*f, width*f, height*f);
+
+ if (ii->second.camera->getRenderTargetImplementation() == osg::Camera::FRAME_BUFFER_OBJECT)
+ ii->second.camera->getViewport()->setViewport(0, 0, width*f, height*f);
+ else
+ ii->second.camera->getViewport()->setViewport(x*f, y*f, width*f, height*f);
}
for (RenderBufferMap::iterator ii = buffers.begin(); ii != buffers.end(); ++ii ) {
void CameraInfo::resized(double w, double h)
{
+ if (w == 1.0 && h == 1.0)
+ return;
+
bufferSize->set( osg::Vec2f( w, h ) );
for (RenderBufferMap::iterator ii = buffers.begin(); ii != buffers.end(); ++ii) {
void CameraInfo::setMatrices(osg::Camera* c)
{
view->set( c->getViewMatrix() );
- viewInverse->set( osg::Matrix::inverse( c->getViewMatrix() ) );
+ osg::Matrixd vi = c->getInverseViewMatrix();
+ viewInverse->set( vi );
projInverse->set( osg::Matrix::inverse( c->getProjectionMatrix() ) );
+ osg::Vec4d pos = osg::Vec4d(0., 0., 0., 1.) * vi;
+ worldPosCart->set( osg::Vec3f( pos.x(), pos.y(), pos.z() ) );
+ SGGeod pos2 = SGGeod::fromCart( SGVec3d( pos.x(), pos.y(), pos.z() ) );
+ worldPosGeod->set( osg::Vec3f( pos2.getLongitudeRad(), pos2.getLatitudeRad(), pos2.getElevationM() ) );
}
void CameraGroup::update(const osg::Vec3d& position,
camera->setInheritanceMask(CullSettings::ALL_VARIABLES
& ~(CullSettings::CULL_MASK
| CullSettings::CULLING_MODE
-#if defined(HAVE_CULLSETTINGS_CLEAR_MASK)
| CullSettings::CLEAR_MASK
-#endif
));
osg::Matrix vOff;
camera->setInheritanceMask(CullSettings::ALL_VARIABLES
& ~(CullSettings::COMPUTE_NEAR_FAR_MODE
| CullSettings::CULLING_MODE
-#if defined(HAVE_CULLSETTINGS_CLEAR_MASK)
| CullSettings::CLEAR_MASK
-#endif
));
camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
camera->setCullingMode(osg::CullSettings::NO_CULLING);