c++ - OpenSceneGraph:分析场景图
问题描述
我想通过 OSG 读取 3D 模型并了解有关顶点、法线和纹理坐标等的 3D 模型信息。
我不明白下面的代码(从这里完成教程)。我们为什么要prset->index(ic)
用作索引?我很困惑。(* verts)
是顶点数组,但什么是prset->index(ic)
?
for (ic=0; ic<prset->getNumIndices(); ic++) { // NB the vertices are held in the drawable -
osg::notify(osg::WARN) << "vertex "<< ic << " is index "<<prset->index(ic) << " at " <<
(* verts)[prset->index(ic)].x() << "," <<
(* verts)[prset->index(ic)].y() << "," <<
(* verts)[prset->index(ic)].z() << std::endl;
}
解决方案
如果您的可绘制对象使用索引图元,则需要取消引用查看索引数组的三角形顶点,因为您可能会重复使用顶点数组的共享顶点。像这样的东西。
推荐阅读
- php - 在 Aws 上的不同实例上路由流量
- python - Python在wordcount函数中返回和打印
- xamarin - 默认纵向在 iPad 上自行更改为横向
- javascript - 使用淘汰赛js为搜索过滤器创建分页以及排序表
- android - 在 JobIntentService 中运行 FileObserver
- ios - 在 UIView 上围绕一个圆圈获取 N 个 CGPoints
- wordpress - 如何在 Wordpress 的公共页面中删除“文本”?
- android - Unity3D构建错误:无法编译资源
- postgresql - 如何选择独特的?
- facebook - 如何使用 Facebook 社交登录(graph API v.2.11)应用程序获取用户的公共个人资料网址?