Direct3D 11 拾取

来源:互联网 发布:足球教案制作软件 编辑:程序博客网 时间:2024/05/22 12:23

ID3DX10Mesh::Intersect

dx10里面有intersect 函数,

可是在dx11里面呢相应的替代函数在哪里?


http://www.braynzarsoft.net/index.php?p=D3D11PICKING

介绍

我们将学习如何选择对象的Direct3D 11 拾取

D3D11的时间比在D3D10拾取一个额外的步骤。这是因为 mesh 接口不是D3D11可用

Picking a 3D Object

To pick a 3D object, we will need to follow a series of steps:

  1. Get a 2D vector (x, y) of the Position of the mouse cursor in screen space (the client window) (in pixels).
  2. Transform the 2D vector representing the mouses position in screen space to a 3D vector (x, y, z) representing a ray in view space.
  3. Transform the view space ray into a world space ray.
  4. Transform the model, or objects vertex positions from model (or local) space to world space.
  5. Loop through each of the triangles in the model to find out which (if any) triangle the ray intersects with. (This is the step we were able to skip in D3D10 by using a method provided by the mesh interface.)

0 0