Various work on osgViewer library, including warp point and graphics window resize support
This commit is contained in:
@@ -51,10 +51,10 @@ void Viewport::read(DataInputStream* in){
|
||||
throw Exception("Viewport::read(): Could not cast this osg::Viewport to an osg::Object.");
|
||||
|
||||
// Read Viewport's properties
|
||||
x() = (GLenum)in->readInt();
|
||||
y() = (GLenum)in->readInt();
|
||||
width() = (GLenum)in->readInt();
|
||||
height() = (GLenum)in->readInt();
|
||||
x() = in->readInt();
|
||||
y() = in->readInt();
|
||||
width() = in->readInt();
|
||||
height() = in->readInt();
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -44,12 +44,10 @@ class Logos: public osg::Drawable
|
||||
osg::Viewport *vp = cv->getViewport();
|
||||
if( vp != NULL )
|
||||
{
|
||||
int x, y, aw, ah, bw, bh;
|
||||
logos->getViewport()->getViewport( x, y, aw, ah );
|
||||
vp->getViewport(x, y, bw, bh );
|
||||
if( aw != bw || ah != bh )
|
||||
if( vp->width() != logos->getViewport()->width() ||
|
||||
vp->height() != logos->getViewport()->height() )
|
||||
{
|
||||
logos->getViewport()->setViewport( x, y, bw, bh );
|
||||
logos->getViewport()->setViewport( vp->x(), vp->y(), vp->width(), vp->height() );
|
||||
logos->dirtyDisplayList();
|
||||
}
|
||||
}
|
||||
@@ -91,13 +89,18 @@ class Logos: public osg::Drawable
|
||||
if( state.getContextID() != _contextID )
|
||||
return;
|
||||
|
||||
int x = 0, y = 0, w = 1, h = 1;
|
||||
if( viewport != NULL )
|
||||
viewport->getViewport( x, y, w, h );
|
||||
float vx = x;
|
||||
float vy = y;
|
||||
float vw = w;
|
||||
float vh = h;
|
||||
|
||||
float vx = 0.0;
|
||||
float vy = 0.0;
|
||||
float vw = 1.0;
|
||||
float vh = 1.0;
|
||||
if (viewport)
|
||||
{
|
||||
vx = viewport->x();
|
||||
vy = viewport->y();
|
||||
vx = viewport->width();
|
||||
vy = viewport->height();
|
||||
}
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glPushMatrix();
|
||||
|
||||
@@ -25,28 +25,27 @@ RegisterDotOsgWrapperProxy g_ViewportProxy
|
||||
bool Viewport_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
int x = 0, y = 0, width = 0, height = 0;
|
||||
double x = 0, y = 0, width = 0, height = 0;
|
||||
|
||||
|
||||
if (fr[0].matchWord("x") && fr[1].getInt(x))
|
||||
if (fr[0].matchWord("x") && fr[1].getFloat(x))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("y") && fr[1].getInt(y))
|
||||
if (fr[0].matchWord("y") && fr[1].getFloat(y))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("width") && fr[1].getInt(width))
|
||||
if (fr[0].matchWord("width") && fr[1].getFloat(width))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("height") && fr[1].getInt(height))
|
||||
if (fr[0].matchWord("height") && fr[1].getFloat(height))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
|
||||
Reference in New Issue
Block a user