33 #include <ICLUtils/ICLConfig.h> 34 #ifndef ICL_HAVE_OPENGL 36 #pragma WARNING("this header must not be included if ICL_HAVE_OPENGL is not defined"); 38 #warning "this header must not be included if ICL_HAVE_OPENGL is not defined" 168 const float p[] = { x,y,z,r };
174 const float p[] = { x,y,z,dx,dy,dz };
179 static inline SceneObject *
sphere(
float x,
float y,
float z,
float r,
int rzSteps,
int xySlices){
180 const float p[] = { x,y,z,r, float(rzSteps), float(xySlices) };
185 static inline SceneObject *
spheroid(
float x,
float y,
float z,
float rx,
float ry,
float rz,
int rzSteps,
int xySlices){
186 const float p[] = { x,y,z,rx, ry, rz, float(rzSteps), float(xySlices) };
192 float dx,
float dy,
float dz,
float e1,
float e2,
int rzSteps,
int xySlices){
193 const float p[] = { x,y,z,rx, ry, rz, dx, dy, dz, e1, e2, float(rzSteps), float(xySlices) };
278 inline void setVisible(
const char *what,
bool recursive=
true){
334 const int *normalIndices=0);
340 int na,
int nb,
int nc,
int nd,
341 bool createTextureOnce=
true,
347 bool createTextureOnce=
true,
349 addTexture(a,b,c,d,texture,-1,-1,-1,-1,createTextureOnce,sm);
356 int sharedTextureIndex,
357 int na=-1,
int nb=-1,
int nc=-1,
int nd=-1);
362 bool createTextureOnce=
true);
376 int stride = 1,
bool createFrontOnce=
true,
385 bool drawLines=
false,
bool drawQuads=
true);
406 int na,
int nb,
int nc,
int nd,
414 addTextTexture(a,b,c,d,
text,
color,-1,-1,-1,-1,textSize, sm);
532 m(0,1),m(1,1),m(2,1),m(3,1),
533 m(0,2),m(1,2),m(2,2),m(3,2),
534 m(0,3),m(1,3),m(2,3),m(3,3)));
544 {
rotate((
float)t[0],(
float)t[1],(
float)t[2]); }
558 inline void scale(
const T &t) {
scale((
float)t[0],(
float)t[1],(
float)t[2]); }
651 return const_cast<SceneObject*>(
this)->hit(v,recursive);
811 std::vector<Hit> &
hits,
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
ICLGeom_API void setSmoothShading(bool on, bool recursive=true)
sets whether to use smoothshading (default is false)
Simple wrapper class for OpenGL 2.0 Fragment Shader Programs.
Definition: GLFragmentShader.h:45
ICLGeom_API void setColorsFromVertices(Primitive::Type t, bool on, bool recursive=true)
sets how 2D-geom colors are set
virtual void prepareForRendering()
called by the renderer before the object is rendered
Definition: SceneObject.h:487
ICLGeom_API void setColor(Primitive::Type t, const GeomColor &color, bool recursive=true)
tints all Primitives with given type in given color
ICLGeom_API void setUseCustomRender(bool use, bool recursive=true)
if set, only custom render is used
void transform(const T &m)
utility method for passing arbitrary matrix classes
Definition: SceneObject.h:530
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
bool m_useCustomRender
Definition: SceneObject.h:827
bool m_lineSmoothingEnabled
Definition: SceneObject.h:845
ICLGeom_API SceneObject & operator=(const SceneObject &other)
assignment operator for deep copy
int m_visibleMask
Definition: SceneObject.h:820
ICLGeom_API std::vector< Vec > & getVertices()
returns object vertices
virtual ICLGeom_API void translate(float dx, float dy, float dz)
translates the scene object (this affects it's translates matrix)
bool m_useSmoothShading
Definition: SceneObject.h:832
bool getLockingEnabled() const
returns whether locking is current enabled for this object
Definition: SceneObject.h:689
void setReceiveShadowsEnabled(bool receiveShadows=true)
Definition: SceneObject.h:764
undocument this line if you encounter any issues!
Definition: Any.h:37
bool m_polyColorsFromVertices
Definition: SceneObject.h:825
float m_lineWidth
Definition: SceneObject.h:830
void unlock()
unlocks the mutex
Definition: Mutex.h:111
std::vector< utils::SmartPtr< SceneObject > > m_children
Definition: SceneObject.h:839
virtual void complexCustomRender(icl::geom::ShaderUtil *util)
this function is called when an object is rendered
Definition: SceneObject.h:502
Ipp8u icl8u
8Bit unsigned integer type for the ICL
Definition: BasicTypes.h:64
bool m_isVisible
Definition: SceneObject.h:833
ICLGeom_API SceneObject * addCuboid(float x, float y, float z, float dx, float dy, float dz)
adds a cuboid child-object with given parameters
const qt::GLFragmentShader * getFragmentShader() const
returns the current fragment shader (or NULL if non was given, const version)
Definition: SceneObject.h:758
void setPointHitMaxDistance(float d)
sets the maximum distance to a pointing view-ray
Definition: SceneObject.h:804
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
Definition: SceneObject.h:191
float m_pointHitMaxDistance
Definition: SceneObject.h:868
ICLGeom_API SceneObject * getParent()
returns the parent scene object
ICLGeom_API Mat getTransformation(bool relative=false) const
returns the current transformation matrix
SceneObject * addCube(float x, float y, float z, float d)
adds a cube child-object with given parameters
Definition: SceneObject.h:438
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
virtual ICLGeom_API bool isInvisibleForCamera(int camIndex) const
this can be overwrittern in subclasses to hide an object for given camera indices
Definition: SceneObject.h:288
void setCastShadowsEnabled(bool castShadows=true)
Definition: SceneObject.h:760
bool m_hasTransformation
Definition: SceneObject.h:837
ICLGeom_API int getChildCount() const
returns the number of children
ICLGeom_API std::vector< GeomColor > & getVertexColors()
returns object vertex colors
ICLGeom_API std::vector< Hit > hits(const ViewRay &v, bool recursive=true)
returns all hits with SceneObjects form the given viewray
GeomColor m_specularReflectance
Definition: SceneObject.h:850
Mat4D32f Mat
Short typedef for 4D float matrices.
Definition: GeomDefs.h:90
#define ICLGeom_API
Definition: CompatMacros.h:179
ICLQt_API void text(ImgQ &image, int x, int y, const string &text)
renders a text into an image (only available with Qt-Support)
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
bool m_quadColorsFromVertices
Definition: SceneObject.h:824
ICLGeom_API void removeTransformation()
sets the internal transformation to the identity matrix
ICLGeom_API std::vector< Vec > getTransformedVertices() const
returns all vertices in their final world coordinates
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
Abastract base type for geoemtric primitives.
Definition: Primitive.h:59
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
Definition: SceneObject.h:345
ICLGeom_API void clearAllPrimitives()
deletes and removes all primitives
void show(bool recursive=true)
calls setVisible(true)
Definition: SceneObject.h:675
ICLGeom_API SceneObject * getChild(int index)
returns child at given index
float m_pointSize
Definition: SceneObject.h:829
bool getDepthTestEnabled() const
returns whether depth test is enabled for this object
Definition: SceneObject.h:780
virtual ICLGeom_API SceneObject * copy() const
performs a deep copy of this object
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
void rotate(const T &t, icl::math::AXES axes=icl::math::AXES_DEFAULT)
utility wrapper for vector based rotation
Definition: SceneObject.h:543
virtual ICLGeom_API ~SceneObject()
Empty destructor (but virtual)
Mat m_transformation
for the scene graph implementation
Definition: SceneObject.h:836
ICLGeom_API void setFragmentShader(qt::GLFragmentShader *shader)
sets a fragment shader to use for this object
std::vector< Vec > m_normals
Definition: SceneObject.h:815
ICLGeom_API bool getSmoothShading() const
returns wheather smooth shading is activated
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
Definition: SceneObject.h:411
std::vector< utils::SmartPtr< qt::GLImg > > m_sharedTextures
Definition: SceneObject.h:819
std::vector< Vec > m_vertices
Definition: SceneObject.h:814
ICLMath_API const AXES AXES_DEFAULT
ICLGeom_API void setVisible(int oredTypes, bool visible, bool recursive=true)
changes visibility of given primitive type
ICLGeom_API void createAutoNormals(bool smooth=true)
automatically creates precomputed normals
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
Definition: SceneObject.h:316
const Hit hit(const ViewRay &v, bool recursive=true) const
returns whether this object is hit by the given viewray (const)
Definition: SceneObject.h:650
void * m_displayListHandle
internally used flag
Definition: SceneObject.h:855
Ipp32f icl32f
32Bit floating point type for the ICL
Definition: BasicTypes.h:55
bool m_triangleColorsFromVertices
Definition: SceneObject.h:823
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
bool m_polygonSmoothingEnabled
Definition: SceneObject.h:846
ICLGeom_API void setPointSize(float pointSize, bool recursive=true)
sets point size
virtual ICLGeom_API void setTransformation(const Mat &m)
Sets a transformation matrix.
ICLGeom_API void freeDisplayList()
frees the displaylist in the next render cycle
bool isVisible() const
returns whether this object is currently visible
Definition: SceneObject.h:669
utility structure that defines a hit between a ViewRay and SceneObjects
Definition: Hit.h:45
utils::SmartPtr< SceneObject > getChildPtr(int index)
returns a shared pointer to the child at given index
void setSpecularReflectance(const GeomColor &values)
sets the materials specular reflectance
Definition: SceneObject.h:775
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)
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)
ICLGeom_API void setLineWidth(float lineWidth, bool recursive=true)
sets point size
void setShininess(icl8u value)
sets the material shininess (default is 128)
Definition: SceneObject.h:769
Definition: ShaderUtil.h:47
ICLGeom_API void addSharedTexture(utils::SmartPtr< qt::GLImg > gli)
adds a GLImg as shared texture
ICLGeom_API bool hasChildren() const
returns whether the SceneObject has children at all
Scene Implementation that is used to handle a list of objects and cameras.
Definition: Scene.h:138
AXES
axes order specifications for euler angles
Definition: FixedMatrix.h:999
ICLGeom_API void addNormal(const Vec &n)
adds a new normal to this object
qt::GLFragmentShader * getFragmentShader()
returns the current fragment shader (or NULL if non was given)
Definition: SceneObject.h:755
virtual void lock() const
locks the internal mutex if locking enabled is set to true
Definition: SceneObject.h:698
ICLGeom_API const std::vector< Vec > & getNormals() const
returns object normals (const)
virtual void customRender()
this function is called when an object is rendered
Definition: SceneObject.h:494
void setDepthTestEnabled(bool enabled, bool recursive=true)
sets whether depth test is enabled for this object
Definition: SceneObject.h:783
ICLGeom_API std::vector< Primitive * > & getPrimitives()
returns object's primitives (lines, quads, etc...)
SceneObject * m_parent
Definition: SceneObject.h:838
ICLGeom_API bool hasTransformation(bool relative=false) const
returns whether the SceneObject has currently a non-ID-transformation
bool getCastShadowsEnabled()
Definition: SceneObject.h:762
virtual ICLGeom_API void transform(const Mat &m)
multiplies the current transformation matrix by given matrix
ICLGeom_API void removeChild(SceneObject *child)
removes given child
icl8u m_shininess
Definition: SceneObject.h:849
void setPolygonSmoothingEnabled(bool enabled=true)
sets whether faces are visualized in a smoothed manner
Definition: SceneObject.h:733
ICLGeom_API void removeAllChildren()
removes all children
int m_createDisplayListNextTime
internal flag
Definition: SceneObject.h:860
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
bool m_receiveShadows
Definition: SceneObject.h:866
This is a view-ray's line equation in parameter form.
Definition: ViewRay.h:49
scalemode
for scaling of Img images theses functions are provided
Definition: Types.h:84
ICLGeom_API Hit hit(const ViewRay &v, bool recursive=true)
returns whether this object is hit by the given viewray
bool m_pointSmoothingEnabled
Definition: SceneObject.h:844
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)
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
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
Definition: SceneObject.h:327
Single precission 3D Vectors Point class of the ICL.
Definition: Point32f.h:41
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)
ICLGeom_API void createDisplayList()
creates a displaylist in the next render cycle
std::vector< GeomColor > m_vertexColors
Definition: SceneObject.h:817
core::Color4D32f GeomColor
color for geometry primitives
Definition: GeomDefs.h:45
ICLGeom_API bool hasChild(const SceneObject *o) const
returns whether the given object is a child of this one
ICLQt_API void color(float r, float g=-1, float b=-1, float alpha=255)
sets the current color to given r,g,b,alpha value
void setVisible(const char *what, bool recursive=true)
explicit version for const char pointer to avoid an explicit cast to bool/int
Definition: SceneObject.h:278
SceneObject * addSphere(float x, float y, float z, float r, int rzSteps, int xySlices)
adds a cuboid child-object with given parameters
Definition: SceneObject.h:450
static SceneObject * spheroid(float x, float y, float z, float rx, float ry, float rz, int rzSteps, int xySlices)
create a shere scene object
Definition: SceneObject.h:185
bool m_castShadows
Definition: SceneObject.h:865
Type
primitive type for dynamic handling of different primitives
Definition: Primitive.h:62
virtual void unlock() const
unlocks the internal mutex if locking enabled is set to true
Definition: SceneObject.h:708
utils::Mutex m_mutex
for asynchronous updates
Definition: SceneObject.h:841
ICLGeom_API Vec getClosestVertex(const Vec &pWorld, bool relative=false)
returns the vertex, that is closest to the given point in wold coordinates
bool m_lineColorsFromVertices
Definition: SceneObject.h:822
std::vector< Primitive * > m_primitives
Definition: SceneObject.h:818
void setLockingEnabled(bool enabled)
sets locking enabled or disabled
Definition: SceneObject.h:682
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)
bool m_depthTestEnabled
default is true
Definition: SceneObject.h:847
ICLGeom_API void addLine(int x, int y, const GeomColor &color=GeomColor(100, 100, 100, 255))
adds a new line to this object
static SceneObject * cube(float x, float y, float z, float r)
create a cube scene object
Definition: SceneObject.h:167
ICLGeom_API void addVertex(const Vec &p, const GeomColor &color=GeomColor(255, 0, 0, 255))
adds a new vertex to this object
static SceneObject * cuboid(float x, float y, float z, float dx, float dy, float dz)
create a cuboid scene object
Definition: SceneObject.h:173
void hide(bool recursive=true)
calls setVisible(false)
Definition: SceneObject.h:672
ICLGeom_API void addChild(SceneObject *child, bool passOwnerShip=true)
adds a new child to this scene object
void setPointSmoothingEnabled(bool enabled=true)
sets whether points are visualized in a smoothed manner
Definition: SceneObject.h:719
void scale(const T &t)
utility wrapper for vector based scaling
Definition: SceneObject.h:558
Mutex class of the ICL.
Definition: Mutex.h:54
SceneObject(const SceneObject &other)
deep copy of SceneObject instance
Definition: SceneObject.h:204
bool m_enableLocking
can be enabled
Definition: SceneObject.h:842
static SceneObject * sphere(float x, float y, float z, float r, int rzSteps, int xySlices)
create a shere scene object
Definition: SceneObject.h:179
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
qt::GLFragmentShader * m_fragmentShader
internal optionally given fragment shader
Definition: SceneObject.h:863
static void collect_hits_recursive(SceneObject *obj, const ViewRay &v, std::vector< Hit > &hits, bool recursive)
recursive picking method
virtual ICLGeom_API void scale(float sx, float sy, float sz)
transformes the current transformation matrix by a scale matrix
void addCustomPrimitive(Primitive *p)
adds a custom primitive
Definition: SceneObject.h:431
Specialization of the SmartPtrBase class for Pointers.
Definition: SmartPtr.h:75
The SceneObject class defines visible objects in scenes or scene graph nodes.
Definition: SceneObject.h:140
void setLineSmoothingEnabled(bool enabled=true)
sets whether lines are visualized in a smoothed manner
Definition: SceneObject.h:726
bool getReceiveShadowsEnabled()
Definition: SceneObject.h:766
void lock()
locks the mutex
Definition: Mutex.h:91
virtual GeomColor getDefaultVertexColor() const
can be reimplemented by subclass to provide and interface for setting default vertex color
Definition: SceneObject.h:636
float getPointHitMaxDistance() const
returns the maximum distance to a pointing viewraw
Definition: SceneObject.h:798
ICLGeom_API SceneObject()
create an object
void translate(const T &t)
utility wrapper for vector based translation
Definition: SceneObject.h:551