|
楼主 |
发表于 2013-5-21 21:27:05
|
显示全部楼层
非常感谢,我试了一下,有这么几个小问题,首先是单元1的纹理贴上去以后比单元0的暗好多
再有一个问题是
假设几何体的顶点是这样的,
v->push_back(osg::Vec3(0.0f,0.0f,1.0f));
v->push_back(osg::Vec3(1.0f,0.0f,1.0f));
v->push_back(osg::Vec3(1.0f,0.0f,0.0f));
v->push_back(osg::Vec3(0.0f,0.0f,0.0f));
geom->setVertexArray(v.get());
osg::ref_ptr<osg::Vec2Array> vt = new osg::Vec2Array();
//添加数据
vt->push_back(osg::Vec2(0.0f,1.0f));
vt->push_back(osg::Vec2(1.0f,1.0f));
vt->push_back(osg::Vec2(1.0f,0.0f));
vt->push_back(osg::Vec2(0.0f,0.0f));
geom->setTexCoordArray(0,vt.get());
//创建纹理坐标2
osg::ref_ptr<osg::Vec2Array> vt2 = new osg::Vec2Array();
//我想再往顶点为134的三角形上贴图的话,这里应该怎么设置,如果设置三个顶点就是123顶点的三角形,怎么把顶点2跳过呢
vt2->push_back(osg::Vec2(0.5f,0.0f));
vt2->push_back(osg::Vec2(1.0f,0.0f));
vt2->push_back(osg::Vec2(1.0f,1.0f));??
geom->setTexCoordArray(1,vt2.get()); |
|