OpenWalnut  1.3.1
Classes | Functions
wge Namespace Reference

Extend the wge utils namespace with additional methods relating WDataTexture3D. More...

Classes

class  UniformType
 Class helping to adapt types specified as template parameter into the best matching osg::Uniform (GLSL) type. More...
class  UniformType< double >
 Maps doubles to floats as only floats are allowed in uniforms. More...
class  UniformType< WVector3d >
 Maps WVector3d/WPosition to osg::Vec3. More...
class  UniformType< WItemSelector >
 Maps Selection Properties to ints. More...
class  GLType
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< double >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< long double >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< float >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< int8_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< uint8_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< int16_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< uint16_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< int32_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< uint32_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< int64_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...
class  GLType< uint64_t >
 Class helping to adapt types specified as template parameter into the best matching OpenGL type. More...

Functions

void bindTexture (osg::ref_ptr< osg::Node > node, osg::ref_ptr< WDataTexture3D > texture, size_t unit=0, std::string prefix="")
 Binds the specified texture to the specified unit.
osg::ref_ptr< osg::Geode > generateBoundingBoxGeode (const WBoundingBox &bb, const WColor &color)
 Generates an OSG geode for the bounding box.
osg::ref_ptr< osg::Node > generateSolidBoundingBoxNode (const WBoundingBox &bb, const WColor &color, bool threeDTexCoords=true)
 Generates an OSG node for the specified bounding box.
osg::ref_ptr< osg::Geometry > createUnitCube (const WColor &color)
 Creates a osg::Geometry containing an unit cube, having 3D texture coordinates.
osg::ref_ptr< osg::Geometry > createUnitCubeAsLines (const WColor &color)
 Creates a osg::Geometry containing an unit cube as line-strips, having 3D texture coordinates.
osg::ref_ptr< osg::Geometry > convertToOsgGeometry (WTriangleMesh::SPtr mesh, const WColor &defaultColor=WColor(1.0, 1.0, 1.0, 1.0), bool includeNormals=false, bool lighting=false, bool useMeshColor=true)
 Extract the vertices and triangles from a WTriangleMesh and save them into an osg::Geometry.
osg::ref_ptr< osg::Geometry > convertToOsgGeometry (WTriangleMesh::SPtr mesh, const WColoredVertices &colorMap, const WColor &defaultColor=WColor(1.0, 1.0, 1.0, 1.0), bool includeNormals=false, bool lighting=false)
 Extract the vertices and triangles from a WTriangleMesh and save them into an osg::Geometry.
osg::ref_ptr< osg::Geometry > convertToOsgGeometryLines (WTriangleMesh::SPtr mesh, const WColor &defaultColor=WColor(1.0, 1.0, 1.0, 1.0), bool useMeshColor=true)
 Convert triangle mesh to lines representing it.
osg::ref_ptr< osg::Geode > generateLineStripGeode (const WLine &line, const float thickness=3.0f, const WColor &color=WColor(0, 0, 0, 0))
 Generates a line geode with thickness and color as parameters.
osg::ref_ptr
< osg::PositionAttitudeTransform > 
addLabel (osg::Vec3 position, std::string text)
 helper function to add a label somewhere
osg::ref_ptr
< osg::PositionAttitudeTransform > 
vector2label (osg::Vec3 position)
 helper function to add a label with it's position vector
osg::ref_ptr< osg::Geode > genFinitePlane (double xSize, double ySize, const WPlane &p, const WColor &color=WColor(0.0, 0.7, 0.7, 1.0), bool border=false)
 Generates a geode out of a Plane with a fixed size in direction of the vectors which span that plane.
osg::ref_ptr< osg::Group > creatCoordinateSystem (osg::Vec3 middle, double sizeX, double sizeY, double sizeZ)
 Create a coordinate system.
osg::ref_ptr< osg::Geode > genFinitePlane (osg::Vec3 const &base, osg::Vec3 const &a, osg::Vec3 const &b)
 Generates a geode out of two vectors and an origin position.
osg::ref_ptr< WGESubdividedPlanegenUnitSubdividedPlane (size_t resX, size_t resY, double spacing=0.01)
 Generates a plane subdivided into quads.
template<class Container >
osg::ref_ptr< osg::Geode > genPointBlobs (boost::shared_ptr< Container > points, double size, const WColor &color=WColor(1.0, 0.0, 0.0, 1.0))
 For each points in the STL container generate small cubes.
osg::ref_ptr< osg::Vec3Array > generateCuboidQuads (const std::vector< WPosition > &corners)
 Creates out of eight corner vertices QUAD vertices.
osg::Vec3 getQuadNormal (const WPosition &a, const WPosition &b, const WPosition &c)
 Generates for a QUAD given via 3 three points ( the fourth is not needed ) the normal.
osg::ref_ptr< osg::Vec3Array > generateCuboidQuadNormals (const std::vector< WPosition > &corners)
 Generates for all QUADS of the Cuboid the normals in the following order:
WTriangleMesh::SPtr triangulate (const std::vector< WPosition > &points, double transformationFactor=0.0)
 Calculate the Delaunay Triangulation of the given points.
template<typename T >
void bindTexture (osg::ref_ptr< osg::Node > node, osg::ref_ptr< T > texture, size_t unit=0, std::string prefix="")
 Binds the specified texture to the specified unit.
template<typename T >
void bindTexture (osg::ref_ptr< osg::Node > node, osg::ref_ptr< WGETexture< T > > texture, size_t unit=0, std::string prefix="")
 Binds the specified texture to the specified unit.
void unbindTexture (osg::ref_ptr< osg::Node > node, size_t unit, size_t count=1)
 Removes the binding associated with the specified unit.
size_t getMaxTexUnits ()
 Returns the maximum number of textures that can be bound to a node.
osg::ref_ptr< WGETexture
< osg::Texture1D > > 
genWhiteNoiseTexture (size_t sizeX, size_t channels)
 This generates an 1D texture only containing white noise in its channels.
osg::ref_ptr< WGETexture
< osg::Texture2D > > 
genWhiteNoiseTexture (size_t sizeX, size_t sizeY, size_t channels)
 This generates an 2D texture only containing white noise in its channels.
osg::ref_ptr< WGETexture
< osg::Texture3D > > 
genWhiteNoiseTexture (size_t sizeX, size_t sizeY, size_t sizeZ, size_t channels)
 This generates an 3D texture only containing white noise in its channels.
osg::ref_ptr< osg::Image > genWhiteNoiseImage (size_t sizeX, size_t sizeY, size_t sizeZ, size_t channels=1)
 Generates an image only containing white noise in its channels.
void enableTransparency (osg::ref_ptr< osg::Node > node)
 Enable transparency for the given node.
WColor getRGBAColorFromDirection (const WPosition &pos1, const WPosition &pos2)
 Transforms a direction given via two points into a RGB color.
osg::ref_ptr< osg::Vec3Array > osgVec3Array (const std::vector< WPosition > &posArray)
 Converts a whole vector of WPositions into an osg::Vec3Array.
osg::Vec3 unprojectFromScreen (const osg::Vec3 screen, osg::ref_ptr< osg::Camera > camera)
 Converts screen coordinates into Camera coordinates.
osg::Vec4 unprojectFromScreen (const osg::Vec4 screen, osg::ref_ptr< osg::Camera > camera)
 Converts screen coordinates into Camera coordinates.
WColor createColorFromIndex (int index)
 creates the same color as the atlas colormap shader from the index
WColor createColorFromHSV (int h, float s=1.0, float v=1.0)
 creates a rgb WColor from a HSV value
WColor getNthHSVColor (int n)
 creates the nth color of a partition of the hsv color circle

Detailed Description

Extend the wge utils namespace with additional methods relating WDataTexture3D.

Convinient functions for use with the graphics engine of OpenWalnut.

ATM the namespace is filled by several files: WGEGeodeUtils, WGEGeometryUtils and WGEUtils.

Function Documentation

osg::ref_ptr< osg::PositionAttitudeTransform > wge::addLabel ( osg::Vec3  position,
std::string  text 
)

helper function to add a label somewhere

Parameters
positionposition of the label
texttext
Returns
a positionattitudetransfom object containing the label

Definition at line 430 of file WGEGeodeUtils.cpp.

References WPathHelper::getAllFonts().

Referenced by vector2label().

template<typename T >
void wge::bindTexture ( osg::ref_ptr< osg::Node >  node,
osg::ref_ptr< T texture,
size_t  unit = 0,
std::string  prefix = "" 
)

Binds the specified texture to the specified unit.

It automatically adds several uniforms which then can be utilized in the shader:

  • u_textureXUnit: the unit number (useful for accessing correct gl_TexCoord and so on)
  • u_textureXSampler: the needed sampler
  • u_textureXSizeX: width of the texture in pixels
  • u_textureXSizeY: height of the texture in pixels
  • u_textureXSizeZ: depth of the texture in pixels
Warning
this is not OSG-thread-safe. This method binds the texture immediately. So please use this only for nodes which are not yet used in the scene graph. For safely binding textures to a node already in the scene, utilize an update callback.
Parameters
nodewhere to bind
unitthe unit to use
texturethe texture to use.
prefixif specified, defines the uniform name prefix. (Sampler, Unit, Sizes, ...)
Template Parameters
Tthe type of texture. Usually osg::Texture3D or osg::Texture2D.

Definition at line 151 of file WGETextureUtils.h.

References string_utils::toString().

template<typename T >
void wge::bindTexture ( osg::ref_ptr< osg::Node >  node,
osg::ref_ptr< WGETexture< T > >  texture,
size_t  unit = 0,
std::string  prefix = "" 
)

Binds the specified texture to the specified unit.

It automatically adds several uniforms which then can be utilized in the shader:

  • u_textureXUnit: the unit number (useful for accessing correct gl_TexCoord and so on)
  • u_textureXSampler: the needed sampler
  • u_textureXSizeX: width of the texture in pixels
  • u_textureXSizeY: height of the texture in pixels
  • u_textureXSizeZ: depth of the texture in pixels If the specified texture is a WGETexture, it additionally adds u_textureXMin and u_textureXScale for unscaling.
Warning
this is not OSG-thread-safe. This method binds the texture immediately. So please use this only for nodes which are not yet used in the scene graph. For safely binding textures to a node already in the scene, utilize an update callback.
Parameters
nodewhere to bind
unitthe unit to use
texturethe texture to use.
prefixif specified, defines the uniform name prefix. (Sampler, Unit, Sizes, ...)
Template Parameters
Tthe type of texture. Usually osg::Texture3D or osg::Texture2D.

Definition at line 168 of file WGETextureUtils.h.

References string_utils::toString().

void wge::bindTexture ( osg::ref_ptr< osg::Node >  node,
osg::ref_ptr< WDataTexture3D texture,
size_t  unit = 0,
std::string  prefix = "" 
)

Binds the specified texture to the specified unit.

It automatically adds several uniforms which then can be utilized in the shader:

  • u_textureXUnit: the unit number (useful for accessing correct gl_TexCoord and so on)
  • u_textureXSampler: the needed sampler
  • u_textureXSizeX: width of the texture in pixels
  • u_textureXSizeY: height of the texture in pixels
  • u_textureXSizeZ: depth of the texture in pixels If the specified texture is a WGETexture, it additionally adds u_textureXMin and u_textureXScale for unscaling.
Parameters
nodewhere to bind
unitthe unit to use
texturethe texture to use.
prefixif specified, defines the uniform name prefix. (Sampler, Unit, Sizes, ...)
Template Parameters
Tthe type of texture. Usually osg::Texture3D or osg::Texture2D.

Definition at line 173 of file WDataTexture3D.cpp.

Referenced by WGEOffscreenRenderPass::bind(), WGETexture< TextureType >::bind(), and WGEColormapping::callback().

osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry ( WTriangleMesh::SPtr  mesh,
const WColor &  defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
bool  includeNormals = false,
bool  lighting = false,
bool  useMeshColor = true 
)

Extract the vertices and triangles from a WTriangleMesh and save them into an osg::Geometry.

It can use the normals and per-vertex colors of the mesh.

Parameters
meshthe WTriangleMesh used as input
includeNormalsWhen true, calculate the vertex normals and include them into the geometry.
defaultColorThis color is used in case the useMeshColor parameter is false or no colors are defined in the mesh.
lightingif true, a standard lighting is activated for this geometry
useMeshColorif true, the mesh color is used. If false, the defaultColor is used.
Returns
an osg::Geometry containing the mesh
Notes:
mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays

Definition at line 247 of file WGEGeodeUtils.cpp.

Referenced by convertToOsgGeometry().

osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry ( WTriangleMesh::SPtr  mesh,
const WColoredVertices colorMap,
const WColor &  defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
bool  includeNormals = false,
bool  lighting = false 
)

Extract the vertices and triangles from a WTriangleMesh and save them into an osg::Geometry.

It can use the normals and per-vertex colors of the mesh. This method additionally uses the specified vertexID-color map to provide additional coloring.

Parameters
meshthe WTriangleMesh used as input
colorMapthe map from vertex to color.
includeNormalsWhen true, calculate the vertex normals and include them into the geometry.
defaultColorThis color is used in case the colorMap does not provide a color for a vertex
lightingif true, a standard lighting is activated for this geometry*
Returns
an osg::Geometry containing the mesh
Notes:
mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays

Definition at line 317 of file WGEGeodeUtils.cpp.

References convertToOsgGeometry(), and WColoredVertices::getData().

osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometryLines ( WTriangleMesh::SPtr  mesh,
const WColor &  defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
bool  useMeshColor = true 
)

Convert triangle mesh to lines representing it.

Draws lines twice (ATM).

Parameters
meshThe WTriangleMesh used as input.
defaultColorThis color is used in case the useMeshColor parameter is false or no colors are defined in the mesh.
useMeshColorIf true, the mesh color is used. If false, the defaultColor is used.
Returns
an osg::Geometry containing the mesh as lines

Definition at line 344 of file WGEGeodeUtils.cpp.

osg::ref_ptr< osg::Group > wge::creatCoordinateSystem ( osg::Vec3  middle,
double  sizeX,
double  sizeY,
double  sizeZ 
)

Create a coordinate system.

The coordinate system is build from cylinders and cones and includes a positive-to-negative color gradient.

Parameters
middleosg::Vec3( middleX, middleY, middleZ ) middle points of X, Y, Z
sizeXwhole lenght of X
sizeYwhole lenght of Y
sizeZwhole lenght of Z
Returns
Group Node

Definition at line 603 of file WGEGeodeUtils.cpp.

WColor wge::createColorFromHSV ( int  h,
float  s = 1.0,
float  v = 1.0 
)

creates a rgb WColor from a HSV value

Parameters
hhue
ssaturation
vvalue
Returns
the color

Definition at line 132 of file WGEUtils.cpp.

Referenced by getNthHSVColor().

WColor wge::createColorFromIndex ( int  index)

creates the same color as the atlas colormap shader from the index

Parameters
indexunsigned char that indexes the color
Returns
the color

Definition at line 58 of file WGEUtils.cpp.

osg::ref_ptr< osg::Geometry > wge::createUnitCube ( const WColor &  color)

Creates a osg::Geometry containing an unit cube, having 3D texture coordinates.

Parameters
colorthe color to set for all vertices
Returns
the geometry

Definition at line 99 of file WGEGeodeUtils.cpp.

Referenced by generateSolidBoundingBoxNode().

osg::ref_ptr< osg::Geometry > wge::createUnitCubeAsLines ( const WColor &  color)

Creates a osg::Geometry containing an unit cube as line-strips, having 3D texture coordinates.

Parameters
colorthe color to set for all vertices
Returns
the geometry

Definition at line 168 of file WGEGeodeUtils.cpp.

Referenced by WGEGridNode::WGEGridNode().

void wge::enableTransparency ( osg::ref_ptr< osg::Node >  node)

Enable transparency for the given node.

This enabled blending and sets the node to the transparency bin.

Parameters
nodethe node

Definition at line 211 of file WGEUtils.cpp.

osg::ref_ptr< osg::Geode > wge::generateBoundingBoxGeode ( const WBoundingBox bb,
const WColor &  color 
)

Generates an OSG geode for the bounding box.

Parameters
bbThe axis aligned bounding box to generate a geode from.
colorThe color in which the bounding box should be generated
Returns
The OSG geode containing the 12 edges of the box.

Definition at line 52 of file WGEGeodeUtils.cpp.

References WBoundingBoxImpl< VT >::getMax(), and WBoundingBoxImpl< VT >::getMin().

osg::ref_ptr< osg::Vec3Array > wge::generateCuboidQuadNormals ( const std::vector< WPosition > &  corners)

Generates for all QUADS of the Cuboid the normals in the following order:

  z-axis  y-axis
  |      /
  | h___/_g
  |/:    /|
  d_:___c |
  | :...|.|
  |.e   | f
  |_____|/ ____x-axis
 a      b
  • a,b,c,d
  • b,f,g,c
  • f,e,h,g
  • e,a,d,h
  • d,c,g,h
  • a,b,f,e
Parameters
cornersCorner points of the cuboid.
Returns
Array of normals in the order as shown above.

Definition at line 85 of file WGEGeometryUtils.cpp.

References getQuadNormal().

Referenced by genPointBlobs().

osg::ref_ptr< osg::Vec3Array > wge::generateCuboidQuads ( const std::vector< WPosition > &  corners)

Creates out of eight corner vertices QUAD vertices.

Parameters
cornersThe eight corner vertices which must be in the following order:
 z-axis  y-axis
 |      /
 | h___/_g
 |/:    /|
 d_:___c |
 | :...|.|
 |.e   | f
 |_____|/ ____x-axis
a      b

The QUADS are generated in the following order:

  • a,b,c,d
  • b,f,g,c
  • f,e,h,g
  • e,a,d,h
  • d,c,g,h
  • a,b,f,e
Returns
OSG vertex array where every four vertices describing a QUAD.

Definition at line 38 of file WGEGeometryUtils.cpp.

Referenced by genPointBlobs().

osg::ref_ptr< osg::Geode > wge::generateLineStripGeode ( const WLine line,
const float  thickness = 3.0f,
const WColor &  color = WColor( 0, 0, 0, 0 ) 
)

Generates a line geode with thickness and color as parameters.

Parameters
linesequence of points
thicknessHow thick the line strip should be
colorIf present this color is used for the whole line, otherwise local coloring is used
Returns
The new assembled geode for this line

Definition at line 389 of file WGEGeodeUtils.cpp.

References WMixinVector< ValueT >::back(), getRGBAColorFromDirection(), and WMixinVector< ValueT >::size().

osg::ref_ptr< osg::Node > wge::generateSolidBoundingBoxNode ( const WBoundingBox bb,
const WColor &  color,
bool  threeDTexCoords = true 
)

Generates an OSG node for the specified bounding box.

It uses solid faces. This actually returns a MatrixTransform node and is especially useful for shader based raytracing.

Parameters
bbThe axis aligned bounding box
colorThe color in which the bounding box should be generated
threeDTexCoordsTrue if 3D texture coordinates should be created.
Returns
The OSG node containing the 12 edges of the box.

Definition at line 211 of file WGEGeodeUtils.cpp.

References createUnitCube(), WBoundingBoxImpl< VT >::getMax(), and WBoundingBoxImpl< VT >::getMin().

osg::ref_ptr< osg::Geode > wge::genFinitePlane ( double  xSize,
double  ySize,
const WPlane p,
const WColor &  color = WColor( 0.0, 0.7, 0.7, 1.0 ),
bool  border = false 
)

Generates a geode out of a Plane with a fixed size in direction of the vectors which span that plane.

Parameters
xSizehow far the plane from its center along the x-axis should be drawn (both directions)
ySizehow far the plane from its center along the y-axis should be drawn (both directions)
pThe plane instance
colorThe color of the plane
borderIf true than a border around each plane is drawn in inverse color of the plane
Returns
The new assembled geode for this plane

Definition at line 465 of file WGEGeodeUtils.cpp.

References WPlane::getPointInPlane().

Referenced by WGEOffscreenTexturePass::setup().

osg::ref_ptr< osg::Geode > wge::genFinitePlane ( osg::Vec3 const &  base,
osg::Vec3 const &  a,
osg::Vec3 const &  b 
)

Generates a geode out of two vectors and an origin position.

Parameters
basethe origin position. NOT the center.
athe first vector spanning the plane
bthe second vector spanning the plane
Returns
the geode

Definition at line 507 of file WGEGeodeUtils.cpp.

template<class Container >
osg::ref_ptr< osg::Geode > wge::genPointBlobs ( boost::shared_ptr< Container >  points,
double  size,
const WColor &  color = WColor( 1.0, 0.0, 0.0, 1.0 ) 
)
inline

For each points in the STL container generate small cubes.

Parameters
pointsCenter point of the cubes
sizeThe size of the cubes
colorThe color of the cubes
Template Parameters
AnSTL container with WPositions as elements ( don't try it with different than vector, set, list or queue )
Returns
Geode with as many cubes as points in the container where each cube is around a certain position.

Definition at line 247 of file WGEGeodeUtils.h.

References generateCuboidQuadNormals(), and generateCuboidQuads().

osg::ref_ptr< WGESubdividedPlane > wge::genUnitSubdividedPlane ( size_t  resX,
size_t  resY,
double  spacing = 0.01 
)

Generates a plane subdivided into quads.

Parameters
resXHow many quads in x-direction
resYHow many quads in y-direction
spacingNot implement yet
Returns
The new uncolored plane geode

Definition at line 551 of file WGEGeodeUtils.cpp.

Referenced by WGEGeodeUtilsTest::testCenterPoints(), and WGEGeodeUtilsTest::testNumQuadsAndTheirVerticesWithoutSpacing().

osg::ref_ptr< osg::Image > wge::genWhiteNoiseImage ( size_t  sizeX,
size_t  sizeY,
size_t  sizeZ,
size_t  channels = 1 
)

Generates an image only containing white noise in its channels.

Parameters
sizeXsize in x direction (in pixels)
sizeYsize in y direction (in pixels)
sizeZsize in z direction (in pixels)
channelsthe number of channels. Valid are 1, 3 and 4.
Returns
the generated image.

Definition at line 89 of file WGETextureUtils.cpp.

Referenced by genWhiteNoiseTexture().

osg::ref_ptr< WGETexture< osg::Texture1D > > wge::genWhiteNoiseTexture ( size_t  sizeX,
size_t  channels 
)

This generates an 1D texture only containing white noise in its channels.

Parameters
sizeXsize in x direction (in pixels)
channelsthe number of channels. Valid are 1, 3 and 4.
Returns
the generated texture.

Definition at line 49 of file WGETextureUtils.cpp.

References genWhiteNoiseImage().

Referenced by WGEPostprocessorLineAO::WGEPostprocessorLineAO(), and WGEPostprocessorSSAO::WGEPostprocessorSSAO().

osg::ref_ptr< WGETexture< osg::Texture2D > > wge::genWhiteNoiseTexture ( size_t  sizeX,
size_t  sizeY,
size_t  channels 
)

This generates an 2D texture only containing white noise in its channels.

Parameters
sizeXsize in x direction (in pixels)
sizeYsize in y direction (in pixels)
channelsthe number of channels. Valid are 1, 3 and 4.
Returns
the generated texture.

Definition at line 61 of file WGETextureUtils.cpp.

References genWhiteNoiseImage().

osg::ref_ptr< WGETexture< osg::Texture3D > > wge::genWhiteNoiseTexture ( size_t  sizeX,
size_t  sizeY,
size_t  sizeZ,
size_t  channels 
)

This generates an 3D texture only containing white noise in its channels.

Parameters
sizeXsize in x direction (in pixels)
sizeYsize in y direction (in pixels)
sizeZsize in z direction (in pixels)
channelsthe number of channels. Valid are 1, 3 and 4.
Returns
the generated texture.

Definition at line 74 of file WGETextureUtils.cpp.

References genWhiteNoiseImage().

size_t wge::getMaxTexUnits ( )

Returns the maximum number of textures that can be bound to a node.

Call this only from withing the OSG thread!

Returns
the max number of texture units.

Definition at line 40 of file WGETextureUtils.cpp.

Referenced by WGEColormapping::callback().

WColor wge::getNthHSVColor ( int  n)

creates the nth color of a partition of the hsv color circle

Parameters
nnumber of the color
Returns
the color

Definition at line 164 of file WGEUtils.cpp.

References createColorFromHSV().

osg::Vec3 wge::getQuadNormal ( const WPosition a,
const WPosition b,
const WPosition c 
)

Generates for a QUAD given via 3 three points ( the fourth is not needed ) the normal.

Parameters
aFirst point of the QUAD
bSecond point of the QUAD
cThird point of the QUAD
Returns
OSG Vector of the normal of the QUAD

Definition at line 75 of file WGEGeometryUtils.cpp.

Referenced by generateCuboidQuadNormals().

WColor wge::getRGBAColorFromDirection ( const WPosition pos1,
const WPosition pos2 
)
inline

Transforms a direction given via two points into a RGB color.

Parameters
pos1First point
pos2Second point
Returns
converts a vector to a color

Definition at line 116 of file WGEUtils.h.

Referenced by generateLineStripGeode().

osg::ref_ptr< osg::Vec3Array > wge::osgVec3Array ( const std::vector< WPosition > &  posArray)

Converts a whole vector of WPositions into an osg::Vec3Array.

Parameters
posArrayThe given positions vector
Returns
Refernce to the same vector but as osg::Vec3Array.

Definition at line 36 of file WGEUtils.cpp.

Referenced by triangulate().

WTriangleMesh::SPtr wge::triangulate ( const std::vector< WPosition > &  points,
double  transformationFactor = 0.0 
)

Calculate the Delaunay Triangulation of the given points.

If the parameter transformationFactor is not zero, the points will be transformed to calcule the triangles to get a better triangulation, but the returned mesh will consist of the original points. Every point which lies above the centroid of all points will be put away from this centroid by transformationFactor * height above the centroid. Any point below the centroid will be drawn to the centroid because its height is negative. This effect is inverted with a negative transformationFactor. This transformation is used to calculate the head surface between several electrodes, were a transformationFactor of -0.005 is reasonable.

Parameters
pointsvector of the points to triangulate
transformationFactormagnitude of the transformation before the triangulation
Returns
triangulation as WTriangleMesh

Definition at line 98 of file WGEGeometryUtils.cpp.

References osgVec3Array().

Referenced by WGEGeometryUtilsTest::testTriangulate().

void wge::unbindTexture ( osg::ref_ptr< osg::Node >  node,
size_t  unit,
size_t  count = 1 
)

Removes the binding associated with the specified unit.

Parameters
unitthe unit to unbind
nodethe node from which the binding should be removed
countthe number of units beginning at the specified one should be unbound? 1 is the default.

Definition at line 31 of file WGETextureUtils.cpp.

Referenced by WGEColormapping::callback().

osg::Vec3 wge::unprojectFromScreen ( const osg::Vec3  screen,
osg::ref_ptr< osg::Camera >  camera 
)

Converts screen coordinates into Camera coordinates.

Parameters
screenthe screen coordinates
cameraThe matrices of this camera will used for unprojecting.
Returns
un-projects a screen coordinate back to world space

Definition at line 48 of file WGEUtils.cpp.

Referenced by WROIBox::updateGFX(), and WROISphere::updateGFX().

osg::Vec4 wge::unprojectFromScreen ( const osg::Vec4  screen,
osg::ref_ptr< osg::Camera >  camera 
)

Converts screen coordinates into Camera coordinates.

Notes:
this method can be useful to work with vectors (w component 0)
Parameters
screenthe screen coordinates
cameraThe matrices of this camera will used for unprojecting.
Returns
un-projects a screen coordinate back to world space

Definition at line 53 of file WGEUtils.cpp.

osg::ref_ptr< osg::PositionAttitudeTransform > wge::vector2label ( osg::Vec3  position)

helper function to add a label with it's position vector

Parameters
positionposition of the label
Returns
a positionattitudetransfom object containing the label

Definition at line 458 of file WGEGeodeUtils.cpp.

References addLabel(), and string_utils::toString().