zoukankan      html  css  js  c++  java
  • osg 自定义图元

    osg::ref_ptr<osg::Geode> OSG_Qt_::createBox()
    {
        osg::ref_ptr<osg::Geode> osg_geode = new osg::Geode;
        osg::ref_ptr<osg::TessellationHints> osg_hints = new osg::TessellationHints;
        osg::ref_ptr<osg::Box> osg_box = new osg::Box(osg::Vec3(0.0, 0.0, 0.0), 1.0, 0.5, 3.0);
        osg::ref_ptr<osg::ShapeDrawable> osg_shapedrawable = new osg::ShapeDrawable(osg_box,osg_hints.get());
    
        //设置颜色
        osg::ref_ptr<osg::Material> osg_material = new osg::Material;
        osg_material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0,1.0,1.0,1.0));
        osg_material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 1.0, 1.0, 1.0));
        osg_material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 1.0, 1.0, 1.0));
        osg_material->setShininess(osg::Material::FRONT_AND_BACK,60.0);
    
        //应用材质
        osg_geode->getOrCreateStateSet()->setAttributeAndModes(osg_material.get(),osg::StateAttribute::ON);
        //设置透明度
        osg_geode->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::ON);
    
        //设置精度
        osg_hints->setDetailRatio(0.5);
        osg_geode->addDrawable(osg_shapedrawable.get());
        return osg_geode;
    }

  • 相关阅读:
    站立会议 第十天
    站立会议 第十天
    找水王
    购买《哈利波特》书籍
    站立会议第三天
    站立会议第二天
    冲刺会议第一天
    补发《超级迷宫》站立会议五
    补发《超级迷宫》站立会议四
    课堂练习之求1到N之间的数里面含有1的个数
  • 原文地址:https://www.cnblogs.com/herd/p/11070466.html
Copyright © 2011-2022 走看看