Scene.cpp

Aller à la documentation de ce fichier.
00001 /*
00002  * Scene.cpp : Scene 3D
00003  * Copyright (C) 2007 Florence Zara, LIRIS
00004  *               florence.zara@liris.univ-lyon1.fr
00005  *               http://liris.cnrs.fr/florence.zara/
00006  *
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License as published
00010  * by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 
00031 #include <list>
00032 #include <string>
00033 #include <iostream>
00034 
00036 #include <GL/gl.h>
00037 #include <GL/glu.h>
00038 
00039 
00041 #include "Noeuds.h"
00042 #include "Scene.h"
00043 
00044 
00045 
00046 
00050 Scene::Scene(std::string Fichier_Param) 
00051 {
00052         // Lecture du fichier de parametres : 
00053         // recuperation de la gravite et de la viscosite
00054         Param(Fichier_Param);
00055 }
00056 
00057 
00058 
00062 void Scene::attache(Noeud *n)
00063 { 
00064         _enfants.push_back(n); 
00065 }
00066 
00067 
00071 void Scene::getName()
00072 {
00073         ListeNoeuds::iterator e;
00074         std::cout << "----------------- Objets de la scene : " ;
00075         
00076         for(e=_enfants.begin(); e!=_enfants.end(); e++)
00077         {
00078                 std::cout << (*e)->getName() << " " ;
00079         }
00080         
00081         std::cout << " " << std::endl;
00082 }
00083 
00084 
00088 void Scene::init_animation()
00089 {
00090         //std::cout << "----------------- Scene::Initialisation()-------------" << std::endl;
00091         ListeNoeuds::iterator e;
00092         
00093         for(e=_enfants.begin(); e!=_enfants.end(); e++)
00094         {
00095                 (*e)->init_animation();
00096         }
00097 }
00098 
00099 
00103 void Scene::affiche()
00104 {
00105         //std::cout << "----------------- Scene::Affiche()-------------" << std::endl;
00106         ListeNoeuds::iterator e;
00107         
00108         for(e=_enfants.begin(); e!=_enfants.end(); e++)
00109         {
00110                 (*e)->affiche();
00111         }
00112 }
00113 
00114 
00115 
00119 void Scene::Simulation(int Tps)
00120 {
00121         //std::cout << "----------------- Scene::Simulation()-------------" << std::endl;
00122         ListeNoeuds::iterator e;
00123         
00124         for(e=_enfants.begin(); e!=_enfants.end(); e++)
00125         {
00126                 (*e)->Simulation(_g, _visco, Tps);
00127         }
00128 }
00129 
00130 
00131 /*
00132  * Modification de la gravite de la scene 
00133  */
00134 void Scene::setGravite(Coord g)
00135 {
00136         // Composantes x, y et z du vecteur de la gravite 
00137         _g.setX(g.getX());
00138         _g.setY(g.getY());
00139         _g.setZ(g.getZ());
00140 }
00141 
00142 
00143 /*
00144  * Modification de la viscosite du milieu 
00145  */
00146 void Scene::setVisco(float visco)
00147 {
00148         // Viscosite du milieu
00149         _visco = visco;
00150 }

Généré le Sat Jan 19 15:49:32 2008 pour Animation 3D par  doxygen 1.5.1