osg::ref_ptr<osg::Material> material = new osg::Material;
osg::Vec4 redColor(1.0, 0.0, 0.0, 1.0);
material->setAmbient(osg::Material::FRONT_AND_BACK, redColor);
material->setDiffuse(osg::Material::FRONT_AND_BACK,redColor);
material->setColorMode(osg::Material::AMBIENT);
cow->getOrCreateStateSet()->setAttributeAndModes(material.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
C++学习(三零四)osg材质Material使用
最新推荐文章于 2025-11-03 18:51:34 发布
这段代码创建了一个osg::Material实例,并设置了红色的环境光和漫反射颜色。然后将该材质应用到名为'cow'的3D模型的状态集中,确保其在渲染时生效并覆盖默认设置。
1854

被折叠的 条评论
为什么被折叠?



