zoukankan      html  css  js  c++  java
  • 关于DrawIndexedPrimitive函数的调用

    函数的原型例如以下所看到的:

    HRESULT DrawIndexedPrimitive(
     [in]  D3DPRIMITIVETYPE Type,
     [in]  INT BaseVertexIndex,
     [in]  UINT MinIndex,
     [in]  UINT NumVertices,
     [in]  UINT StartIndex,
     [in]  UINT PrimitiveCount
    );

    <1>  Type:D3DPRIMITIVETYPE枚举成员中的一个,表示绘制的图元类型

    typedef enum D3DPRIMITIVETYPE {
     D3DPT_POINTLIST       = 1,
     D3DPT_LINELIST        = 2,
     D3DPT_LINESTRIP       = 3,
     D3DPT_TRIANGLELIST    = 4,
     D3DPT_TRIANGLESTRIP   = 5,
     D3DPT_TRIANGLEFAN     = 6,
     D3DPT_FORCE_DWORD     = 0x7fffffff
    }D3DPRIMITIVETYPE, *LPD3DPRIMITIVETYPE;

    当中D3DPT_POINTLIST表示点列


    D3DPT_LINELIST表示线段列


    D3DPT_LINESTRIP表示线段带


    D3DPT_TRIANGLELIST表示三角面列


    D3DPT_TRIANGLESTRIP表示三角面带


    D3DPT_TRIANGLEFAN表示扇形面



    <2> BaseVertexIndex

    顶点缓存中距离第一个顶点的偏移量,这里说的都是顶点缓存中的索引。

    BaseVertexIndex is a value that's effectively added to every VBIndex stored in the index buffer.

    它是要加入到索引缓存中存储的顶点缓存的每个值上的。

    <3> MinIndex

    函数调用中最小的索引。这是以0为基础,相对于BaseVertexIndex的索引。当然是针对顶点缓存来说的。

    <4> NumVertices

    函数调用过程中用到的顶点数,第一个顶点是BaseVertexIndex +MinIndex

    <5> StartIndex

    当訪问顶点缓存的时候用到的第一个索引的的索引,

    <6> PrimitiveCount

    图元的个数

     

    以下几幅图最能说明BaseVertexIndex。MiniIndex,StartIndex。以及NumVertices的含义

    <1> 当BaseVertexIndex =0


    此时的函数调用例如以下所看到的:

    DrawIndexedPrimitive( D3DPT_TRIANGLELIST, // PrimitiveType
                        0,                  // BaseVertexIndex
                        0,                  // MinIndex
                        4,                  // NumVertices
                        3,                  // StartIndex
                        1 );                // PrimitiveCount

    <2>当BaseVertexIndex ≠0


    此时索引缓存中的没一个值都要加上一个BaseVertexIndex的值来表示真正的索引。

    函数的调用例如以下所看到的:

    DrawIndexedPrimitive(D3DPT_TRIANGLELIST, // PrimitiveType
                        50,                 // BaseVertexIndex
                        0,                  // MinIndex
                        4,                  // NumVertices
                        3,                  // StartIndex
                        1 );   



  • 相关阅读:
    linux下base命令
    lldpd-0.7.7代码解读(send_pdu部分)
    openwrt 包makefile
    字符
    AC_CONFIG_HEADER
    大小端
    查看使用了那种shell
    debia下安装libjpeg
    工作流模式 (zhuan)
    1.2.1 工作流管理系统参考模型 (zhuan)
  • 原文地址:https://www.cnblogs.com/mfmdaoyou/p/7339974.html
Copyright © 2011-2022 走看看