add sampler states

add light
add normals
This commit is contained in:
2025-11-12 12:24:37 +01:00
parent d78aec9c1a
commit 5e31638fb8
6 changed files with 95 additions and 53 deletions
+11 -2
View File
@@ -38,7 +38,10 @@ int WINAPI WinMain(
// set render states
d3d.getDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
d3d.getDevice()->SetRenderState(D3DRS_LIGHTING, FALSE);
d3d.getDevice()->SetRenderState(D3DRS_LIGHTING, TRUE);
d3d.getDevice()->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
d3d.getDevice()->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
d3d.getDevice()->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
// 3. create a mesh
Mesh mesh = {};
@@ -62,7 +65,13 @@ int WINAPI WinMain(
// 7. create light source
Light light = {};
error = light.init();
D3DLIGHT9 data = {};
data.Type = D3DLIGHT_DIRECTIONAL;
data.Direction = { 0.0f, 0.0f, 1.0f };
data.Diffuse = { 0.0f, 0.0f, 0.0f, 1.0f };
data.Specular = { 1.0f, 1.0f, 1.0f, 1.0f };
data.Ambient = { 0.1f, 0.1f, 0.5f, 1.0f };
error = light.init(data);
CheckError(error);
// 8. run application