本文整理汇总了C++中ViewportPtr::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::getType方法的具体用法?C++ ViewportPtr::getType怎么用?C++ ViewportPtr::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
//.........这里部分代码省略.........
示例2: updateViewport
/*! update all changed viewport field from the client port
*/
void MultiDisplayWindow::updateViewport(ViewportPtr &serverPort,
ViewportPtr &clientPort)
{
bool equal, found;
// Compare the pointers.
if(serverPort == clientPort)
return;
if(serverPort == NullFC || clientPort == NullFC)
return;
if(serverPort->getType() != serverPort->getType())
return;
const FieldContainerType &type = serverPort->getType();
UInt32 fcount = osgMin(serverPort->getType().getNumFieldDescs(),
clientPort->getType().getNumFieldDescs());
BitVector ffilter = RemoteAspect::getFieldFilter(type.getId());
for(UInt32 i = 1; i <= fcount; ++i)
{
const FieldDescription* fdesc = type.getFieldDescription(i);
// ignore attachments
if(strcmp(fdesc->getCName(), "parent") == 0 ||
strcmp(fdesc->getCName(), "camera") == 0)
continue;
BitVector mask = fdesc->getFieldMask();
// don't update filtered fields
if(ffilter & mask)
continue;
Field *dst_field = serverPort->getField(i);
Field *src_field = clientPort->getField(i);
const FieldType &dst_ftype = dst_field->getType();
const FieldType &src_ftype = src_field->getType();
if(dst_ftype != src_ftype)
continue;
equal = true;
found = false;
if(strstr(dst_ftype.getCName(), "Ptr") == NULL)
{
// This is very slow with multi fields!!!!
std::string av, bv;
dst_field->getValueByStr(av);
src_field->getValueByStr(bv);
if(av != bv)
equal = false;
}
else
{
if(dst_field->getCardinality() == FieldType::SINGLE_FIELD)
{
if((static_cast<SFFieldContainerPtr *>(dst_field)->getValue() !=
static_cast<SFFieldContainerPtr *>(src_field)->getValue()))
equal = false;
}
else if(dst_field->getCardinality() == FieldType::MULTI_FIELD)
{
UInt32 j, cn = static_cast<MFFieldContainerPtr*>(src_field)->size(),
sn = static_cast<MFFieldContainerPtr*>(src_field)->size();
if (strcmp(fdesc->getCName(), "foregrounds") == 0)
{
MFForegroundPtr sFgndBag;
MFForegroundPtr::const_iterator sFgndIt, cFgndIt;
DisplayFilterForegroundPtr filterFgnd = NullFC;
sFgndIt = serverPort->getMFForegrounds()->begin();
cFgndIt = clientPort->getMFForegrounds()->begin();
while (sFgndIt != serverPort->getMFForegrounds()->end())
{
filterFgnd = DisplayFilterForegroundPtr::dcast(*sFgndIt);
if (filterFgnd != NullFC &&
!filterFgnd->getServer().empty())
found = true; // loaded filters found
else
sFgndBag.push_back(*sFgndIt);
++sFgndIt;
}
if (sFgndBag.size() !=
clientPort->getMFForegrounds()->size())
{
equal = false;
}
else
{
sFgndIt = sFgndBag.begin();
//.........这里部分代码省略.........