当前位置: 首页>>代码示例>>C++>>正文


C++ Vec4::g方法代码示例

本文整理汇总了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();
    }
开发者ID:ldelgass,项目名称:osgearth,代码行数:29,代码来源:AGGLiteRasterizerTileSource.cpp

示例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);
	}
开发者ID:kamalsirsa,项目名称:vtp,代码行数:33,代码来源:Vehicles.cpp

示例3: color

QColor OSGTextNode::color() const
{
    const osg::Vec4 osgColor = h->text->getColor();
    return QColor::fromRgbF(
                osgColor.r(),
                osgColor.g(),
                osgColor.b(),
                osgColor.a());
}
开发者ID:mp3butcher,项目名称:osg4noob,代码行数:9,代码来源:OSGTextNode.cpp

示例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;
}
开发者ID:crycrane,项目名称:hogbox,代码行数:14,代码来源:TextRegion.cpp

示例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;
 }
开发者ID:rdelmont,项目名称:osgearth,代码行数:5,代码来源:OSGTileSource.cpp

示例6: setColor

void CSulGeomTriangleList::setColor( const osg::Vec4& color )
{
	setColor( color.r(), color.g(), color.b(), color.a() );
}
开发者ID:Crisium,项目名称:sigmaosg,代码行数:4,代码来源:SulGeomTriangleList.cpp

示例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()); }
开发者ID:BodyViz,项目名称:osg,代码行数:1,代码来源:ImageUtils.cpp


注:本文中的osg::Vec4::g方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。