本文整理汇总了C++中NodePtr::editVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::editVolume方法的具体用法?C++ NodePtr::editVolume怎么用?C++ NodePtr::editVolume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::editVolume方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSize
float PruneGraphOp::getSize(const NodePtr& node)
{
#ifndef OSG_2_PREP
const DynamicVolume &vol = node->editVolume(true);
#else
const BoxVolume &vol = node->editVolume(true);
#endif
if (_method == VOLUME)
{
return vol.getScalarVolume();
}
else if (_method == SUM_OF_DIMENSIONS)
{
Pnt3f min, max;
vol.getBounds(min, max);
Vec3f diff = max - min;
return diff[0] + diff[1] + diff[2];
}
else
{
SWARNING << "Unknown size calculation method" << std::endl;
return 0;
}
}
示例2: keyboard
void keyboard(unsigned char k, int x, int y)
{
switch(k)
{
case 27:
{
OpenSGDeformActionManager::Destroy();
osgExit();
exit(0);
}
case '1':
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
break;
}
case '2':
{
glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
break;
}
case '3':
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
}
case '5':
{
chairIndex = (chairIndex + 1) % 6;
model = chairNodes[chairIndex];
cout << "Selected model is: ";
if (getName(model))
cout << getName(model);
cout << " " << model << endl;
break;
}
case '6':
{
ax *= -1;
break;
}
case '7':
{
if (ax < 0)
ax = -1;
else
ax = 1;
break;
}
case '8':
{
if (ax < 0)
ax = -2;
else
ax = 2;
break;
}
case '9':
{
if (ax < 0)
ax = -3;
else
ax = 3;
break;
}
case 'p':
{
#if OSG_MAJOR_VERSION >= 2
traverse(scene, boost::bind(printSceneGraph,_1));
#else
traverse(scene, osgTypedFunctionFunctor1CPtrRef
<Action::ResultE, NodePtr>(printSceneGraph));
#endif
break;
}
case 'h':
{
printUsage();
break;
}
case 'i':
{
gmtl::AABoxf aabb;
osgdam = OpenSGDeformActionManager::GetInstance();
if (osgdam != 0)
{
osgdam->insertLattice(model, 2, 2, 2, 3);
}
break;
}
case 'j':
{
osgdam = OpenSGDeformActionManager::GetInstance();
if(osgdam != 0)
{
gmtl::AABoxf aabb;
Pnt3f aabbMin, aabbMax;
#if OSG_MAJOR_VERSION >= 2
model->editVolume(true).getBounds(aabbMin, aabbMax);
#else
model->getVolume(true).getBounds(aabbMin, aabbMax);
//.........这里部分代码省略.........
示例3: main
//.........这里部分代码省略.........
Vec3f tsize[] =
{ Vec3f(.1,0,0), Vec3f(.1,0,0), Vec3f(.1,0,0), Vec3f(.1,0,0),
Vec3f(.1,0,0) };
for(UInt32 i=0; tpos[i][0] > -1000; ++i)
{
indices->push_back(i);
p->push_back(tpos[i]);
sp->push_back(tsecpos[i]);
velocities[i].setValue(tvel[i]);
cols->editFieldPtr()->push_back(tcol[i]);
size->push_back(tsize[i]);
}
}
endEditCP(pnts);
endEditCP(secpnts);
endEditCP(cols);
beginEditCP(norms);
norms->push_back(Vec3f(0,1,0));
endEditCP(norms);
particles->setPositions( pnts );
particles->setSecPositions( secpnts );
particles->setColors( cols );
particles->setNormals( norms );
endEditCP(particles);
// set volume static to prevent constant update
beginEditCP(pnode, Node::VolumeFieldMask);
#ifndef OSG_2_PREP
Volume &v = pnode->editVolume(false).getInstance();
#else
Volume &v = pnode->editVolume(false);
#endif
v.setEmpty();
v.extendBy(Pnt3f(0,0,0));
v.extendBy(Pnt3f(1,1,1));
v.setStatic();
#ifndef OSG_2_PREP
pnode->editVolume(false).instanceChanged();
#endif
endEditCP (pnode, Node::VolumeFieldMask);
SimpleTexturedMaterialPtr tm;
tm = SimpleTexturedMaterial::create();
UChar8 imgdata[] =
{ 255,255,255, 255,0,0, 255,0,255,
255,0,0, 255,0,0, 255,255,255 };
ImagePtr pImage = Image::create();
if (argc > 2)
{
pImage->read(argv[2]);
}
else
{
pImage->set(Image::OSG_RGB_PF, 3, 2, 1, 1, 1, 0, imgdata);
}
beginEditCP(tm);
tm->setDiffuse( Color3f( 1,1,1 ) );