本文整理汇总了C++中ItemPtr::GetIvRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemPtr::GetIvRoot方法的具体用法?C++ ItemPtr::GetIvRoot怎么用?C++ ItemPtr::GetIvRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemPtr
的用法示例。
在下文中一共展示了ItemPtr::GetIvRoot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
IvDragger::IvDragger(QtCoinViewerPtr viewer, ItemPtr pItem, float draggerScale)
{
_selectedItem = pItem;
_viewer = viewer;
_scale = draggerScale;
_penv = viewer->GetEnv();
//_ptext = NULL;
// set some default behavioral options
_checkCollision = false;
_prevtransparency = pItem->GetIvTransparency()->value;
pItem->GetIvTransparency()->value = SoGLRenderAction::SCREEN_DOOR;
if( !!pItem &&(pItem->GetIvRoot() != NULL)) {
_GetBounds(pItem->GetIvRoot(), _ab);
// make the item transparent
SoSearchAction search;
search.setType(SoMaterial::getClassTypeId());
search.setInterest(SoSearchAction::ALL);
search.apply(pItem->GetIvRoot());
for(int i = 0; i < search.getPaths().getLength(); ++i) {
SoPath* path = search.getPaths()[i];
SoMaterial* pmtrl = (SoMaterial*)path->getTail();
vtransparency.push_back(pmtrl->transparency[0]);
pmtrl->transparency = 0.25f;
}
_vlinkaxes.resize(pItem->GetNumIvLinks());
for(size_t i = 0; i < _vlinkaxes.size(); ++i) {
_vlinkaxes[i] = _CreateAxes(i == 0 ? 1.0f : 0.25f,0.5f);
pItem->GetIvLink(i)->addChild(_vlinkaxes[i]);
}
}
}
示例2: GetSelectedItem
IvObjectDragger::~IvObjectDragger()
{
_SetColor(_normalColor);
_transformBox->removeMotionCallback(_MotionHandler, this);
if( _draggerRoot != NULL ) {
ItemPtr selectedItem = GetSelectedItem();
if( !!selectedItem ) {
selectedItem->GetIvRoot()->removeChild(_draggerRoot);
}
}
}
示例3: IvDragger
IvObjectDragger::IvObjectDragger(QtCoinViewerPtr viewer, ItemPtr pItem, float draggerScale, bool bAllowRotation)
: IvDragger(viewer, pItem, draggerScale)
{
// create a root node for the dragger nodes
_draggerRoot = new SoSeparator;
ItemPtr selectedItem = GetSelectedItem();
selectedItem->GetIvRoot()->insertChild(_draggerRoot, 0);
// create and size a transform box dragger and then add it to the scene graph
_transformBox = new SoTransformBoxDragger;
_transformBox->scaleFactor.setValue(_ab.extents.x * _scale, _ab.extents.y * _scale, _ab.extents.z * _scale);
_transformBox->translation.setValue(_ab.pos.x, _ab.pos.y, _ab.pos.z);
_toffset = selectedItem->GetTransform();
_draggerRoot->addChild(_transformBox);
// disable the scaling part of the transform box
_transformBox->setPart("scaler", NULL);
// disable the rotation around the X and Z axes
if (!bAllowRotation) {
const char *rotators[2] = { "rotator1", "rotator3" };
for (int i = 0; i < 2; i++)
_transformBox->setPart(rotators[i], NULL);
}
// get the material node that governs the color of the dragger and
// note the dragger's normal color
if (bAllowRotation) {
SoRotateCylindricalDragger *rp = (SoRotateCylindricalDragger *)_transformBox->getPart("rotator1", false);
SoSeparator *s = (SoSeparator *) rp->getPart("rotator", false);
_draggerMaterial = (SoMaterial *) s->getChild(0);
}
else
_draggerMaterial = new SoMaterial();
_normalColor = _draggerMaterial->diffuseColor[0];
// add a motion callback handler for the dragger
_transformBox->addMotionCallback(_MotionHandler, this);
UpdateDragger();
}