![]() |
OpenWalnut
1.5.0dev
|
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< WMatrix4d > |
Maps WMatrix4d to osg::Matrixd. More... | |
class | UniformType< WItemSelector > |
Maps Selection Properties to ints. More... | |
class | UniformType< WIntervalDouble > |
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. More... | |
osg::Vec2 | toUniformType (const WIntervalDouble &in) |
Creates an OSG vec2 when an interval is inserted. More... | |
template<typename InType > | |
UniformType< InType >::Type | toUniformType (const InType &in) |
Create an instance of the uniform target type given some input type. More... | |
osg::ref_ptr< osg::Geode > | generateBoundingBoxGeode (const WBoundingBox &bb, const WColor &color) |
Generates an OSG geode for the bounding box. More... | |
osg::ref_ptr< osg::Node > | generateSolidBoundingBoxNode (const WBoundingBox &bb, const WColor &color, bool threeDTexCoords=true) |
Generates an OSG node for the specified bounding box. More... | |
osg::ref_ptr< osg::Geometry > | createUnitCube (const WColor &color) |
Creates a osg::Geometry containing an unit cube, having 3D texture coordinates. More... | |
void | createCube (osg::ref_ptr< osg::Geometry > geometry, const WPosition &position, const WPosition &size, const WColor &color) |
Create an arbitrary cube and insert it into the given geometry. More... | |
osg::ref_ptr< osg::Geometry > | createCube (const WPosition &position, const WPosition &size, const WColor &color) |
Create an arbitrary cube. More... | |
osg::ref_ptr< osg::Geometry > | createUnitCubeAsLines (const WColor &color, bool asLines=false) |
Creates a osg::Geometry containing an unit cube as line-strips, having 3D texture coordinates. More... | |
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. More... | |
osg::ref_ptr< osg::Geometry > | convertToOsgGeometryFlatShaded (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 in order to produce a flat shaded rendering. More... | |
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. More... | |
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. More... | |
osg::ref_ptr< osg::PositionAttitudeTransform > | addLabel (osg::Vec3 position, std::string text) |
helper function to add a label somewhere More... | |
osg::ref_ptr< osg::PositionAttitudeTransform > | vector2label (osg::Vec3 position) |
helper function to add a label with it's position vector More... | |
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. More... | |
osg::ref_ptr< osg::Group > | creatCoordinateSystem (osg::Vec3 middle, double sizeX, double sizeY, double sizeZ) |
Create a coordinate system. More... | |
osg::ref_ptr< osg::Geode > | genFinitePlane (osg::Vec3 const &base, osg::Vec3 const &a, osg::Vec3 const &b, const WColor &color=defaultColor::WHITE) |
Generates a geode out of two vectors and an origin position. More... | |
osg::ref_ptr< osg::Vec3Array > | generateCuboidQuads (const std::vector< WPosition > &corners) |
Creates out of eight corner vertices QUAD vertices. More... | |
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. More... | |
osg::ref_ptr< osg::Vec3Array > | generateCuboidQuadNormals (const std::vector< WPosition > &corners) |
Generates for all QUADS of the Cuboid the normals in the following order: More... | |
WTriangleMesh::SPtr | triangulate (const std::vector< WPosition > &points, double transformationFactor=0.0) |
Calculate the Delaunay Triangulation of the given points. More... | |
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. More... | |
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. More... | |
void | unbindTexture (osg::ref_ptr< osg::Node > node, size_t unit, size_t count=1) |
Removes the binding associated with the specified unit. More... | |
size_t | getMaxTexUnits () |
Returns the maximum number of textures that can be bound to a node. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
osg::ref_ptr< WGETexture< osg::Texture3D > > | genTuringNoiseTexture (std::size_t sizeX, std::size_t sizeY, std::size_t sizeZ, std::size_t channels=1) |
Generates a 3D turing noise texture. More... | |
void | enableTransparency (osg::ref_ptr< osg::Node > node) |
Enable transparency for the given node. More... | |
WColor | getRGBAColorFromDirection (const WPosition &pos1, const WPosition &pos2) |
Transforms a direction given via two points into a RGB color. More... | |
osg::ref_ptr< osg::Vec3Array > | osgVec3Array (const std::vector< WPosition > &posArray) |
Converts a whole vector of WPositions into an osg::Vec3Array. More... | |
osg::Vec3 | unprojectFromScreen (const osg::Vec3 screen, osg::ref_ptr< WGECamera > camera) |
Converts screen coordinates into Camera coordinates. More... | |
osg::Vec4 | unprojectFromScreen (const osg::Vec4 screen, osg::ref_ptr< WGECamera > camera) |
Converts screen coordinates into Camera coordinates. More... | |
WColor | createColorFromIndex (int index) |
creates the same color as the atlas colormap shader from the index More... | |
WColor | createColorFromHSV (int h, float s=1.0, float v=1.0) |
creates a rgb WColor from a HSV value More... | |
WColor | getNthHSVColor (int n) |
creates the nth color of a partition of the hsv color circle More... | |
template<typename T > | |
void | bindAsUniform (osg::Node *node, T prop, std::string name) |
Creates a osg::Uniform with given type and name and applies it to the given node. More... | |
osg::ref_ptr< osg::Node > | generateCullProxy (const WBoundingBox &bbox) |
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling. More... | |
osg::ref_ptr< osg::Node > | generateDynamicCullProxy (osg::ref_ptr< osg::Node > node) |
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling. More... | |
template<> | |
void | bindAsUniform< double > (osg::Node *node, double prop, std::string name) |
Template specialization for double values. More... | |
template<> | |
void | bindAsUniform< size_t > (osg::Node *node, size_t prop, std::string name) |
Template specialization for size_t values. More... | |
template<> | |
void | bindAsUniform< WPropDouble > (osg::Node *node, WPropDouble prop, std::string name) |
Template specialization for WPropDouble values. More... | |
template<> | |
void | bindAsUniform< WPropColor > (osg::Node *node, WPropColor prop, std::string name) |
Template specialization for WPropColor values. More... | |
template<> | |
void | bindAsUniform< WPropBool > (osg::Node *node, WPropBool prop, std::string name) |
Template specialization for WPropBool values. More... | |
template<> | |
void | bindAsUniform< WPropInt > (osg::Node *node, WPropInt prop, std::string name) |
Template specialization for WPropInt values. More... | |
template<> | |
void | bindAsUniform< osg::ref_ptr< osg::Uniform > > (osg::Node *node, osg::ref_ptr< osg::Uniform > uniform, std::string) |
Template specialization for osg::Uniform values. More... | |
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.
osg::ref_ptr< osg::PositionAttitudeTransform > wge::addLabel | ( | osg::Vec3 | position, |
std::string | text | ||
) |
helper function to add a label somewhere
position | position of the label |
text | text |
Definition at line 595 of file WGEGeodeUtils.cpp.
References WPathHelper::getAllFonts().
Referenced by vector2label().
|
inline |
Creates a osg::Uniform with given type and name and applies it to the given node.
This is a shortcut for using WGEPropertyUniform in this way:
*
T | This is the data used for the uniform. It may be a PropertyType, an integral or an osg::Uniform. |
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 171 of file WGEUtils.h.
|
inline |
Template specialization for double values.
This is a shortcut for osg::Uniform generation and osg::StateSet-binding.
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 186 of file WGEUtils.h.
|
inline |
Template specialization for osg::Uniform values.
node | Node where the uniform should be bound to. |
uniform | The type of the uniform. |
Definition at line 275 of file WGEUtils.h.
|
inline |
Template specialization for size_t values.
This is a shortcut for osg::Uniform generation and osg::StateSet-binding.
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 201 of file WGEUtils.h.
|
inline |
Template specialization for WPropBool values.
This is a shortcut for osg::Uniform generation and osg::StateSet-binding.
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 246 of file WGEUtils.h.
|
inline |
Template specialization for WPropColor values.
This is a shortcut for osg::Uniform generation and osg::StateSet-binding.
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 231 of file WGEUtils.h.
|
inline |
Template specialization for WPropDouble values.
This is a shortcut for osg::Uniform generation and osg::StateSet-binding.
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 216 of file WGEUtils.h.
|
inline |
Template specialization for WPropInt values.
This is a shortcut for osg::Uniform generation and osg::StateSet-binding.
node | Node where the uniform should be bound to. |
prop | The type of the uniform. |
name | The name of the uniform. |
Definition at line 261 of file WGEUtils.h.
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:
node | where to bind |
unit | the unit to use |
texture | the texture to use. |
prefix | if specified, defines the uniform name prefix. (Sampler, Unit, Sizes, ...) |
T | the type of texture. Usually osg::Texture3D or osg::Texture2D. |
Definition at line 167 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:
node | where to bind |
unit | the unit to use |
texture | the texture to use. |
prefix | if specified, defines the uniform name prefix. (Sampler, Unit, Sizes, ...) |
T | the type of texture. Usually osg::Texture3D or osg::Texture2D. |
Definition at line 182 of file WDataTexture3D.cpp.
Referenced by WGETexture< TextureType >::bind(), WGEOffscreenRenderPass::bind(), WGEColormapping::callback(), WMDirectVolumeRendering::moduleMain(), WMIsosurfaceRaytracer::moduleMain(), WMProjectionsAsContext::moduleMain(), WMTemplateShaders::moduleMain(), and WMTransferFunctionColorBar::moduleMain().
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:
node | where to bind |
unit | the unit to use |
texture | the texture to use. |
prefix | if specified, defines the uniform name prefix. (Sampler, Unit, Sizes, ...) |
T | the type of texture. Usually osg::Texture3D or osg::Texture2D. |
Definition at line 184 of file WGETextureUtils.h.
References string_utils::toString().
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.
mesh | the WTriangleMesh used as input |
includeNormals | When true, calculate the vertex normals and include them into the geometry. |
defaultColor | This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh. |
lighting | if true, a standard lighting is activated for this geometry |
useMeshColor | if true, the mesh color is used. If false, the defaultColor is used. |
Definition at line 368 of file WGEGeodeUtils.cpp.
Referenced by convertToOsgGeometry(), WMEEGView::drawHeadSurface(), WMSurfaceIllustrator::renderMesh(), and WMTriangleMeshRenderer::renderMesh().
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.
mesh | the WTriangleMesh used as input |
colorMap | the map from vertex to color. |
includeNormals | When true, calculate the vertex normals and include them into the geometry. |
defaultColor | This color is used in case the colorMap does not provide a color for a vertex |
lighting | if true, a standard lighting is activated for this geometry* |
Definition at line 520 of file WGEGeodeUtils.cpp.
References convertToOsgGeometry(), and WColoredVertices::getData().
osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometryFlatShaded | ( | 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 in order to produce a flat shaded rendering.
mesh | the WTriangleMesh used as input |
includeNormals | When true, calculate the triangle normals and include them into the geometry. |
defaultColor | This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh. |
lighting | if true, a standard lighting is activated for this geometry |
useMeshColor | if true, the mesh color is used. If false, the defaultColor is used. |
Definition at line 438 of file WGEGeodeUtils.cpp.
Referenced by WMTriangleMeshRenderer::renderMesh().
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).
mesh | The WTriangleMesh used as input. |
defaultColor | This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh. |
useMeshColor | If true, the mesh color is used. If false, the defaultColor is used. |
Definition at line 549 of file WGEGeodeUtils.cpp.
Referenced by WMSurfaceIllustrator::renderMesh(), and WMTriangleMeshRenderer::renderMesh().
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.
middle | osg::Vec3( middleX, middleY, middleZ ) middle points of X, Y, Z |
sizeX | whole lenght of X |
sizeY | whole lenght of Y |
sizeZ | whole lenght of Z |
Definition at line 722 of file WGEGeodeUtils.cpp.
Referenced by WMTriangleMeshRenderer::renderMesh().
WColor wge::createColorFromHSV | ( | int | h, |
float | s = 1.0 , |
||
float | v = 1.0 |
||
) |
creates a rgb WColor from a HSV value
h | hue |
s | saturation |
v | value |
Definition at line 136 of file WGEUtils.cpp.
Referenced by getNthHSVColor().
WColor wge::createColorFromIndex | ( | int | index | ) |
creates the same color as the atlas colormap shader from the index
index | unsigned char that indexes the color |
Definition at line 62 of file WGEUtils.cpp.
Referenced by WMPaintTexture::createROI().
osg::ref_ptr< osg::Geometry > wge::createCube | ( | const WPosition & | position, |
const WPosition & | size, | ||
const WColor & | color | ||
) |
Create an arbitrary cube.
position | position of the lower,left,front vertex |
size | size in x,y,z direction |
color | a color |
Definition at line 232 of file WGEGeodeUtils.cpp.
References createCube().
void wge::createCube | ( | osg::ref_ptr< osg::Geometry > | geometry, |
const WPosition & | position, | ||
const WPosition & | size, | ||
const WColor & | color | ||
) |
Create an arbitrary cube and insert it into the given geometry.
You will get a cube with normals, tex coords and a single color. This function is very restrictive with respect to the given geode. It is not recommended to use it in combination with an geometry you already filled with something. It is designed to be used to fill many cubes into one geometry.
position | position of the lower,left,front vertex |
size | size in x,y,z direction |
color | a color |
geometry | the geometry where to add the cube. It can be completely empty (no arrays). If you use an invalid (in the following terms) geometry here, the graphics will fail. Ensure that you have a color array, tex array, normal array and vertex array, where the color array is used per primitive set and normals/tex are bound per vertex. The vertices/tex/normals need to be vec3 arrays. The color array needs to be a vec4 array. |
Definition at line 99 of file WGEGeodeUtils.cpp.
Referenced by createCube(), createUnitCube(), WMVoxelizer::genDataSetGeode(), and WROIBox::updateGFX().
osg::ref_ptr< osg::Geometry > wge::createUnitCube | ( | const WColor & | color | ) |
Creates a osg::Geometry containing an unit cube, having 3D texture coordinates.
color | the color to set for all vertices |
Definition at line 240 of file WGEGeodeUtils.cpp.
References createCube().
Referenced by generateSolidBoundingBoxNode().
osg::ref_ptr< osg::Geometry > wge::createUnitCubeAsLines | ( | const WColor & | color, |
bool | asLines = false |
||
) |
Creates a osg::Geometry containing an unit cube as line-strips, having 3D texture coordinates.
color | the color to set for all vertices |
asLines | force the cube to be made only of lines, no line strips. |
Definition at line 246 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.
node | the node |
Definition at line 215 of file WGEUtils.cpp.
Referenced by WMIsosurfaceRaytracer::moduleMain(), WMPointRenderer::moduleMain(), and WMIsosurface::renderMesh().
osg::ref_ptr< osg::Geode > wge::generateBoundingBoxGeode | ( | const WBoundingBox & | bb, |
const WColor & | color | ||
) |
Generates an OSG geode for the bounding box.
bb | The axis aligned bounding box to generate a geode from. |
color | The color in which the bounding box should be generated |
Definition at line 51 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
corners | Corner points of the cuboid. |
Definition at line 84 of file WGEGeometryUtils.cpp.
References getQuadNormal().
osg::ref_ptr< osg::Vec3Array > wge::generateCuboidQuads | ( | const std::vector< WPosition > & | corners | ) |
Creates out of eight corner vertices QUAD vertices.
corners | The 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:
Definition at line 37 of file WGEGeometryUtils.cpp.
osg::ref_ptr< osg::Node > wge::generateCullProxy | ( | const WBoundingBox & | bbox | ) |
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling.
This is especially useful if you create some geometry and modify it on the GPU by shaders. In these cases, OSG will not properly cull and near-far clip. This cull proxy is basically a cube, which gets shrinked to zero size on the GPU. This ensures you cannot see it, but it makes OSG see you proper bounding volume.
bbox | the bounding box to cover |
Definition at line 236 of file WGEUtils.cpp.
References generateSolidBoundingBoxNode().
Referenced by generateDynamicCullProxy(), WMNavigationSlices::initOSG(), WMImageSpaceLIC::moduleMain(), WMImageSpaceTensorLIC::moduleMain(), and WMTemplateRenderPipelines::moduleMain().
osg::ref_ptr< osg::Node > wge::generateDynamicCullProxy | ( | osg::ref_ptr< osg::Node > | node | ) |
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling.
This is especially useful if you create some geometry and modify it on the GPU by shaders. In these cases, OSG will not properly cull and near-far clip. This cull proxy is basically a cube, which gets shrinked to zero size on the GPU. This ensures you cannot see it, but it makes OSG see you proper bounding volume.
node | the node |
Definition at line 295 of file WGEUtils.cpp.
References generateCullProxy().
Referenced by WGEOffscreenRenderNode::addGeometryRenderPass().
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.
bb | The axis aligned bounding box |
color | The color in which the bounding box should be generated |
threeDTexCoords | True if 3D texture coordinates should be created. |
Definition at line 332 of file WGEGeodeUtils.cpp.
References createUnitCube(), WBoundingBoxImpl< VT >::getMax(), and WBoundingBoxImpl< VT >::getMin().
Referenced by generateCullProxy(), WMDirectVolumeRendering::moduleMain(), WMIsosurfaceRaytracer::moduleMain(), and WMSurfaceParameterAnimator::renderSurface().
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.
xSize | how far the plane from its center along the x-axis should be drawn (both directions) |
ySize | how far the plane from its center along the y-axis should be drawn (both directions) |
p | The plane instance |
color | The color of the plane |
border | If true than a border around each plane is drawn in inverse color of the plane |
Definition at line 630 of file WGEGeodeUtils.cpp.
References WPlane::getPointInPlane().
Referenced by WDemoGeometry::createPlaneGeometry(), WMNavigationSlices::initOSG(), WMImageSpaceLIC::initOSG(), WMImageSpaceTensorLIC::initOSG(), WMColormapper::moduleMain(), WMTransferFunctionColorBar::moduleMain(), WGEOffscreenTexturePass::setup(), and WGEViewerEffect::WGEViewerEffect().
osg::ref_ptr< osg::Geode > wge::genFinitePlane | ( | osg::Vec3 const & | base, |
osg::Vec3 const & | a, | ||
osg::Vec3 const & | b, | ||
const WColor & | color = defaultColor::WHITE |
||
) |
Generates a geode out of two vectors and an origin position.
base | the origin position. NOT the center. |
a | the first vector spanning the plane |
b | the second vector spanning the plane |
color | the color to use. |
Definition at line 673 of file WGEGeodeUtils.cpp.
osg::ref_ptr< WGETexture< osg::Texture3D > > wge::genTuringNoiseTexture | ( | std::size_t | sizeX, |
std::size_t | sizeY, | ||
std::size_t | sizeZ, | ||
std::size_t | channels = 1 |
||
) |
Generates a 3D turing noise texture.
For details, see:
Eichelbaum, Sebastian, et al. "Fabric-like visualization of tensor field data on arbitrary surfaces in image space." New Developments in the Visualization and Processing of Tensor Fields. Springer Berlin Heidelberg, 2012. 71-92.
sizeX | The size of the textures in voxels, should be a power of 2. |
sizeY | The size of the textures in voxels, should be a power of 2. |
sizeZ | The size of the textures in voxels, should be a power of 2. |
channels | The number of channels; either 1, 3 or 4. |
Definition at line 122 of file WGETextureUtils.cpp.
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.
sizeX | size in x direction (in pixels) |
sizeY | size in y direction (in pixels) |
sizeZ | size in z direction (in pixels) |
channels | the number of channels. Valid are 1, 3 and 4. |
Definition at line 94 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.
sizeX | size in x direction (in pixels) |
channels | the number of channels. Valid are 1, 3 and 4. |
Definition at line 54 of file WGETextureUtils.cpp.
References genWhiteNoiseImage().
Referenced by WMImageSpaceLIC::moduleMain(), WMIsosurfaceRaytracer::moduleMain(), WMTemplateShaders::moduleMain(), WGEPostprocessorHalftone::WGEPostprocessorHalftone(), 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.
sizeX | size in x direction (in pixels) |
sizeY | size in y direction (in pixels) |
channels | the number of channels. Valid are 1, 3 and 4. |
Definition at line 66 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.
sizeX | size in x direction (in pixels) |
sizeY | size in y direction (in pixels) |
sizeZ | size in z direction (in pixels) |
channels | the number of channels. Valid are 1, 3 and 4. |
Definition at line 79 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!
Definition at line 45 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
n | number of the color |
Definition at line 168 of file WGEUtils.cpp.
References createColorFromHSV().
Referenced by WMHierchClustDisplay::clusterSelection(), WMClusterDisplay::colorClusters(), WMClusterDisplay::handleBiggestClustersChanged(), WMClusterDisplay::handleRoiChanged(), WMClusterDisplayVoxels::initColors(), WMHierchClustDisplay::initializeColorsHdist(), WMHierchClustDisplay::initializeColorsSize(), WMHierchClustDisplay::updateSelection(), WMClusterDisplay::updateWidgets(), and WMClusterDisplayVoxels::updateWidgets().
Generates for a QUAD given via 3 three points ( the fourth is not needed ) the normal.
a | First point of the QUAD |
b | Second point of the QUAD |
c | Third point of the QUAD |
Definition at line 74 of file WGEGeometryUtils.cpp.
Referenced by generateCuboidQuadNormals().
Transforms a direction given via two points into a RGB color.
pos1 | First point |
pos2 | Second point |
Definition at line 162 of file WGEUtils.h.
osg::ref_ptr< osg::Vec3Array > wge::osgVec3Array | ( | const std::vector< WPosition > & | posArray | ) |
Converts a whole vector of WPositions into an osg::Vec3Array.
posArray | The given positions vector |
Definition at line 40 of file WGEUtils.cpp.
Referenced by triangulate().
UniformType< InType >::Type wge::toUniformType | ( | const InType & | in | ) |
Create an instance of the uniform target type given some input type.
InType | the input type |
in | the input value |
Definition at line 128 of file WGEUniformTypeTraits.h.
osg::Vec2 wge::toUniformType | ( | const WIntervalDouble & | in | ) |
Creates an OSG vec2 when an interval is inserted.
in | the interval to convert |
Definition at line 29 of file WGEUniformTypeTraits.cpp.
References WInterval< T >::getLower(), and WInterval< T >::getUpper().
Referenced by WGEPropertyUniformCallback< T >::operator()().
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.
points | vector of the points to triangulate |
transformationFactor | magnitude of the transformation before the triangulation |
Definition at line 97 of file WGEGeometryUtils.cpp.
References osgVec3Array().
Referenced by WMEEGView::drawHeadSurface(), and 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.
unit | the unit to unbind |
node | the node from which the binding should be removed |
count | the number of units beginning at the specified one should be unbound? 1 is the default. |
Definition at line 36 of file WGETextureUtils.cpp.
Referenced by WGEColormapping::callback().
osg::Vec3 wge::unprojectFromScreen | ( | const osg::Vec3 | screen, |
osg::ref_ptr< WGECamera > | camera | ||
) |
Converts screen coordinates into Camera coordinates.
screen | the screen coordinates |
camera | The matrices of this camera will used for unprojecting. |
Definition at line 52 of file WGEUtils.cpp.
Referenced by WMNavigationSlices::PickCallback::pick(), WROIBox::updateGFX(), and WROISphere::updateGFX().
osg::Vec4 wge::unprojectFromScreen | ( | const osg::Vec4 | screen, |
osg::ref_ptr< WGECamera > | camera | ||
) |
Converts screen coordinates into Camera coordinates.
screen | the screen coordinates |
camera | The matrices of this camera will used for unprojecting. |
Definition at line 57 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
position | position of the label |
Definition at line 623 of file WGEGeodeUtils.cpp.
References addLabel(), and string_utils::toString().