mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-21 20:11:24 +00:00
Fix most of the hacks for clang
gcc didn't like a couple of the changes (rightly so: one was actually incorrect), and the fix for qfcc I didn't think to suggest while working with Emily. The general CFLAGS etc fixes mostly required just getting the order of operations right: check for attributes after setting the warnings flags, though those needed some care for gcc as it began warning about main wanting the const attribute. Fixing the imui link errors required moving the ui functions and setup to vulkan_lighting.c, which is really the only place they're used.
This commit is contained in:
parent
3098b5d3f7
commit
2b879af3e1
13 changed files with 293 additions and 151 deletions
82
config.d/attributes.m4
Normal file
82
config.d/attributes.m4
Normal file
|
@ -0,0 +1,82 @@
|
|||
dnl ==================================================================
|
||||
dnl Checks for compiler attributes
|
||||
dnl ==================================================================
|
||||
|
||||
AC_MSG_CHECKING(for __attribute__)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[static __attribute__ ((unused)) const char *foo = "bar";]]
|
||||
[[int bar(void);]],
|
||||
[[return bar();]])],
|
||||
[AC_DEFINE(HAVE___ATTRIBUTE__)
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)]
|
||||
)
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__],
|
||||
[/* Define this if the GCC __attribute__ keyword is available */
|
||||
#undef HAVE___ATTRIBUTE__
|
||||
#ifndef HAVE___ATTRIBUTE__
|
||||
# define __attribute__(x)
|
||||
#endif])
|
||||
|
||||
AC_MSG_CHECKING(for __attribute__ ((visibility)))
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[void foo (void);]]
|
||||
[[__attribute__ ((visibility ("default"))) void foo (void) {}]]
|
||||
[[int bar(void);]],
|
||||
[[return bar();]]
|
||||
)],
|
||||
[AC_DEFINE(HAVE___ATTRIBUTE__VISIBILITY)
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)]
|
||||
)
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY],
|
||||
[/* Define this if the GCC visibility __attribute__ is available */
|
||||
#undef HAVE___ATTRIBUTE__VISIBILITY
|
||||
#ifdef HAVE___ATTRIBUTE__VISIBILITY
|
||||
# define VISIBLE __attribute__((visibility ("default")))
|
||||
#else
|
||||
# define VISIBLE
|
||||
#endif])
|
||||
|
||||
AC_MSG_CHECKING(for __attribute__ ((designated_init)))
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[struct x { char y; } __attribute__ ((designated_init));]]
|
||||
[[int bar(void);]],
|
||||
[[return bar();]]
|
||||
)],
|
||||
[AC_DEFINE(HAVE___ATTRIBUTE__DESIGNATED_INIT)
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)]
|
||||
)
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__DESIGNATED_INIT],
|
||||
[/* Define this if the GCC designated_init __attribute__ is available */
|
||||
#undef HAVE___ATTRIBUTE__DESIGNATED_INIT
|
||||
#ifdef HAVE___ATTRIBUTE__DESIGNATED_INIT
|
||||
# define DESIGNATED_INIT __attribute__((designated_init))
|
||||
#else
|
||||
# define DESIGNATED_INIT
|
||||
#endif])
|
||||
|
||||
if test "x$SYSTYPE" = "xWIN32"; then
|
||||
AC_MSG_CHECKING(for __attribute__ ((gcc_struct)))
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[typedef struct { int foo; }]]
|
||||
[[__attribute__ ((gcc_struct)) gcc_struct_test;]],
|
||||
[[return gcc_struct_test.foo]])],
|
||||
[AC_DEFINE(HAVE___ATTRIBUTE__GCC_STRUCT)
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
])
|
||||
fi
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__GCC_STRUCT],
|
||||
[/* Define this if the GCC gcc_struct __attribute__ is available */
|
||||
#undef HAVE___ATTRIBUTE__GCC_STRUCT
|
||||
#ifdef HAVE___ATTRIBUTE__GCC_STRUCT
|
||||
# define GCC_STRUCT __attribute__((gcc_struct))
|
||||
#else
|
||||
# define GCC_STRUCT
|
||||
#endif])
|
|
@ -6,6 +6,18 @@ else
|
|||
cvs_def_disabled="!= xno"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for clang)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[]],
|
||||
[[#ifndef __clang__],
|
||||
[ choke me],
|
||||
[#endif]])],
|
||||
[CLANG=yes],
|
||||
[CLANG=no]
|
||||
)
|
||||
AC_MSG_RESULT($CLANG)
|
||||
|
||||
AC_MSG_CHECKING(for CFLAGS pre-set)
|
||||
leave_cflags_alone=no
|
||||
if test "x$CFLAGS" != "x"; then
|
||||
|
@ -86,7 +98,7 @@ dnl We want warnings, lots of warnings...
|
|||
dnl The help text should be INVERTED before release!
|
||||
dnl when in git, this test defaults to ENABLED.
|
||||
dnl In a release, this test defaults to DISABLED.
|
||||
if test "x$GCC" = "xyes"; then
|
||||
if test "x$GCC" = "xyes" -a "x$leave_cflags_alone" != xyes; then
|
||||
if test "x$enable_Werror" $cvs_def_enabled; then
|
||||
CFLAGS="$CFLAGS -Wall -Werror -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
|
||||
else
|
||||
|
@ -95,6 +107,10 @@ if test "x$GCC" = "xyes"; then
|
|||
CFLAGS="$CFLAGS -fno-common"
|
||||
fi
|
||||
|
||||
if test "x$CLANG" = xyes -a "x$leave_cflags_alone" != xyes; then
|
||||
CFLAGS="$CFLAGS -Wno-misleading-indentation"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(optimize,
|
||||
AS_HELP_STRING([--disable-optimize],
|
||||
[compile without optimizations (for development)]),
|
||||
|
@ -150,8 +166,8 @@ if test "x$optimize" = xyes -a "x$leave_cflags_alone" != "xyes"; then
|
|||
dnl if test "$CC_MAJ" -ge 4; then
|
||||
dnl QF_CC_OPTION(-finline-limit=32000 -Winline)
|
||||
dnl fi
|
||||
dnl heavy="-O2 $CFLAGS -ffast-math -fno-unsafe-math-optimizations -funroll-loops -fomit-frame-pointer"
|
||||
heavy="-O2 $CFLAGS -fno-fast-math -funroll-loops -fomit-frame-pointer "
|
||||
dnl heavy="-O2 -ffast-math -fno-unsafe-math-optimizations -funroll-loops -fomit-frame-pointer"
|
||||
heavy="-O2 -fno-fast-math -funroll-loops -fomit-frame-pointer "
|
||||
CFLAGS="$saved_cflags"
|
||||
light="-O2"
|
||||
AC_ARG_ENABLE(strict-aliasing,
|
||||
|
@ -233,7 +249,7 @@ AC_ARG_ENABLE(profile,
|
|||
[compile with profiling (for development)]),
|
||||
profile=$enable_profile
|
||||
)
|
||||
if test "x$profile" = xyes; then
|
||||
if test "x$profile" = xyes -a "x$leave_cflags_alone" != xyes; then
|
||||
BUILD_TYPE="$BUILD_TYPE Profile"
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="`echo $CFLAGS | sed -e 's/-fomit-frame-pointer//g'` -pg"
|
||||
|
@ -244,7 +260,7 @@ if test "x$profile" = xyes; then
|
|||
fi
|
||||
|
||||
check_pipe=no
|
||||
if test "x$GCC" = xyes; then
|
||||
if test "x$GCC" = xyes -a "x$leave_cflags_alone" != xyes; then
|
||||
dnl Check for -pipe vs -save-temps.
|
||||
AC_MSG_CHECKING(for -pipe vs -save-temps)
|
||||
AC_ARG_ENABLE(save-temps,
|
||||
|
@ -283,7 +299,7 @@ dnl with many compilers that do not support the latest ISO standards. Well,
|
|||
dnl that is our cover story -- the reality is that we like them and do not want
|
||||
dnl to give them up. :)
|
||||
dnl Make the compiler swallow its pride...
|
||||
if test "x$GCC" != xyes; then
|
||||
if test "x$GCC" != xyes -a "x$CLANG" != xyes -a "x$leave_cflags_alone" != xyes; then
|
||||
AC_MSG_CHECKING(for how to deal with BCPL-style comments)
|
||||
case "${host}" in
|
||||
*-aix*)
|
||||
|
|
|
@ -14,61 +14,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[int foo = _SC_PAGE
|
|||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for __attribute__)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[static __attribute__ ((unused)) const char *foo = "bar";]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__)
|
||||
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
|
||||
])
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__],
|
||||
[/* Define this if the GCC __attribute__ keyword is available */
|
||||
#undef HAVE___ATTRIBUTE__
|
||||
#ifndef HAVE___ATTRIBUTE__
|
||||
# define __attribute__(x)
|
||||
#endif])
|
||||
|
||||
AC_MSG_CHECKING(for __attribute__ ((visibility)))
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (void);
|
||||
__attribute__ ((visibility ("default"))) void foo (void) {}]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__VISIBILITY)
|
||||
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
|
||||
])
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__VISIBILITY],
|
||||
[/* Define this if the GCC visibility __attribute__ is available */
|
||||
#undef HAVE___ATTRIBUTE__VISIBILITY
|
||||
#ifdef HAVE___ATTRIBUTE__VISIBILITY
|
||||
# define VISIBLE __attribute__((visibility ("default")))
|
||||
#else
|
||||
# define VISIBLE
|
||||
#endif])
|
||||
|
||||
AC_MSG_CHECKING(for __attribute__ ((designated_init)))
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (void);
|
||||
struct x { char y; } __attribute__ ((designated_init));]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__DESIGNATED_INIT)
|
||||
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
|
||||
])
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__DESIGNATED_INIT],
|
||||
[/* Define this if the GCC designated_init __attribute__ is available */
|
||||
#undef HAVE___ATTRIBUTE__DESIGNATED_INIT
|
||||
#ifdef HAVE___ATTRIBUTE__DESIGNATED_INIT
|
||||
# define DESIGNATED_INIT __attribute__((designated_init))
|
||||
#else
|
||||
# define DESIGNATED_INIT
|
||||
#endif])
|
||||
|
||||
if test "x$SYSTYPE" = "xWIN32"; then
|
||||
AC_MSG_CHECKING(for __attribute__ ((gcc_struct)))
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef struct { int foo; }
|
||||
__attribute__ ((gcc_struct)) gcc_struct_test;]], [[]])],[AC_DEFINE(HAVE___ATTRIBUTE__GCC_STRUCT)
|
||||
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
|
||||
])
|
||||
fi
|
||||
AH_VERBATIM([HAVE___ATTRIBUTE__GCC_STRUCT],
|
||||
[/* Define this if the GCC gcc_struct __attribute__ is available */
|
||||
#undef HAVE___ATTRIBUTE__GCC_STRUCT
|
||||
#ifdef HAVE___ATTRIBUTE__GCC_STRUCT
|
||||
# define GCC_STRUCT __attribute__((gcc_struct))
|
||||
#else
|
||||
# define GCC_STRUCT
|
||||
#endif])
|
||||
|
||||
AC_MSG_CHECKING(for __builtin_expect)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int x;]], [[if (__builtin_expect(!x, 1)) {}]])],[AC_DEFINE(HAVE___BUILTIN_EXPECT)
|
||||
AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
|
||||
|
|
30
configure.ac
30
configure.ac
|
@ -54,7 +54,27 @@ case "$host_os" in
|
|||
;;
|
||||
*)
|
||||
dnl Checks for working -lm
|
||||
AC_CHECK_LIB(m, lgammaf,, AC_MSG_ERROR([math library (-lm) appears broken]))
|
||||
AC_MSG_CHECKING(for pow and atan2 in standard library)
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <math.h>
|
||||
int func_ind;
|
||||
double (*func[])(double, double) = {pow, atan2};]],
|
||||
[[return (int)(func[func_ind])(2, 3);]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(for pow and atan2 in -lm)
|
||||
LIBS="-lm $LIBS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <math.h>
|
||||
int func_ind;
|
||||
double (*func[])(double, double) = {pow, atan2};]],
|
||||
[[return (int)(func[func_ind])(2, 3);]])],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_ERROR([math library (-lm) appears broken])]
|
||||
)]
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -70,6 +90,11 @@ m4_include(config.d/sdl.m4)
|
|||
m4_include(config.d/curses.m4)
|
||||
m4_include(config.d/freetype.m4)
|
||||
|
||||
m4_include(config.d/networking.m4)
|
||||
|
||||
m4_include(config.d/compiling.m4)
|
||||
m4_include(config.d/attributes.m4)
|
||||
|
||||
dnl ==================================================================
|
||||
dnl Checks for system type
|
||||
dnl ==================================================================
|
||||
|
@ -115,13 +140,10 @@ m4_include(config.d/joystick.m4)
|
|||
m4_include(config.d/evdev.m4)
|
||||
m4_include(config.d/cdrom.m4)
|
||||
|
||||
m4_include(config.d/networking.m4)
|
||||
|
||||
m4_include(config.d/paths.m4)
|
||||
|
||||
m4_include(config.d/build_control.m4)
|
||||
m4_include(config.d/qfcc.m4)
|
||||
m4_include(config.d/compiling.m4)
|
||||
|
||||
AC_ARG_ENABLE(static-doc,
|
||||
AS_HELP_STRING([--enable-static-doc],
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#ifndef __QFCC__
|
||||
#include "QF/cexpr.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
#ifndef __QFCC__
|
||||
#include "QF/darray.h"
|
||||
#include "QF/Vulkan/command.h"
|
||||
#endif
|
||||
|
@ -142,13 +142,8 @@ typedef struct qfv_attachmentinfo_s {
|
|||
} qfv_attachmentinfo_t;
|
||||
|
||||
typedef struct qfv_taskinfo_s {
|
||||
#ifndef __QFCC__
|
||||
exprfunc_t *func;
|
||||
const exprval_t **params;
|
||||
#else
|
||||
void *func;
|
||||
const void **params;
|
||||
#endif
|
||||
void *param_data;
|
||||
} qfv_taskinfo_t;
|
||||
|
||||
|
|
|
@ -72,11 +72,4 @@ 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
|
||||
|
|
|
@ -4,6 +4,7 @@ EXTRA_PROGRAMS += libs/audio/test/testsound
|
|||
|
||||
testaudio_libs= \
|
||||
libs/audio/libQFsound.la \
|
||||
libs/scene/libQFscene.la \
|
||||
libs/ruamoko/libQFruamoko.la \
|
||||
libs/util/libQFutil.la
|
||||
|
||||
|
|
|
@ -571,14 +571,14 @@ draw_input_line (inputline_t *il, draw_charbuffer_t *buffer)
|
|||
char *src = il->lines[il->edit_line] + il->scroll + 1;
|
||||
size_t i;
|
||||
|
||||
*dst++ = il->scroll ? '<' | 0x80U : il->lines[il->edit_line][0];
|
||||
*dst++ = il->scroll ? (char) ('<' | 0x80) : il->lines[il->edit_line][0];
|
||||
for (i = 0; i < il->width - 2 && *src; i++) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
while (i++ < il->width - 2) {
|
||||
*dst++ = ' ';
|
||||
}
|
||||
*dst++ = *src ? '>' | 0x80U : ' ';
|
||||
*dst++ = *src ? (char) ('<' | 0x80) : ' ';
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
90
libs/models/brush/leafmesh.c
Normal file
90
libs/models/brush/leafmesh.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
leafmesh.c
|
||||
|
||||
Generate a mesh for a leaf node.
|
||||
|
||||
Copyright (C) 2023 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#include "qfalloca.h"
|
||||
#include "compat.h"
|
||||
#include "mod_internal.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
||||
typedef struct {
|
||||
vec3_t vel; // velocity part of Plücker coords
|
||||
vec3_t mom; // moment part of Plücker coords
|
||||
uint32_t verts[2]; // ~0u if not a valid vert (0 or 1 plane intersects)
|
||||
} lm_edge_t;
|
||||
|
||||
typedef struct {
|
||||
vec4f_t p; // 1-vector plane (ax + by + cz + d = 0)
|
||||
} lm_plane_t;
|
||||
|
||||
typedef struct {
|
||||
vec4f_t p; // trivector point
|
||||
} lm_vert_t;
|
||||
|
||||
void *leafmesh (const mod_brush_t *brush, uint32_t leafnum, memhunk_t *hunk);
|
||||
|
||||
void *
|
||||
leafmesh (const mod_brush_t *brush, uint32_t leafnum, memhunk_t *hunk)
|
||||
{
|
||||
if (leafnum > brush->modleafs || leafnum < 1) {
|
||||
// invalid leafnum (0 is the infinite solid leaf and doesn't actually
|
||||
// exist (also, generally not convex))
|
||||
return 0;
|
||||
}
|
||||
if (!brush->leaf_parents[leafnum]) {
|
||||
// with only one parent node, there's no way to generate a mesh for
|
||||
// the leaf
|
||||
return 0;
|
||||
}
|
||||
uint32_t num_planes = 0;
|
||||
for (int32_t p = brush->leaf_parents[leafnum]; p != -1;
|
||||
p = brush->leaf_parents[p]) {
|
||||
num_planes++;
|
||||
};
|
||||
lm_plane_t *planes = Hunk_RawAlloc (hunk, sizeof (lm_plane_t[num_planes]));
|
||||
for (int32_t p = brush->leaf_parents[leafnum], i = 0; p != -1;
|
||||
p = brush->leaf_parents[p], i++) {
|
||||
planes[i].p = brush->nodes[p].plane;
|
||||
};
|
||||
}
|
|
@ -12,9 +12,6 @@
|
|||
#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)
|
||||
{
|
||||
|
@ -210,69 +207,3 @@ Light_DecayLights (lightingdata_t *ldata, float frametime, double realtime)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
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));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -792,7 +792,7 @@ IMUI_Layout_SetXSize (imui_ctx_t *ctx, imui_size_t size, int value)
|
|||
auto pcont = View_Control (ctx->current_parent);
|
||||
uint32_t id = ctx->current_parent.id;
|
||||
pcont->semantic_x = size;
|
||||
if (size == imui_size_percent || (bool) imui_size_expand) {
|
||||
if (size == imui_size_percent || size == imui_size_expand) {
|
||||
*(int *) Ent_AddComponent(id, c_percent_x, ctx->csys.reg) = value;
|
||||
}
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ IMUI_Layout_SetYSize (imui_ctx_t *ctx, imui_size_t size, int value)
|
|||
auto pcont = View_Control (ctx->current_parent);
|
||||
uint32_t id = ctx->current_parent.id;
|
||||
pcont->semantic_y = size;
|
||||
if (size == imui_size_percent || (bool) imui_size_expand) {
|
||||
if (size == imui_size_percent || size == imui_size_expand) {
|
||||
*(int *) Ent_AddComponent(id, c_percent_y, ctx->csys.reg) = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
#define const
|
||||
#define __attribute__(x)
|
||||
#define DESIGNATED_INIT
|
||||
|
|
|
@ -1788,6 +1788,70 @@ show_leaves (vulkan_ctx_t *ctx, uint32_t leafnum, efrag_t *efrags)
|
|||
mark_leaves (pass, &pvs);
|
||||
}
|
||||
|
||||
static 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);
|
||||
}
|
||||
}
|
||||
|
||||
static 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));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
scene_efrags_ui (void *comp, imui_ctx_t *imui_ctx,
|
||||
ecs_registry_t *reg, uint32_t ent, void *data)
|
||||
|
@ -1847,6 +1911,8 @@ Vulkan_LoadLights (scene_t *scene, vulkan_ctx_t *ctx)
|
|||
lctx->ldata = 0;
|
||||
if (lctx->scene) {
|
||||
auto reg = lctx->scene->reg;
|
||||
reg->components.a[scene_dynlight].ui = light_dyn_light_ui;
|
||||
reg->components.a[scene_light].ui = light_light_ui;
|
||||
reg->components.a[scene_efrags].ui = scene_efrags_ui;
|
||||
reg->components.a[scene_lightleaf].ui = scene_lightleaf_ui;
|
||||
|
||||
|
|
Loading…
Reference in a new issue