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;
    }

  • 相关阅读:
    Oracle-函数-split 和 splitstr 的创建
    git merge方法
    查看Android 设备进程id
    内存泄漏
    Mac显示隐藏文件快捷键
    gradle版本
    commit单一文件
    21不下发信号
    FileInputStream read函数何时返回-1
    maven turbonet目录
  • 原文地址:https://www.cnblogs.com/herd/p/11070466.html
Copyright © 2011-2022 走看看