本文整理汇总了C++中osg::BoundingBox::expandBy方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::expandBy方法的具体用法?C++ BoundingBox::expandBy怎么用?C++ BoundingBox::expandBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::expandBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getExtents
void TXPArchive::getExtents(osg::BoundingBox& extents)
{
TileInfo sw, ne;
trpg2iPoint tileExtents;
this->GetHeader()->GetLodSize(0, tileExtents);
this->getTileInfo(0, 0, 0, sw);
this->getTileInfo(tileExtents.x-1, tileExtents.y-1, 0, ne);
extents.set(sw.bbox._min, sw.bbox._max);
extents.expandBy(ne.bbox);
}
示例2: apply
void apply(osg::Node &node)
{
osg::Transform *mt;
osg::Geode *geo;
osg::ref_ptr<osg::RefMatrix> M = matStack.back();
if ((geo = dynamic_cast<osg::Geode *>(&node)))
{
unsigned int i;
osg::BoundingBox bb;
for (i = 0; i < geo->getNumDrawables(); i++)
{
bb.expandBy(geo->getDrawable(i)->getBound());
}
if (M.get())
{
bbox.expandBy(osg::Vec3(bb.xMin(), bb.yMin(), bb.zMin()) * *M);
bbox.expandBy(osg::Vec3(bb.xMax(), bb.yMax(), bb.zMax()) * *M);
}
else
{
bbox.expandBy(osg::Vec3(bb.xMin(), bb.yMin(), bb.zMin()));
bbox.expandBy(osg::Vec3(bb.xMax(), bb.yMax(), bb.zMax()));
}
}
if ((mt = dynamic_cast<osg::Transform *>(&node)))
{
osg::ref_ptr<osg::RefMatrix> matrix = new osg::RefMatrix;
mt->computeLocalToWorldMatrix(*matrix, this);
matStack.push_back(matrix);
}
traverse(node);
if ((mt = dynamic_cast<osg::Transform *>(&node)))
{
matStack.pop_back();
}
}
示例3: sizeUpY
osg::ref_ptr<osg::Geometry> HUDView::createRandNumBackground(osg::BoundingBox bb)
{
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
osg::Vec3 sizeUpY(0, bb.yMax() + bb.yMax() / 2, 0.0);
osg::Vec3 sizeUpYN(0, -bb.yMax() / 2, 0.0);
bb.expandBy(sizeUpY);
bb.expandBy(sizeUpYN);
osg::Vec3 halfExtent((bb.xMax() - bb.xMin()) / 2.0, (bb.yMax() - bb.yMin()) / 2.0f, 0);
float x_length = bb.xMax() - bb.xMin();
float y_length = bb.yMax() - bb.yMin();
vertices->push_back(osg::Vec3(0, y_length, 0) - halfExtent);
vertices->push_back(osg::Vec3(0, 0, 0) - halfExtent);
vertices->push_back(osg::Vec3(x_length, 0, 0) - halfExtent);
vertices->push_back(osg::Vec3(x_length, y_length, 0) - halfExtent);
geom->setVertexArray(vertices);
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.0f, 0.2f, 1.0f, 0.7f));
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4));
osg::ref_ptr<osg::StateSet> stateset = geom->getOrCreateStateSet();
stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
//stateset->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
return geom;
}