]> git.mxchange.org Git - simgear.git/blob - simgear/scene/material/Pass.cxx
Use Effects in materials library, and therefore in scenery
[simgear.git] / simgear / scene / material / Pass.cxx
1 #include "Pass.hxx"
2
3 #include <simgear/structure/OSGUtils.hxx>
4
5 #include <osg/StateSet>
6 #include <osgDB/Registry>
7 #include <osgDB/Input>
8 #include <osgDB/ParameterOutput>
9
10 namespace simgear
11 {
12
13 Pass::Pass(const Pass& rhs, const osg::CopyOp& copyop) :
14     _stateSet(clone_ref(rhs._stateSet, copyop))
15 {
16 }
17
18 void Pass::resizeGLObjectBuffers(unsigned int maxSize)
19 {
20     if (_stateSet.valid())
21         _stateSet->resizeGLObjectBuffers(maxSize);
22 }
23
24 void Pass::releaseGLObjects(osg::State* state) const
25 {
26     if (_stateSet.valid())
27         _stateSet->releaseGLObjects(state);
28 }
29
30 bool Pass_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
31 {
32     const Pass& pass = static_cast<const Pass&>(obj);
33
34     fw.indent() << "stateSet\n";
35     fw.writeObject(*pass.getStateSet());
36     return true;
37 }
38
39 namespace
40 {
41 osgDB::RegisterDotOsgWrapperProxy passProxy
42 (
43     new Pass,
44     "simgear::Pass",
45     "Object simgear::Pass",
46     0,
47     &Pass_writeLocalData
48     );
49 }
50 }