DirectX 9 D3DLIGHT9 文档的不准确定义

DirectX 9 中关于 D3DLIGHT9 在 spotlight 下对于成员 Direction 的定义如下:

Direction that the light is pointing in world space, specified by a D3DVECTOR structure. This member has meaning only for directional and spotlights. This vector need not be normalized, but it should have a nonzero length.

这个造成很大的误解,我测试的结果是,Direction 坐标系应当是以成员 Position 为原点的坐标值, 而不是 world 坐标系。

如随便设置一个 spotlight (100, 20, 30), 想让它照回原点,Direction 不能设成 (0, 0, 0)  , 而应当设为 (-100, -20,-30)


Comments are closed.