]> git.mxchange.org Git - simgear.git/blob - simgear/scene/material/EffectGeode.cxx
Merge branch 'frohlich/weak' into next
[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 #ifdef HAVE_CONFIG_H
18 #  include <simgear_config.h>
19 #endif
20
21 #include "EffectGeode.hxx"
22 #include "Effect.hxx"
23 #include "Technique.hxx"
24
25 #include <osgUtil/CullVisitor>
26
27 #include <osgDB/Registry>
28 #include <osgDB/Input>
29 #include <osgDB/ParameterOutput>
30
31 namespace simgear
32 {
33
34 using namespace osg;
35 using namespace osgUtil;
36
37 EffectGeode::EffectGeode()
38 {
39 }
40
41 EffectGeode::EffectGeode(const EffectGeode& rhs, const CopyOp& copyop) :
42     Geode(rhs, copyop)
43 {
44     _effect = static_cast<Effect*>(rhs._effect->clone(copyop));
45 }
46
47 void EffectGeode::resizeGLObjectBuffers(unsigned int maxSize)
48 {
49     if (_effect.valid())
50         _effect->resizeGLObjectBuffers(maxSize);
51     Geode::resizeGLObjectBuffers(maxSize);
52 }
53
54 void EffectGeode::releaseGLObjects(osg::State* state) const
55 {
56     if (_effect.valid())
57         _effect->releaseGLObjects(state);
58     Geode::releaseGLObjects(state);
59 }
60
61 bool EffectGeode_writeLocalData(const Object& obj, osgDB::Output& fw)
62 {
63     const EffectGeode& eg = static_cast<const EffectGeode&>(obj);
64
65     fw.indent() << "effect\n";
66     fw.writeObject(*eg.getEffect());
67     return true;
68 }
69
70 namespace
71 {
72 osgDB::RegisterDotOsgWrapperProxy effectGeodeProxy
73 (
74     new EffectGeode,
75     "simgear::EffectGeode",
76     "Object Node Geode simgear::EffectGeode",
77     0,
78     &EffectGeode_writeLocalData
79     );
80 }
81 }