本文整理汇总了C++中osg::Vec4::a方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec4::a方法的具体用法?C++ Vec4::a怎么用?C++ Vec4::a使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Vec4
的用法示例。
在下文中一共展示了Vec4::a方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rasterize
// rasterizes a geometry to color
void rasterize(const Geometry* geometry, const osg::Vec4& color, RenderFrame& frame,
agg::rasterizer& ras, agg::rendering_buffer& buffer)
{
unsigned a = (unsigned)(127.0f+(color.a()*255.0f)/2.0f); // scale alpha up
agg::rgba8 fgColor = agg::rgba8( (unsigned)(color.r()*255.0f), (unsigned)(color.g()*255.0f), (unsigned)(color.b()*255.0f), a );
ConstGeometryIterator gi( geometry );
while( gi.hasMore() )
{
const Geometry* g = gi.next();
for( Geometry::const_iterator p = g->begin(); p != g->end(); p++ )
{
const osg::Vec3d& p0 = *p;
double x0 = frame.xf*(p0.x()-frame.xmin);
double y0 = frame.yf*(p0.y()-frame.ymin);
if ( p == g->begin() )
ras.move_to_d( x0, y0 );
else
ras.line_to_d( x0, y0 );
}
}
agg::renderer<agg::span_abgr32, agg::rgba8> ren(buffer);
ras.render(ren, fgColor);
ras.reset();
}
示例2:
void DebugShadowMap::ViewData::setDebugPolytope
( const char * name, const ConvexPolyhedron & polytope,
osg::Vec4 colorOutline, osg::Vec4 colorInside )
{
if( !getDebugDraw() ) return;
if( &polytope == NULL ) { // delete
PolytopeGeometry & pg = _polytopeGeometryMap[ std::string( name ) ];
for( unsigned int i = 0; i < VECTOR_LENGTH( pg._geometry ) ; i++ )
{
if( pg._geometry[i].valid() ) {
if( _geode[i].valid() &&
_geode[i]->containsDrawable( pg._geometry[i].get() ) )
_geode[i]->removeDrawable( pg._geometry[i].get() );
pg._geometry[i] = NULL;
}
}
_polytopeGeometryMap.erase( std::string( name ) );
} else { // update
PolytopeGeometry & pg = _polytopeGeometryMap[ std::string( name ) ];
pg._polytope = polytope;
if( colorOutline.a() > 0 )
pg._colorOutline = colorOutline;
if( colorInside.a() > 0 )
pg._colorInside = colorInside;
for( unsigned int i = 0; i < VECTOR_LENGTH( pg._geometry ) ; i++ )
{
if( !pg._geometry[i].valid() ) {
pg._geometry[i] = new osg::Geometry;
pg._geometry[i]->setDataVariance( osg::Object::DYNAMIC );
pg._geometry[i]->setUseDisplayList( false );
pg._geometry[i]->setSupportsDisplayList( false );
}
if( _geode[i].valid() &&
!_geode[i]->containsDrawable( pg._geometry[i].get() ) ) {
osg::Geode::DrawableList & dl =
const_cast< osg::Geode::DrawableList &>
( _geode[i]->getDrawableList() );
dl.insert( dl.begin(), pg._geometry[i].get() );
}
}
}
}
示例3: color
QColor OSGTextNode::color() const
{
const osg::Vec4 osgColor = h->text->getColor();
return QColor::fromRgbF(
osgColor.r(),
osgColor.g(),
osgColor.b(),
osgColor.a());
}
示例4: operator
bool operator()( const osg::Vec4& in, osg::Vec4& out ) {
out = in;
out.a() = 0.3333*(in.r() + in.g() + in.b());
return true;
}
示例5: setColor
void CSulGeomTriangleList::setColor( const osg::Vec4& color )
{
setColor( color.r(), color.g(), color.b(), color.a() );
}
示例6: rgba
inline void rgba(float& r,float& g,float& b,float& a) const { a = (r*_colour.r()+g*_colour.g()+b*_colour.b()+a*_colour.a()); }