当前位置: 首页>>代码示例>>C++>>正文


C++ NodePtr::editVolume方法代码示例

本文整理汇总了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;
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:24,代码来源:OSGPruneGraphOp.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:flair2005,项目名称:inVRs,代码行数:101,代码来源:main.cpp

示例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 ) );
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:67,代码来源:testParticlesRenderMotion.cpp


注:本文中的NodePtr::editVolume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。