Skip to content

Commit

Permalink
extract models with blender (#577)
Browse files Browse the repository at this point in the history
* start making models extraction with blender

* finishing extract model

* Update fast64

* extract course

* Update fast64

* Update fast64

* simplify import of course_displaylists and course_textures and remplace adress with texture

* Update fast64

* change data format and simplify the thread queue

* move in a blender folder

* remove fast64

* re add fast64

* add model_extract and fast64_blender in makefile

* multithread with make file split the models into multiple json and add course segment

* Update fast64

* remove old model_extract

* remove the error when he don't find blender

* start rename around course section

* update submodule fast64

* fix compilation issue and add some model to extract

* Update fast64

* remove fast64

* re add fast64

* update submodule

* fix compilation issue

* add other collision gfx and prepare reorganise file

* re arrange json

* Create README.MD

* Update README.MD

* Update README.MD

* update fast64

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
  • Loading branch information
coco875 and MegaMech authored Sep 15, 2024
1 parent 93aebab commit 6da6598
Show file tree
Hide file tree
Showing 40 changed files with 3,797 additions and 698 deletions.
3 changes: 3 additions & 0 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@ mingw64/
.ash_history
!tools/ido-recomp/*/*

# models
*.blend

# torch
torch.hash.yml
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "tools/torch"]
path = tools/torch
url = https://github.com/HarbourMasters/torch
[submodule "tools/blender/fast64"]
path = tools/blender/fast64
url = https://github.com/Fast-64/fast64.git
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,18 @@ GLOBAL_ASM_OS_O_FILES = $(foreach file,$(GLOBAL_ASM_OS_FILES),$(BUILD_DIR)/$(fil
GLOBAL_ASM_AUDIO_O_FILES = $(foreach file,$(GLOBAL_ASM_AUDIO_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
GLOBAL_ASM_RACING_O_FILES = $(foreach file,$(GLOBAL_ASM_RACING_C_FILES),$(BUILD_DIR)/$(file:.c=.o))

ifneq ($(BLENDER),)
else ifneq ($(call find-command,blender),)
BLENDER := blender
else ifeq ($(DETECTED_OS), windows)
BLENDER := "C:\Program Files\Blender Foundation\Blender 3.6\blender.exe"
endif

MODELS_JSON := $(call rwildcard,models,*.json)
MODELS_PROC := $(MODELS_JSON:%.json=%)

models/%: models/%.json
$(PYTHON) tools/blender/extract_models.py $(BLENDER) $<

#==============================================================================#
# Compiler Options #
Expand Down Expand Up @@ -446,6 +457,11 @@ format:
clean:
$(RM) -r $(BUILD_DIR)

model_extract: $(MODELS_PROC)

fast64_blender:
$(BLENDER) --python tools/blender/fast64_run.py

distclean: distclean_assets
$(RM) -r $(BUILD_DIR_BASE)
$(PYTHON) extract_assets.py --clean
Expand Down Expand Up @@ -591,6 +607,9 @@ LDFLAGS += $(foreach elf,$(COURSE_DATA_ELFS),-R $(elf))

COURSE_DATA_TARGETS := $(foreach dir,$(COURSE_DIRS),$(BUILD_DIR)/$(dir)/course_data.mio0.o)

COURSE_DISPLAYLIST_OFILES := $(foreach dir,$(COURSE_DIRS),$(BUILD_DIR)/$(dir)/course_data.o)
$(COURSE_DISPLAYLIST_OFILES): $(BUILD_DIR)/%/course_data.o: %/course_textures.linkonly.h

%/course_data.elf: %/course_data.o %/course_displaylists.inc.elf
$(V)$(LD) -t -e 0 -Ttext=06000000 -Map $@.map -R $*/course_displaylists.inc.elf -o $@ $< --no-check-sections

Expand Down
2 changes: 2 additions & 0 deletions courses/banshee_boardwalk/course_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <mk64.h>

#include "course_displaylists.inc.h"
#include "course_textures.linkonly.h"

Gfx d_course_banshee_boardwalk_dl_0[] = {
gsSPEndDisplayList(),
};
Expand Down
9 changes: 5 additions & 4 deletions courses/koopa_troopa_beach/course_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
#include <animation.h>

#include "course_displaylists.inc.h"
#include "course_textures.linkonly.h"

Gfx d_course_koopa_troopa_beach_dl_0[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOLOD),
gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 0x007C, 0x007C),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0x05003800),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gKTBTexture660D8C),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD),
Expand All @@ -29,7 +30,7 @@ Gfx d_course_koopa_troopa_beach_dl_48[] = {
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 6, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOLOD),
gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 0x007C, 0x00FC),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0x05004000),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gKTBTexture6609D0),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD),
Expand Down Expand Up @@ -7997,7 +7998,7 @@ Gfx d_course_koopa_troopa_beach_dl_18D68[] = {
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOLOD),
gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 0x007C, 0x007C),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0x05003800),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gKTBTexture660D8C),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD),
Expand All @@ -8008,7 +8009,7 @@ Gfx d_course_koopa_troopa_beach_dl_18D68[] = {
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, 6, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, 5, G_TX_NOLOD),
gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 0x007C, 0x00FC),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, 0x05004000),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gKTBTexture6609D0),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD),
Expand Down
Loading

0 comments on commit 6da6598

Please sign in to comment.