本文整理汇总了C++中osg::StateSet::setAttributeAndModes方法的典型用法代码示例。如果您正苦于以下问题:C++ StateSet::setAttributeAndModes方法的具体用法?C++ StateSet::setAttributeAndModes怎么用?C++ StateSet::setAttributeAndModes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::StateSet
的用法示例。
在下文中一共展示了StateSet::setAttributeAndModes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setBlending
void myModel::setBlending()
{
_blendFunc = new osg::BlendFunc;
_stateset = _model->getOrCreateStateSet();
_blendFunc->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
_stateset->setAttributeAndModes( _blendFunc );
}
示例2: Configurar_Material
void Configurar_Material()
{
// version which sets the color of the wireframe.
material->setColorMode(osg::Material::OFF); // switch glColor usage off
// turn all lighting off
material->setShininess(osg::Material::FRONT_AND_BACK,10.0f);
material->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(0.0,1.0f,0.0f,1.0f));
material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(0.0,1.0f,0.0f,1.0f));
material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(0.0,1.0f,0.0f,1.0f));
// except emission... in which we set the color we desire
material->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4(0.0,0.0f,0.0f,1.0f));
stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
Torreta->setStateSet(stateset);
}
示例3: createShaders
void createShaders(osg::StateSet& ss)
{
osg::ref_ptr<osg::Shader> verShader=
new osg::Shader(osg::Shader::VERTEX,vertSource);
osg::ref_ptr<osg::Shader> fragShader=
new osg::Shader(osg::Shader::FRAGMENT,fragSource);
osg::ref_ptr<osg::Program> program=new osg::Program;
program->addShader(verShader.get());
program->addShader(fragShader.get());
osg::ref_ptr<osg::Uniform> mainColor=
new osg::Uniform("mainColor",osg::Vec4(1,0.5,0.5,1));
mainColor->setUpdateCallback(new ColorCallback);
ss.addUniform(mainColor.get());
ss.setAttributeAndModes(program.get());
}
示例4: nave
torreta(int x, int y, int z,int tamaño)
{
Torreta = new osg::Group();
material = new osg::Material;
stateset =new osg::StateSet;
//Configurar_Material();
boton=y;
left=x;
//top=(8*tamaño)+z;
//right=(11*tamaño);
int tamaño_cubo_grade=tamaño*5;
nave* cubomio=new nave (x,y,z,tamaño_cubo_grade);
int puntopunta=tamaño_cubo_grade;
puntopunta=puntopunta/2;
puntopunta=puntopunta-(tamaño/2);
nave* cubomio2=new nave(x+puntopunta,y,tamaño_cubo_grade+z,tamaño);
Torreta->addChild(cubomio->getNave());
Torreta->addChild(cubomio2->getNave());
top=tamaño_cubo_grade+tamaño+y;
right=tamaño_cubo_grade+x;
yDisparo=top;
xDisparo=x+puntopunta;
stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF);
};