Added: lighting

This commit is contained in:
2026-10-20 18:27:15 +02:00
parent 2246370722
commit e35a61c2a9
12 changed files with 179 additions and 15 deletions
+13
View File
@@ -58,6 +58,19 @@ int WINAPI WinMain(
// 7. create light source
Light light = {};
Light::LightBuffer lightData = {};
// directional light
lightData.LightVector = { -1.0f, -1.0f, 1.0f };
// point light
lightData.LightPosition = { -50.0f, 400.0f, 0.0f };
lightData.LightAttenuation = { 1.0f, 0.3f, 0.1f };
lightData.LightIntensity = 1000.0f;
lightData.DiffuseColor = { 1.0f, 1.0f, 1.0f, 1.0f };
lightData.SpecularColor = { 0.2f, 0.2f, 0.2f, 1.0f };
lightData.Phong = 8.0f;
lightData.CameraPosition = camera.getCameraPosition();
error = light.init(d3d.getDevice(), lightData);
CheckError(error);