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:

相关推荐
在下胡三汉14 小时前
3dmax模型怎么导入酷家乐插件,材质贴图在,可优化不卡,可批量处理,无需打开一个个max,可批量转FBX/GLB/GLTF/OBJ/SU
vr·材质·贴图·glb·酷家乐
ue星空7 天前
UE快速预览材质节点快捷键
材质
dermail11 天前
丝杆升降机各部件材质深度剖析:解锁高效稳定运行的技术密码
材质
向宇it12 天前
【blender小技巧】Blender导出带贴图的FBX模型,并在unity中提取材质模型使用
开发语言·unity·c#·游戏引擎·blender·材质·贴图
在下胡三汉15 天前
3dmax标准材质/vr/cr材质贴图转PBR材质贴图插件,支持多维子材质转换
vr·材质·贴图
Zhichao_9716 天前
【UE】渐变框材质
ue5·材质
dermail17 天前
深度解析丝杆升降机各部件材质:性能、应用与选型
材质
向宇it23 天前
【零基础入门unity游戏开发——2D篇】SortingGroup(排序分组)组件
开发语言·unity·c#·游戏引擎·材质
在下胡三汉25 天前
3dmax批量转glb/gltf/fbx/osgb/stl/3ds/dae/obj/skp格式导出转换插件,无需一个个打开max,材质贴图在
3d·材质·贴图
go54631584651 个月前
基于动态光影融合的缺陷实时检测和材质量化方法,并且整合EventPS、VMNer和EvDiG
材质