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


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

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


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

示例1: layoutSize

Vec2f AbsoluteLayout::layoutSize(const MFUnrecComponentPtr* Components,
                                 const Component* ParentComponent,
                                 SizeType TheSizeType) const
{
    Vec2f Result(0.0,0.0);

    Vec2f ComponentSize;
    Pnt2f ComponentPosition;
    for(UInt32 i(0) ; i<Components->size() ; ++i)
    {
        ComponentPosition = dynamic_cast<AbsoluteLayoutConstraints*>((*Components)[i]->getConstraints())->getPosition();

        ComponentSize = getComponentSize((*Components)[i],TheSizeType);
        if(ComponentPosition.x() + ComponentSize.x() > Result.x())
        {
            Result[0] = ComponentPosition.x() + ComponentSize.x();
        }
        if(ComponentPosition.y() + ComponentSize.y() > Result.y())
        {
            Result[1] = ComponentPosition.y() + ComponentSize.y();
        }
    }

    return Result;
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:25,代码来源:OSGAbsoluteLayout.cpp

示例2: drawGradient

void GradientLayer::drawGradient(Graphics* const TheGraphics, const Pnt2f& Origin, const Vec2f& Size, const Vec2f& UAxis, const Real32& Start, const Real32& End, const Real32& Opacity) const
{
	glPushMatrix();
	Matrix Transformation;
	Transformation.setTransform(Vec3f(Origin.x()+Start*UAxis.x()*Size.x(), Origin.y()+Start*UAxis.y()*Size.x(),0.0f), Quaternion(Vec3f(1.0f,0.0f,0.0f),Vec3f(UAxis.x(), UAxis.y(), 0.0f)), Vec3f(Size.x()*(End-Start), Size.y(),0.0f));
	glMultMatrixf(Transformation.getValues());

	if (osgMin(getMFColors()->size(),getMFStops()->size()) > 1)
	{
		if(getMFColors()->size() != getMFStops()->size())
		{    
			SWARNING << "GradientLayer::drawGradient: The number of colors and the number of stops are not equal." << std::endl;
		}

		UInt32 NumStops = osgMin(getMFColors()->size(),getMFStops()->size());
		Real32 CurentRelaviteStop= 0.0f;
			
		for(UInt32 i(0) ; i<NumStops-1 ; ++i)
		{
			TheGraphics->drawQuad(Pnt2f(getStops(i),0.0f),
				                  Pnt2f(getStops(i+1),0.0f),
				                  Pnt2f(getStops(i+1),1.0f),
				                  Pnt2f(getStops(i),1.0f),
								  getColors(i),
								  getColors(i+1),
								  getColors(i+1),
								  getColors(i),
								  Opacity);
		}
	}
	glPopMatrix();
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:32,代码来源:OSGGradientLayer.cpp

示例3: Alpha

void Graphics3DExtrude::drawText(const Pnt2f& Position, const std::string& Text, const UIFontUnrecPtr TheFont, const Color4f& Color, const Real32& Opacity) const
{
   TextLayoutParam layoutParam;
   layoutParam.spacing = 1.1;
   layoutParam.majorAlignment = TextLayoutParam::ALIGN_BEGIN;
   layoutParam.minorAlignment = TextLayoutParam::ALIGN_BEGIN;
 
   TextLayoutResult layoutResult;
   TheFont->layout(Text, layoutParam, layoutResult);

   TheFont->getTexture()->activate(getDrawEnv());

   Real32 Alpha(Color.alpha() * Opacity * getOpacity());
	
   //Setup the blending equations properly
   glPushAttrib(GL_COLOR_BUFFER_BIT);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);

   glColor4f(Color.red(), Color.green(), Color.blue(), Alpha );
   glPushMatrix();
   glTranslatef(Position.x(), Position.y(), 0.0);
   glScalef(TheFont->getSize(), TheFont->getSize(), 1);
   drawCharacters(layoutResult, TheFont);
   glPopMatrix();

   TheFont->getTexture()->deactivate(getDrawEnv());

	glDisable(GL_BLEND);
   glPopAttrib();
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:31,代码来源:OSGGraphics3DExtrude.cpp

示例4: getBounds

void PolygonUIDrawObject::getBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
    if(getMFVerticies()->size() > 0)
    {
        TopLeft = getVerticies(0);
        BottomRight = TopLeft;
        //Determine Top Left And Bottom Right
        for(UInt32 i(0) ; i<getMFVerticies()->size(); ++i)
        {
            TopLeft.setValues( osgMin(TopLeft.x(), getVerticies(i).x()),
                               osgMin(TopLeft.y(), getVerticies(i).y()) );

            BottomRight.setValues(osgMax<Real32>(BottomRight.x(), getVerticies(i).x()),
                                  osgMax<Real32>(BottomRight.y(), getVerticies(i).y()) );
        }
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:17,代码来源:OSGPolygonUIDrawObject.cpp

示例5: getPathClosestTo

TreePath FixedHeightTreeModelLayout::getPathClosestTo(const Pnt2f& Loc) const
{
    //Determine the row
    UInt32 Row(osgMin<UInt32>(Loc.y()/getRowHeight(),getRowCount()-1));

    //Get the Path for that row
    return getPathForRow(Row);
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:8,代码来源:OSGFixedHeightTreeModelLayout.cpp

示例6: maximizeVisibility

void UIViewport::maximizeVisibility(const Pnt2f& TopLeft, const Pnt2f& BottomRight)
{
    //Scroll as little as possible until as much as can be is visible

    Pnt2f ViewTopLeft, ViewBottomRight;
    getViewBounds(ViewTopLeft,ViewBottomRight);

    Pnt2f NewViewPosition(getViewPosition());

    //Vertical
    if(ViewTopLeft.y() > TopLeft.y())
    {
        //Scroll up
        NewViewPosition[1] = TopLeft.y();

    }
    else if(ViewBottomRight.y() < BottomRight.y())
    {
        Pnt2f InsetsTopLeft, InsetsBottomRight;
        getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);
        //Scroll down
        NewViewPosition[1] = BottomRight.y() - (InsetsBottomRight - InsetsTopLeft).y();
    }

    //Horizontal
    if(ViewTopLeft.x() > TopLeft.x())
    {
        //Scroll left
        NewViewPosition[0] = TopLeft.x();

    }
    else if(ViewBottomRight.x() < BottomRight.x())
    {
        Pnt2f InsetsTopLeft, InsetsBottomRight;
        getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);

        //Scroll right
        NewViewPosition[0] = BottomRight.x() - (InsetsBottomRight - InsetsTopLeft).x();
    }

    setViewPosition(NewViewPosition);
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:42,代码来源:OSGUIViewport.cpp

示例7: updateCursor

void WindowEventProducer::updateCursor(Pnt2f MousePos)
{
	CursorRegionListItor ListItor;
	bool CursorChanged(false);
	for(ListItor = _CursorRegions.begin() ; ListItor != _CursorRegions.end() ; ++ListItor)
	{
		if(MousePos.x() >= ListItor->_TopLeft.x() &&
		   MousePos.y() >= ListItor->_TopLeft.y() &&
		   MousePos.x() <= ListItor->_BottomRight.x() &&
		   MousePos.y() <= ListItor->_TopLeft.y())
		{
			setCursorType(ListItor->_CursorType);
			CursorChanged = true;
		}
	}
	if(!CursorChanged)
	{
		setCursorType(CURSOR_POINTER);
	}
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:20,代码来源:OSGWindowEventProducer.cpp

示例8: getInsideBorderBounds

void Component::getInsideBorderBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
    Real32 TopInset(0), LeftInset(0), BottomInset(0), RightInset(0);

    if(getBorder() != NULL)
    {
        //Get Border Insets
        getBorder()->getInsets(LeftInset,RightInset,TopInset,BottomInset);
    }
    TopLeft.setValues(LeftInset, TopInset);
    BottomRight.setValues(TopLeft.x()+getSize().x()-(LeftInset + RightInset), TopLeft.y()+getSize().y()-(TopInset + BottomInset));
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:12,代码来源:OSGComponent.cpp

示例9: drawBraceHighlight

void TextDomArea::drawBraceHighlight(Graphics * const TheGraphics, Real32 Opacity) const
{
	if(getLayoutManager()->getBracesHighlightFlag())
	{
		if(getLayoutManager()->getStartingBraceLine() != -1 && getLayoutManager()->getStartingBraceIndex() != -1)
		{
			Pnt2f thePosition = getLayoutManager()->getXYPosition(getLayoutManager()->getStartingBraceLine(),getLayoutManager()->getStartingBraceIndex(),true);
			TheGraphics->drawRect(thePosition,Pnt2f(thePosition.x()+5,thePosition.y()+getLayoutManager()->getHeightOfLine()),Color4f(0.7,0.7,0.0,1.0),Opacity);
		}
		if(getLayoutManager()->getEndingBraceLine() != -1 && getLayoutManager()->getEndingBraceIndex() != -1)
		{
			if(getLayoutManager()->getEndingBraceLine()<getLayoutManager()->getRootElement()->getElementCount())
			{
				PlainDocumentLeafElementRefPtr temp = dynamic_cast<PlainDocumentLeafElement*>(getLayoutManager()->getRootElement()->getElement(getLayoutManager()->getEndingBraceLine()));
				if(getLayoutManager()->getEndingBraceIndex() < temp->getTextLength())
				{
					Pnt2f thePosition = getLayoutManager()->getXYPosition(getLayoutManager()->getEndingBraceLine(),getLayoutManager()->getEndingBraceIndex(),true);
					TheGraphics->drawRect(thePosition,Pnt2f(thePosition.x()+5,thePosition.y()+getLayoutManager()->getHeightOfLine()),Color4f(0.7,0.7,0.0,1.0),Opacity);
				}
			}
		}
	}
}
开发者ID:danguilliams,项目名称:OpenSGToolbox,代码行数:23,代码来源:OSGTextDomArea.cpp

示例10: LineStart

void Graphics3DExtrude::drawTextUnderline(const Pnt2f& Position, const std::string& Text, const UIFontUnrecPtr TheFont, const Color4f& Color, const Real32& Opacity) const
{
    Pnt2f TextTopLeft, TextBottomRight;
    TheFont->getBounds(Text, TextTopLeft, TextBottomRight);
    
    Pnt2f CharacterTopLeft, CharacterBottomRight;
    TheFont->getBounds("A", CharacterTopLeft, CharacterBottomRight);
    
    //Line Start Point
    Pnt2f LineStart(Position.x() + TextTopLeft.x(), Position.y() + CharacterBottomRight.y()-1);
    //Line End Point
    Pnt2f LineEnd(LineStart + Vec2f(TextBottomRight.x()-TextTopLeft.x(),1));

    drawRect(LineStart, LineEnd, Color, Opacity);
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:15,代码来源:OSGGraphics3DExtrude.cpp

示例11: drawPad

void GradientLayer::drawPad(Graphics* const TheGraphics, const Pnt2f& Origin, const Vec2f& Size, const Vec2f& UAxis, const Real32& Start, const Real32& End, const Color4f Color, const Real32& Opacity) const
{
	glPushMatrix();
	Matrix Transformation;
	Transformation.setTransform(Vec3f(Origin.x()+Start*UAxis.x()*Size.x(), Origin.y()+Start*UAxis.y()*Size.x(),0.0f), Quaternion(Vec3f(1.0f,0.0f,0.0f),Vec3f(UAxis.x(), UAxis.y(), 0.0f)), Vec3f(Size.x()*(End-Start), Size.y(),0.0f));
	glMultMatrixf(Transformation.getValues());

	
	TheGraphics->drawRect(Pnt2f(0.0,0.0f),
		                  Pnt2f(1.0,1.0f),
						  Color,
						  Opacity);

	glPopMatrix();
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:15,代码来源:OSGGradientLayer.cpp

示例12: windowToViewport

ViewportUnrecPtr WindowEventProducer::windowToViewport(const Pnt2f& WindowPoint, Pnt2f& ViewportPoint)
{
	ViewportUnrecPtr ThePort;
	for(UInt32 i(0) ; i<getMFPort()->size() ; ++i)
	{
		ThePort = getPort(i);
        if(ThePort->getEnabled())
        {
            ViewportPoint.setValues(WindowPoint.x() - ThePort->getPixelLeft(), WindowPoint.y() - ThePort->getPixelBottom());
    		
            return ThePort;
        }
		
	}
	return NULL;
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:16,代码来源:OSGWindowEventProducer.cpp

示例13: viewportToRenderingSurface

bool UIRectangleMouseTransformFunctor::viewportToRenderingSurface(const Pnt2f& ViewportPoint,
                                                                  const Viewport* TheViewport,
                                                                  Pnt2f& Result) const
{
    //Get Viewport to View Space line
    Line l;
    if( !TheViewport->getCamera()->calcViewRay( l, ViewportPoint.x(), ViewportPoint.y(), *TheViewport ) )
    {
        return false;
    }

    //Transform Line to UIRectangle Space
    Matrix m ;
    getParent()->accumulateMatrix(m);

    m.invert();

    Pnt3f pos;
    Vec3f dir;

    m.multFull(l.getPosition (), pos);
    m.mult    (l.getDirection(), dir);

    l.setValue(pos, dir);
    //ia->scale(dir.length());

    //Intersect the Line with the UIRectangle quad
    Real32 t;
    if(!intersectLineRect(l,getParent()->getPoint(),
                          getParent()->getPoint() + Vec3f(getParent()->getWidth(),0,0),
                          getParent()->getPoint() + Vec3f(getParent()->getWidth(),getParent()->getHeight(),0),
                          getParent()->getPoint() + Vec3f(0,getParent()->getHeight(),0)
                          ,t))
    {
        return false;
    }

    //Return the point on the quad of the intersection if there was one
    Result.setValues(l.getPosition().x() + t*l.getDirection().x() - getParent()->getPoint().x(), 
                     getParent()->getHeight() - l.getPosition().y() - t*l.getDirection().y() + getParent()->getPoint().y());
    return true;
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:42,代码来源:OSGUIRectangleMouseTransformFunctor.cpp

示例14: draw

void GradientLayer::draw(Graphics* const TheGraphics, const Pnt2f& TopLeft, const Pnt2f& BottomRight, const Real32 Opacity) const
{
	if(getMFColors()->size() == getMFStops()->size())
	{
		if(getMFColors()->size() == 1)
		{
			TheGraphics->drawQuad(TopLeft, Pnt2f(BottomRight.x(), TopLeft.y()), BottomRight, Pnt2f(TopLeft.x(), BottomRight.y()), getColors(0), getColors(0), getColors(0), getColors(0), Opacity);
		}
		else
		{
			Pnt2f StartPosition= TopLeft;
			StartPosition[0] += getStartPosition()[0]*(BottomRight[0] - TopLeft[0]);
			StartPosition[1] += getStartPosition()[1]*(BottomRight[1] - TopLeft[1]);
			Pnt2f EndPosition= TopLeft;
			EndPosition[0] += getEndPosition()[0]*(BottomRight[0] - TopLeft[0]);
			EndPosition[1] += getEndPosition()[1]*(BottomRight[1] - TopLeft[1]);
			
			//Calculate the coordinate system
			Vec2f u(EndPosition-StartPosition);
			u.normalize();
			Vec3f v3D(Vec3f(u.x(), u.y(), 0.0f).cross(Vec3f(0.0,0.0,-1.0)));
			Vec2f v(v3D.x(), v3D.y());
			Matrix22<Real32> CoordinateSystem(u.x(), u.y(), v.x(), v.y());

			Pnt2f Min;
			Pnt2f Max;
			{
				//Calculate the bounding box in the new coordinate system
				Pnt2f UVTopLeft(CoordinateSystem*TopLeft), 
					UVBottomRight(CoordinateSystem*BottomRight), 
					UVTopRight(CoordinateSystem*Vec2f(BottomRight.x(), TopLeft.y())),
					UVBottomLeft(CoordinateSystem*Vec2f(TopLeft.x(), BottomRight.y()));


				Min.setValues( osgMin(UVTopLeft.x(), osgMin(UVBottomRight.x(), osgMin(UVTopRight.x(), UVBottomLeft.x()))),
							   osgMin(UVTopLeft.y(), osgMin(UVBottomRight.y(), osgMin(UVTopRight.y(), UVBottomLeft.y()))));
				Max.setValues( osgMax(UVTopLeft.x(), osgMax(UVBottomRight.x(), osgMax(UVTopRight.x(), UVBottomLeft.x()))),
							   osgMax(UVTopLeft.y(), osgMax(UVBottomRight.y(), osgMax(UVTopRight.y(), UVBottomLeft.y()))));
			}

			Pnt2f Origin(CoordinateSystem.inverse() * Min);
			Real32 PreStartLength(((CoordinateSystem*StartPosition).x()-Min.x())/(Max.x() - Min.x())),
				   PostEndLength((Max.x()- (CoordinateSystem*EndPosition).x())/(Max.x() - Min.x())),
				   GradientLength(1.0f-PostEndLength-PreStartLength);
			
			if(getSpreadMethod() == SPREAD_REFLECT||
			   getSpreadMethod() == SPREAD_REPEAT)
			{
				//Code for drawing the Gradient with Repeating/Reflection
					//Determine the Number of Repeats
					UInt32 RepeatCount = static_cast<UInt32>(osgCeil(1.0f/GradientLength));

					//Determine the relative location in the gradient that the Start left is at
					Real32 StartGradientLocation = PreStartLength - GradientLength * osgCeil(PreStartLength/GradientLength);

					//Determine whether the start is a reflection or normal
					bool isReflection = getSpreadMethod() == SPREAD_REFLECT && static_cast<UInt32>(osgCeil(PreStartLength/GradientLength))%2==1;

					for(UInt32 i(0) ; i<RepeatCount ; ++i)
					{
						if(isReflection)
						{
							drawGradient(TheGraphics, Origin, Max-Min,u,StartGradientLocation+GradientLength*(i+1),StartGradientLocation+GradientLength*i,Opacity);					
						}
						else
						{
							drawGradient(TheGraphics, Origin, Max-Min,u,StartGradientLocation+GradientLength*i,StartGradientLocation+GradientLength*(i+1),Opacity);					
						}

						if(getSpreadMethod() == SPREAD_REFLECT)
						{
							isReflection = !isReflection;
						}
					}
				
			}
			else
			{
				//Code for drawing the Gradient with Padding
				
				//Front Pad
				if(PreStartLength != 0.0f)
				{
					drawPad(TheGraphics, Origin,
                            Max-Min,u,0.0,PreStartLength,getMFColors()->front(),Opacity);
				}
				
				drawGradient(TheGraphics, Origin, Max-Min,u,PreStartLength,PreStartLength+GradientLength,Opacity);
				
				//End Pad
				if(PostEndLength != 0.0f)
				{
					drawPad(TheGraphics, Origin, Max-Min,u,PreStartLength+GradientLength,1.0,getMFColors()->back(),Opacity);
				}
			}
		}
	}
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:98,代码来源:OSGGradientLayer.cpp

示例15: getExtrudeLength

void Graphics3DExtrude::drawComplexDisc(const Pnt2f& Center, const Real32& InnerRadius, const Real32& OuterRadius, 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
	glBegin(GL_QUAD_STRIP);
	   glNormal3f(0.0,0.0,1.0);
		for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
		{
			glColor4f(OuterColor.red(), OuterColor.green(), OuterColor.blue(), OuterColor.alpha());
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(OuterRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(OuterRadius)*osgSin(angleNow),0.0);
			glColor4f(CenterColor.red(), CenterColor.green(), CenterColor.blue(), CenterColor.alpha());
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(InnerRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(InnerRadius)*osgSin(angleNow), 0.0);
			angleNow += angleDiff;
		}
	glEnd();
	
	//OuterArc
	angleNow = StartAngleRad;
	glBegin(GL_QUAD_STRIP);
		glColor4f(OuterColor.red(), OuterColor.green(), OuterColor.blue(), OuterColor.alpha());
		for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
		{
			glNormal3f(osgCos(angleNow),osgSin(angleNow),0.0);

			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(OuterRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(OuterRadius)*osgSin(angleNow),getExtrudeLength());
			
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(OuterRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(OuterRadius)*osgSin(angleNow),0.0);
			
			
			angleNow += angleDiff;
		}
	glEnd();

	//InnerArc
	angleNow = StartAngleRad;
	glBegin(GL_QUAD_STRIP);
		glColor4f(CenterColor.red(), CenterColor.green(), CenterColor.blue(), CenterColor.alpha());
		for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
		{
			glNormal3f(-osgCos(angleNow),-osgSin(angleNow),0.0);
			
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(InnerRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(InnerRadius)*osgSin(angleNow),0.0);
			
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(InnerRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(InnerRadius)*osgSin(angleNow),getExtrudeLength());
			
			angleNow += angleDiff;
		}
	glEnd();

	//Back
	angleNow = StartAngleRad;
	glBegin(GL_QUAD_STRIP);
	   glNormal3f(0.0,0.0,-1.0);
		for(UInt16 i = 0 ; i<SubDivisions+1 ; ++i)
		{
			glColor4f(CenterColor.red(), CenterColor.green(), CenterColor.blue(), CenterColor.alpha());
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(InnerRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(InnerRadius)*osgSin(angleNow), getExtrudeLength());
			glColor4f(OuterColor.red(), OuterColor.green(), OuterColor.blue(), OuterColor.alpha());
			glVertex3f(static_cast<Real32>(Center.x()) + static_cast<Real32>(OuterRadius)*osgCos(angleNow), static_cast<Real32>(Center.y()) + static_cast<Real32>(OuterRadius)*osgSin(angleNow), getExtrudeLength());
			angleNow += angleDiff;
		}
	glEnd();

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


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