00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifdef HAVE_CONFIG_H
00018 # include <simgear_config.h>
00019 #endif
00020
00021 #include "EffectGeode.hxx"
00022 #include "Effect.hxx"
00023 #include "Technique.hxx"
00024
00025 #include <osgUtil/CullVisitor>
00026
00027 #include <osgDB/Registry>
00028 #include <osgDB/Input>
00029 #include <osgDB/ParameterOutput>
00030
00031 namespace simgear
00032 {
00033
00034 using namespace osg;
00035 using namespace osgUtil;
00036
00037 EffectGeode::EffectGeode()
00038 {
00039 }
00040
00041 EffectGeode::EffectGeode(const EffectGeode& rhs, const osg::CopyOp& copyop) :
00042 Geode(rhs, copyop),
00043 _effect(static_cast<Effect*>(copyop(rhs._effect.get())))
00044 {
00045 }
00046
00047 void EffectGeode::setEffect(Effect* effect)
00048 {
00049 _effect = effect;
00050 if (!_effect)
00051 return;
00052 addUpdateCallback(new Effect::InitializeCallback);
00053 }
00054
00055 void EffectGeode::resizeGLObjectBuffers(unsigned int maxSize)
00056 {
00057 if (_effect.valid())
00058 _effect->resizeGLObjectBuffers(maxSize);
00059 Geode::resizeGLObjectBuffers(maxSize);
00060 }
00061
00062 void EffectGeode::releaseGLObjects(osg::State* state) const
00063 {
00064 if (_effect.valid())
00065 _effect->releaseGLObjects(state);
00066 Geode::releaseGLObjects(state);
00067 }
00068
00069 bool EffectGeode_writeLocalData(const Object& obj, osgDB::Output& fw)
00070 {
00071 const EffectGeode& eg = static_cast<const EffectGeode&>(obj);
00072
00073 fw.indent() << "effect\n";
00074 fw.writeObject(*eg.getEffect());
00075 return true;
00076 }
00077
00078 namespace
00079 {
00080 osgDB::RegisterDotOsgWrapperProxy effectGeodeProxy
00081 (
00082 new EffectGeode,
00083 "simgear::EffectGeode",
00084 "Object Node Geode simgear::EffectGeode",
00085 0,
00086 &EffectGeode_writeLocalData
00087 );
00088 }
00089 }