OgreNext高级材质中增加线宽,点大小,虚线模式绘制支持

修改Ogre高级材质系统,增加线宽,点大小,虚线模式,虚线参数的支持,效果如下:

需要修改的代码文件如下:

修改如下

代码文本:

cpp 复制代码
         //范围[0.2 - 51]  0.2 * [0,255];
        Ogre::uint8 mLineWidth;
        //范围[0.5 - 127.5]  0.5 * [0, 255];
        Ogre::uint8 mPointSize;
        //虚线标记
        Ogre::uint16 mLineStrip; 
       //虚线重复因子
       Ogre::uint8 mLineRepatFactor;  //glLineStipple(repatFactor, lineStrip)  glLineStipple(1, 0x0F0F)
        //是否虚线模式
       bool mEnableLineStipple;  // Ogre::uint8  // glEnalbe( GL_LINE_STIPPLE )  
cpp 复制代码
                  mPolygonMode != _r.mPolygonMode || 
                  mLineWidth != _r.mLineWidth ||
                  mPointSize != _r.mPointSize ||
                  mLineStrip !=  _r.mLineStrip ||
                  mLineRepatFactor != _r.mLineRepatFactor ||
                  mEnableLineStipple != _r.mEnableLineStipple;

修改文件:

代码文本:

cpp 复制代码
        mPolygonMode( PM_SOLID ),
        mLineWidth(5),
        mPointSize(2),
        mLineStrip(0xFFFF),
        mLineRepatFactor(1),
        mEnableLineStipple(false)

修改文件:

代码文本:

cpp 复制代码
        PFNGLLINESTRIPPLEPROC                                   LineStripple;

        #define glLineStipple									 gl3wProcs.gl.LineStripple

修改文件:

代码文本:

cpp 复制代码
// add ext func
typedef void( APIENTRYP PFNGLLINESTRIPPLEPROC )( GLint factor, GLushort pattern );

修改文件:

对结构体修改的重命名不需要,测试影响范围才改的。

代码文本如下:

cpp 复制代码
        float     lineWidth;
        float     pointSize;
        bool      enableLineStipple;
        //GLshort   lineStrip;
        //GLshort   lineRepeatFactor;
        //bool      enablePointSmooth;

修改文件:

代码文本如下:

cpp 复制代码
        pso->lineWidth = newBlock->macroblock->mLineWidth * 0.2f;
        pso->pointSize = newBlock->macroblock->mPointSize * 0.5f;
        pso->enableLineStipple = newBlock->macroblock->mEnableLineStipple;
        // GLshort   lineStrip;
        // GLshort   lineRepeatFactor;
        // bool      enablePointSmooth;
  

switch( macroblock->mPolygonMode )
{
        case PM_POINTS:
             OCGE( glPointSize( pso->pointSize));
            break;
        case PM_WIREFRAME:
            glLineWidth( pso->lineWidth );
            #define GL_LINE_STIPPLE 0x0B24 //这个不属于core
            if( macroblock->mEnableLineStipple )
            {    
                OCGE( glEnable( GL_LINE_STIPPLE ) );
                if( glLineStipple )
                    OCGE( glLineStipple( macroblock->mLineRepatFactor, macroblock->mLineStrip ) );
            }
            else
            {
                OCGE( glDisable( GL_LINE_STIPPLE ) );
            }
            break;
          // case PM_SOLID:
        default:  
            break;
}

修改文件:

代码文本如下:

cpp 复制代码
"glLineStipple",

支持解析材质json:

相关推荐
 M͏⁠͏r.D4 小时前
UE4 材质学习笔记03(翻书(Flipbook)动画/环境混合)
学习·ue4·材质
先生沉默先4 小时前
在3damax重创建了一个材质,然后在场景中也没有应用这个材质,将材质编辑器窗口重置,如何找回创建的材质(如何找回创建但是没有应用的材质(大概率找不回啦))
3d·编辑器·材质
 M͏⁠͏r.D11 小时前
UE4 材质学习笔记05(凹凸偏移和视差映射/扭曲着色器)
学习·ue4·材质
先生沉默先6 天前
unity 默认渲染管线材质球的材质通道,材质球的材质通道
unity·游戏引擎·材质
 M͏⁠͏r.D6 天前
UE4 材质学习笔记01(什么是着色器/PBR基础)
ue4·材质
renwen15799 天前
Maya没有Arnold材质球
材质·maya
wxbangzkj9 天前
激光切割机适用材质有哪些
材质
qq_421813799 天前
细说硫酸钙防静电地板的材质结构和优势特点
其他·材质
&AtTiTuDe;24 天前
电容的不同材质对应的温度范围
笔记·硬件工程·材质