Work on build process

This commit is contained in:
James Lambert 2022-04-30 21:51:08 -06:00
parent 10ee8e3e79
commit 59c03abe37
6 changed files with 59 additions and 2 deletions

7
.gitignore vendored
View file

@ -3,9 +3,14 @@
*.elf
*.map
*.z64
*.blend1
build/
debugger
assets/
assets_working/
vpk/
portal_pak_dir/
portal_pak_modified/
tools/skeletool64
tools/vtf2png

View file

@ -11,6 +11,7 @@ include /usr/include/n64/make/PRdefs
MIDICVT:=tools/midicvt
SFZ2N64:=tools/sfz2n64
SKELATOOL64:=tools/skeletool64
VTF2PNG:=tools/vtf2png
OPTIMIZER := -O0
LCDEFS := -DDEBUG -g -Isrc/ -I/usr/include/n64/nustd -Werror -Wall
@ -84,6 +85,36 @@ src/models/subject.h src/models/subject_geo.inc.h: assets/fbx/Subject.fbx
src/models/sphere.h src/models/sphere_geo.inc.h: assets/fbx/Sphere.fbx
skeletool64 -s 100 -r 0,0,0 -n sphere -o src/models/sphere.h assets/fbx/Sphere.fbx
####################
## vpk extraction
####################
portal_pak_dir: vpk/portal_pak_dir.vpk
vpk -x portal_pak_dir vpk/portal_pak_dir.vpk
portal_pak_dir/materials/concrete/concrete_modular_wall001d.png
TEXTURE_SCRIPTS = $(shell find assets/ -type f -name '*.ims')
TEXTURE_IMAGES = $(TEXTURE_SCRIPTS:assets/%.ims=portal_pak_modified/%.png)
%.png: %.vtf
$(VTF2PNG) $< $@
portal_pak_modified/%.png: portal_pak_dir/%.png assets/%.ims
@mkdir -p $(@D)
convert $< `cat $(@:portal_pak_modified/%.png=assets/%.ims)` $@
####################
## Materials
####################
build/assets/materials/materials.h: assets/materials/materials.yaml $(TEXTURE_IMAGES)
@mkdir -p $(@D)
$(SKELATOOL64) -n materials -m $< -M $@
####################
## Test Chambers
####################

View file

@ -8,4 +8,18 @@ First, you will need to setup [modern sdk](https://crashoveride95.github.io/n64h
Next, you will need to downlaod blender 2.9 or higher. Then set the environment variable `BLENDER_2_9` to be the absolute path where the blender executable is located on your computer.
You will need to instal python vpk
```
pip install vpk
```
Build and install [vtf2png](https://github.com/eXeC64/vtf2png)
Install image magic
```
sudo apt install imagemagic
```
Finally run `make` to build the project

View file

@ -0,0 +1 @@
-crop 256x512+0+0 -resize 64x128

View file

@ -0,0 +1,6 @@
materials:
concrete_modular_wall001d:
gDPSetTile:
filename: ../../portal_pak_modified/materials/concrete/concrete_modular_wall001d.png
fmt: G_IM_FMT_I
siz: G_IM_SIZ_4b