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:

相关推荐
da_vinci_x3 天前
PS 3D Viewer (Beta):概念美术的降维打击,白模直接在PS里转光打影出5张大片
人工智能·游戏·3d·prompt·aigc·材质·游戏美术
云卓SKYDROID4 天前
无人机遥控器连接技术对比分析
无人机·材质·中继器·高科技·云卓科技
reddingtons6 天前
Firefly Text-to-Texture:一键生成PBR武器材质的游戏美术效率革命
人工智能·3d·prompt·材质·技术美术·游戏策划·游戏美术
搞科研的小刘选手8 天前
【同济大学主办】第十一届能源资源与环境工程研究进展国际学术会议(ICAESEE 2025)
大数据·人工智能·能源·材质·材料工程·地理信息
da_vinci_x13 天前
Substance 3D 材质流:AI 快速生成与程序化精修
人工智能·游戏·3d·材质·设计师·技术美术·游戏美术
da_vinci_x15 天前
Painter AI 材质 x 智能遮罩:告别“风格化”手K地狱
人工智能·aigc·材质·设计师·技术美术·工作流·游戏美术
CG_MAGIC15 天前
3ds Max材质高清参数设置:10分钟提升渲染真实感
3d·vr·3dmax·材质·vray·渲云渲染
云卓SKYDROID16 天前
无人机探测器技术要点解析
人工智能·无人机·材质·高科技·云卓科技
我救我自己18 天前
UE5.6 玻璃材质——Lumen
ue5·材质
DvLee102418 天前
UnityGLTF 材质创建与赋值流程
unity·材质