src/scene3D.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by                                                 *
00003  *         Pierre-yves JEZEQUEL, Julien MICHOT, Loic MOISAN,               *
00004  *         Julien PAPILLON, Sebastien PINEAUD, Barthelemy SERRES           *
00005  *                                                                         *
00006  *   https://sourceforge.net/projects/anidam                               *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; if not, write to the                         *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00022  ***************************************************************************/
00023 #include <osg/ShapeDrawable>
00024 #include <osgUtil/SceneView>
00025 #include <osgUtil/Optimizer>
00026 #include <osg/Geode>
00027 #include <osg/Fog>
00028 #include <osg/Geometry>
00029 #include <osg/Texture2D>
00030 #include <osg/Billboard>
00031 #include <osg/BlendFunc>
00032 #include <osg/AlphaFunc>
00033 #include <osgDB/Registry>
00034 #include <osgDB/ReadFile>
00035 #include <osgProducer/Viewer>
00036 
00037 
00042 //#include "rotator.h"
00043 #include "lightManager.h"
00044 #include "soundManager.h"
00045 
00046 
00047 class Scene3D{
00048 public:
00049   Scene3D();
00050   ~Scene3D();
00051   //void attach(osgUtil::SceneView &) const;
00052   void attach(osgProducer::Viewer* );
00053   void update();
00054   void createScene();
00055   void initSound();
00056   //void optimize(osg::ref_ptr<osg::Group> root);
00057   void optimize(osg::Node* root);
00058   void setSky();
00059   void setVisibilityRange(float range);
00060   void setSkyDome(osg::Node* skyDome);
00061   void setClouds(osg::Node* node, float height);
00062   void setSkyLightColor(const osg::Vec4& color);
00063   void setSkyLightPosition(const osg::Vec2& headingAzimuth);
00064   void addTree (const std::string & strFile, float x,float y, float z);
00065   osg::Node* addObject(osg::Node* node,osg::Vec3d pos,osg::Vec3d scale);
00066   osg::ref_ptr<osgAL::SoundNode> addSound(const std::string& name);
00067   void addSoundSource (const std::string & strFile, float x,float y, float z,float factor, float dist);
00068   osg::ref_ptr<osg::Group> getRootNode();
00069   osg::ref_ptr<osg::MatrixTransform> getRoot();
00070   bool isSoundEnabled();
00071   osg::Node* createMovingModel(osg::Node* n,float scale,const std::string & strFile,const osg::Vec3& center, float radius,float speed);
00072   void creerChutesEtAnim(osg::Group* scene);
00073  
00074   void setTrees(bool b){trees=b;};
00075   void setFogs(bool b){fogs=b;};
00076 
00077 private:
00078     osgProducer::Viewer* viewer;
00079     osg::Drawable* createShrub(const float & scale, osg::StateSet* bbState);
00080     osg::ref_ptr<osgAL::SoundRoot> sound_root;
00081     osg::ref_ptr<osg::Group> rootNode;
00082     osg::ref_ptr<osg::MatrixTransform> root;
00083     osg::ref_ptr<osg::StateSet> rootStateSet;
00084     osg::ref_ptr<osg::MatrixTransform> sky;
00085     osg::ref_ptr<osg::MatrixTransform> skyDome;
00086     osg::ref_ptr<osg::LightSource> skyLight;
00087     osg::ref_ptr<osg::LightSource> backLight;
00088     osg::ref_ptr<osg::MatrixTransform> clouds;
00089     LightManager lightManager;
00090     SoundManager * soundMgr;
00091     bool sound;
00092         bool trees;
00093         bool fogs;
00094 };
00095 

Generated on Tue Jun 5 16:56:48 2007 for Anidam by  doxygen 1.5.1