tlp::GlScene Class Reference
Tulip scene class.
More...
#include <GlScene.h>
List of all members.
Public Member Functions
- GlScene (GlLODCalculator *calculator=NULL)
- Constructor By default GlScene use a GlQuadTreeLODCalculator to compute LOD but you can change this default lod calculator, to do that : put your calculator in constructor parameters.
- ~GlScene ()
- void initGlParameters ()
- void prerenderMetaNodes ()
- void draw ()
- void centerScene ()
- void computeAjustSceneToSize (int width, int height, Coord *center, Coord *eye, float *sceneRadius, float *xWhiteFactor, float *yWhiteFactor, BoundingBox *sceneBoundingBox=NULL)
- void ajustSceneToSize (int width, int height)
- void zoomXY (int step, const int x, const int y)
- void zoom (float factor, const Coord &dest)
- void zoom (int step)
- void translateCamera (const int x, const int y, const int z)
- void rotateScene (const int x, const int y, const int z)
- bool selectEntities (RenderingEntitiesFlag type, int x, int y, int h, int w, GlLayer *layer, std::vector< unsigned long > &selectedEntities)
- void outputSVG (unsigned int size, const std::string &filename)
- void outputEPS (unsigned int size, const std::string &filename)
- unsigned char * getImage ()
- void setViewport (Vector< int, 4 > &newViewport)
- void setViewport (int x, int y, int width, int height)
- Vector< int, 4 > getViewport ()
- void setBackgroundColor (const Color &color)
- Color getBackgroundColor ()
- void setViewOrtho (bool viewOrtho)
- bool isViewOrtho ()
- void setViewLabel (bool viewLabel)
- void addLayer (GlLayer *layer)
- bool insertLayerBefore (GlLayer *layer, const std::string &name)
- bool insertLayerAfter (GlLayer *layer, const std::string &name)
- GlLayer * getLayer (const std::string &name)
- void removeLayer (const std::string &name, bool deleteLayer)
- void removeLayer (GlLayer *layer, bool deleteLayer)
- std::vector< std::pair
< std::string, GlLayer * > > * getLayersList ()
- void clearLayersList ()
- void getXML (std::string &out)
- void setWithXML (std::string &in, Graph *graph)
- GlLODCalculator * getCalculator ()
- void setCalculator (GlLODCalculator *calculator)
- BoundingBox getBoundingBox ()
- void setViewportZoom (int zoom=1, int xDec=0, int yDec=0)
- void getViewportZoom (int &zoom, int &xDec, int &yDec)
- void addGlGraphCompositeInfo (GlLayer *layer, GlGraphComposite *glGraphComposite)
- GlGraphComposite * getGlGraphComposite ()
- GlLayer * getGraphLayer ()
- Camera & getCamera ()
- void setCamera (const Camera &camera)
- void setNoClearBackground (bool clear)
- bool getNoClearBackground () const
Detailed Description
Tulip scene class.
The GlScene class is the core of the tulip rendering system This class is used to render entities and graph in OpenGL If you want to render entities and graph, you have to use GlLayer system. You just have to create GlLayer and add entities in.
- Warning:
- GlScene work with only one graph, if you add a GlGraphComposite you have to call the addGlGraphCompositeInfo(GlLayer *, GlGraphComposite *) After adding layers you can do a centerScene() and a draw()
GlLayer *mainLayer=new GlLayer("Main");
GlGraphComposite *graphComposite=new GlGraphComposite(graph);
mainLayer->addGlEntity(graphComposite,"graph");
GlLayer *otherLayer=new GlLayer("Other");
GlCircle *circle=new GlCircle();
otherLayer->addGlEntity(circle,"circle");
glScene.addLayer(mainLayer);
glScene.addLayer(otherLayer);
glScene.addGlGraphCompositeInfo(mainLayer,graphComposite);
glScene.centerScene();
glScene.draw();
If you want to create a widget with a visualisation is better to use GlMainWidget class (this class use a GlScene inside)
Constructor & Destructor Documentation
tlp::GlScene::GlScene |
( |
GlLODCalculator * |
calculator = NULL |
) |
|
Constructor By default GlScene use a GlQuadTreeLODCalculator to compute LOD but you can change this default lod calculator, to do that : put your calculator in constructor parameters.
tlp::GlScene::~GlScene |
( |
|
) |
|
Member Function Documentation
void tlp::GlScene::addLayer |
( |
GlLayer * |
layer |
) |
|
void tlp::GlScene::ajustSceneToSize |
( |
int |
width, |
|
|
int |
height | |
|
) |
| | |
Ajust camera to have entities near borders
void tlp::GlScene::centerScene |
( |
|
) |
|
void tlp::GlScene::clearLayersList |
( |
|
) |
[inline] |
void tlp::GlScene::computeAjustSceneToSize |
( |
int |
width, |
|
|
int |
height, |
|
|
Coord * |
center, |
|
|
Coord * |
eye, |
|
|
float * |
sceneRadius, |
|
|
float * |
xWhiteFactor, |
|
|
float * |
yWhiteFactor, |
|
|
BoundingBox * |
sceneBoundingBox = NULL | |
|
) |
| | |
Compute informations for ajustSceneToSize
- Parameters:
-
| width | : request width |
| height | : request height |
| center | : the result center will be stored in (if center != NULL) |
| eye | : the result eye will be stored in (if eye != NULL) |
| sceneRadius | : the result sceneRadius will be stored in (if sceneRadius != NULL) |
| xWhiteFactor | : xWhiteFactor is the white part on x borders (left and right), the result xWhiteFactor will be stored in (if xWhiteFactor != NULL) |
| yWhiteFactor | : yWhiteFactor is the white part on y borders (top and bottom), the result yWhiteFactor will be stored in (if yWhiteFactor != NULL) |
| sceneBoundingBox | : the result sceneBoundingBox will be stored in (if sceneBoundingBox != NULL) |
void tlp::GlScene::draw |
( |
|
) |
|
Color tlp::GlScene::getBackgroundColor |
( |
|
) |
[inline] |
Get the background color of the scene
BoundingBox tlp::GlScene::getBoundingBox |
( |
|
) |
|
Return the bouding box of the scene
- Warning:
- This bounding box is compute in rendering, so if you add an entity in a layer the bounding box include this entity if a draw is call
GlLODCalculator* tlp::GlScene::getCalculator |
( |
|
) |
[inline] |
Return lod calculator used to render this scene
Camera& tlp::GlScene::getCamera |
( |
|
) |
[inline] |
GlLayer* tlp::GlScene::getGraphLayer |
( |
|
) |
[inline] |
unsigned char* tlp::GlScene::getImage |
( |
|
) |
|
Return the RGB image of OpenGL view
GlLayer* tlp::GlScene::getLayer |
( |
const std::string & |
name |
) |
|
Return the layer with name : name
std::vector<std::pair<std::string, GlLayer*> >* tlp::GlScene::getLayersList |
( |
|
) |
[inline] |
bool tlp::GlScene::getNoClearBackground |
( |
|
) |
const [inline] |
Vector<int, 4> tlp::GlScene::getViewport |
( |
|
) |
[inline] |
Get the viewport of the scene
void tlp::GlScene::getViewportZoom |
( |
int & |
zoom, |
|
|
int & |
xDec, |
|
|
int & |
yDec | |
|
) |
| | |
Get a zoom level and a xDec/yDec, this parameters change viewport of the scene
void tlp::GlScene::getXML |
( |
std::string & |
out |
) |
|
Get XML description of the scene and children and store it in out string
void tlp::GlScene::initGlParameters |
( |
|
) |
|
Init scene's OpenGL parameters
bool tlp::GlScene::insertLayerAfter |
( |
GlLayer * |
layer, |
|
|
const std::string & |
name | |
|
) |
| | |
Add a layer just after layer with given name Return true if insert is ok and false if layer with given name is not find
bool tlp::GlScene::insertLayerBefore |
( |
GlLayer * |
layer, |
|
|
const std::string & |
name | |
|
) |
| | |
Add a layer just before layer with given name Return true if insert is ok and false if layer with given name is not find
bool tlp::GlScene::isViewOrtho |
( |
|
) |
[inline] |
Scene is render in orthogonal mode ?
void tlp::GlScene::outputEPS |
( |
unsigned int |
size, |
|
|
const std::string & |
filename | |
|
) |
| | |
void tlp::GlScene::outputSVG |
( |
unsigned int |
size, |
|
|
const std::string & |
filename | |
|
) |
| | |
void tlp::GlScene::prerenderMetaNodes |
( |
|
) |
|
void tlp::GlScene::removeLayer |
( |
GlLayer * |
layer, |
|
|
bool |
deleteLayer | |
|
) |
| | |
Remove a layer and delete it (if bool deleteLayer == true)
void tlp::GlScene::removeLayer |
( |
const std::string & |
name, |
|
|
bool |
deleteLayer | |
|
) |
| | |
Remove the layer with name and delete it (if bool deleteLayer == true)
void tlp::GlScene::rotateScene |
( |
const int |
x, |
|
|
const int |
y, |
|
|
const int |
z | |
|
) |
| | |
bool tlp::GlScene::selectEntities |
( |
RenderingEntitiesFlag |
type, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
h, |
|
|
int |
w, |
|
|
GlLayer * |
layer, |
|
|
std::vector< unsigned long > & |
selectedEntities | |
|
) |
| | |
Select entities with selection flag : type (SelectSimpleEntities,SelectNodes,SelectEdges) Select at position x,y with heigh : h and width : w Select in GlLayer : layer And store result in selectedEntities vector
void tlp::GlScene::setBackgroundColor |
( |
const Color & |
color |
) |
[inline] |
Set the background color of the scene
void tlp::GlScene::setCalculator |
( |
GlLODCalculator * |
calculator |
) |
[inline] |
Set a new lod calculator used to render this scene
void tlp::GlScene::setCamera |
( |
const Camera & |
camera |
) |
[inline] |
void tlp::GlScene::setNoClearBackground |
( |
bool |
clear |
) |
[inline] |
If true, color buffer will not be cleared before drawing the scene.
void tlp::GlScene::setViewLabel |
( |
bool |
viewLabel |
) |
[inline] |
Render the nodes/edges label
void tlp::GlScene::setViewOrtho |
( |
bool |
viewOrtho |
) |
[inline] |
Set if scene is render in orthogonal mode
void tlp::GlScene::setViewport |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height | |
|
) |
| | [inline] |
Set the viewport of the scene with 4 int
void tlp::GlScene::setViewport |
( |
Vector< int, 4 > & |
newViewport |
) |
[inline] |
Set the viewport of the scene with a vector
void tlp::GlScene::setViewportZoom |
( |
int |
zoom = 1 , |
|
|
int |
xDec = 0 , |
|
|
int |
yDec = 0 | |
|
) |
| | |
Set a zoom level and a xDec/yDec, this parameters change viewport of the scene
void tlp::GlScene::setWithXML |
( |
std::string & |
in, |
|
|
Graph * |
graph | |
|
) |
| | |
Set scene's data and children with a XML
void tlp::GlScene::translateCamera |
( |
const int |
x, |
|
|
const int |
y, |
|
|
const int |
z | |
|
) |
| | |
Translate camera by (x,y,z)
void tlp::GlScene::zoom |
( |
int |
step |
) |
|
void tlp::GlScene::zoom |
( |
float |
factor, |
|
|
const Coord & |
dest | |
|
) |
| | |
void tlp::GlScene::zoomXY |
( |
int |
step, |
|
|
const int |
x, |
|
|
const int |
y | |
|
) |
| | |
|