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:

相关推荐
北京软秦科技有限公司2 天前
通用零部件来料材质证书智能把关,IACheck搭配AI报告审核通审Agent版比对订单与报告参数
人工智能·材质
音乐宝贝家3 天前
户外演出时吉他实际音量、音质等表现数据究竟如何?
数据库·新媒体运营·媒体·材质·内容运营
坚毅之梦5084 天前
全品美学鉴赏视角】四相共生赋能多元质感:解锁狼山石四大单品的专属审美内核
生活·材质·狼山石
CG_MAGIC4 天前
Substance Painter:图层蒙版与智能材质
3d·材质·贴图·substance painter·效果图·建模教程·渲云渲染
CG_MAGIC6 天前
3ds Max粒子系统:雪与雨特效制作
3d·blender·材质·效果图·渲云渲染
机汇五金_6 天前
交换机箱体材质如何选择?铝合金与钢板有什么区别?
python·材质
音乐宝贝家6 天前
吉他桶型技术解析:GA桶 vs D桶 vs OM桶——入门弹唱选哪个
新媒体运营·音视频·业界资讯·媒体·材质·零售·内容运营
法雅特吉他6 天前
吉他面板材质怎么选?西提卡云杉单板深度解析
经验分享·新媒体运营·学习方法·流量运营·材质·内容运营
音乐宝贝家7 天前
吉他面板材质怎么选?云杉单板面单吉他配置深度解析
数据库·新媒体运营·产品运营·媒体·材质·内容运营