• 灵活顶点格式D3DFVF_XYZW and D3DFVF_XYZRHW


    From the DXSDK Documentation
    D3DFVF_XYZRHW - Vertex format includes the position of a transformed vertex. This flag cannot be used with the D3DFVF_XYZ or D3DFVF_NORMAL flags.
    D3DFVF_XYZW - Vertex format contains transformed and clipped (x, y, z, w) data. ProcessVertices does not invoke the clipper, instead outputting data in clip coordinates. This constant is designed for, and can only be used with, the programmable vertex pipeline.

    That should clarify the difference. Both are transformed coordinates but the latter are also clipped; i. e. one step further down the road to the screen.

    D3DFVF_XYZRHW: Use that when you need to work in screenspace (in 2D, for example for UIs and stuff like that) The vertex shader / pipeline won't be applied to those vertices. Only the pixel shader / pipeline. x and y contain the x and y coordinate of the vertex in screenspace, and z and w contain the depth information (never remember how its stored)

    D3DFVF_XYZW: Use that ONLY if you're using a vertex shader which needs a float4 as the POSITION input. This FVF code won't work with the fixed pipeline.

    在顶点结构体中没有RHW时,Direct3D将执行视、投影、世界等变换以及进行光线计算,之后你才能在窗口中得到你所绘制的物体。当顶点结构体中有RHW时,告知Direct3D使用的顶点已经在屏幕坐标系中了,不再执行视图、投影、世界等变换和光线计算,因为D3DFVF_XYZRHW标志告诉它顶点已经经过了这些处理,并直接将顶点进行光栅操作,任何用SetTransform进行的转换都对其无效。不过这时的原点就在客户区的左上角了,其中x向右为正,y向下为正,而z的意义已经变为z-buffer的象素深度。

        D3DFVF_XYZRHW和D3DFVF_XYZ、D3DFVF_NORMAL不能共存,因为后两个标志与前一个矛盾。在使用这种顶点时,系统需要顶点的位置已经经过变换了,也就是说x、y必须在屏幕坐标系中,z必须是z-buffer中的象素深度,取值范围:0.0-1.0,离观察者最近的地方为0.0,观察范围内最远可见的地方为1.0。

     

  • 相关阅读:
    【bzoj1116】[POI2008]CLO 并查集
    【bzoj3831】[Poi2014]Little Bird 单调队列优化dp
    【bzoj4726】[POI2017]Sabota? 树形dp
    【bzoj4822/bzoj1935】[Cqoi2017]老C的任务/[Shoi2007]Tree 园丁的烦恼 树状数组
    【bzoj4884】[Lydsy2017年5月月赛]太空猫 dp
    【bzoj2500】幸福的道路 树形dp+倍增RMQ+二分
    【bzoj2424】[HAOI2010]订货 费用流
    【bzoj2662】[BeiJing wc2012]冻结 分层图Spfa
    【bzoj1195】[HNOI2006]最短母串 AC自动机+状态压缩+BFS最短路
    【bzoj4818】[Sdoi2017]序列计数 矩阵乘法
  • 原文地址:https://www.cnblogs.com/kex1n/p/2736564.html
Copyright © 2020-2023  润新知