]> git.mxchange.org Git - simgear.git/blob - simgear/scene/material/EffectGeode.cxx
include file change to make simgear work with OSG 2.9.X again
[simgear.git] / simgear / scene / material / EffectGeode.cxx
1 // Copyright (C) 2008  Timothy Moore timoore@redhat.com
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 2 of the
6 // License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16
17 #include "EffectGeode.hxx"
18 #include "Effect.hxx"
19 #include "Technique.hxx"
20
21 #include <osgUtil/CullVisitor>
22
23 #include <osgDB/Registry>
24 #include <osgDB/Input>
25 #include <osgDB/ParameterOutput>
26
27 namespace simgear
28 {
29
30 using namespace osg;
31 using namespace osgUtil;
32
33 EffectGeode::EffectGeode()
34 {
35 }
36
37 EffectGeode::EffectGeode(const EffectGeode& rhs, const CopyOp& copyop) :
38     Geode(rhs, copyop)
39 {
40     _effect = static_cast<Effect*>(rhs._effect->clone(copyop));
41 }
42
43 void EffectGeode::resizeGLObjectBuffers(unsigned int maxSize)
44 {
45     if (_effect.valid())
46         _effect->resizeGLObjectBuffers(maxSize);
47     Geode::resizeGLObjectBuffers(maxSize);
48 }
49
50 void EffectGeode::releaseGLObjects(osg::State* state) const
51 {
52     if (_effect.valid())
53         _effect->releaseGLObjects(state);
54     Geode::releaseGLObjects(state);
55 }
56
57 bool EffectGeode_writeLocalData(const Object& obj, osgDB::Output& fw)
58 {
59     const EffectGeode& eg = static_cast<const EffectGeode&>(obj);
60
61     fw.indent() << "effect\n";
62     fw.writeObject(*eg.getEffect());
63     return true;
64 }
65
66 namespace
67 {
68 osgDB::RegisterDotOsgWrapperProxy effectGeodeProxy
69 (
70     new EffectGeode,
71     "simgear::EffectGeode",
72     "Object Node Geode simgear::EffectGeode",
73     0,
74     &EffectGeode_writeLocalData
75     );
76 }
77 }