Light.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2022, Jesse Buhagiar <jooster669@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGfx/Vector3.h>
  8. #include <LibGfx/Vector4.h>
  9. namespace GPU {
  10. struct Light {
  11. bool is_enabled { false };
  12. // According to the OpenGL 1.5 specification, page 56, all of the parameters
  13. // for the following data members (positions, colors, and reals) are all
  14. // floating point.
  15. Vector4<float> ambient_intensity { 0.0f, 0.0f, 0.0f, 1.0f };
  16. Vector4<float> diffuse_intensity { 0.0f, 0.0f, 0.0f, 1.0f };
  17. Vector4<float> specular_intensity { 0.0f, 0.0f, 0.0f, 1.0f };
  18. Vector4<float> position { 0.0f, 0.0f, 1.0f, 0.0f };
  19. Vector3<float> spotlight_direction { 0.0f, 0.0f, -1.0f };
  20. float spotlight_exponent { 0.0f };
  21. float spotlight_cutoff_angle { 180.0f };
  22. float constant_attenuation { 1.0f }; // This is referred to `k0i` in the OpenGL spec
  23. float linear_attenuation { 0.0f }; // This is referred to `k1i` in the OpenGL spec
  24. float quadratic_attenuation { 0.0f }; // This is referred to `k2i` in the OpenGL spec
  25. };
  26. }