本文整理汇总了C++中osg::Vec4::g方法的典型用法代码示例。如果您正苦于以下问题:C++ Vec4::g方法的具体用法?C++ Vec4::g怎么用?C++ Vec4::g使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Vec4
的用法示例。
在下文中一共展示了Vec4::g方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: apply
virtual void apply(osg::Geode& geode)
{
for (unsigned i=0; i<geode.getNumDrawables(); ++i)
{
osg::Geometry *geo = dynamic_cast<osg::Geometry *>(geode.getDrawable(i));
if (!geo) continue;
osg::StateSet *stateset = geo->getStateSet();
if (!stateset) continue;
osg::StateAttribute *state = stateset->getAttribute(osg::StateAttribute::MATERIAL);
if (!state) continue;
osg::Material *mat = dynamic_cast<osg::Material *>(state);
if (!mat) continue;
const osg::Vec4 v4 = mat->getDiffuse(FAB);
if (v4.r() == 1.0f && v4.g() == 0.0f && v4.b() == 1.0f)
{
//VTLOG("oldmat rc %d, ", mat->referenceCount());
osg::Material *newmat = (osg::Material *)mat->clone(osg::CopyOp::DEEP_COPY_ALL);
newmat->setDiffuse(FAB, osg::Vec4(c.r*2/3,c.g*2/3,c.b*2/3,1));
newmat->setAmbient(FAB, osg::Vec4(c.r*1/3,c.g*1/3,c.b*1/3,1));
//VTLOG("newmat rc %d\n", newmat->referenceCount());
stateset->setAttribute(newmat);
//VTLOG(" -> %d %d\n", mat->referenceCount(), newmat->referenceCount());
}
}
osg::NodeVisitor::apply(geode);
}
示例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: SetBackDropColor
//
//set the drop shadow color
//
void TextRegion::SetBackDropColor(const osg::Vec4 &color)
{
_backdropColor.r() = color.r();
_backdropColor.g() = color.g();
_backdropColor.b() = color.b();
_backdropColor.a() = this->GetAlpha()*0.5f;
_text->setBackdropColor(_backdropColor);
_dirtyRenderState = true;
}
示例5: operator
bool operator()( const osg::Vec4& in, osg::Vec4& out ) {
out = in;
out.a() = 0.3333*(in.r() + in.g() + in.b());
return true;
}
示例6: setColor
void CSulGeomTriangleList::setColor( const osg::Vec4& color )
{
setColor( color.r(), color.g(), color.b(), color.a() );
}
示例7: 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()); }