本文整理汇总了C++中ViewportPtr::getLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::getLeft方法的具体用法?C++ ViewportPtr::getLeft怎么用?C++ ViewportPtr::getLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::getLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ViewportPtr
ViewportPtr
Canvas::getViewportAt(const unsigned int theX, const unsigned int theY) const {
int myViewportCount = getNode().childNodesLength(VIEWPORT_NODE_NAME);
for (int i = myViewportCount-1; i >= 0; --i) {
dom::NodePtr myViewportNode = getNode().childNode(VIEWPORT_NODE_NAME,i);
ViewportPtr myViewport = myViewportNode->getFacade<Viewport>();
int myTop = 0;
int myLeft = 0;
unsigned int myWidth = 0;
unsigned int myHeight = 0;
if (myViewport->getTop(myTop) && myViewport->getHeight(myHeight) &&
myViewport->getWidth(myWidth) && myViewport->getLeft(myLeft) &&
myTop <= static_cast<int>(theY) &&
myHeight + myTop >= theY &&
myLeft <= static_cast<int>(theX) &&
myLeft + myWidth >= theX)
{
return myViewport;
}
}
return ViewportPtr(0);
}
示例2: serverRender
//.........这里部分代码省略.........
#endif
{
clientStereoPort =
dynamic_cast<StereoBufferViewportPtr>(clientPort);
cleft = (Int32)(clientPort->getPixelLeft() * scaleCWidth) ;
cbottom = (Int32)(clientPort->getPixelBottom() * scaleCHeight) ;
cright = (Int32)((clientPort->getPixelRight()+1) * scaleCWidth) -1;
ctop = (Int32)((clientPort->getPixelTop()+1) * scaleCHeight)-1;
if(cright < left ||
cleft > right ||
ctop < bottom ||
cbottom > top )
{
// invisible on this server screen
continue;
}
// calculate overlapping viewport
l = osgMax(cleft ,left ) - left;
b = osgMax(cbottom,bottom) - bottom;
r = osgMin(cright ,right ) - left;
t = osgMin(ctop ,top ) - bottom;
if(serverWindow->getPort().size() <= sv)
{
serverPort =
dynamic_cast<ViewportPtr>(clientPort->shallowCopy());
deco = TileCameraDecorator::create();
serverWindow->addPort(serverPort);
serverPort->setCamera(deco);
}
else
{
serverPort = serverWindow->getPort()[sv];
deco = dynamic_cast<TileCameraDecoratorPtr>(
serverPort->getCamera());
if(serverWindow->getPort()[sv]->getType() !=
clientPort->getType())
{
// there is a viewport with the wrong type
serverPort =
dynamic_cast<ViewportPtr>(clientPort->shallowCopy());
serverWindow->replacePort(sv,
serverPort);//[sv] = serverPort;
serverPort->setCamera(deco);
}
else
{
deco = dynamic_cast<TileCameraDecoratorPtr>(
serverPort->getCamera());
}
}
// update changed viewport fields
updateViewport(serverPort,clientPort);
// set viewport size
serverPort->setSize(Real32(l),Real32(b),Real32(r),Real32(t));
// use pixel even if pixel = 1
if(serverPort->getLeft() == 1.0)
serverPort->setLeft(1.0001);
if(serverPort->getRight() == 1.0)
serverPort->setRight(1.0001);
if(serverPort->getTop() == 1.0)
serverPort->setTop(1.0001);
if(serverPort->getBottom() == 1.0)
serverPort->setBottom(1.0001);
// calculate tile parameters
deco->setFullWidth ( cright-cleft );
deco->setFullHeight( ctop-cbottom );
deco->setSize( ( l+left-cleft ) / (float)( cright-cleft ),
( b+bottom-cbottom ) / (float)( ctop-cbottom ),
( r+left-cleft ) / (float)( cright-cleft ),
( t+bottom-cbottom ) / (float)( ctop-cbottom ) );
deco->setDecoratee( clientPort->getCamera() );
}
sv++;
}
// remove unused ports
while(serverWindow->getPort().size()>sv)
{
serverWindow->subPort(sv);
}
Inherited::serverRender(serverWindow,id,action);
}