3D: tinyblocks-3d com renderizadores Vulkan (vk) e OpenGL (gl); jogo das moedas
tinyblocks-3d (categoria 3D): cena com objetos com nome (cubo, esfera, plano, cilindro), posicao/rotacao/escala/cor, colisao por caixas, distancia, camera, luz direcional, ceu, e o bloco "imagem da cena" que desenha numa imagem para o palco. Define o contrato Tb3dRenderer e traz um rasterizador em software (z-buffer, corte no plano de perto, lambert por vertice). tinyblocks-gl: OpenGL 3.3 core por EGL sem janela (surfaceless), numa thread propria dona do contexto (o SDL pode usar GL na thread do editor). tinyblocks-vk: Vulkan 1.1 sem janela (render pass cor + profundidade, viewport com altura negativa, z convertido no shader, push constants de 128 bytes, copia para buffer); SPIR-V embutido, gerado pelo glslc (make shaders). Os dois publicam o renderizador no lib_userdata e nao dependem de simbolos da 3d (o quadro leva a MVP pronta). Escolha automatica: Vulkan, OpenGL, software. test-3d: blocos, colisao e camera; as imagens de Vulkan e OpenGL ficam a 0,001 de diferenca media do software (testado na NVIDIA, na Intel e no llvmpipe, com a camada de validacao). No Windows a 3d entra so com o software. examples/jogo-3d: "Pegue as moedas", todo em blocos. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8f2c00693d
commit
5bae31edf3
29 files changed
+18420
-5
No files matched your search
@@ -86,10 +86,10 @@ CAT_LDFLAGS := $(foreach l,$(CAT_LIBS),-ltinyblocks-$(l))
|
||||
CAT_INCS := $(foreach l,$(CAT_LIBS),-I$(LIBDIR)/tinyblocks-$(l)/include)
|
||||
# Libraries que o editor registra como as de categoria, mas com varios
|
||||
# fontes e o Makefile proprio (o harness nao as compila junto)
|
||||
APP_LIBS := socket ssl http archive tensor ai plot
|
||||
APP_LIBS := socket ssl http archive tensor ai plot 3d gl vk
|
||||
APP_A := $(foreach l,$(APP_LIBS),$(LIBDIR)/tinyblocks-$(l)/build/libtinyblocks-$(l).a)
|
||||
APP_INCS := $(foreach l,$(APP_LIBS),-I$(LIBDIR)/tinyblocks-$(l)/include)
|
||||
APP_LDLIBS := -lssl -lcrypto -lz -lpthread
|
||||
APP_LDLIBS := -lssl -lcrypto -lz -lpthread -lEGL -lOpenGL -lvulkan
|
||||
ED_A := $(ED_DIR)/build/libtinyblocks-editor.a
|
||||
GX_A := $(GX_DIR)/build/libtinyblocks-graphics.a
|
||||
SD_A := $(SD_DIR)/build/libtinyblocks-sdl2.a
|
||||
@@ -111,7 +111,7 @@ LIB_LDFLAGS := -L$(ED_DIR)/build -L$(GX_DIR)/build -L$(SD_DIR)/build \
|
||||
editor run-editor run-sdl2 mylib vector customappearance graphics sdl2-backend test-editor \
|
||||
appdir appimage run-appimage icon \
|
||||
test-toml test-plugin test-blueprint test-a11y test-mcp test-mcp-server test-base64 test-curves test-meta test-ppm test-bmp test-png test-image test-vg test-svg test-jpg \
|
||||
test-tensor test-ai test-http test-archive test-plot test-syntax test-os test-value test-vars test-scratchblocks test-input test-stdlib test-regex test-markdown test-opentype \
|
||||
test-tensor test-ai test-http test-archive test-plot test-3d test-syntax test-os test-value test-vars test-scratchblocks test-input test-stdlib test-regex test-markdown test-opentype \
|
||||
category-libs category-sos libs app-libs \
|
||||
lib-events lib-control lib-errors lib-input lib-operators lib-number lib-string lib-variables lib-vector lib-appearance lib-pen lib-fs lib-os \
|
||||
lib-environ \
|
||||
@@ -651,6 +651,19 @@ $(BUILD)/archive_test: tests/archive_test.c $(LIBDIR)/tinyblocks-archive/src/tb_
|
||||
test-archive: $(BUILD)/archive_test ## Roda o teste da archive (ASan/UBSan)
|
||||
./$(BUILD)/archive_test
|
||||
|
||||
# -- Teste da 3d (cena e colisao; Vulkan e OpenGL comparados ao software) ---
|
||||
D3_DIR := $(LIBDIR)/tinyblocks-3d
|
||||
D3_SRCS := $(D3_DIR)/src/tb_3d.c $(LIBDIR)/tinyblocks-gl/src/tb_gl.c $(LIBDIR)/tinyblocks-vk/src/tb_vk.c
|
||||
$(BUILD)/d3_test: tests/d3_test.c $(D3_SRCS) $(LIBDIR)/tinyblocks-vk/src/tb_vk_shaders.h static
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS_DBG) -DWITH_GL -DWITH_VK -I$(D3_DIR)/include -I$(LIBDIR)/tinyblocks-gl/include \
|
||||
-I$(LIBDIR)/tinyblocks-vk/include -I$(PNG_DIR)/include \
|
||||
$(D3_SRCS) $(PNG_DIR)/src/tb_png.c tests/d3_test.c -o $@ \
|
||||
-Wl,--start-group $(LIB_A) -Wl,--end-group -lpng -lEGL -lOpenGL -lvulkan -lpthread -lm
|
||||
|
||||
test-3d: $(BUILD)/d3_test ## Roda o teste da 3d (sem os vazamentos dos drivers de GPU; grava /tmp/tb_3d_*.png)
|
||||
ASAN_OPTIONS=detect_leaks=0 ./$(BUILD)/d3_test
|
||||
|
||||
# -- Teste da library plot (figura -> imagem PNG) ---
|
||||
PLOT_DIR := $(LIBDIR)/tinyblocks-plot
|
||||
$(BUILD)/plot_test: tests/plot_test.c $(PLOT_DIR)/src/tb_plot.c $(PLOT_DIR)/src/plot_font.h $(TENSOR_SRCS) static
|
||||
|
||||
Reference in new issue
Block a user