Merge branch 'master' into terrain
This commit is contained in:
commit
0ff396757b
2
.clangd
Normal file
2
.clangd
Normal file
@ -0,0 +1,2 @@
|
||||
CompileFlags: # Tweak the parse settings
|
||||
Add: [-Iunigi/]
|
19
.gitmodules
vendored
19
.gitmodules
vendored
@ -1,15 +1,12 @@
|
||||
[submodule "haloo3d"]
|
||||
path = haloo3d
|
||||
url = https://github.com/randomouscrap98/haloo3d.git
|
||||
[submodule "unigi/unigi"]
|
||||
path = unigi/unigi
|
||||
url = https://git.lumen.sh/Fierelier/unigi.git
|
||||
[submodule "unigi/unigi.headers"]
|
||||
path = unigi/unigi.headers
|
||||
url = https://git.lumen.sh/Fierelier/unigi.headers.git
|
||||
[submodule "unigi/unigi.ext"]
|
||||
path = unigi/unigi.ext
|
||||
url = https://git.lumen.sh/Fierelier/unigi.ext
|
||||
[submodule "unigi/unigi.platform.sdl1"]
|
||||
path = unigi/unigi.platform.sdl1
|
||||
[submodule "unigi.platform.sdl2"]
|
||||
path = unigi.platform.sdl2
|
||||
url = https://git.lumen.sh/Fierelier/unigi.platform.sdl2.git
|
||||
[submodule "unigi.platform.sdl1"]
|
||||
path = unigi.platform.sdl1
|
||||
url = https://git.lumen.sh/Fierelier/unigi.platform.sdl1.git
|
||||
[submodule "unigi"]
|
||||
path = unigi
|
||||
url = https://git.lumen.sh/Fierelier/unigi.git
|
||||
|
20
Makefile
20
Makefile
@ -21,28 +21,38 @@ else
|
||||
endif
|
||||
|
||||
HALOOLIB = haloo3d/build/haloo3d_full.a
|
||||
UNIGIPLAT = $(BUILDD)/unigi.platform.sdl2.o
|
||||
UNIGILIB = $(BUILDD)/unigi.a
|
||||
|
||||
.PHONY: clean
|
||||
.PHONY: full
|
||||
.PHONY: libs
|
||||
|
||||
full:
|
||||
echo "Please specify a sample to build (ends with .exe)"
|
||||
libs: $(UNIGILIB) $(HALOOLIB)
|
||||
@echo "Built libs!"
|
||||
|
||||
$(HALOOLIB):
|
||||
cd haloo3d && $(MAKE) full
|
||||
|
||||
$(UNIGIPLAT): unigi.platform.sdl2/main.c
|
||||
mkdir -p $(BUILDD)
|
||||
$(CC) $(CFLAGS) -I. -c $< -o $@
|
||||
|
||||
$(UNIGILIB): $(UNIGIPLAT)
|
||||
ar -vr $@ $^
|
||||
|
||||
# Rule to build .o files in main folder
|
||||
$(BUILDD)/%.o: %.c %.h
|
||||
mkdir -p $(BUILDD)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# Rule to build any sample. We ALWAYS need math so... link it
|
||||
%.exe: %.o $(HALOOLIB)
|
||||
$(CC) $(CFLAGS) $< $(HALOOLIB) -o $@ -lm -lSDL
|
||||
%.exe: %.o $(UNIGILIB) $(HALOOLIB)
|
||||
$(CC) $(CFLAGS) $^ -o $@ -lm -lSDL2
|
||||
|
||||
# Rule to clean the build files
|
||||
clean:
|
||||
rm -rf $(BUILDD)
|
||||
rm -f *.o *.elf
|
||||
find . -name "*.exe" -type f -delete
|
||||
cd haloo3d && $(MAKE) clean
|
||||
|
||||
|
45
Makefile_PS2
Normal file
45
Makefile_PS2
Normal file
@ -0,0 +1,45 @@
|
||||
# _____ ___ ____ ___ ____
|
||||
# ____| | ____| | | |____|
|
||||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2001-2022, ps2dev - http://www.ps2dev.org
|
||||
# Licenced under Academic Free License version 2.0
|
||||
# Review ps2sdk README & LICENSE files for further details.
|
||||
|
||||
EE_BIN = $(PROGRAM_PS2).elf
|
||||
|
||||
# KERNEL_NOPATCH = 1
|
||||
# NEWLIB_NANO = 1
|
||||
|
||||
# NOTE: CANNOT USE JUST 'PS2' AS A DEFINE, IT BREAKS EVERYTHING!
|
||||
EE_OBJS = $(PROGRAM_PS2).o
|
||||
EE_CFLAGS += -fdata-sections -ffunction-sections -I$(PS2SDK)/ports/include -Wformat=0
|
||||
EE_LDFLAGS += -L$(PS2SDK)/ports/lib -L$(GSKIT)/lib -lSDL2 -lgskit -ldmakit -lps2_drivers -lm -Wl,--gc-sections
|
||||
|
||||
ifeq ($(DUMMY_TIMEZONE), 1)
|
||||
EE_CFLAGS += -DDUMMY_TIMEZONE
|
||||
endif
|
||||
|
||||
ifeq ($(DUMMY_LIBC_INIT), 1)
|
||||
EE_CFLAGS += -DDUMMY_LIBC_INIT
|
||||
endif
|
||||
|
||||
ifeq ($(KERNEL_NOPATCH), 1)
|
||||
EE_CFLAGS += -DKERNEL_NOPATCH
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
EE_CFLAGS += -DDEBUG -O0 -g
|
||||
else
|
||||
EE_CFLAGS += -Os
|
||||
EE_LDFLAGS += -s
|
||||
endif
|
||||
|
||||
all: $(EE_BIN)
|
||||
|
||||
clean:
|
||||
rm -rf $(EE_OBJS) $(EE_BIN)
|
||||
|
||||
# Include makefiles
|
||||
include $(PS2SDK)/samples/Makefile.pref
|
||||
include $(PS2SDK)/samples/Makefile.eeglobal
|
16
make_ps2.sh
Executable file
16
make_ps2.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -lt "1" ]; then
|
||||
echo "ERROR: You must pass the program name! For instance, to build maze.elf,"
|
||||
echo "pass in just 'maze'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make -f Makefile_PS2 PROGRAM_PS2="$1"
|
||||
|
||||
if [ "$#" -gt "1" ]; then
|
||||
echo "Running on $2"
|
||||
ps2client -h "$2" reset
|
||||
sleep 1
|
||||
ps2client -h "$2" execee host:$1.elf
|
||||
fi
|
85
maze.c
85
maze.c
@ -1,13 +1,33 @@
|
||||
// NOTE: CANNOT USE JUST 'PS2' AS A DEFINE, IT BREAKS EVERYTHING
|
||||
#ifdef _EE
|
||||
#define DIRECTBUILD
|
||||
#define H3D_VOLATILE_FLOATS
|
||||
#endif
|
||||
|
||||
#ifdef DIRECTBUILD
|
||||
// clang-format off
|
||||
#define MATHC_USE_UNIONS
|
||||
#define MATHC_NO_STRUCT_FUNCTIONS
|
||||
#include "haloo3d/lib/mathc.c"
|
||||
#define FNL_IMPL
|
||||
#include "haloo3d/lib/FastNoiseLite.h"
|
||||
#include "haloo3d/haloo3d.c"
|
||||
#include "haloo3d/haloo3dex_console.c"
|
||||
#include "haloo3d/haloo3dex_easy.c"
|
||||
#include "haloo3d/haloo3dex_gen.c"
|
||||
#include "haloo3d/haloo3dex_obj.c"
|
||||
#include "haloo3d/haloo3dex_print.c"
|
||||
#include "unigi.platform.sdl2/main.c"
|
||||
// clang-format on
|
||||
#else
|
||||
#include "haloo3d/haloo3d.h"
|
||||
#include "haloo3d/haloo3dex_console.h"
|
||||
#include "haloo3d/haloo3dex_easy.h"
|
||||
#include "haloo3d/haloo3dex_gen.h"
|
||||
// #include "haloo3d/haloo3dex_img.h"
|
||||
#include "haloo3d/haloo3dex_obj.h"
|
||||
#include "haloo3d/haloo3dex_print.h"
|
||||
|
||||
#include "unigi/unigi.headers/src/main.h"
|
||||
#include "unigi/unigi.platform.sdl1/src/main.c"
|
||||
#include "unigi/main.h"
|
||||
#endif
|
||||
|
||||
#include "ecs2.h"
|
||||
#include "keys.h"
|
||||
@ -23,25 +43,34 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// INteresting flags for debugging
|
||||
#define FASTFILL
|
||||
#define NUMMICE 1
|
||||
#define MOUSELOGGING
|
||||
// #define NOWALLS
|
||||
|
||||
#ifdef _EE
|
||||
#define WIDTH 160
|
||||
#define HEIGHT 120
|
||||
#define SCREENSCALE 4
|
||||
#define DITHERSTART 2.5
|
||||
#define DITHEREND 3.5
|
||||
int fps = 20;
|
||||
#else
|
||||
#define WIDTH 480
|
||||
#define HEIGHT 300
|
||||
#define ASPECT ((float)WIDTH / HEIGHT)
|
||||
#define SCREENSCALE 2
|
||||
#define MOUSELOGGING
|
||||
#define DITHERSTART 10000
|
||||
#define DITHEREND 10000
|
||||
int fps = 30;
|
||||
#endif
|
||||
|
||||
#define ASPECT ((float)WIDTH / HEIGHT)
|
||||
#define SWIDTH (WIDTH * SCREENSCALE)
|
||||
#define SHEIGHT (HEIGHT * SCREENSCALE)
|
||||
#define NEARCLIP 0.01
|
||||
#define FARCLIP 100.0
|
||||
#define LIGHTANG -MPI / 4.0
|
||||
#define AVGWEIGHT 0.85
|
||||
// Try 0.5 and 3.5 or something
|
||||
#define DITHERSTART 10000
|
||||
#define DITHEREND 10000
|
||||
|
||||
// Game options
|
||||
#define MAZESIZE 15
|
||||
@ -97,8 +126,7 @@ const char POLYNAMES[NUMPOLYS][20] = {"tetrahedron"};
|
||||
float fov = 90.0;
|
||||
float minlight = 0.15;
|
||||
float speed = 1.0;
|
||||
int fps = 30;
|
||||
uint16_t sky = 0xF000;
|
||||
uint16_t sky = 0xF644;
|
||||
|
||||
struct vec2i dirtovec(uint8_t dir) {
|
||||
struct vec2i result;
|
||||
@ -969,10 +997,20 @@ void create_paintingobj(haloo3d_obj *obj) {
|
||||
}
|
||||
}
|
||||
|
||||
int main() { // int argc, char **argv) {
|
||||
int main() { // int argc, char *argv[]) {
|
||||
|
||||
srand(clock());
|
||||
|
||||
// Init unigi system
|
||||
unigi_type_event event;
|
||||
unigi_type_resolution res;
|
||||
res.width = SWIDTH;
|
||||
res.height = SHEIGHT;
|
||||
res.depth = 0;
|
||||
|
||||
unigi_graphics_init();
|
||||
unigi_window_create(res, "maze.exe"); // render.printbuf);
|
||||
|
||||
haloo3d_easystore storage;
|
||||
haloo3d_easystore_init(&storage);
|
||||
|
||||
@ -1071,25 +1109,11 @@ int main() { // int argc, char **argv) {
|
||||
init_billboard(endi, 0.25);
|
||||
eprintf("Setup all static object instances\n");
|
||||
|
||||
unigi_type_event event;
|
||||
unigi_type_resolution res;
|
||||
res.width = SWIDTH;
|
||||
res.height = SHEIGHT;
|
||||
res.depth = 0;
|
||||
|
||||
int totaldrawn = 0;
|
||||
|
||||
eprintf("Scene has %d tris, %d verts\n", render.totalfaces,
|
||||
render.totalverts);
|
||||
|
||||
// Init unigi system
|
||||
unigi_graphics_init();
|
||||
unigi_window_create(res, "maze.exe"); // render.printbuf);
|
||||
|
||||
// render.camera.pos.y = 4; // 5;
|
||||
// render.camera.pitch = MPI - 0.1; // 2.2;
|
||||
// ceili->pos.y = -10;
|
||||
|
||||
haloo3d_debugconsole dc;
|
||||
haloo3d_debugconsole_init(&dc);
|
||||
|
||||
@ -1191,17 +1215,10 @@ int main() { // int argc, char **argv) {
|
||||
|
||||
while (1) {
|
||||
haloo3d_easytimer_start(&frametimer);
|
||||
// render.camera.yaw += 0.008;
|
||||
haloo3d_perspective(render.perspective, fov, ASPECT, NEARCLIP, FARCLIP);
|
||||
haloo3d_easyrender_beginframe(&render);
|
||||
haloo3d_fb_clear(&render.window, sky);
|
||||
|
||||
// walli->scale.y = fabs(sin(3 * render.camera.yaw));
|
||||
// render.camera.up.x = sin(render.camera.yaw);
|
||||
// render.camera.up.y = cos(render.camera.yaw);
|
||||
// walli->up.x = sin(3 * render.camera.yaw);
|
||||
// walli->up.y = cos(4 * render.camera.yaw);
|
||||
|
||||
do {
|
||||
unigi_event_get(&event);
|
||||
switch (event.type) {
|
||||
|
1
unigi
Submodule
1
unigi
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 8767a3dd8538c6650ab06f36c15d926d12a4b081
|
1
unigi.platform.sdl1
Submodule
1
unigi.platform.sdl1
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c2bb042dcb29e55879f9b0b415c2989afed56132
|
1
unigi.platform.sdl2
Submodule
1
unigi.platform.sdl2
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7761a397a86b0e94bf5d7280b3c2c65e3713fae8
|
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
cd unigi
|
||||
git pull
|
||||
cd ../unigi.headers
|
||||
git pull
|
||||
cd ../unigi.ext
|
||||
git pull
|
||||
cd ../unigi.platform.sdl1
|
||||
git pull
|
@ -1 +0,0 @@
|
||||
Subproject commit 34aa7f0a1cd24939c2de879b5dcce03daa0c7de2
|
@ -1 +0,0 @@
|
||||
Subproject commit cf21dd85c6d49509c946ab9f462edc2e8a73327c
|
@ -1 +0,0 @@
|
||||
Subproject commit ab07d46aac8d7043399437b83f81ce8ce3bf1233
|
@ -1 +0,0 @@
|
||||
Subproject commit e407020c2118d7ad2f4d43eca5214b6360a0b7cc
|
Loading…
Reference in New Issue
Block a user