Image Component Library (ICL)
Public Member Functions | List of all members
icl::physics::PhysicsScene Class Reference

#include <PhysicsScene.h>

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

Public Member Functions

 PhysicsScene (PhysicsWorld::BulletSolverType type=PhysicsWorld::Default)
 
void addObject (PhysicsObject *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 (PhysicsObject *obj)
 removes given top-level object from scene (not recursive) More...
 
void removeObjects (int startIndex, int endIndex=-1)
 removed object at given indices More...
 
- Public Member Functions inherited from icl::geom::Scene
 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) throw (utils::ICLException)
 returns contained object at given index More...
 
const SceneObjectgetObject (int index) const throw (utils::ICLException)
 returns contained object at given index (const) More...
 
SceneObjectgetObject (const std::vector< int > recursiveIndices) throw (utils::ICLException)
 returns a child that is deeper in the scene graph More...
 
SceneObjectgetObject (const std::vector< int > recursiveIndices) const throw (utils::ICLException)
 returns a child that is deeper in the scene graph (const) More...
 
std::vector< int > findPath (const SceneObject *o) const throw (utils::ICLException)
 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) throw (utils::ICLException)
 returns a reference to a light with given index More...
 
const SceneLightgetLight (int index) const throw (utils::ICLException)
 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 throw (utils::ICLException)
 returns current depth camera (CAN be implemented by implementation More...
 
virtual Camera getColorCamera () const throw (utils::ICLException)
 
virtual void setCameraWorldFrame (const math::FixedMatrix< float, 4, 4 > &T) throw (utils::ICLException)
 
virtual void reinit (const std::string &description) throw (utils::ICLException)
 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) throw (ICLException)
 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) throw (ICLException)
 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) throw (ICLException)
 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 Member Functions inherited from icl::physics::PhysicsWorld
 PhysicsWorld (BulletSolverType solver_type=Default)
 constructor with given config file name More...
 
 ~PhysicsWorld ()
 Destructor. More...
 
void addObject (PhysicsObject *obj)
 adds a physics object to the world (ownership is not passed) More...
 
void removeObject (PhysicsObject *obj)
 removes the given physics object from the world More...
 
void setGravity (const geom::Vec &gravity)
 sets the Gravity of the World More...
 
void setGravityEnabled (bool on, const geom::Vec *useThisGravityIfOn=0)
 enables/disables gravity More...
 
void splitImpulseEnabled (bool enable)
 enable splitImpulse More...
 
void step (float dtSeconds=-1, int maxSubSteps=10, float fixedTimeStep=1.f/120.f)
 applies physical simulation for the given time step More...
 
double getLastTimeDelta ()
 returns the last delta of time in seconds as a double value. More...
 
bool collideWithWorld (RigidObject *obj, bool ignoreJoints=true)
 check collision of an object with the world More...
 
void setGroupCollision (int group0, int group1, bool collides)
 enables/disables collision between the group0 and group1 More...
 
bool getGroupCollision (int group0, int group1)
 returns wether group0 and group1 collide More...
 
bool rayCast (const geom::ViewRay &ray, float rayLength, PhysicsObject *&obj, geom::Vec &normal, geom::Vec &hitPoint)
 Return true if the ray hit and sets the pointer to the first object that was hit as well as the hit normal and hit point. More...
 
void addConstraint (Constraint *constraint, bool disableCollisionWithLinkedBodies=false, bool passOwnerShip=false)
 adds a constraint to the world More...
 
void removeConstraint (Constraint *constraint)
 removes a cosntraint from the world More...
 
const btSoftBodyWorldInfo * getWorldInfo () const
 returns an internal world-info struct More...
 
btSoftBodyWorldInfo * getWorldInfo ()
 returns an internal world-info struct More...
 

Additional Inherited Members

- Public Types inherited from icl::geom::Scene
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 Types inherited from icl::physics::PhysicsWorld
enum  BulletSolverType {
  SequentialImpulseConstraintSolver, MLCP_Dantzig, NNCG, Lemke,
  Default = SequentialImpulseConstraintSolver
}
 
- 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) throw (ICLException)
 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) throw (ICLException)
 creates a configurable by given name More...
 
- Public Attributes inherited from icl::geom::Scene
icl::qt::GLFragmentShaderm_shaders [ShaderUtil::COUNT]
 renders the current scene using an instance of pbuffer More...
 
RenderSettings * m_renderSettings
 
FBOData * m_fboData
 
- 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...
 
- Protected Member Functions inherited from icl::geom::Scene
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()) throw (ICLException)
 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) throw (ICLException)
 this CAN be used e.g. to store a property value in internal property-list More...
 
const Propertyprop (const std::string &propertyName) const throw (ICLException)
 this CAN be used e.g. to store a property value in internal property-list More...
 
 Configurable (const std::string &ID="", bool ordered=true) throw (ICLException)
 create this configurable with given ID More...
 
void call_callbacks (const std::string &propertyName, const Configurable *caller) const
 calls all registered callbacks More...
 
- Protected Member Functions inherited from icl::physics::PhysicsWorld
void removeContactPoints (PhysicsObject *obj)
 removes contactpoints (used when the collisionshape of an object has changed) More...
 
- Protected Member Functions inherited from icl::utils::Uncopyable
 Uncopyable ()
 Empty base constructor. More...
 
- Protected Attributes inherited from icl::geom::Scene
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...
 

Constructor & Destructor Documentation

icl::physics::PhysicsScene::PhysicsScene ( PhysicsWorld::BulletSolverType  type = PhysicsWorld::Default)

Member Function Documentation

void icl::physics::PhysicsScene::addObject ( PhysicsObject 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.

void icl::physics::PhysicsScene::removeObject ( int  idx)

removed object at given index

The object is deleted if it's ownwership was passed

void icl::physics::PhysicsScene::removeObject ( PhysicsObject obj)

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

The object is deleted if it's ownwership was passed

void icl::physics::PhysicsScene::removeObjects ( int  startIndex,
int  endIndex = -1 
)

removed object at given indices

The object's are deleted if their ownwership was passed


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