zoukankan      html  css  js  c++  java
  • 灵活顶点格式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。

     

  • 相关阅读:
    Android WelcomeActivity 启动画更换网络图片
    Android 手机号码格式验证
    Android 身份证号码查询、手机号码查询、天气查询
    Android Http请求框架一:Get 和 Post 请求
    自定义带进度条的WebView , 增加获取web标题和url 回掉
    JavaScript之正則表達式入门
    Spring之WEB模块
    【VBA研究】浮点数计算总是有误差的
    CSDN日报20170403 ——《该不该离职?它说了算!》
    怎样清除浏览器缓存?
  • 原文地址:https://www.cnblogs.com/kex1n/p/2736564.html
Copyright © 2011-2022 走看看