• hge source explor 0xA graphics Ⅰ


    Graphics

      在这一部分完成初始化DX,并且完成固定流水线,然后在进行渲染。

      在这一部分会用到的数据结构和参数有:

      参数:

    D3DPRESENT_PARAMETERS*  d3dpp;
    
        D3DPRESENT_PARAMETERS   d3dppW;
        D3DPRESENT_PARAMETERS   d3dppFS;
    
        IDirect3D8*                pD3D;
        IDirect3DDevice8*        pD3DDevice;
        IDirect3DVertexBuffer8*    pVB;
        IDirect3DIndexBuffer8*    pIB;
    
        IDirect3DSurface8*    pScreenSurf;
        IDirect3DSurface8*    pScreenDepth;
        CRenderTargetList*    pTargets;
        CRenderTargetList*    pCurTarget;
    
        D3DXMATRIX            matView;
        D3DXMATRIX            matProj;
    
        CTextureList*        textures;
        hgeVertex*            VertArray;
    
        int                    nPrim;
        int                    CurPrimType;
        int                    CurBlendMode;
        HTEXTURE            CurTexture;
    para

      其中还有这些结构:

      hgevertex

    /*
    ** HGE Vertex structure
    */
    struct hgeVertex
    {
        float            x, y;        // screen position    
        float            z;            // Z-buffer depth 0..1
        DWORD            col;        // color
        float            tx, ty;        // texture coordinates
    };
    
    //对应的定点设置
    #define D3DFVF_HGEVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
    #define VERTEX_BUFFER_SIZE 4000

       

    CRenderTargetList

    struct CRenderTargetList
    {
        int                    width;
        int                    height;
        IDirect3DTexture8*    pTex;
        IDirect3DSurface8*    pDepth;
        CRenderTargetList*    next;
    };

    CTextureList

    struct CTextureList
    {
        HTEXTURE            tex;
        int                    width;
        int                    height;
        CTextureList*        next;
    };

     渲染的图元

    /*
    ** HGE Primitive type constants
    */
    #define HGEPRIM_LINES        2
    #define HGEPRIM_TRIPLES        3
    #define HGEPRIM_QUADS        4
    
    
    /*
    ** HGE Vertex structure
    */
    struct hgeVertex
    {
        float            x, y;        // screen position    
        float            z;            // Z-buffer depth 0..1
        DWORD            col;        // color
        float            tx, ty;        // texture coordinates
    };
    
    
    /*
    ** HGE Triple structure
    */
    struct hgeTriple
    {
        hgeVertex        v[3];
        HTEXTURE        tex;
        int                blend;
    };
    
    
    /*
    ** HGE Quad structure
    */
    struct hgeQuad
    {
        hgeVertex        v[4];
        HTEXTURE        tex;
        int                blend;
    };

    BLEND类型

    /*
    ** HGE Blending constants
    */
    #define    BLEND_COLORADD        1
    #define    BLEND_COLORMUL        0
    #define    BLEND_ALPHABLEND    2
    #define    BLEND_ALPHAADD        0
    #define    BLEND_ZWRITE        4
    #define    BLEND_NOZWRITE        0
    
    #define BLEND_DEFAULT        (BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE)
    #define BLEND_DEFAULT_Z        (BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_ZWRITE)
  • 相关阅读:
    微信小程序
    如何在微信小程序中使用骨架屏
    Nlog打印日志到Influxdb数据库
    C#通过模板导出Word的两种方法(超简单)
    VS2019制作的安装包,默认安装到C盘快捷方式无法打开
    orcale数据库还原备份
    Thread 类创建线程
    Quartz.NET
    DataTable ,使用详细。
    Unity3D 学习
  • 原文地址:https://www.cnblogs.com/yoru/p/5515662.html
Copyright © 2020-2023  润新知