我从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*/ }
答案 0 :(得分:0)
你应该用XMOLOROR替换所有D3DVECTOR和用XMCOLOR替换D3DXCOLOUR。