zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    mysql更新语句中的safe_mode
    MySQL数据类型详解
    刚更新完版本就炸了:java.lang.NoClassDefFoundError: org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream
    微信支付分创建支付分订单+签名+验签
    根据序列号加密生产4*4的密码,如:X9PL-TERY-NOZN-GMF1
    对称加密:AES
    MySQL按中文排序
    腾讯云COS分片上传
    Linux中jar包指定端口、配置文件启动并记录日志
    Java8新特性两个关联集合合并成父子级
  • 原文地址:https://www.cnblogs.com/yoru/p/5515662.html
Copyright © 2011-2022 走看看