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


C++ Pnt2f类代码示例

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


在下文中一共展示了Pnt2f类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ViewportToComponent

void TableHeader::MarginDraggedListener::mouseDragged(const MouseEventUnrecPtr e)
{
	if(e->getButton() == e->BUTTON1)
	{
		Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), TableHeaderRefPtr(_TableHeader), e->getViewport());


        TableColumnRefPtr TheColumn(_TableHeader->getColumnModel()->getColumn(_TableHeader->_ResizingColumn));
        Real32 NewWidth(MousePosInComponent.x() - _TableHeader->getColumnHeaders(_TableHeader->_ResizingColumn)->getPosition().x());

        if(NewWidth <= 0 || NewWidth < TheColumn->getMinWidth())
        {
            NewWidth = TheColumn->getMinWidth();
        }

        if(NewWidth > TheColumn->getMaxWidth())
        {
            NewWidth = TheColumn->getMaxWidth();
        }
        
		//Get the new desired center for this margin
	        TheColumn->setWidth(NewWidth);
        _TableHeader->updateLayout();
	}
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:25,代码来源:OSGTableHeader.cpp

示例3: glPushMatrix

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

示例4: 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

示例5: ViewportToComponent

void TableHeader::handleColBorderMouseDragged(MouseEventDetails* const e)
{
	if(e->getButton() == MouseEventDetails::BUTTON1)
	{
		Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), this, e->getViewport());


        TableColumnRefPtr TheColumn(getColumnModel()->getColumn(_ResizingColumn));
        Real32 NewWidth(MousePosInComponent.x() - getColumnHeaders(_ResizingColumn)->getPosition().x());

        if(NewWidth <= 0 || NewWidth < TheColumn->getMinWidth())
        {
            NewWidth = TheColumn->getMinWidth();
        }

        if(NewWidth > TheColumn->getMaxWidth())
        {
            NewWidth = TheColumn->getMaxWidth();
        }
        
		//Get the new desired center for this margin
	    TheColumn->setWidth(NewWidth);
        updateLayout();
	}
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:25,代码来源:OSGTableHeader.cpp

示例6: Result

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

示例7: BottomRight

void InternalWindow::BorderDraggedListener::mouseDragged(const MouseEventUnrecPtr e)
{
    Vec2f Size;
    bool PositionChange;
    Pnt2f Position;
    Pnt2f BottomRight(_InternalWindow->getPosition() + _InternalWindow->getSize());
    switch(_BorderDragged)
    {
        case WINDOW_LEFT_BORDER:
            Size.setValues(BottomRight.x() - e->getLocation().x(), _InternalWindow->getPreferredSize().y());
            PositionChange = true;
            Position = BottomRight - Size;
            break;
        case WINDOW_RIGHT_BORDER:
            PositionChange = false;
            Size.setValues(e->getLocation().x() - _InternalWindow->getPosition().x(), _InternalWindow->getPreferredSize().y());
            break;
        case WINDOW_TOP_BORDER:
            Size.setValues(_InternalWindow->getPreferredSize().x(), BottomRight.y() - e->getLocation().y());
            PositionChange = true;
            Position = BottomRight - Size;
            break;
        case WINDOW_BOTTOM_BORDER:
            PositionChange = false;
            Size.setValues(_InternalWindow->getPreferredSize().x(), e->getLocation().y() - _InternalWindow->getPosition().y());
            break;
        case WINDOW_TOP_LEFT_BORDER:
            Size.setValues(BottomRight.x() - e->getLocation().x(), BottomRight.y() - e->getLocation().y());
            PositionChange = true;
            Position = BottomRight - Size;
            break;
        case WINDOW_BOTTOM_RIGHT_BORDER:
            PositionChange = false;
            Size.setValues(e->getLocation().x() - _InternalWindow->getPosition().x(), e->getLocation().y() - _InternalWindow->getPosition().y());
            break;
        case WINDOW_TOP_RIGHT_BORDER:
            Size.setValues(e->getLocation().x() - _InternalWindow->getPosition().x(), BottomRight.y() - e->getLocation().y());
            PositionChange = true;
            Position.setValues(_InternalWindow->getPosition().x(), BottomRight.y() - Size.y());
            break;
        case WINDOW_BOTTOM_LEFT_BORDER:
            Size.setValues(BottomRight.x() - e->getLocation().x(), e->getLocation().y() - _InternalWindow->getPosition().y());
            PositionChange = true;
            Position.setValues( BottomRight.x() - Size.x(), _InternalWindow->getPosition().y());
            break;
    }

    if(PositionChange)
    {
        _InternalWindow->setPreferredSize(Size);
        _InternalWindow->setPosition(Position);
    }
    else
    {
        _InternalWindow->setPreferredSize(Size);
    }
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:57,代码来源:OSGInternalWindow.cpp

示例8: getBounds

void TexturedQuadUIDrawObject::getBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
   TopLeft.setValues(
       osgMin(osgMin(osgMin(getPoint1().x(), getPoint2().x()),getPoint3().x()),getPoint4().x()),
       osgMin(osgMin(osgMin(getPoint1().y(), getPoint2().y()),getPoint3().y()),getPoint4().y()));
   
   BottomRight.setValues(
       osgMax(osgMax(osgMax(getPoint1().x(), getPoint2().x()),getPoint3().x()),getPoint4().x()),
       osgMax(osgMax(osgMax(getPoint1().y(), getPoint2().y()),getPoint3().y()),getPoint4().y()));
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:10,代码来源:OSGTexturedQuadUIDrawObject.cpp

示例9: getTitlebarBounds

void InternalWindow::getTitlebarBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
    if(getDrawDecorations() && getDrawTitlebar() && getDrawnBorder()->getType().isDerivedFrom(WindowBorder::getClassType()))
    {
        dynamic_pointer_cast<WindowBorder>(getDrawnBorder())->getTitlebarBounds(0, 0, getSize().x(), getSize().y(), TopLeft, BottomRight);
    }
    else
    {
        TopLeft.setValues(0,0);
        BottomRight.setValues(0,0);
    }
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:12,代码来源:OSGInternalWindow.cpp

示例10: 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

示例11: 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

示例12: getTitlebarBounds

void WindowBorder::getTitlebarBounds(const Real32 x, const Real32 y , const Real32 Width, const Real32 Height, Pnt2f& TopLeft, Pnt2f& BottomRight)
{
    Real32 LeftIn(0.0f), RightIn(0.0f), BottomIn(0.0f), UpperIn(0.0f);
    if(getOuterBorder() != NULL)
    {
        getOuterBorder()->getInsets(LeftIn, RightIn, UpperIn, BottomIn);
    }

    TopLeft.setValues(x+LeftIn, y+UpperIn);
    if(getTitlebar() != NULL)
    {
        UpperIn += getTitlebar()->getSize().y();
    }

    BottomRight.setValues(x+Width-RightIn, y+UpperIn);
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:16,代码来源:OSGWindowBorder.cpp

示例13: 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

示例14: getViewBounds

void UIViewport::getViewBounds(Pnt2f& TopLeft, Pnt2f& BottomRight)
{
    Pnt2f InsetsTopLeft, InsetsBottomRight;
    getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);

    TopLeft.setValues(getViewPosition().x(),getViewPosition().y());
    BottomRight = TopLeft + (InsetsBottomRight - InsetsTopLeft);
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:8,代码来源:OSGUIViewport.cpp

示例15: getBounds

void UIFont::getBounds(const std::string& Text, Pnt2f& TopLeft, Pnt2f& BottomRight)
{
    TextLayoutParam layoutParam;
    layoutParam.spacing = 1.1;
    layoutParam.majorAlignment = TextLayoutParam::ALIGN_BEGIN;
    layoutParam.minorAlignment = TextLayoutParam::ALIGN_BEGIN;

    TextLayoutResult layoutResult;
    layout(Text, layoutParam, layoutResult);

    //Vec2f BottomLeft, TopRight;
    Vec2f size = Vec2f(layoutResult.textBounds.x()*getSize(),layoutResult.textBounds.y()*getSize());
    // _face->calculateBoundingBox(layoutResult,BottomLeft, TopRight);

    TopLeft.setValues(0, 0);
    BottomRight.setValue(size);
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:17,代码来源:OSGUIFont.cpp


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