OSG闪存

《osg程序设计教程》
第四章
1.模型node与几何图元geode
2.geometry组成
2.1顶点Vertex,Vec3Array,setVertexArray(v.get);
2.2颜色color,Vec4Array,setColorArray(c.get);
2.3关联方式,geom.addPrimitiveSet(
new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
2.4法线normal,Vec3Array,setNormalArray(n.get);
setNormalBinding(::BIND_OVERALL);
n.push_back(osg::Vec3(0.f,-1.f,0.f);
3.geode.addDrawable(geom.get);
--------------------
1.状态属性类LineWidth
lineWidth.setWidth(10.0);
geom.getOrCreateStateSet().
setAttributeAndModes(lineWidth.get,
osg::StateAttribute::ON);
2.内置几何类型osg::Shape
3.附录..asGeometry();
第五章
1.viewer.getSceneData();得到数据。
2.键盘响应得到viewer
addEventHandler(osgGA::GUIEventHandler);
可以控制事件的拦截,由几个函数处理。
要不要继续向下传递。
3.重写handle();把参数转换为viewer
判断事件类型GUIEventAdapter::KEYDOWN:
viewer.getSceneData.asGroup.getChild.setNodeMask;
4.拾取pick
判断射线与viewer中的物体相交
判断相交结点为我们需要的。
5.x,y座标通过handle参数得到
射线
osgUtil::LineSegmentIntersector::Intersections
viewer.computeIntersections(x,y,intersection)
遍历Intersections
可能通过setName();getName();筛选结点
第六章
1.osg自带Trackball
2.osgGA::MatrixManipulator专门响应控制viewer
3.碰撞检查
LineSegment,osgUtil::IntersectVisitor
iv.addLineSegment(line.get);
node.accept(iv);
iv::HitList hlist;
4.制作路径漫游
时间,位置,旋转角度。
5.mfc中osg
去掉OnNewDocument();
重载OnOpenDocument();
CCoreOSG(HWND hWnd);
initOSG();
initManipulators(void);
initSceneGraph(void);
initCameraConfig(void);
setupWindow(void);
preFrameUpdate();
postFrameUpdate();
6.CView::OnEraseBkgnd(pDC);
第七章
1.回调:某件事情发生时执行一个函数。
2.按S显示帧速。
3.fountain.osg再看。
4.自定义回调
继承NodeCallback
重写operator();
更新矩阵setMatrix(Matrix::translate);
traverse(node,nv);贯穿
5.定义矩阵节点MatrixTransform
.setUpdateCallback(new MyCallBack);
6.节点访问器,参看osgCallBack案例
构造函数(::TRAVERSE_ALL_CHILDREN);
apply(osg::Geode)
geode.getNumDrawables();
geom=dyn_cast(geode.getDrawable(i));
geom.getVertexArray();
vArr.insert(end,begin,end);
遍历得到的结果可以放在类成员变量里。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章