diff options
| author | 3gg <3gg@shellblade.net> | 2025-10-24 15:40:40 -0700 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-10-24 15:40:40 -0700 |
| commit | 175c72557b21f356e295a6f8a4acd91b7e744bef (patch) | |
| tree | 3d2a77481bc112e58a7618ef3b8de20a9e415811 /src/llr/light.c | |
| parent | c2cbe2ef1cb0237efd14fbe87469ee991ad3daa1 (diff) | |
Consolidate LLR into a single file.
Diffstat (limited to 'src/llr/light.c')
| -rw-r--r-- | src/llr/light.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/llr/light.c b/src/llr/light.c deleted file mode 100644 index 0fa1522..0000000 --- a/src/llr/light.c +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | #include "light_impl.h" | ||
| 2 | |||
| 3 | #include "memory.h" | ||
| 4 | #include "scene/node_impl.h" | ||
| 5 | |||
| 6 | #include <error.h> | ||
| 7 | |||
| 8 | static void make_environment_light( | ||
| 9 | Light* light, const EnvironmentLightDesc* desc) { | ||
| 10 | assert(light); | ||
| 11 | assert(desc); | ||
| 12 | light->type = EnvironmentLightType; | ||
| 13 | light->environment.environment_map = desc->environment_map; | ||
| 14 | } | ||
| 15 | |||
| 16 | Light* gfx_make_light(const LightDesc* desc) { | ||
| 17 | assert(desc); | ||
| 18 | |||
| 19 | Light* light = mem_alloc_light(); | ||
| 20 | |||
| 21 | switch (desc->type) { | ||
| 22 | case EnvironmentLightType: | ||
| 23 | make_environment_light(light, &desc->light.environment); | ||
| 24 | break; | ||
| 25 | default: | ||
| 26 | log_error("Unhandled light type"); | ||
| 27 | gfx_destroy_light(&light); | ||
| 28 | return 0; | ||
| 29 | } | ||
| 30 | |||
| 31 | return light; | ||
| 32 | } | ||
| 33 | |||
| 34 | void gfx_destroy_light(Light** light) { | ||
| 35 | assert(light); | ||
| 36 | if (*light) { | ||
| 37 | if ((*light)->parent.val) { | ||
| 38 | gfx_del_node((*light)->parent); | ||
| 39 | } | ||
| 40 | mem_free_light(light); | ||
| 41 | } | ||
| 42 | } | ||
