From 905a5a25fab2f4b68b3502df88315ed80f37e70c Mon Sep 17 00:00:00 2001 From: KillTheGoblin Date: Fri, 25 Jul 2025 23:28:29 +0200 Subject: [PATCH] started hologram --- src/components/hologram.c | 6 ++++++ src/components/hologram.h | 38 ++++++++++++++++++++++++++++++++++++++ src/neonucleus.h | 26 +++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/components/hologram.c create mode 100644 src/components/hologram.h diff --git a/src/components/hologram.c b/src/components/hologram.c new file mode 100644 index 0000000..599c284 --- /dev/null +++ b/src/components/hologram.c @@ -0,0 +1,6 @@ +#include "hologram.h" + +void nn_hologram_clear() { + +} + diff --git a/src/components/hologram.h b/src/components/hologram.h new file mode 100644 index 0000000..d6450ed --- /dev/null +++ b/src/components/hologram.h @@ -0,0 +1,38 @@ +#ifndef NN_HOLOGRAM_H +#define NN_HOLOGRAM_H + +#include "../neonucleus.h" + +typedef struct nn_hologram { + nn_Context ctx; + nn_guard *lock; + nn_refc refc; + + int pallette_len; + int* pallette_array; + + int width_x; + int width_z; + int height; + + float minScale; + float maxScale; + float scale; + int depth; + + float min_translationX; + float max_translationX; + float translationX; + + float min_translationY; + float max_translationY; + float translationY; + + float min_translationZ; + float max_translationZ; + float translationZ; + + int* grid; // I don't know what to call this +} nn_hologram; + +#endif \ No newline at end of file diff --git a/src/neonucleus.h b/src/neonucleus.h index 769ed99..4bc28a6 100644 --- a/src/neonucleus.h +++ b/src/neonucleus.h @@ -1047,7 +1047,31 @@ nn_bool_t nn_destroyDiskDrive(nn_diskDrive *diskDrive); nn_component *nn_addDiskDrive(nn_computer *computer, nn_address address, int slot, nn_diskDrive *diskDrive); -#ifdef __cplusplus +typedef struct nn_hologram nn_hologram; + +nn_hologram *nn_newHologram(nn_Context *context, int pallette_len, int width_x, int width_z, int height, int depth); +nn_guard *nn_getHologramLock(nn_hologram *hologram); +void nn_retainHologram(nn_hologram *hologram); +nn_bool_t nn_destroyHologram(nn_hologram *hologram); + +nn_component *nn_addHologram(nn_computer *computer, nn_address address, int slot, nn_hologram *hologram); + +int nn_XYZtoIndex(int x, int y, int z); + +void nn_hologram_clear(nn_hologram *hologram); +int nn_hologram_get(nn_hologram *hologram, int x, int y, int z); +void nn_hologram_set(nn_hologram *hologram, int x, int y, int z, int value); +void nn_hologram_fill(nn_hologram *hologram, int x, int z, int minY, int maxY, int value); +void nn_hologram_copy(nn_hologram *hologram, int x, int z, int sx, int sz, int tx, int tz); +float nn_hologram_getScale(nn_hologram *hologram); +void nn_hologram_setScale(nn_hologram *hologram, float value); +void nn_hologram_getTranslation(nn_hologram *hologram, int *x, int *y, int *z); +void nn_hologram_setTranslation(nn_hologram *hologram, int x, int y, int z); +int nn_hologram_maxDepth(nn_hologram *hologram); +int nn_hologram_getPaletteColor(nn_hologram *hologram, int index); +int nn_hologram_setPaletteColor(nn_hologram *hologram, int index, int value); + +#ifdef __cplusplus // c++ sucks } #endif