35 #include <osg/Uniform>
37 #include "../common/WColor.h"
38 #include "../common/WBoundingBox.h"
39 #include "../common/WAssert.h"
40 #include "../common/WPropertyVariable.h"
42 #include "shaders/WGEPropertyUniform.h"
43 #include "WGECamera.h"
71 osg::ref_ptr< osg::Vec3Array >
osgVec3Array(
const std::vector< WPosition >& posArray );
131 template<
typename T >
132 void bindAsUniform( osg::Node* node, T prop, std::string name );
164 WPosition direction( normalize( pos2 - pos1 ) );
165 return WColor( std::abs( direction[0] ), std::abs( direction[1] ), std::abs( direction[2] ), 1.0f );
170 template<
typename T >
173 osg::ref_ptr< osg::Uniform > uniform =
new osg::Uniform( name.c_str(), prop );
174 osg::StateSet *states = node->getOrCreateStateSet();
175 states->addUniform( uniform );
188 osg::ref_ptr< osg::Uniform > uniform(
new osg::Uniform( name.c_str(),
static_cast< float >( prop ) ) );
189 osg::StateSet *states = node->getOrCreateStateSet();
190 states->addUniform( uniform );
203 osg::ref_ptr< osg::Uniform > uniform(
new osg::Uniform( name.c_str(),
static_cast< int >( prop ) ) );
204 osg::StateSet *states = node->getOrCreateStateSet();
205 states->addUniform( uniform );
219 osg::StateSet *states = node->getOrCreateStateSet();
220 states->addUniform( uniform );
234 osg::StateSet *states = node->getOrCreateStateSet();
235 states->addUniform( uniform );
249 osg::StateSet *states = node->getOrCreateStateSet();
250 states->addUniform( uniform );
264 osg::StateSet *states = node->getOrCreateStateSet();
265 states->addUniform( uniform );
275 inline void bindAsUniform< osg::ref_ptr< osg::Uniform > >( osg::Node* node, osg::ref_ptr< osg::Uniform > uniform, std::string )
277 osg::StateSet *states = node->getOrCreateStateSet();
278 states->addUniform( uniform );
This only is a 3d double vector.
Extend the wge utils namespace with additional methods relating WDataTexture3D.
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.
WColor getNthHSVColor(int n)
creates the nth color of a partition of the hsv color circle
void enableTransparency(osg::ref_ptr< osg::Node > node)
Enable transparency for the given node.
WColor createColorFromHSV(int h, float s=1.0, float v=1.0)
creates a rgb WColor from a HSV value
osg::ref_ptr< osg::Node > generateCullProxy(const WBoundingBox &bbox)
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling.
WColor getRGBAColorFromDirection(const WPosition &pos1, const WPosition &pos2)
Transforms a direction given via two points into a RGB color.
void bindAsUniform< WPropDouble >(osg::Node *node, WPropDouble prop, std::string name)
Template specialization for WPropDouble values.
void bindAsUniform< WPropBool >(osg::Node *node, WPropBool prop, std::string name)
Template specialization for WPropBool values.
osg::Vec3 unprojectFromScreen(const osg::Vec3 screen, osg::ref_ptr< WGECamera > camera)
Converts screen coordinates into Camera coordinates.
void bindAsUniform< WPropInt >(osg::Node *node, WPropInt prop, std::string name)
Template specialization for WPropInt values.
WColor createColorFromIndex(int index)
creates the same color as the atlas colormap shader from the index
void bindAsUniform< double >(osg::Node *node, double prop, std::string name)
Template specialization for double values.
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.
void bindAsUniform< size_t >(osg::Node *node, size_t prop, std::string name)
Template specialization for size_t values.
void bindAsUniform< WPropColor >(osg::Node *node, WPropColor prop, std::string name)
Template specialization for WPropColor values.
osg::ref_ptr< osg::Vec3Array > osgVec3Array(const std::vector< WPosition > &posArray)
Converts a whole vector of WPositions into an osg::Vec3Array.