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:

相关推荐
王源骏3 天前
使用反转法线材质球,实现切换天空盒相同的功能,优点:包体变小
材质
Thomas_YXQ5 天前
Unity3D RectTransform.rect属性详解
unity·编辑器·游戏引擎·材质
梨轻巧5 天前
Maya绑定:渲染编辑器Hypershade简单使用,给小球添加材质纹理
材质·maya
vonlycn8 天前
UE5 性能优化(1) 模型合并,材质合并
ue5·材质
二川bro18 天前
第21节:环境贴图与PBR材质升级——构建电影级真实感渲染
材质·贴图
Thomas_YXQ1 个月前
Unity3D编辑器扩展-物体批量替换设置材质
游戏·unity·编辑器·游戏引擎·材质
CG_MAGIC1 个月前
主流 3D 模型格式(FBX/OBJ/DAE/GLTF)材质支持与转换操作指南
3d·渲染·动画·材质·贴图·3d 模型格式·材质支持与转换操作指南
郝学胜-神的一滴1 个月前
Three.js 材质系统深度解析
javascript·3d·游戏引擎·webgl·材质
渲吧-云渲染1 个月前
破译真实感:渲染参数进阶指南——告别塑料感,唤醒材质生命力
材质
ue星空1 个月前
UE材质World Position 和 Object Position
材质