本文整理汇总了C++中ViewportPtr::shallowCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::shallowCopy方法的具体用法?C++ ViewportPtr::shallowCopy怎么用?C++ ViewportPtr::shallowCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::shallowCopy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serverRender
void MultiDisplayWindow::serverRender(WindowPtr serverWindow,
UInt32 id,
DrawActionBase *action )
{
TileCameraDecoratorPtr deco;
ViewportPtr serverPort;
ViewportPtr clientPort;
StereoBufferViewportPtr clientStereoPort;
UInt32 sv,cv;
Int32 l,r,t,b;
Int32 cleft,cright,ctop,cbottom;
// sync, otherwise viewports will be out of date
if(!getHServers())
{
setHServers(getServers().size());
}
if(!getVServers())
{
setVServers(1);
}
UInt32 row =id/getHServers();
UInt32 column=id%getHServers();
// calculate width and height from local width and height
UInt32 width = serverWindow->getWidth() ;
UInt32 height = serverWindow->getHeight();
if(getWidth()==0)
{
setWidth( width*getHServers() );
}
if(getHeight()==0)
{
setHeight( height*getVServers() );
}
Int32 left = column * width - column * getXOverlap();
Int32 bottom = row * height - row * getYOverlap();
Int32 right = left + width - 1;
Int32 top = bottom + height - 1;
Real64 scaleCWidth =
((width - getXOverlap()) * (getHServers() - 1) + width) /
(float)getWidth();
Real64 scaleCHeight =
((height - getYOverlap())* (getVServers() - 1) + height)/
(float)getHeight();
bool isVirtualPort = false;
// duplicate viewports
for(cv = 0, sv = 0; cv < getPort().size(); ++cv)
{
clientPort = getPort()[cv];
#if 0
isVirtualPort = clientPort->getType().isDerivedFrom(FBOViewport::getClassType());
if(isVirtualPort)
{
// TODO -- seems wrong to render this on all servers, though rendering
// then transmitting the texture doesn't seem like a good idea either.
if(serverWindow->getPort().size() <= sv)
{
serverPort = ViewportPtr::dcast(clientPort->shallowCopy());
beginEditCP(serverWindow);
serverWindow->addPort(serverPort);
endEditCP(serverWindow);
}
else
{
serverPort = serverWindow->getPort()[sv];
if(serverWindow->getPort()[sv]->getType() !=
clientPort->getType())
{
// there is a viewport with the wrong type
subRefCP(serverWindow->getPort()[sv]);
serverPort = ViewportPtr::dcast(clientPort->shallowCopy());
beginEditCP(serverWindow);
{
serverWindow->getPort()[sv] = serverPort;
}
endEditCP(serverWindow);
}
}
// update changed viewport fields
updateViewport(serverPort,clientPort);
}
else
#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;
//.........这里部分代码省略.........