00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00053
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
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
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
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
00133
00134 void Scene::setGravite(Coord g)
00135 {
00136
00137 _g.setX(g.getX());
00138 _g.setY(g.getY());
00139 _g.setZ(g.getZ());
00140 }
00141
00142
00143
00144
00145
00146 void Scene::setVisco(float visco)
00147 {
00148
00149 _visco = visco;
00150 }