Image Component Library (ICL)
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | Friends | List of all members
icl::geom::Scene Class Reference

Scene Implementation that is used to handle a list of objects and cameras. More...

#include <Scene.h>

Inheritance diagram for icl::geom::Scene:
icl::utils::Lockable icl::geom::PointCloudGrabber icl::utils::Configurable icl::physics::PhysicsScene

Classes

struct  PBufferIndex
 

Public Types

enum  DepthBufferMode { RawDepth01, DistToCamPlane, DistToCamCenter }
 
- Public Types inherited from icl::utils::Configurable
typedef Function< void, const Property & > Callback
 Function type for changed properties. More...
 

Public Member Functions

 Scene ()
 Base constructor (creates an empty scene) More...
 
 ~Scene ()
 Destructor. More...
 
 Scene (const Scene &scene)
 Explicitly implemented deep copy (performs complete deep copy of all cameras and objects) More...
 
Sceneoperator= (const Scene &scene)
 Assignment operator (complete deep copy) More...
 
void addCamera (const Camera &cam, float visSize=1.0)
 Adds a new Camera to the scene. More...
 
void removeCamera (int index)
 removed the camera at given index More...
 
CameragetCamera (int camIndex=0)
 returns a reference to the i-th camera More...
 
const CameragetCamera (int camIndex=0) const
 returns the i-th scene camera More...
 
int getCameraCount () const
 returns the count of contained cameras More...
 
std::vector< Camera * > getAllCameras (int firstIndex=0, int num=-1)
 returns a vector with pointers to all cameras in given range More...
 
void addObject (SceneObject *object, bool passOwnerShip=false)
 adds a new top-level object to the Scene instance More...
 
void removeObject (int idx)
 removed object at given index More...
 
void removeObject (const SceneObject *obj)
 removes given top-level object from scene (not recursive) More...
 
void removeObjects (int startIndex, int endIndex=-1)
 removed object at given indices More...
 
int getObjectCount () const
 returns the number of top-level objects More...
 
SceneObjectgetObject (int index)
 returns contained object at given index More...
 
const SceneObjectgetObject (int index) const
 returns contained object at given index (const) More...
 
SceneObjectgetObject (const std::vector< int > recursiveIndices)
 returns a child that is deeper in the scene graph More...
 
SceneObjectgetObject (const std::vector< int > recursiveIndices) const
 returns a child that is deeper in the scene graph (const) More...
 
std::vector< int > findPath (const SceneObject *o) const
 finds the recursive indices for a given object. More...
 
void clear (bool camerasToo=false)
 deletes and removes all objects, handlers and callbacks More...
 
qt::MouseHandlergetMouseHandler (int camIndex=0)
 returns a mouse handler that adapts the scene's camera using mouse-interaction More...
 
void setMouseHandler (SceneMouseHandler *sceneMouseHandler, int camIndex=0)
 registeres a custom SceneMouseHandler for given camera index More...
 
qt::ICLDrawWidget3D::GLCallbackgetGLCallback (int camIndex)
 returns a callback that is used to render the scene into a GL-context More...
 
const core::Img8urender (int camIndx, const core::ImgBase *background=0, core::Img32f *depthBuffer=0, DepthBufferMode mode=DistToCamCenter, bool fastRendering=false)
 
void setDrawCamerasEnabled (bool enabled)
 sets wheter cameras are also visualized in scenes. More...
 
bool getDrawCamerasEnabled () const
 returns whether cameras are visualized More...
 
void setDrawLightsEnabled (bool enabled, float lightSize=1)
 sets wheter lights are also visualized in scenes. More...
 
bool getDrawLightsEnabled () const
 returns whether lights are visualized More...
 
void setDrawCoordinateFrameEnabled (bool enabled, float size=120)
 sets wheter a coordinate frame is automatically inserted into the scene More...
 
bool getDrawCoordinateFrameEnabled () const
 returns wheter a coordinate frame is automatically shown in the scene More...
 
void setDrawObjectFramesEnabled (bool enabled, float size)
 sets whether all object frames are visualized More...
 
bool getDrawObjectFramesEnabled () const
 returns whether object frames are visualized More...
 
void setCursor (Vec newPosition)
 sets the Position of the cursor More...
 
Vec getCursor ()
 gets the Position of the cursor More...
 
void activateCursor (bool activate=true)
 activate or deactivate the cursor More...
 
SceneLightgetLight (int index)
 returns a reference to a light with given index More...
 
const SceneLightgetLight (int index) const
 returns a const reference to a light with given index More...
 
void setLightingEnabled (bool flag)
 sets whether OpenGL's lighting is globally activated More...
 
void setGlobalAmbientLight (const GeomColor &color)
 this can be used to change OpenGL's global ambient light color More...
 
Hit findObject (int camIndex, int xScreen, int yScreen)
 picks the closest contained scene-object clicked at given ScreenPosition More...
 
Hit findObject (const ViewRay &v)
 picks the first object that is hit by the given viewray More...
 
std::vector< HitfindObjects (const ViewRay &v)
 retunrs all objects intersected by the given viewray More...
 
std::vector< HitfindObjects (int camIndex, int xScreen, int ySceen)
 retunrs all objects on that are intersected by the defined cameras viewray through given x and y More...
 
void setBounds (float minX, float maxX=0, float minY=0, float mayY=0, float minZ=0, float maxZ=0)
 sets the expected bounds of contained objects More...
 
void setBackgroundColor (const GeomColor &color)
 sets the scene's background color (alpha is not used) More...
 
GeomColor getBackgroundColor () const
 returns the current background colo More...
 
virtual void grab (PointCloudObjectBase &dst)
 implements the PointCloudGrabber interface More...
 
- Public Member Functions inherited from icl::utils::Lockable
 Lockable (bool recursive=false)
 Default constructor. More...
 
 Lockable (const Lockable &l)
 copy constructor (does not copy the source mutex) More...
 
Lockableoperator= (const Lockable &l)
 assignment operator (does not copy the source mutex) More...
 
 ~Lockable ()
 Destructor. More...
 
void lock () const
 lock object More...
 
void unlock () const
 unlock object More...
 
MutexgetMutex () const
 returns mutex of this object More...
 
- Public Member Functions inherited from icl::geom::PointCloudGrabber
virtual ~PointCloudGrabber ()
 virtual, but empty destructor More...
 
virtual const core::Img32fgetDepthImage () const
 returns the last grabbed point cloud's underlying depth image (if available) More...
 
virtual const core::Img8ugetColorImage () const
 returns the last grabbed point cloud's underlying depth image (if available) More...
 
virtual Camera getDepthCamera () const
 returns current depth camera (CAN be implemented by implementation More...
 
virtual Camera getColorCamera () const
 
virtual void setCameraWorldFrame (const math::FixedMatrix< float, 4, 4 > &T)
 
virtual void reinit (const std::string &description)
 re-initializes the current device More...
 
- Public Member Functions inherited from icl::utils::Configurable
virtual ~Configurable ()
 virtual destructor More...
 
 Configurable (const Configurable &other)
 Copy constructor. More...
 
Configurableoperator= (const Configurable &other)
 Assignment operator. More...
 
void setConfigurableID (const std::string &ID)
 sets the ID of this configurable More...
 
const std::string & getConfigurableID () const
 returns the configurables static ID More...
 
bool isOrderedFlagSet () const
 returns whether the ordered flag is set More...
 
void deactivateProperty (const std::string &pattern)
 adds an additional deativation pattern More...
 
void deleteDeactivationPattern (const std::string &pattern)
 removed a formerly added deactivation pattern More...
 
std::vector< std::string > getPropertyListWithoutDeactivated () const
 this returns a filtered list of properties (using all filters added by deactivateProperty) More...
 
virtual void adaptProperty (const std::string &name, const std::string &newType, const std::string &newInfo, const std::string &newToolTip)
 this function can be used to adapt a specific property afterwards More...
 
void registerCallback (const Callback &cb)
 add a callback for changed properties More...
 
void removedCallback (const Callback &cb)
 removes a callback that was registered before More...
 
void syncChangesTo (Configurable *others, int num=1)
 this can be used to let this instance also apply property changes to others More...
 
virtual void setPropertyValue (const std::string &propertyName, const Any &value)
 sets a property value More...
 
virtual std::vector< std::string > getPropertyList () const
 returns a list of All properties, that can be set using setProperty More...
 
virtual bool supportsProperty (const std::string &propertyName) const
 base implementation for property check (seaches in the property list) More...
 
virtual void saveProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC) const
 writes all available properties into a file More...
 
virtual void loadProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC)
 reads a camera config file from disc More...
 
virtual std::string getPropertyType (const std::string &propertyName) const
 get type of property More...
 
virtual std::string getPropertyInfo (const std::string &propertyName) const
 get information of a properties valid values More...
 
virtual Any getPropertyValue (const std::string &propertyName) const
 returns the current value of a property or a parameter More...
 
virtual std::string getPropertyToolTip (const std::string &propertyName) const
 returns the tooltip description for a given property More...
 
virtual int getPropertyVolatileness (const std::string &propertyName) const
 Returns whether this property may be changed internally. More...
 

Public Attributes

icl::qt::GLFragmentShaderm_shaders [ShaderUtil::COUNT]
 renders the current scene using an instance of pbuffer More...
 
RenderSettings * m_renderSettings
 
FBOData * m_fboData
 

Protected Member Functions

void createDisplayList (SceneObject *o) const
 creates a displaylist for the given object More...
 
void freeDisplayList (SceneObject *o) const
 frees the display list, that is associated with an object More...
 
void renderScene (int camIndex, qt::ICLDrawWidget3D *widget=0) const
 internally used rendering method More...
 
void renderShadow (const unsigned int light, const unsigned int shadow, unsigned int size, int camID) const
 renders the shadowmap More...
 
void renderSceneObjectRecursiveShadow (ShaderUtil *util, SceneObject *o, int camID) const
 
void renderSceneObjectRecursive (SceneObject *o, int camID) const
 internally used rendering method for recursive rendering of the scene graph More...
 
void renderSceneObjectRecursive (ShaderUtil *util, SceneObject *o, int camID) const
 internally used rendering method for recursive rendering of the scene graph More...
 
void renderObjectFramesRecursive (SceneObject *o, SceneObject *cs, int camID) const
 recursively renders object frames for all scene objects More...
 
float getMaxSceneDim () const
 internally used utility method that computes the extend of the Scene content More...
 
void extendMaxSceneDimRecursive (float &minX, float &maxX, float &minY, float &maxY, float &minZ, float &maxZ, SceneObject *o) const
 recursive utility method More...
 
void freeAllPBuffers ()
 frees all pbuffers allocated before More...
 
void freePBuffer (const utils::Size &size)
 frees the pbffer associated with given size (if there is one) More...
 
- Protected Member Functions inherited from icl::utils::Configurable
void addProperty (const std::string &name, const std::string &type, const std::string &info, const Any &value=Any(), const int volatileness=0, const std::string &tooltip=std::string())
 This can be used by derived classes to store supported properties in the internal list. More...
 
void addChildConfigurable (Configurable *configurable, const std::string &childPrefix="")
 This adds another configurable as child. More...
 
void removeChildConfigurable (Configurable *configurable)
 removes the given child configurable More...
 
Propertyprop (const std::string &propertyName)
 this CAN be used e.g. to store a property value in internal property-list More...
 
const Propertyprop (const std::string &propertyName) const
 this CAN be used e.g. to store a property value in internal property-list More...
 
 Configurable (const std::string &ID="", bool ordered=true)
 create this configurable with given ID More...
 
void call_callbacks (const std::string &propertyName, const Configurable *caller) const
 calls all registered callbacks More...
 

Protected Attributes

std::vector< Cameram_cameras
 internal list of cameras More...
 
std::vector< utils::SmartPtr< SceneObject > > m_objects
 internal list of top-level objects More...
 
std::vector< utils::SmartPtr< SceneObject > > m_cameraObjects
 internal list of top-level camera objects used for camera visualization More...
 
std::vector< utils::SmartPtr< SceneMouseHandler > > m_mouseHandlers
 internally used list of mouse handlers More...
 
std::vector< utils::SmartPtr< GLCallback > > m_glCallbacks
 internally used list of callbacks More...
 
std::map< PBufferIndex, PBuffer * > m_pbuffers
 
utils::SmartPtr< SceneObjectm_coordinateFrameObject
 internally used scene object More...
 
utils::SmartPtr< SceneObjectm_objectFrameObject
 also internally used object frame object More...
 
utils::SmartPtr< SceneLightm_lights [8]
 internal list of lights More...
 
utils::SmartPtr< SceneObjectm_shadowCameraObjects [8]
 list of cameras for visualisation of shadowcameras More...
 
bool m_previousLightState [8][4]
 previous lightstate More...
 
utils::SmartArray< utils::Range32f > m_bounds
 optionally given bounds of the scene More...
 
math::FixedColVector< int, 4 > m_globalAmbientLight
 global ambient light More...
 
GeomColor m_backgroundColor
 current scene background color More...
 
utils::FPSEstimator m_fps
 
- Protected Attributes inherited from icl::utils::Configurable
std::vector< Callbackcallbacks
 internally managed list of callbacks More...
 

Static Private Member Functions

static void freeDisplayList (void *handle)
 called from the SceneObject class More...
 

Private Attributes

SceneObjectm_cursor
 

Friends

class SceneObject
 make SceneObject friend of Scene More...
 

Additional Inherited Members

- Static Public Member Functions inherited from icl::utils::Configurable
static std::string create_default_ID (const std::string &prefix)
 this function can be used in subclasses to create a default ID More...
 
static Configurableget (const std::string &id)
 returns configurable by given ID More...
 
static void register_configurable_type (const std::string &classname, Function< Configurable * > creator)
 registers a configurable type More...
 
static std::vector< std::string > get_registered_configurables ()
 returns a list of all registered configurable classnames More...
 
static Configurablecreate_configurable (const std::string &classname)
 creates a configurable by given name More...
 
- Static Public Attributes inherited from icl::utils::Configurable
static const std::vector< std::string > EMPTY_VEC
 used as shortcut – just an empty vector of std::strings More...
 

Detailed Description

Scene Implementation that is used to handle a list of objects and cameras.

The scene combines visual objects (icl::SceneObject) which define nodes of a scene graph and cameras. You can use ICL's camera calibration tool icl-cam-calib (and icl-cam-calib-2) to calibrate cameras in your scene. Later, you can define a scene (including SceneObject-instances) and use the calibrated camera to draw the Scene as an image overlay.

The following example demonstrates how to use the Scene class. The example can also be found at ICLGeom/examples/geom-demo-simple.cpp. A more complex demo that also uses the Scene's scene graph can be found at ICLGeom/examples/scene-graph-demo.cpp

#include <ICLQt/Common.h>
#include <ICLGeom/Geom.h>
// global data
Scene scene;
void init(){
// create graphical user interface with a scene's viewport set of size 640x480
gui << Draw3D(utils::Size(640,480)).minSize(16,12).handle("draw").label("scene view")
<< FSlider(0.5,20,3).out("f").handle("focal").label("focal length").maxSize(100,3);
gui.show();
// create camera and add to scene instance
Camera cam(Vec(0,0,-10), // position
Vec(0,0,1), // view-direction
Vec(1,0,0)); // up-direction
scene.addCamera(cam);
if(pa("-o")){ // either load an .obj file
scene.addObject(new SceneObject(*pa("-o")));
}else{ // or create a simple cube
float data[] = {0,0,0,7,3,2};
scene.addObject(new SceneObject("cuboid",data));
}
// link the scene's first camera with mouse gestures in the draw-GUI-component
gui["draw"].install(scene.getMouseHandler(0));
}
void run(){
DrawHandle3D draw = gui["draw"]; // get the draw-GUI compoment
scene.getCamera(0).setFocalLength(gui["f"]); // update the camera's focal length
// now simply copy and past this block ...
draw->link(scene.getGLCallback(0)); // render the whole scene
draw.render(); // post an update-event (don't use draw->render() !!)
static FPSLimiter limiter(25);
limiter.wait();
}
int main(int n, char**ppc){
return ICLApplication(n,ppc,"-obj|-o(.obj-filename)",init,run).exec();
}
 

Member Enumeration Documentation

◆ DepthBufferMode

Enumerator
RawDepth01 

raw core::depth buffer in range [0,1]

DistToCamPlane 

core::depth buffer values define distance to the camera's z=0 plane

DistToCamCenter 

core::depth buffer values define distanct to the camera center

Constructor & Destructor Documentation

◆ Scene() [1/2]

icl::geom::Scene::Scene ( )

Base constructor (creates an empty scene)

◆ ~Scene()

icl::geom::Scene::~Scene ( )

Destructor.

◆ Scene() [2/2]

icl::geom::Scene::Scene ( const Scene scene)

Explicitly implemented deep copy (performs complete deep copy of all cameras and objects)

Member Function Documentation

◆ activateCursor()

void icl::geom::Scene::activateCursor ( bool  activate = true)

activate or deactivate the cursor

◆ addCamera()

void icl::geom::Scene::addCamera ( const Camera cam,
float  visSize = 1.0 
)

Adds a new Camera to the scene.

Parameters
camwhich is copied into the scene
visSizethis parameter determines the size of the 3D visualized cameras in the scene. If visSize is 1.0, The camera coordinate system is visualized with size 50x50x50. Actually, the visSize you need depends on the unit you use for your scene in your application. The default visSize is quite appropriate if you work with mm. If you e.g. use cm instead, visSize should be set to 0.1.

◆ addObject()

void icl::geom::Scene::addObject ( SceneObject object,
bool  passOwnerShip = false 
)

adds a new top-level object to the Scene instance

By default, the object's memory is managed externally. If you want to pass the ownership to the Scene instance, you have to set passOwnerShip to true.

◆ clear()

void icl::geom::Scene::clear ( bool  camerasToo = false)

deletes and removes all objects, handlers and callbacks

If camerasToo is set to true, also all cameras are removed

◆ createDisplayList()

void icl::geom::Scene::createDisplayList ( SceneObject o) const
protected

creates a displaylist for the given object

◆ extendMaxSceneDimRecursive()

void icl::geom::Scene::extendMaxSceneDimRecursive ( float &  minX,
float &  maxX,
float &  minY,
float &  maxY,
float &  minZ,
float &  maxZ,
SceneObject o 
) const
protected

recursive utility method

◆ findObject() [1/2]

Hit icl::geom::Scene::findObject ( int  camIndex,
int  xScreen,
int  yScreen 
)
inline

picks the closest contained scene-object clicked at given ScreenPosition

returns 0 if no object was hit, if contactPos is not 0, the 3D-contact position is stored there.

◆ findObject() [2/2]

Hit icl::geom::Scene::findObject ( const ViewRay v)

picks the first object that is hit by the given viewray

The first object that is returned has the smallest distance to the given viewRay's offset. If contactPos is not 0, the contact point is stored there.

◆ findObjects() [1/2]

std::vector<Hit> icl::geom::Scene::findObjects ( const ViewRay v)

retunrs all objects intersected by the given viewray

◆ findObjects() [2/2]

std::vector<Hit> icl::geom::Scene::findObjects ( int  camIndex,
int  xScreen,
int  ySceen 
)
inline

retunrs all objects on that are intersected by the defined cameras viewray through given x and y

◆ findPath()

std::vector<int> icl::geom::Scene::findPath ( const SceneObject o) const

finds the recursive indices for a given object.

If no exceptions are thrown, getObject(findPath(o)) is always o. throws ans exception if the given object cannot be found.

◆ freeAllPBuffers()

void icl::geom::Scene::freeAllPBuffers ( )
protected

frees all pbuffers allocated before

◆ freeDisplayList() [1/2]

void icl::geom::Scene::freeDisplayList ( SceneObject o) const
protected

frees the display list, that is associated with an object

◆ freeDisplayList() [2/2]

static void icl::geom::Scene::freeDisplayList ( void *  handle)
staticprivate

called from the SceneObject class

◆ freePBuffer()

void icl::geom::Scene::freePBuffer ( const utils::Size size)
protected

frees the pbffer associated with given size (if there is one)

◆ getAllCameras()

std::vector<Camera*> icl::geom::Scene::getAllCameras ( int  firstIndex = 0,
int  num = -1 
)

returns a vector with pointers to all cameras in given range

Please note, that the results become invalid if addCamera() or removeCamera() was called. If 'num' selects more cameras than possible, is it just increased appropriately automatically.

◆ getBackgroundColor()

GeomColor icl::geom::Scene::getBackgroundColor ( ) const

returns the current background colo

◆ getCamera() [1/2]

Camera& icl::geom::Scene::getCamera ( int  camIndex = 0)

returns a reference to the i-th camera

This can also be used to set the camera or to set's some of it's properties:

// set a totally new camera
scene.getCamera(0) = Camera(...);
// update the focal length only
scene.getCamera(0).setFocalLength(77);

◆ getCamera() [2/2]

const Camera& icl::geom::Scene::getCamera ( int  camIndex = 0) const

returns the i-th scene camera

◆ getCameraCount()

int icl::geom::Scene::getCameraCount ( ) const
inline

returns the count of contained cameras

◆ getCursor()

Vec icl::geom::Scene::getCursor ( )

gets the Position of the cursor

◆ getDrawCamerasEnabled()

bool icl::geom::Scene::getDrawCamerasEnabled ( ) const

returns whether cameras are visualized

◆ getDrawCoordinateFrameEnabled()

bool icl::geom::Scene::getDrawCoordinateFrameEnabled ( ) const

returns wheter a coordinate frame is automatically shown in the scene

◆ getDrawLightsEnabled()

bool icl::geom::Scene::getDrawLightsEnabled ( ) const

returns whether lights are visualized

◆ getDrawObjectFramesEnabled()

bool icl::geom::Scene::getDrawObjectFramesEnabled ( ) const

returns whether object frames are visualized

◆ getGLCallback()

qt::ICLDrawWidget3D::GLCallback* icl::geom::Scene::getGLCallback ( int  camIndex)

returns a callback that is used to render the scene into a GL-context

please see ICLQt::ICLDrawWidget3D::callback

◆ getLight() [1/2]

SceneLight& icl::geom::Scene::getLight ( int  index)

returns a reference to a light with given index

The returned reference cam be used to set lighting parameters. Since OpenGL does only support 8 lights, allowed indices are 0-7. If another index is passed, an exception is thrown.

◆ getLight() [2/2]

const SceneLight& icl::geom::Scene::getLight ( int  index) const

returns a const reference to a light with given index

Since OpenGL does only support 8 lights, allowed indices are 0-7. If another index is passed, an exception is thrown.

◆ getMaxSceneDim()

float icl::geom::Scene::getMaxSceneDim ( ) const
protected

internally used utility method that computes the extend of the Scene content

The extend is used when scene mouse handlers are created. Here, it will e.g. compute a usefull step when moving forward or strafing.

◆ getMouseHandler()

qt::MouseHandler* icl::geom::Scene::getMouseHandler ( int  camIndex = 0)

returns a mouse handler that adapts the scene's camera using mouse-interaction

◆ getObject() [1/4]

SceneObject* icl::geom::Scene::getObject ( int  index)

returns contained object at given index

If the index is not valid, an exception is thrown

◆ getObject() [2/4]

const SceneObject* icl::geom::Scene::getObject ( int  index) const

returns contained object at given index (const)

If the index is not valid, an exception is thrown

◆ getObject() [3/4]

SceneObject* icl::geom::Scene::getObject ( const std::vector< int >  recursiveIndices)

returns a child that is deeper in the scene graph

e.g. if recursiveIndices is [1,2,3], then first, the Scene's object at index 1 is used. Then this objects child at index 2. And finally that objects child at index 3 is returned. An exception is thrown if one of the indices is wrong.

◆ getObject() [4/4]

SceneObject* icl::geom::Scene::getObject ( const std::vector< int >  recursiveIndices) const

returns a child that is deeper in the scene graph (const)

e.g. if recursiveIndices is [1,2,3], then first, the Scene's object at index 1 is used. Then this objects child at index 2. And finally that objects child at index 3 is returned. An exception is thrown if one of the indices is wrong.

◆ getObjectCount()

int icl::geom::Scene::getObjectCount ( ) const
inline

returns the number of top-level objects

◆ grab()

virtual void icl::geom::Scene::grab ( PointCloudObjectBase dst)
virtual

implements the PointCloudGrabber interface

Internally uses the camera index that can be defined by setting the int-property "point cloud grabber cam" by setting the "grab depth feature" property, the destination point cloud will be filled with a depth -field as well

Implements icl::geom::PointCloudGrabber.

◆ operator=()

Scene& icl::geom::Scene::operator= ( const Scene scene)

Assignment operator (complete deep copy)

◆ removeCamera()

void icl::geom::Scene::removeCamera ( int  index)

removed the camera at given index

◆ removeObject() [1/2]

void icl::geom::Scene::removeObject ( int  idx)

removed object at given index

The object is deleted if it's ownwership was passed

◆ removeObject() [2/2]

void icl::geom::Scene::removeObject ( const SceneObject obj)

removes given top-level object from scene (not recursive)

The object is deleted if it's ownwership was passed

◆ removeObjects()

void icl::geom::Scene::removeObjects ( int  startIndex,
int  endIndex = -1 
)

removed object at given indices

The object's are deleted if their ownwership was passed

◆ render()

const core::Img8u& icl::geom::Scene::render ( int  camIndx,
const core::ImgBase background = 0,
core::Img32f depthBuffer = 0,
DepthBufferMode  mode = DistToCamCenter,
bool  fastRendering = false 
)

◆ renderObjectFramesRecursive()

void icl::geom::Scene::renderObjectFramesRecursive ( SceneObject o,
SceneObject cs,
int  camID 
) const
protected

recursively renders object frames for all scene objects

◆ renderScene()

void icl::geom::Scene::renderScene ( int  camIndex,
qt::ICLDrawWidget3D widget = 0 
) const
protected

internally used rendering method

◆ renderSceneObjectRecursive() [1/2]

void icl::geom::Scene::renderSceneObjectRecursive ( SceneObject o,
int  camID 
) const
inlineprotected

internally used rendering method for recursive rendering of the scene graph

◆ renderSceneObjectRecursive() [2/2]

void icl::geom::Scene::renderSceneObjectRecursive ( ShaderUtil util,
SceneObject o,
int  camID 
) const
protected

internally used rendering method for recursive rendering of the scene graph

◆ renderSceneObjectRecursiveShadow()

void icl::geom::Scene::renderSceneObjectRecursiveShadow ( ShaderUtil util,
SceneObject o,
int  camID 
) const
protected

◆ renderShadow()

void icl::geom::Scene::renderShadow ( const unsigned int  light,
const unsigned int  shadow,
unsigned int  size,
int  camID 
) const
protected

renders the shadowmap

◆ setBackgroundColor()

void icl::geom::Scene::setBackgroundColor ( const GeomColor color)

sets the scene's background color (alpha is not used)

channel ranges are assumed to be in [0,255]. The default background color is black

◆ setBounds()

void icl::geom::Scene::setBounds ( float  minX,
float  maxX = 0,
float  minY = 0,
float  mayY = 0,
float  minZ = 0,
float  maxZ = 0 
)

sets the expected bounds of contained objects

The set information is used when a mouse-handler is created, in order to estimate appropriate step sizes. If the scene bounds were not explicitly, the scene tries to infer this information from the contained objects
Each [min-max] range where min=max, is automatically set to [minX,maxX]. If additionally, minX is equal to maxX, max is is set to -minX. If the resulting x-range has still zero length, the bounds are deleted internally

◆ setCursor()

void icl::geom::Scene::setCursor ( Vec  newPosition)

sets the Position of the cursor

◆ setDrawCamerasEnabled()

void icl::geom::Scene::setDrawCamerasEnabled ( bool  enabled)

sets wheter cameras are also visualized in scenes.

This means, that you will be able to see e.g. camera 1 in the view of camera 0

◆ setDrawCoordinateFrameEnabled()

void icl::geom::Scene::setDrawCoordinateFrameEnabled ( bool  enabled,
float  size = 120 
)

sets wheter a coordinate frame is automatically inserted into the scene

◆ setDrawLightsEnabled()

void icl::geom::Scene::setDrawLightsEnabled ( bool  enabled,
float  lightSize = 1 
)

sets wheter lights are also visualized in scenes.

◆ setDrawObjectFramesEnabled()

void icl::geom::Scene::setDrawObjectFramesEnabled ( bool  enabled,
float  size 
)

sets whether all object frames are visualized

◆ setGlobalAmbientLight()

void icl::geom::Scene::setGlobalAmbientLight ( const GeomColor color)

this can be used to change OpenGL's global ambient light color

by default, we use a very weak white ambient background light of [255,255,255,20]. The color values are given in ranges [0,255]

◆ setLightingEnabled()

void icl::geom::Scene::setLightingEnabled ( bool  flag)

sets whether OpenGL's lighting is globally activated

by default, lighting is activated

◆ setMouseHandler()

void icl::geom::Scene::setMouseHandler ( SceneMouseHandler sceneMouseHandler,
int  camIndex = 0 
)

registeres a custom SceneMouseHandler for given camera index

Friends And Related Function Documentation

◆ SceneObject

friend class SceneObject
friend

make SceneObject friend of Scene

Member Data Documentation

◆ m_backgroundColor

GeomColor icl::geom::Scene::m_backgroundColor
protected

current scene background color

◆ m_bounds

utils::SmartArray<utils::Range32f> icl::geom::Scene::m_bounds
protected

optionally given bounds of the scene

◆ m_cameraObjects

std::vector<utils::SmartPtr<SceneObject> > icl::geom::Scene::m_cameraObjects
protected

internal list of top-level camera objects used for camera visualization

◆ m_cameras

std::vector<Camera> icl::geom::Scene::m_cameras
protected

internal list of cameras

◆ m_coordinateFrameObject

utils::SmartPtr<SceneObject> icl::geom::Scene::m_coordinateFrameObject
mutableprotected

internally used scene object

◆ m_cursor

SceneObject* icl::geom::Scene::m_cursor
private

◆ m_fboData

FBOData* icl::geom::Scene::m_fboData
mutable

◆ m_fps

utils::FPSEstimator icl::geom::Scene::m_fps
protected

◆ m_glCallbacks

std::vector<utils::SmartPtr<GLCallback> > icl::geom::Scene::m_glCallbacks
protected

internally used list of callbacks

◆ m_globalAmbientLight

math::FixedColVector<int,4> icl::geom::Scene::m_globalAmbientLight
protected

global ambient light

◆ m_lights

utils::SmartPtr<SceneLight> icl::geom::Scene::m_lights[8]
protected

internal list of lights

◆ m_mouseHandlers

std::vector<utils::SmartPtr<SceneMouseHandler> > icl::geom::Scene::m_mouseHandlers
protected

internally used list of mouse handlers

◆ m_objectFrameObject

utils::SmartPtr<SceneObject> icl::geom::Scene::m_objectFrameObject
mutableprotected

also internally used object frame object

◆ m_objects

std::vector<utils::SmartPtr<SceneObject> > icl::geom::Scene::m_objects
protected

internal list of top-level objects

◆ m_pbuffers

std::map<PBufferIndex, PBuffer*> icl::geom::Scene::m_pbuffers
mutableprotected

◆ m_previousLightState

bool icl::geom::Scene::m_previousLightState[8][4]
mutableprotected

previous lightstate

◆ m_renderSettings

RenderSettings* icl::geom::Scene::m_renderSettings
mutable

◆ m_shaders

icl::qt::GLFragmentShader* icl::geom::Scene::m_shaders[ShaderUtil::COUNT]
mutable

renders the current scene using an instance of pbuffer

This method is currently only supported on linux systems, since the used pbuffer (OpenGL offscreen framebuffer object)

The method trys to create a default r8 g8 b8 pbuffer with 24Bit depthbuffer. If this is not supported, an at least 4 4 4 16 context is tryed to be created. If this does also fail, an exception will be thrown.

Shared Offsceen Rendering

When a single scene is used for both on- and offscreen rendering, an internal optimation needs to be deactivated by calling Scene::enableSharedOffscreenRendering.

Please note: The rendering pbuffer is allocated on the graphics card. Per definition, pbuffers are located in the screenbuffer memory segment which might be much smaller than the actual memory of your graphics card. Therefore, it is strongly recommended to free all pbuffers when they are no longer used. The pbuffer that is created to render the image in this method is stored internally and it will remain allocated for later use. If you need to render images of different sizes (the output image is rendered to the image size that the camera at given index has), you should free the pbuffers from time to time using Scene::freeAllPBuffers and Scene::freePBuffer(const utils::Size&).

If a non-null depthBuffer parameter is provided, it is filled with data from the scene core::depth buffer usually, the raw core::depth buffer does not provide useful information for further processing. In OpenGL, the standard core::depth buffer values are highly non-linearily distributed within the near and far clipping plane. If the core::depth buffer mode is not RawDepth01, this is compensated and the core::depth buffer is filled with (metric) core::depth values that denote either a pixel's distance to the z=0 plane in camera space or the distance to the camera center. For correcting the linearized core::depth buffer values that are computed for the DistToCamPlane mode, a set of correction coefficients has to be computed, which entails creation of all camera viewrays. This can last about a second in the first call. In later calls, the values are just re-used.Vector containing the shaders used in ImprovedShading

◆ m_shadowCameraObjects

utils::SmartPtr<SceneObject> icl::geom::Scene::m_shadowCameraObjects[8]
protected

list of cameras for visualisation of shadowcameras


The documentation for this class was generated from the following file: