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 );
128 template<
typename T >
129 void bindAsUniform( osg::Node* node, T prop, std::string name );
161 WPosition direction( normalize( pos2 - pos1 ) );
162 return WColor( std::abs( direction[0] ), std::abs( direction[1] ), std::abs( direction[2] ), 1.0f );
167 template<
typename T >
170 osg::ref_ptr< osg::Uniform > uniform =
new osg::Uniform( name.c_str(), prop );
171 osg::StateSet *states = node->getOrCreateStateSet();
172 states->addUniform( uniform );
185 osg::ref_ptr< osg::Uniform > uniform(
new osg::Uniform( name.c_str(),
static_cast< float >( prop ) ) );
186 osg::StateSet *states = node->getOrCreateStateSet();
187 states->addUniform( uniform );
200 osg::ref_ptr< osg::Uniform > uniform(
new osg::Uniform( name.c_str(),
static_cast< int >( prop ) ) );
201 osg::StateSet *states = node->getOrCreateStateSet();
202 states->addUniform( uniform );
216 osg::StateSet *states = node->getOrCreateStateSet();
217 states->addUniform( uniform );
231 osg::StateSet *states = node->getOrCreateStateSet();
232 states->addUniform( uniform );
242 inline void bindAsUniform< osg::ref_ptr< osg::Uniform > >( osg::Node* node, osg::ref_ptr< osg::Uniform > uniform, std::string )
244 osg::StateSet *states = node->getOrCreateStateSet();
245 states->addUniform( uniform );