之前已经学习了osg加载场景的基本流程;
Geometry类型是一个几何体对象;定义一个几何体对象geom1;
Vec3Array是向量数组类型,定义该类型的变量v1;
v1调用push_back方法放入4个向量,Vec3是三维向量;
并把v1设置为geom1的顶点数组;
法线也是用一个三维向量表示;
定义一个三维向量n1;n1加入数值;
设置geom1的法线是n1,并绑定,绑定方式是BIND_OVERALL;
BIND_OVERALL可能是在两个方向,两面均绑定;
geom1用它的顶点数组绘制四边形;
定义一个Geode类型对象geode1;
把geom1加入geode1;
把geode1加入组节点;
显示场景;
#include <osg/Geode>
#include <osg/Group>
#include <osg/ref_ptr>
#include <osg/Geometry>
#include <osgViewer/Viewer>
int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer();
//创建场景组节点
osg::ref_ptr<osg::Group> root = new osg::Group();
osg::ref_ptr<osg::Geometry> geom1 = new osg::Geometry;
osg::ref_ptr<osg::Vec3Array>