diff --git a/include/QF/scene/light.h b/include/QF/scene/light.h index 5e4f04b22..c7943c50e 100644 --- a/include/QF/scene/light.h +++ b/include/QF/scene/light.h @@ -72,4 +72,11 @@ void Light_DecayLights (lightingdata_t *ldata, float frametime, double realtime); void Light_LinkLight (lightingdata_t *ldata, uint32_t entid); +struct imui_ctx_s; +struct ecs_registry_s; +void Light_dyn_light_ui (void *l, struct imui_ctx_s *imui_ctx, + struct ecs_registry_s *reg, uint32_t ent, void *data); +void Light_light_ui (void *l, struct imui_ctx_s *imui_ctx, + struct ecs_registry_s *reg, uint32_t ent, void *data); + #endif//__QF_scene_light_h diff --git a/libs/scene/light.c b/libs/scene/light.c index d9f6e8291..2f6884ac3 100644 --- a/libs/scene/light.c +++ b/libs/scene/light.c @@ -12,6 +12,9 @@ #include "QF/scene/scene.h" #include "QF/simd/vec4f.h" +#include "QF/ui/imui.h" +#define IMUI_context imui_ctx + static void expand_pvs (set_t *pvs, mod_brush_t *brush) { @@ -207,3 +210,67 @@ Light_DecayLights (lightingdata_t *ldata, float frametime, double realtime) } } } + +void +Light_dyn_light_ui (void *comp, imui_ctx_t *imui_ctx, + ecs_registry_t *reg, uint32_t ent, void *data) +{ + dlight_t *dlight = comp; + UI_Horizontal { + UI_Labelf ("Origin: "); + UI_FlexibleSpace (); + UI_Labelf ("%6.1f %6.1f %6.1f %6g", VEC4_EXP (dlight->origin)); + } + UI_Horizontal { + UI_Label ("Color: "); + UI_FlexibleSpace (); + UI_Labelf ("%5.3f %5.3f %5.3f %5.3f", VEC4_EXP (dlight->color)); + } + UI_Horizontal { + UI_Labelf ("Radius: "); + UI_FlexibleSpace (); + UI_Labelf ("%6g", dlight->radius); + } + UI_Horizontal { + UI_Labelf ("Die: "); + UI_FlexibleSpace (); + UI_Labelf ("%6.2f", dlight->die); + } + UI_Horizontal { + UI_Labelf ("Decay: "); + UI_FlexibleSpace (); + UI_Labelf ("%6.2f", dlight->decay); + } + UI_Horizontal { + UI_Labelf ("Min Light: "); + UI_FlexibleSpace (); + UI_Labelf ("%6g", dlight->minlight); + } +} + +void +Light_light_ui (void *comp, imui_ctx_t *imui_ctx, + ecs_registry_t *reg, uint32_t ent, void *data) +{ + light_t *light = comp; + UI_Horizontal { + UI_Label ("Color: "); + UI_FlexibleSpace (); + UI_Labelf ("%5.3f %5.3f %5.3f %3g", VEC4_EXP (light->color)); + } + UI_Horizontal { + UI_Labelf ("Position: "); + UI_FlexibleSpace (); + UI_Labelf ("%6.1f %6.1f %6.1f %6g", VEC4_EXP (light->position)); + } + UI_Horizontal { + UI_Labelf ("Direction: "); + UI_FlexibleSpace (); + UI_Labelf ("%6.3f %6.3f %6.3f %6.3g", VEC4_EXP (light->direction)); + } + UI_Horizontal { + UI_Labelf ("Attenuation: "); + UI_FlexibleSpace (); + UI_Labelf ("%g %g %g %g", VEC4_EXP (light->attenuation)); + } +} diff --git a/libs/scene/scene.c b/libs/scene/scene.c index 121bbf1da..a085062bd 100644 --- a/libs/scene/scene.c +++ b/libs/scene/scene.c @@ -156,11 +156,13 @@ static const component_t scene_components[scene_comp_count] = { [scene_dynlight] = { .size = sizeof (dlight_t), .name = "dyn_light", + .ui = Light_dyn_light_ui, }, [scene_light] = { .size = sizeof (light_t), .name = "light", + .ui = Light_light_ui, }, [scene_efrags] = { .size = sizeof (efrag_t *),