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


C++ RenderElement::GetThickness方法代码示例

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


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

示例1: RenderPrimitives

void RendererOpenGL::RenderPrimitives( const RenderElement& _Primitives )
#endif
{
    PROFILING( "Render Primitives" );

#ifdef MULTIPLE_RENDER_ELEMENTS  
    RenderElementPrimitives::Type eType = _spPrimitives->GetType();
    const CFoundation::Color& color = _spPrimitives->GetColor();
    Float16 f16Thickness = _spPrimitives->GetThickness();
    const RenderElementPrimitives::PointVec& avPoints = _spPrimitives->GetPoints();
#else
    RenderElement::Type eType = _Primitives.GetType();
    const CFoundation::Color& color = _Primitives.GetColor();
    Float16 f16Thickness = _Primitives.GetThickness();
    const RenderElement::PointVec& avPoints = _Primitives.GetPoints();
#endif

    // Get opengl type
    Unsigned32 u32Type = 0;
    switch ( eType )
    {
#ifdef MULTIPLE_RENDER_ELEMENTS 
    case RenderElementPrimitives::TYPE_POINTS:
#else
    case RenderElement::TYPE_POINTS:
#endif
        {
            u32Type = GL_POINTS;
        }
        break;
#ifdef MULTIPLE_RENDER_ELEMENTS 
    case RenderElementPrimitives::TYPE_LINES:
#else
    case RenderElement::TYPE_LINES:
#endif
        {
            u32Type = GL_LINES;
        }
        break;
#ifdef MULTIPLE_RENDER_ELEMENTS 
    case RenderElementPrimitives::TYPE_TRIANGLES:
#else
    case RenderElement::TYPE_TRIANGLES:
#endif
        {
            u32Type = GL_TRIANGLES;
        }
        break;
#ifdef MULTIPLE_RENDER_ELEMENTS 
    case RenderElementPrimitives::TYPE_QUADS:
#else
    case RenderElement::TYPE_QUADS:
#endif
        {
            u32Type = GL_QUADS;
        }
        break;
    }

    // Set color
    Float16 f16R, f16G, f16B, f16A;
    color.ToRGBA( f16R, f16G, f16B, f16A );
    glColor4f( f16R, f16G, f16B, f16A );

    // Set line thickness
    glLineWidth( f16Thickness );

    // Render primitives
    glLoadIdentity();
    glDisable( GL_TEXTURE_2D );

	glBegin( u32Type );

    Unsigned32 u32NumPoints = avPoints.size();
    for ( Unsigned32 u32Idx = 0; u32Idx < u32NumPoints; ++u32Idx )
    {
        const CFoundation::Vector2Df& vPoint = avPoints[ u32Idx ];
        glVertex3d( vPoint.GetX(),  vPoint.GetY(), 0 );
    }

	glEnd();
}
开发者ID:coeing,项目名称:cframework,代码行数:82,代码来源:RendererOpenGL.cpp


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