//初始化部分
// 创建一个cube
g_Box = new Cube(g_Device);
// 设置方向光源
D3DLIGHT9 light;
::ZeroMemory(&light, sizeof(light));
light.Type = D3DLIGHT_DIRECTIONAL;
light.Type = D3DLIGHT_DIRECTIONAL;
light.Ambient = D3DXCOLOR(0.8f, 0.8f, 0.8f, 1.0f);
light.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
light.Specular = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);
light.Direction = D3DXVECTOR3(1.0f, -1.0f, 0.0f);
g_Device->SetLight(0, &light);
g_Device->LightEnable(0, true);
g_Device->SetRenderState(D3DRS_NORMALIZENORMALS, true);
g_Device->SetRenderState(D3DRS_SPECULARENABLE, true);
// 创建一个纹理
D3DXCreateTextureFromFile(g_Device, "crate.jpg", &g_Tex);
// 设置纹理过滤器
//g_Device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
//g_Device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
//g_Device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
// 高质量贴图,需要硬件
DirectX3D 纹理贴图
最新推荐文章于 2024-07-19 17:56:42 发布