|
就是面向我的这一个面(front face) 是被照亮的. 但是如果把 正方形的 背面转过来, 就是黑的了. 虽然是一个光源, 但是我对 front 和 back face 都加了法向量, 背面转过来的时候应该被光源照亮啊?
- v->push_back(leftTop);
- v->push_back(rightTop);
- v->push_back(rightBottom);
- v->push_back(leftBottom);
- osg::ref_ptr<osg::Vec4Array> color = new osg::Vec4Array;
- color->push_back(osg::Vec4(1.0,1.0,1.0,1.0));
- osg::ref_ptr<osg::DrawArrays> da = new osg::DrawArrays(GL_QUADS, 0, v->size());
- geometry->setVertexArray(v);
- geometry->addPrimitiveSet(da);
- geometry->setColorArray(color);
- geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
- osg::Vec3Array* quadNormal = new osg::Vec3Array;
- geometry->setNormalArray(quadNormal);
- geometry->setNormalBinding(osg::Geometry::BIND_OVERALL);
- quadNormal->push_back(osg::Vec3(0.f, -1.0f, 0.0f));
- quadNormal->push_back(osg::Vec3(0.f, 1.0f, 0.0f));
复制代码
不知道该如何处理啊, 加了disable cull face 还是没用:
- Group::getOrCreateStateSet()->setMode(GL_CULL_FACE, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);
复制代码 |
|