20 #ifndef Tulip_GLSCENE_H
21 #define Tulip_GLSCENE_H
23 #include <tulip/tulipconf.h>
25 #include <tulip/Graph.h>
26 #include <tulip/GlLODCalculator.h>
27 #include <tulip/GlSceneObserver.h>
28 #include <tulip/GlLayer.h>
29 #include <tulip/GlDisplayListManager.h>
30 #include <tulip/GlTextureManager.h>
47 enum SelectedEntityType {
51 SIMPLE_ENTITY_SELECTED = 3
54 SelectedEntity():simpleEntity(NULL),complexEntityId((
unsigned int)(-1)),entityType(UNKNOW_SELECTED),complexEntityGraph(NULL) {}
55 SelectedEntity(
GlSimpleEntity *entity):simpleEntity(entity),complexEntityId((
unsigned int)(-1)),entityType(SIMPLE_ENTITY_SELECTED),complexEntityGraph(NULL) {}
56 SelectedEntity(
Graph *graph,
unsigned int id,SelectedEntityType type):simpleEntity(NULL),complexEntityId(
id),entityType(type),complexEntityGraph(graph) {}
59 assert(simpleEntity!=NULL);
63 unsigned int getComplexEntityId()
const {
64 assert(complexEntityId!=(
unsigned int)(-1));
65 return complexEntityId;
68 Graph *getComplexEntityGraph()
const {
69 assert(complexEntityGraph!=NULL);
70 return complexEntityGraph;
73 SelectedEntityType getEntityType()
const {
80 unsigned int complexEntityId;
81 SelectedEntityType entityType;
82 Graph *complexEntityGraph;
124 GlScene(GlLODCalculator *calculator=NULL);
132 void initGlParameters();
157 void computeAjustSceneToSize(
int width,
int height, Coord *center, Coord *eye,
float *sceneRadius,
float *xWhiteFactor,
float *yWhiteFactor,
BoundingBox *sceneBoundingBox=NULL,
float *zoomFactor=NULL);
164 void ajustSceneToSize(
int width,
int height);
170 void zoomXY(
int step,
const int x,
const int y);
176 void zoom(
float factor,
const Coord& dest);
187 void translateCamera(
const int x,
const int y,
const int z);
195 void rotateScene(
const int x,
const int y,
const int z);
207 bool selectEntities(RenderingEntitiesFlag type,
int x,
int y,
int h,
int w,
GlLayer *layer,std::vector<SelectedEntity>& selectedEntities);
212 void outputSVG(
unsigned int size,
const std::string& filename);
217 void outputEPS(
unsigned int size,
const std::string& filename);
222 unsigned char * getImage();
229 viewport=newViewport;
255 backgroundColor=color;
262 return backgroundColor;
269 this->viewOrtho=viewOrtho;
285 GlLayer *createLayer(
const std::string &name);
294 GlLayer *createLayerBefore(
const std::string &layerName,
const std::string &beforeLayerWithName);
303 GlLayer *createLayerAfter(
const std::string &layerName,
const std::string &afterLayerWithName);
310 void addExistingLayer(
GlLayer *layer);
318 bool addExistingLayerBefore(
GlLayer *layer,
const std::string &beforeLayerWithName);
326 bool addExistingLayerAfter(
GlLayer *layer,
const std::string &afterLayerWithName);
332 GlLayer *getLayer(
const std::string& name);
340 void removeLayer(
const std::string& name,
bool deleteLayer=
true);
348 void removeLayer(
GlLayer *layer,
bool deleteLayer=
true);
362 for(std::vector<std::pair<std::string,GlLayer*> >::iterator it=layersList.begin(); it!=layersList.end(); ++it)
371 void getXML(std::string &out);
376 void getXMLOnlyForCameras(std::string &out);
381 void setWithXML(std::string &in,
Graph *graph);
387 return lodCalculator;
394 lodCalculator=calculator;
395 calculator->setScene(*
this);
408 return glGraphComposite;
423 assert(graphLayer!=NULL);
424 return graphLayer->getCamera();
432 assert(graphLayer!=NULL);
433 graphLayer->setCamera(camera);
440 clearBufferAtDraw = clear;
447 return clearBufferAtDraw;
452 std::vector<std::pair<std::string,GlLayer *> > layersList;
453 GlLODCalculator *lodCalculator;
454 Vector<int, 4> viewport;
455 Color backgroundColor;
461 bool clearBufferAtDraw;
487 void notifyModifyLayer(
const std::string &name,
GlLayer *layer);
501 #endif // Tulip_GLSCENE_H