本文整理汇总了C++中osg::ref_ptr::getChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ref_ptr::getChild方法的具体用法?C++ ref_ptr::getChild怎么用?C++ ref_ptr::getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::ref_ptr
的用法示例。
在下文中一共展示了ref_ptr::getChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out_of_range
osg::Object *RefosgLOD::getChildObject(unsigned i) {
if (i < 1) {
return _object->getStateSet();
} else {
i -= 1;
}
if (i < 1) {
return _object->getCullCallback();
} else {
i -= 1;
}
if (i < 1) {
return _object->getUpdateCallback();
} else {
i -= 1;
}
if (i < 1) {
return _object->getEventCallback();
} else {
i -= 1;
}
if (i < _object->getNumChildren()) {
return _object->getChild(i);
} else {
i -= _object->getNumChildren();
}
throw std::out_of_range("child");
}
示例2:
const ClassReflection::PropertyNames RefosgLOD::getTablePropertyRowTitles(const std::string &name) {
PropertyNames titles;
if (name == "_ranges") {
for (unsigned i=0; i < _object->getNumChildren(); i++) {
titles.push_back(_object->getChild(i)->getName());
}
}
return titles;
}
示例3: UpdateTriangleNode
void UpdateTriangleNode(osg::ref_ptr<osg::Group> const &gp,
osg::Vec4 const &color)
{
// Change the color of the triangle if
// its currently intersecting the view frustum
osg::Geode * gd = static_cast<osg::Geode*>(gp->getChild(0));
osg::Geometry * gm = static_cast<osg::Geometry*>(gd->getDrawable(0));
osg::ref_ptr<osg::Vec4Array> list_cx = new osg::Vec4Array;
list_cx->push_back(color);
gm->setColorArray(list_cx,osg::Array::BIND_OVERALL);
}
示例4: previousSlide
void SlideEventHandler::previousSlide()
{
if (_switch->getNumChildren()==0) return;
if (_fileList.size()>0) {
if (_activeSlide==0) _activeSlide = _fileList.size()/2-1;
else --_activeSlide;
osg::ref_ptr<osg::Group> images = loadImages(_fileList[2*_activeSlide],_fileList[2*_activeSlide+1],_texmatLeft.get(),_texmatRight.get(),_radius,_height,_length);
if (images.valid()) _switch->replaceChild(_switch->getChild(0),images.get());
} else {
if (_activeSlide==0) _activeSlide = _switch->getNumChildren()-1;
else --_activeSlide;
_switch->setSingleChildOn(_activeSlide);
}
}
示例5: addSimpleObject
// insert a sphere in the scene with desired position, radius and reflectance properties
void addSimpleObject(osg::ref_ptr<osg::Group> root, osg::Vec3 position, float radius, float reflectance) {
// create the drawable
osg::ref_ptr<osg::Drawable> drawable = new osg::ShapeDrawable(new osg::Sphere(position, radius));
// create the stateset and add the uniform
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
stateset->addUniform(new osg::Uniform("reflectance", reflectance));
// add the stateset to the drawable
drawable->setStateSet(stateset);
if(!root->getNumChildren()) {
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
root->addChild(geode);
}
root->getChild(0)->asGeode()->addDrawable(drawable);
}