osg绘制闭合曲线
osg绘制闭合曲线
osg::TessellationHints* outline_hits1 = new osg::TessellationHints(); outline_hits1->setDetailRatio(0.9f); osg::Geode* outline_geode = new osg::Geode(); osg::Geode* outline_node_geode = new osg::Geode(); osg::Geometry* outline_geometry = new osg::Geometry(); osg::ref_ptr<osg::Group> outline_group = new osg::Group; //设置顶点数据 outline_geometry->setVertexArray(outline_vec3array); //设置法线 osg::Vec3Array* outline_normal = new osg::Vec3Array(); outline_normal->push_back(osg::Vec3(0.0f, 1.0f, 1.0f)); outline_geometry->setNormalArray(outline_normal); outline_geometry->setNormalBinding(osg::Geometry::BIND_OVERALL); outline_geode->addDrawable(outline_geometry); //设置材质 osg::ref_ptr<osg::Material> outline_material = new osg::Material; { //设置环境光 outline_material->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 0.7, 0.0, 1.0)); //设置散射光 outline_material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 1.0, 1.0, 1.0)); //设置镜面光 outline_material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(1.0, 1.0, 1.0, 1.0)); //设置幅射光 outline_material->setShininess(osg::Material::FRONT_AND_BACK, 60.0); } osg::ref_ptr<osg::StateSet> outline_stateset = outline_geode->getOrCreateStateSet(); osg::ref_ptr<osg::LineWidth> outline_lineWidth = new osg::LineWidth(100.0f); outline_stateset->setAttribute(outline_lineWidth); outline_geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, outline_final_vecs.size())); //设置材质 outline_geometry->getOrCreateStateSet()->setAttributeAndModes(outline_material, osg::StateAttribute::ON); if (m_root !=nullptr) { outline_group->addChild(outline_geode); outline_group->addChild(outline_node_geode); m_root->addChild(outline_group.get()); }
#########################
QQ 3087438119
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
2021-06-22 ifc Pset_MaterialConcrete
2020-06-22 IfcCompositeCurveSegment
2019-06-22 osg 自定义图元
2019-06-22 osg model
2018-06-22 Java3D-对象基本变换
2017-06-22 git在eclipse中的配置 完整版 转载
2017-06-22 在阿里云上搭建自己的git服务器