-1

我从 www.directxtutorial.com 学习 DirectX (DirectX 9) 并在 Windows 8 中使用 Visual Studio 2012。d3dx9 (d3dx) 替换为 DirectXMath 等其他标头,因此我替换了所有需要的,但有一个问题 - 将 XMVECTOR 转换为D3DVECTOR 和 D3DCOLORVALUE。

问题代码(写的问题-/问题! /):

void init_light(void) {
D3DLIGHT9 light;    // create the light struct
D3DMATERIAL9 material;    // create the material struct

ZeroMemory(&light, sizeof(light));    // clear out the light struct for use
light.Type = D3DLIGHT_DIRECTIONAL;    // make the light type 'directional light'
light.Diffuse = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f); /*problem!*/   // set the light's color
light.Direction = D3DXVECTOR3(-1.0f, -0.3f, -1.0f); /*problem!*/

d3ddev->SetLight(0, &light);    // send the light struct properties to light #0
d3ddev->LightEnable(0, TRUE);    // turn on light #0

ZeroMemory(&material, sizeof(D3DMATERIAL9));    // clear out the struct for use
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); /*problem!*/   // set diffuse color to white
material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); /*problem!*/   // set ambient color to white

d3ddev->SetMaterial(&material);    /*set the globably-used material to &material*/ }
4

1 回答 1

0

您应该将所有 D3DVECTOR 替换为 XMVECTOR,将 D3DXCOLOUR 替换为 XMCOLOR。

于 2013-06-24T14:11:23.767 回答