Image Component Library (ICL)
|
A Box that can with RigidObject features. More...
#include <RigidBoxObject.h>
Public Member Functions | |
RigidBoxObject (float x, float y, float z, float dx, float dy, float dz, float mass=1.0) | |
Constructor that takes the position and dimensions, as well as mass of the box. More... | |
Public Member Functions inherited from icl::physics::RigidObject | |
RigidObject () | |
RigidObject. More... | |
virtual btRigidBody * | getRigidBody () |
virtual const btRigidBody * | getRigidBody () const |
returns internal physical object as rigidBody (const) More... | |
void | setLinearVelocity (geom::Vec velocity) |
sets the linear velocity of that object More... | |
void | setAngularVelocity (geom::Vec velocity) |
sets the angular velocity of that object More... | |
geom::Vec | getLinearVelocity () |
returns the linear velocity of that object More... | |
geom::Vec | getAngularVelocity () |
returns the angular velocity of that object More... | |
geom::Vec | getTotalForce () |
geom::Vec | getTotalTorque () |
void | applyForce (geom::Vec force, geom::Vec relPos) |
apply a force at the point relPos More... | |
void | applyCentralForce (geom::Vec force) |
apply a force to the center More... | |
void | applyImpulse (geom::Vec force, geom::Vec relPos) |
apply an impulse at the point relPos More... | |
void | applyCentralImpulse (geom::Vec force) |
apply an impulse to the center More... | |
void | applyTorque (geom::Vec t) |
apply a torque to the center More... | |
void | applyTorqueImpulse (geom::Vec t) |
apply a torque impulse to the center More... | |
void | setDeactivationTime (float time) |
void | setDamping (float linear, float angular) |
sets the angular and linear damping of that object More... | |
void | setActivationMode (ActivationMode const mode) |
sets the corresponding bullet activation state for this object More... | |
void | setActive (bool force_active=false) |
activates this component regarding the current activation mode More... | |
virtual | ~RigidObject () |
float | getMass () |
returns the mass of the object More... | |
void | setMass (float mass) |
sets the mass of the object. 0 weight makes the object static. More... | |
Public Member Functions inherited from icl::physics::PhysicsObject | |
PhysicsObject () | |
Default constructor (initializint m_physicalObject with 0) More... | |
virtual | ~PhysicsObject () |
Destructor (freeing m_physicalObject if not 0) More... | |
void | setPhysicalObject (btCollisionObject *obj) |
sets the physical object (delets the old one of not 0) More... | |
void | forgetPhysicalObject (bool removeFromWorld=true) |
sets the internal physical object o null, but wont delete it! More... | |
virtual btCollisionObject * | getCollisionObject () |
returns internal physical object as collision object More... | |
virtual const btCollisionObject * | getCollisionObject () const |
virtual void | updateSceneObject () |
this method is used to update the visualization object from the physical object More... | |
virtual void | prepareForRendering () |
called by the scene before it's rendered (calling purely virtual updateSceneObject) More... | |
virtual void | setTransformation (const geom::Mat &m) |
Sets the transform of this object. Scaling or shearing is not supported: Use setScale instead. More... | |
virtual void | transform (const geom::Mat &m) |
applies the given transformation matrix. Scaling or shearing is not supported: Use setScale instead. More... | |
geom::Mat | getTransformation () |
returns the transformation of this object More... | |
void | setScale (geom::Vec scale) |
geom::Vec | getScale () |
void | setCollisionMargin (float margin) |
sets the collision margin for this object More... | |
void | setFriction (float friction) |
sets the friction of this object More... | |
void | setRollingFriction (float friction) |
sets the rolling friction of this obect More... | |
void | setCollisionGroup (int group) |
sets the collision group of this object More... | |
int | getCollisionGroup () |
returns the collision group of this object More... | |
void | setContactResponse (bool response) |
enables or disable collision with other objects More... | |
bool | hasContactResponse () |
Checks if the object has a collisionresponse. More... | |
void | setRestitution (float restitution) |
sets the restitution of this object More... | |
void | activate (bool forceActivation=false) |
sets the activation mode of this object More... | |
int | getCollisionObjectType () |
void | setCollisionObjectType (int type) |
int | getCollisionFlags () |
void | setCollisionFlags (int flags) |
void | stateChanged () |
sets an internal flag to update the sceneobject More... | |
void | setCurrentPhysicsWorld (PhysicsWorld *world) |
sets an internal pointer to the world the object is currently in More... | |
void | setCollisionCallback (utils::Function< void, PhysicsObject *, PhysicsObject *, geom::Vec > collisionCallback) |
sets the collision callback of the object More... | |
void | collisionCallback (PhysicsObject *self, PhysicsObject *other, geom::Vec pos) |
calls the collision callback of the object More... | |
void | setObjectID (std::string const &id) |
sets the identifier string. There is no proof for beeing unique within the world More... | |
std::string | getObjectID () |
returns the (not unique) object identifier More... | |
std::string | getObjectID () const |
returns the (not unique) object identifier (const) More... | |
Public Member Functions inherited from icl::geom::SceneObject | |
ICLGeom_API | SceneObject () |
create an object More... | |
ICLGeom_API | SceneObject (const std::string &type, const float *params) |
create by string: More... | |
ICLGeom_API | SceneObject (const std::string &objFileName) |
creates a scene object from given .obj file More... | |
SceneObject (const SceneObject &other) | |
deep copy of SceneObject instance More... | |
ICLGeom_API SceneObject & | operator= (const SceneObject &other) |
assignment operator for deep copy More... | |
virtual ICLGeom_API | ~SceneObject () |
Empty destructor (but virtual) More... | |
ICLGeom_API std::vector< Vec > & | getVertices () |
returns object vertices More... | |
ICLGeom_API const std::vector< Vec > & | getVertices () const |
returns object vertices (const) More... | |
ICLGeom_API const std::vector< Vec > & | getNormals () const |
returns object normals (const) More... | |
ICLGeom_API std::vector< GeomColor > & | getVertexColors () |
returns object vertex colors More... | |
ICLGeom_API const std::vector< GeomColor > & | getVertexColors () const |
returns object vertex colors (const) More... | |
ICLGeom_API std::vector< Primitive * > & | getPrimitives () |
returns object's primitives (lines, quads, etc...) More... | |
ICLGeom_API const std::vector< Primitive * > & | getPrimitives () const |
returns object's primitives (lines, quads, etc...) (const) More... | |
ICLGeom_API void | setVisible (int oredTypes, bool visible, bool recursive=true) |
changes visibility of given primitive type More... | |
ICLGeom_API void | setVisible (const std::string &what, bool recursive=true) |
convenience method that allows for setting several visibility properties at once More... | |
void | setVisible (const char *what, bool recursive=true) |
explicit version for const char pointer to avoid an explicit cast to bool/int More... | |
ICLGeom_API bool | isVisible (Primitive::Type t) const |
returns visibility of given primitive type More... | |
virtual ICLGeom_API bool | isInvisibleForCamera (int camIndex) const |
this can be overwrittern in subclasses to hide an object for given camera indices More... | |
ICLGeom_API void | addVertex (const Vec &p, const GeomColor &color=GeomColor(255, 0, 0, 255)) |
adds a new vertex to this object More... | |
ICLGeom_API void | addSharedTexture (utils::SmartPtr< qt::GLImg > gli) |
adds a GLImg as shared texture More... | |
ICLGeom_API void | addSharedTexture (const core::ImgBase *image, core::scalemode sm=core::interpolateLIN) |
adds an core::ImgBase * as shared texutre More... | |
ICLGeom_API void | addNormal (const Vec &n) |
adds a new normal to this object More... | |
ICLGeom_API void | addLine (int x, int y, const GeomColor &color=GeomColor(100, 100, 100, 255)) |
adds a new line to this object More... | |
ICLGeom_API void | addTriangle (int a, int b, int c, int na, int nb, int nc, const GeomColor &color=GeomColor(0, 100, 250, 255)) |
adds a new triangle to this onject More... | |
void | addTriangle (int a, int b, int c, const GeomColor &color=GeomColor(0, 100, 250, 255)) |
convenience method for creation of a triangle with auto-normals More... | |
ICLGeom_API void | addQuad (int a, int b, int c, int d, int na, int nb, int nc, int nd, const GeomColor &color=GeomColor(0, 100, 250, 255)) |
adds a new triangle to this onject More... | |
void | addQuad (int a, int b, int c, int d, const GeomColor &color=GeomColor(0, 100, 250, 255)) |
convenience method for creation of a quad with auto-normals More... | |
ICLGeom_API void | addPolygon (int nPoints, const int *vertexIndices, const GeomColor &color=GeomColor(0, 100, 250, 255), const int *normalIndices=0) |
add a polygon to this object (note triangles and quads are slower here) More... | |
ICLGeom_API void | addTexture (int a, int b, int c, int d, const core::ImgBase *texture, int na, int nb, int nc, int nd, bool createTextureOnce=true, core::scalemode sm=core::interpolateLIN) |
void | addTexture (int a, int b, int c, int d, const core::ImgBase *texture, bool createTextureOnce=true, core::scalemode sm=core::interpolateLIN) |
convenience method for creation of a texture with auto-normals More... | |
ICLGeom_API void | addTexture (int a, int b, int c, int d, int sharedTextureIndex, int na=-1, int nb=-1, int nc=-1, int nd=-1) |
adds are shared texture primitive More... | |
ICLGeom_API void | addTexture (const core::ImgBase *image, int numPoints, const int *vertexIndices, const utils::Point32f *texCoords, const int *normalIndices=0, bool createTextureOnce=true) |
adds a GenericTexturePrimitive for custom texCoords More... | |
ICLGeom_API void | addTextureGrid (int w, int h, const core::ImgBase *image, const icl32f *px, const icl32f *py, const icl32f *pz, const icl32f *pnx=0, const icl32f *pny=0, const icl32f *pnz=0, int stride=1, bool createTextureOnce=true, core::scalemode sm=core::interpolateLIN) |
adds a texture that is drawn on a 2D grid of vertices in 3D space More... | |
ICLGeom_API void | addTwoSidedTextureGrid (int w, int h, const core::ImgBase *front, const core::ImgBase *back, const icl32f *px, const icl32f *py, const icl32f *pz, const icl32f *pnx=0, const icl32f *pny=0, const icl32f *pnz=0, int stride=1, bool createFrontOnce=true, bool createBackOnce=true, core::scalemode sm=core::interpolateLIN) |
adds a texture grid that has two different texture for the two faces More... | |
ICLGeom_API void | addTwoSidedTGrid (int w, int h, const Vec *vertices, const Vec *normals=0, const GeomColor &frontColor=GeomColor(0, 100, 255, 255), const GeomColor &backColor=GeomColor(255, 0, 100, 255), const GeomColor &lineColor=GeomColor(0, 255, 100, 255), bool drawLines=false, bool drawQuads=true) |
adds a two sided grid (sides may have different colors) More... | |
ICLGeom_API void | addTextTexture (int a, int b, int c, int d, const std::string &text, const GeomColor &color, int na, int nb, int nc, int nd, int textSize, core::scalemode sm=core::interpolateLIN) |
adds text-texture quad -primitive to this object More... | |
void | addTextTexture (int a, int b, int c, int d, const std::string &text, const GeomColor &color=GeomColor(255, 255, 255, 255), int textSize=30, core::scalemode sm=core::interpolateLIN) |
convenience method for creation of a text-texture with auto-normals More... | |
ICLGeom_API void | addText (int a, const std::string &text, float billboardHeight=10, const GeomColor &color=GeomColor(255, 255, 255, 255), int textRenderSize=30, core::scalemode sm=core::interpolateLIN) |
adds a billboard text-texture attached to given node index a More... | |
void | addCustomPrimitive (Primitive *p) |
adds a custom primitive More... | |
SceneObject * | addCube (float x, float y, float z, float d) |
adds a cube child-object with given parameters More... | |
ICLGeom_API SceneObject * | addCuboid (float x, float y, float z, float dx, float dy, float dz) |
adds a cuboid child-object with given parameters More... | |
SceneObject * | addSphere (float x, float y, float z, float r, int rzSteps, int xySlices) |
adds a cuboid child-object with given parameters More... | |
ICLGeom_API SceneObject * | addSpheroid (float x, float y, float z, float rx, float ry, float rz, int rzSteps, int xySlices) |
adds a cuboid child-object with given parameters More... | |
ICLGeom_API SceneObject * | addCylinder (float x, float y, float z, float rx, float ry, float h, int steps) |
adds a cylindical child object with given parameters More... | |
ICLGeom_API SceneObject * | addCone (float x, float y, float z, float rx, float ry, float h, int steps) |
adds a conical child object with given parameters More... | |
ICLGeom_API void | setColor (Primitive::Type t, const GeomColor &color, bool recursive=true) |
tints all Primitives with given type in given color More... | |
ICLGeom_API void | setPointSize (float pointSize, bool recursive=true) |
sets point size More... | |
ICLGeom_API void | setLineWidth (float lineWidth, bool recursive=true) |
sets point size More... | |
ICLGeom_API void | setUseCustomRender (bool use, bool recursive=true) |
if set, only custom render is used More... | |
virtual ICLGeom_API SceneObject * | copy () const |
performs a deep copy of this object More... | |
virtual void | customRender () |
this function is called when an object is rendered More... | |
virtual void | complexCustomRender (icl::geom::ShaderUtil *util) |
this function is called when an object is rendered More... | |
ICLGeom_API void | setColorsFromVertices (Primitive::Type t, bool on, bool recursive=true) |
sets how 2D-geom colors are set More... | |
ICLGeom_API bool | getSmoothShading () const |
returns wheather smooth shading is activated More... | |
ICLGeom_API void | setSmoothShading (bool on, bool recursive=true) |
sets whether to use smoothshading (default is false) More... | |
ICLGeom_API void | createAutoNormals (bool smooth=true) |
automatically creates precomputed normals More... | |
virtual GeomColor | getDefaultVertexColor () const |
can be reimplemented by subclass to provide and interface for setting default vertex color More... | |
ICLGeom_API Hit | hit (const ViewRay &v, bool recursive=true) |
returns whether this object is hit by the given viewray More... | |
const Hit | hit (const ViewRay &v, bool recursive=true) const |
returns whether this object is hit by the given viewray (const) More... | |
ICLGeom_API std::vector< Hit > | hits (const ViewRay &v, bool recursive=true) |
returns all hits with SceneObjects form the given viewray More... | |
ICLGeom_API std::vector< Vec > | getTransformedVertices () const |
returns all vertices in their final world coordinates More... | |
ICLGeom_API Vec | getClosestVertex (const Vec &pWorld, bool relative=false) |
returns the vertex, that is closest to the given point in wold coordinates More... | |
ICLGeom_API void | setVisible (bool visible, bool recursive=true) |
sets the visibility of this object More... | |
bool | isVisible () const |
returns whether this object is currently visible More... | |
void | hide (bool recursive=true) |
calls setVisible(false) More... | |
void | show (bool recursive=true) |
calls setVisible(true) More... | |
void | setLockingEnabled (bool enabled) |
sets locking enabled or disabled More... | |
bool | getLockingEnabled () const |
returns whether locking is current enabled for this object More... | |
virtual void | lock () const |
locks the internal mutex if locking enabled is set to true More... | |
virtual void | unlock () const |
unlocks the internal mutex if locking enabled is set to true More... | |
void | setPointSmoothingEnabled (bool enabled=true) |
sets whether points are visualized in a smoothed manner More... | |
void | setLineSmoothingEnabled (bool enabled=true) |
sets whether lines are visualized in a smoothed manner More... | |
void | setPolygonSmoothingEnabled (bool enabled=true) |
sets whether faces are visualized in a smoothed manner More... | |
ICLGeom_API void | clearAllPrimitives () |
deletes and removes all primitives More... | |
virtual ICLGeom_API void | clearObject (bool deleteAndRemoveChildren=true, bool resetTransform=false) |
deletes all primitive and all vertex, color and normal content (and optionally also the children) More... | |
ICLGeom_API void | createDisplayList () |
creates a displaylist in the next render cycle More... | |
ICLGeom_API void | freeDisplayList () |
frees the displaylist in the next render cycle More... | |
ICLGeom_API void | setFragmentShader (qt::GLFragmentShader *shader) |
sets a fragment shader to use for this object More... | |
qt::GLFragmentShader * | getFragmentShader () |
returns the current fragment shader (or NULL if non was given) More... | |
const qt::GLFragmentShader * | getFragmentShader () const |
returns the current fragment shader (or NULL if non was given, const version) More... | |
void | setCastShadowsEnabled (bool castShadows=true) |
bool | getCastShadowsEnabled () |
void | setReceiveShadowsEnabled (bool receiveShadows=true) |
bool | getReceiveShadowsEnabled () |
void | setShininess (icl8u value) |
sets the material shininess (default is 128) More... | |
void | setSpecularReflectance (const GeomColor &values) |
sets the materials specular reflectance More... | |
bool | getDepthTestEnabled () const |
returns whether depth test is enabled for this object More... | |
void | setDepthTestEnabled (bool enabled, bool recursive=true) |
sets whether depth test is enabled for this object More... | |
float | getPointHitMaxDistance () const |
returns the maximum distance to a pointing viewraw More... | |
void | setPointHitMaxDistance (float d) |
sets the maximum distance to a pointing view-ray More... | |
ICLGeom_API void | removeTransformation () |
sets the internal transformation to the identity matrix More... | |
template<class T > | |
void | transform (const T &m) |
utility method for passing arbitrary matrix classes More... | |
virtual ICLGeom_API void | rotate (float rx, float ry, float rz, icl::math::AXES axes=icl::math::AXES_DEFAULT) |
rotates the scene object (this affects it's transformation matrix) More... | |
template<class T > | |
void | rotate (const T &t, icl::math::AXES axes=icl::math::AXES_DEFAULT) |
utility wrapper for vector based rotation More... | |
virtual ICLGeom_API void | translate (float dx, float dy, float dz) |
translates the scene object (this affects it's translates matrix) More... | |
template<class T > | |
void | translate (const T &t) |
utility wrapper for vector based translation More... | |
virtual ICLGeom_API void | scale (float sx, float sy, float sz) |
transformes the current transformation matrix by a scale matrix More... | |
template<class T > | |
void | scale (const T &t) |
utility wrapper for vector based scaling More... | |
ICLGeom_API Mat | getTransformation (bool relative=false) const |
returns the current transformation matrix More... | |
ICLGeom_API bool | hasTransformation (bool relative=false) const |
returns whether the SceneObject has currently a non-ID-transformation More... | |
ICLGeom_API SceneObject * | getParent () |
returns the parent scene object More... | |
ICLGeom_API const SceneObject * | getParent () const |
returns the parent scene object (const version) More... | |
ICLGeom_API void | addChild (SceneObject *child, bool passOwnerShip=true) |
adds a new child to this scene object More... | |
void | addChild (utils::SmartPtr< SceneObject > child) |
directly passes a smart pointer as a child More... | |
ICLGeom_API void | removeChild (SceneObject *child) |
removes given child More... | |
ICLGeom_API void | removeAllChildren () |
removes all children More... | |
ICLGeom_API bool | hasChildren () const |
returns whether the SceneObject has children at all More... | |
ICLGeom_API int | getChildCount () const |
returns the number of children More... | |
ICLGeom_API SceneObject * | getChild (int index) |
returns child at given index More... | |
ICLGeom_API const SceneObject * | getChild (int index) const |
returns child at given index (const) More... | |
utils::SmartPtr< SceneObject > | getChildPtr (int index) |
returns a shared pointer to the child at given index More... | |
ICLGeom_API bool | hasChild (const SceneObject *o) const |
returns whether the given object is a child of this one More... | |
Additional Inherited Members | |
Public Types inherited from icl::physics::RigidObject | |
enum | ActivationMode { DYNAMIC = 0, ACTIVE_FOREVER = 1, INACTIVE_FOREVER = 2, BT_ISLAND_SLEEPING = 3, TOWARDS_INACTIVE = 4 } |
Static Public Member Functions inherited from icl::geom::SceneObject | |
static SceneObject * | cube (float x, float y, float z, float r) |
create a cube scene object More... | |
static SceneObject * | cuboid (float x, float y, float z, float dx, float dy, float dz) |
create a cuboid scene object More... | |
static SceneObject * | sphere (float x, float y, float z, float r, int rzSteps, int xySlices) |
create a shere scene object More... | |
static SceneObject * | spheroid (float x, float y, float z, float rx, float ry, float rz, int rzSteps, int xySlices) |
create a shere scene object More... | |
static SceneObject * | superquadric (float x, float y, float z, float rx, float ry, float rz, float dx, float dy, float dz, float e1, float e2, int rzSteps, int xySlices) |
create a superquadric scene object More... | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
Uncopyable () | |
Empty base constructor. More... | |
Static Protected Member Functions inherited from icl::geom::SceneObject | |
static void | collect_hits_recursive (SceneObject *obj, const ViewRay &v, std::vector< Hit > &hits, bool recursive) |
recursive picking method More... | |
A Box that can with RigidObject features.
icl::physics::RigidBoxObject::RigidBoxObject | ( | float | x, |
float | y, | ||
float | z, | ||
float | dx, | ||
float | dy, | ||
float | dz, | ||
float | mass = 1.0 |
||
) |
Constructor that takes the position and dimensions, as well as mass of the box.
|
protected |