30 #include "../common/math/linearAlgebra/WLinearAlgebra.h"
32 #include "WGETexture.h"
36 osg::ref_ptr< osg::Vec3Array >
wge::osgVec3Array(
const std::vector< WPosition >& posArray )
38 osg::ref_ptr< osg::Vec3Array > result = osg::ref_ptr< osg::Vec3Array >(
new osg::Vec3Array );
39 result->reserve( posArray.size() );
40 std::vector< WPosition >::const_iterator cit;
41 for( cit = posArray.begin(); cit != posArray.end(); ++cit )
43 result->push_back( *cit );
50 return screen * osg::Matrix::inverse( camera->getViewMatrix() * camera->getProjectionMatrix() * camera->getViewport()->computeWindowMatrix() );
55 return screen * osg::Matrix::inverse( camera->getViewMatrix() * camera->getProjectionMatrix() * camera->getViewport()->computeWindowMatrix() );
67 return WColor( 0.0, 0.0, 0.0, 1.0 );
70 if( ( index & 1 ) == 1 )
74 if( ( index & 2 ) == 2 )
78 if( ( index & 4 ) == 4 )
82 if( ( index & 8 ) == 8 )
85 if( r < 1.0 && g < 1.0 && b < 1.0 )
91 if( ( index & 16 ) == 16 )
94 if( r < 1.0 && g < 1.0 && b < 1.0 )
100 if( ( index & 32 ) == 32 )
103 if( r < 1.0 && g < 1.0 && b < 1.0 )
109 if( ( index & 64 ) == 64 )
112 if( r < 1.0 && g < 1.0 && b < 1.0 )
117 if( ( index & 128 ) == 128 )
120 if( r < 1.0 && g < 1.0 && b < 1.0 )
129 return WColor( r, g, b, 1.0 );
137 float f = (
static_cast<float>( h ) / 60.0 ) - hi;
139 float p = v * ( 1.0 - s );
140 float q = v * ( 1.0 - s * f );
141 float t = v * ( 1.0 - s * ( 1.0 - f ) );
146 return WColor( v, t, p, 1.0 );
148 return WColor( q, v, p, 1.0 );
150 return WColor( p, v, t, 1.0 );
152 return WColor( p, q, v, 1.0 );
154 return WColor( t, p, v, 1.0 );
156 return WColor( v, p, q, 1.0 );
158 return WColor( v, t, p, 1.0 );
160 return WColor( v, t, p, 1.0 );
187 if( ( n & 16 ) == 16 )
191 if( ( n & 32 ) == 32 )
195 if( ( n & 64 ) == 64 )
199 if( ( n & 128 ) == 128 )
203 if( ( n & 256 ) == 256 )
213 osg::StateSet* state = node->getOrCreateStateSet();
216 state->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
219 state->setMode( GL_DEPTH_TEST, osg::StateAttribute::ON );
229 state->setMode( GL_BLEND, osg::StateAttribute::ON );