1 #include <OpenThreads/ScopedLock>
3 #include "StateAttributeFactory.hxx"
9 StateAttributeFactory::StateAttributeFactory()
11 _standardAlphaFunc = new AlphaFunc;
12 _standardAlphaFunc->setFunction(osg::AlphaFunc::GREATER);
13 _standardAlphaFunc->setReferenceValue(0.01);
14 _standardAlphaFunc->setDataVariance(Object::STATIC);
15 _smooth = new ShadeModel;
16 _smooth->setMode(ShadeModel::SMOOTH);
17 _smooth->setDataVariance(Object::STATIC);
18 _flat = new ShadeModel(ShadeModel::FLAT);
19 _flat->setDataVariance(Object::STATIC);
20 _standardBlendFunc = new BlendFunc;
21 _standardBlendFunc->setSource(BlendFunc::SRC_ALPHA);
22 _standardBlendFunc->setDestination(BlendFunc::ONE_MINUS_SRC_ALPHA);
23 _standardBlendFunc->setDataVariance(Object::STATIC);
24 _standardTexEnv = new TexEnv;
25 _standardTexEnv->setMode(TexEnv::MODULATE);
26 _standardTexEnv->setDataVariance(Object::STATIC);
29 osg::ref_ptr<StateAttributeFactory> StateAttributeFactory::_theInstance;
30 OpenThreads::Mutex StateAttributeFactory::_instanceMutex;
32 StateAttributeFactory* StateAttributeFactory::instance()
34 OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_instanceMutex);
35 if (!_theInstance.valid()) {
36 _theInstance = new StateAttributeFactory;
38 return _theInstance.get();