#include #include using namespace osg; Material::Material() { _colorMode = OFF; _ambientFrontAndBack = true; _ambientFront.set(0.2f, 0.2f, 0.2f, 1.0f); _ambientBack.set(0.2f, 0.2f, 0.2f, 1.0f); _diffuseFrontAndBack = true; _diffuseFront.set(0.8f, 0.8f, 0.8f, 1.0f); _diffuseBack.set(0.8f, 0.8f, 0.8f, 1.0f); _specularFrontAndBack = true; _specularFront.set(0.0f, 0.0f, 0.0f, 1.0f); _specularBack.set(0.0f, 0.0f, 0.0f, 1.0f); _emissionFrontAndBack = true; _emissionFront.set(0.0f, 0.0f, 0.0f, 1.0f); _emissionBack.set(0.0f, 0.0f, 0.0f, 1.0f); _shininessFrontAndBack = true; _shininessFront = 0.0f; _shininessBack = 0.0f; } Material::~Material() { } void Material::setAmbient( const Face face, const Vec4& ambient ) { switch(face) { case(FRONT): _ambientFrontAndBack = false; _ambientFront = ambient; clampArray4BetweenRange(_ambientFront,0.0f,1.0f,"osg::Material::setAmbient(..)"); break; case(BACK): _ambientFrontAndBack = false; _ambientBack = ambient; clampArray4BetweenRange(_ambientBack,0.0f,1.0f,"Material::setAmbient(..)"); break; case(FRONT_AND_BACK): _ambientFrontAndBack = true; _ambientFront = ambient; clampArray4BetweenRange(_ambientFront,0.0f,1.0f,"Material::setAmbient(..)"); _ambientBack = _ambientFront; break; default: notify(NOTICE)<<"Notice: invalid Face passed to Material::setAmbient()."<