|
楼主 |
发表于 2008-9-2 23:25:25
|
显示全部楼层
谢谢你。什么是场景的法线归一化?创建光源的代码(不行):
osg::Node* createLights(osg::BoundingBox& bb,osg::StateSet* rootStateSet)
{
osg::Group* lightGroup = new osg::Group;
// create the light 全局光
osg::LightSource* lightSource = new osg::LightSource;
osg::Light* light = lightSource->getLight();
light->setLightNum(0);
//light->setPosition(osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // directional light from above
light->setAmbient(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
light->setDiffuse(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
light->setSpecular(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
//light->setSpotExponent(0);
//light->setDirection(osg::Vec3(1,1,-1));
rootStateSet->setAttribute(light, osg::StateAttribute::ON);
osg::StateSet* statelightON_OVRD = lightGroup->getOrCreateStateSet();
statelightON_OVRD->setAttribute(light, osg::StateAttribute::ON);
statelightON_OVRD->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
lightGroup->addChild(lightSource);
return lightGroup;
}
[[i] 本帖最后由 kinsung 于 2008-9-2 23:26 编辑 [/i]] |
|