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


C++ Pnt2f::getValues方法代码示例

本文整理汇总了C++中Pnt2f::getValues方法的典型用法代码示例。如果您正苦于以下问题:C++ Pnt2f::getValues方法的具体用法?C++ Pnt2f::getValues怎么用?C++ Pnt2f::getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pnt2f的用法示例。


在下文中一共展示了Pnt2f::getValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw

void GlassLayer::draw(Graphics* const TheGraphics, const Pnt2f& TopLeft, const Pnt2f& BottomRight, const Real32 Opacity) const
{
    Pnt2f IntermediatePosition;
    Vec3f Bounds(BottomRight- TopLeft);
    
    //Setup the Blending equations properly
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);

    glBegin(GL_TRIANGLE_FAN);
        glColor4f(getEdgeColor().red(),getEdgeColor().green(),getEdgeColor().blue(),getEdgeColor().alpha() * Opacity);
        glVertex2f(getStartPosition().x(), getEndPosition().y());
        glColor4f(getCenterColor().red(),getCenterColor().green(),getCenterColor().blue(),getCenterColor().alpha() * Opacity);
        glVertex2fv(getStartPosition().getValues());
        for(UInt32 i(0) ; i<_Segments.size(); ++i)
        {
            IntermediatePosition.setValues(_Segments[i].x() * Bounds.x(),_Segments[i].y() * Bounds.y());
            glVertex2fv(IntermediatePosition.getValues());
        }
        glVertex2fv(getEndPosition().getValues());
    glEnd();

    glDisable(GL_BLEND);

}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:25,代码来源:OSGGlassLayer.cpp

示例2: Alpha

void Graphics3DExtrude::drawQuad(const Pnt2f& p1, const Pnt2f& p2, const Pnt2f& p3, const Pnt2f& p4, 
						const Vec2f& t1, const Vec2f& t2, const Vec2f& t3, const Vec2f& t4,
						const MaterialUnrecPtr Material,
						const Real32& Opacity) const
{
	Real32 Alpha( Opacity * getOpacity());
	if(Alpha < 1.0 || Material->isTransparent())
	{
		//Setup the Blending equations properly
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_BLEND);
	}

    StateUnrecPtr state = NULL;
    if(Material != NULL)
    {
        state = Material->finalize(MaterialMapKey(),getDrawEnv()->getWindow())->getState();

        state->activate(getDrawEnv());
    }
	
	glBegin(GL_QUADS);
	   glColor4f(1.0, 1.0, 1.0, Alpha );
	   glTexCoord2fv(t1.getValues());
	   glVertex2fv(p1.getValues());
	   glTexCoord2fv(t2.getValues());
	   glVertex2fv(p2.getValues());
	   glTexCoord2fv(t3.getValues());
	   glVertex2fv(p3.getValues());
	   glTexCoord2fv(t4.getValues());
	   glVertex2fv(p4.getValues());
	glEnd();
	
	if(state != NULL)
	{
		state->deactivate(getDrawEnv());
	}

	if(Alpha < 1.0 || Material->isTransparent())
	{
		glDisable(GL_BLEND);
	}
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:43,代码来源:OSGGraphics3DExtrude.cpp

示例3: getOpacity

void Graphics3DExtrude::drawDisc(const Pnt2f& Center, const Real32& Width, const Real32& Height, const Real32& StartAngleRad, const Real32& EndAngleRad, const UInt16& SubDivisions, const Color4f& CenterColor, const Color4f& OuterColor, const Real32& Opacity) const
{
	Real32 angleNow = StartAngleRad;
	Real32 angleDiff = (EndAngleRad-StartAngleRad)/(static_cast<Real32>(SubDivisions));
	if(EndAngleRad-StartAngleRad > 2*3.1415926535)
		angleDiff = 2*3.1415926535/static_cast<Real32>(SubDivisions);
    if(CenterColor.alpha() < 1.0 ||
       OuterColor.alpha() < 1.0)
	{
		//Setup the blending equations properly
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_BLEND);
	}
	
	//Front Disc
	glBegin(GL_TRIANGLE_FAN);
	  glNormal3f(0.0,0.0,1.0);
      glColor4f(CenterColor.red(), CenterColor.green(), CenterColor.blue(), CenterColor.alpha() * Opacity * getOpacity() );
      glVertex2fv(Center.getValues());
      glColor4f(OuterColor.red(), OuterColor.green(), OuterColor.blue(), OuterColor.alpha() * Opacity * getOpacity() );
      for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
      {
			glVertex2f(static_cast<Real32>(Center.x()) + static_cast<Real32>(Width)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(Height)*osgSin(angleNow));
			angleNow -= angleDiff;
		}
	glEnd();
	
	//Back Disc
	angleNow = StartAngleRad;
	glBegin(GL_TRIANGLE_FAN);
	  glNormal3f(0.0,0.0,-1.0);
      glColor4f(CenterColor.red(), CenterColor.green(), CenterColor.blue(), CenterColor.alpha() * Opacity * getOpacity() );
      glVertex3f(Center.x(), Center.y(), getExtrudeLength());
      glColor4f(OuterColor.red(), OuterColor.green(), OuterColor.blue(), OuterColor.alpha() * Opacity * getOpacity() );
      for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
      {
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(Width)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(Height)*osgSin(angleNow), getExtrudeLength());
			angleNow += angleDiff;
		}
	glEnd();

	//Outer Hull
	angleNow = StartAngleRad;
	glBegin(GL_QUAD_STRIP);
      glColor4f(OuterColor.red(), OuterColor.green(), OuterColor.blue(), OuterColor.alpha() * Opacity * getOpacity() );

      for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
      {
		glNormal3f(osgCos(angleNow),osgSin(angleNow),0.0);
		glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(Width)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(Height)*osgSin(angleNow), 0);
		glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(Width)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(Height)*osgSin(angleNow), getExtrudeLength());
		angleNow -= angleDiff;
	  }
	glEnd();

    if(CenterColor.alpha() < 1.0 ||
       OuterColor.alpha() < 1.0)
    {
        glDisable(GL_BLEND);
    }
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:61,代码来源:OSGGraphics3DExtrude.cpp


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