91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-12
  • 語言: 其他
  • 標簽: OSG??

資源簡介

osg用約束線去掉想去掉三角網的區域,實現地形的裁剪和編輯,方便靈活。

資源截圖

代碼片段和文件信息

/**********************************************************
*Write?by?FlySky
*zzuxp@163.com??http://www.OsgChina.org???
**********************************************************/

#include?
#include?

#include?
#include?
#include?
#include?

#include?
#include?

#include?

#include?
#include?


#include?“Tex.h“



int?main()
{

osg::ref_ptr?viewer?=?new?osgViewer::Viewer();
//方便查看在多邊形之間切換,以查看三角網
viewer->addEventHandler(?new?osgGA::StateSetManipulator(viewer->getCamera()->getOrCreateStateSet())?);

osg::ref_ptr?root?=?new?osg::Group();

//畫約束線
osgUtil::DelaunayConstraint?*?dc=new?osgUtil::DelaunayConstraint;
//std::ostringstream?what;
????osg::ref_ptr?bounds?=?new?osg::Vec3Array();
bounds->push_back(osg::Vec3(600041461-32.0));
bounds->push_back(osg::Vec3(600641461-32.0));
bounds->push_back(osg::Vec3(600641461+32.0));
bounds->push_back(osg::Vec3(600041461+32.0));

dc->setVertexArray(bounds);
dc->addPrimitiveSet(new?osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP04)?);

//創建頂點數組
osg::ref_ptr?coords?=?new?osg::Vec3Array();

//計算頂點數組的大小
?int?n;
?n?=?sizeof(vertex)/sizeof(float[3]);

//添加頂點數據
for(?unsigned?int?i?=?0;?i? {
coords->push_back(?osg::Vec3(vertex[i][0]?vertex[i][1]?vertex[i][2]?));
}

//創建Delaunay三角網對象
osg::ref_ptr?dt?=?new?osgUtil::DelaunayTriangulator(coords.get());
?dt->addInputConstraint(dc);
//生成三角網
dt->triangulate();
dt->removeInternalTriangles(dc);
//創建幾何體
osg::ref_ptr?geometry?=?new?osg::Geometry();
//設置頂點數組
geometry->setVertexArray(coords.get());

//加入到繪圖基元
geometry->addPrimitiveSet(dt->getTriangles());

//添加到葉節點
osg::ref_ptr?geode?=?new?osg::Geode();
geode->addDrawable(?geometry.get());

root->addChild(geode.get())?;
//osgDB::writeNodeFile(*(root)“SJW.osg“);

//優化場景數據
osgUtil::Optimizer?optimizer?;
optimizer.optimize(root.get())?;

viewer->setSceneData(root.get());

viewer->realize();
viewer->addEventHandler(new?osgViewer::WindowSizeHandler);
viewer->run();



return?0?;
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2496??2016-01-15?17:38??main.cpp

?????文件??????46586??2015-03-06?11:20??Tex.h

-----------?---------??----------?-----??----

????????????????49082????????????????????2


評論

共有 條評論