diff --git a/.gitignore b/.gitignore index 7dc1ae2..1a45af3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -temp/ .vscode/ -objmc_mod/ +temp/ +models/ history.txt out.png potion.json diff --git a/objmc.py b/objmc.py index 0e84c91..4522db8 100644 --- a/objmc.py +++ b/objmc.py @@ -298,24 +298,26 @@ def indexvert(o, vert): # index obj def indexobj(o, frame, nframes, nfaces): - for face in range(0, len(o["faces"])): - if face % 1000 == 0: + for faceid in range(0, len(o["faces"])): + if faceid % 1000 == 0: print( "\Reading obj ", frame + 1, " of ", nframes, "...", - "{:>15.2f}".format((frame * nfaces + face) * 100 / (nframes * nfaces)), + "{:>15.2f}".format((frame * nfaces + faceid) * 100 / (nframes * nfaces)), "%\033[K", sep="", end="\r", ) - face = o["faces"][face] - for vert in face: + face = o["faces"][faceid] + for vert in face[:4]: indexvert(o, vert) if len(face) == 3: indexvert(o, face[1]) + if len(face) > 4: + print(col.warn + "Found N-Gon" + col.end) # unique pixel uv per face with color pointing to topleft diff --git a/objmc/assets/minecraft/equipment/backpack.json b/objmc/assets/minecraft/equipment/backpack.json new file mode 100644 index 0000000..6534948 --- /dev/null +++ b/objmc/assets/minecraft/equipment/backpack.json @@ -0,0 +1,728 @@ +{ + "layers": { + "humanoid": [ + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" }, + { "texture": "bp" } + ] + } +} diff --git a/objmc/assets/minecraft/equipment/shuba.json b/objmc/assets/minecraft/equipment/shuba.json new file mode 100644 index 0000000..64e4b6d --- /dev/null +++ b/objmc/assets/minecraft/equipment/shuba.json @@ -0,0 +1,124 @@ +{ + "layers": { + "humanoid": [ + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" }, + { "texture": "shuba" } + ] + } +} diff --git a/objmc/assets/minecraft/shaders/core/render/armor.fsh b/objmc/assets/minecraft/shaders/core/render/armor.fsh new file mode 100644 index 0000000..529864e --- /dev/null +++ b/objmc/assets/minecraft/shaders/core/render/armor.fsh @@ -0,0 +1,56 @@ +#version 150 + +#moj_import +#moj_import + +uniform sampler2D Sampler0; + +uniform vec4 ColorModulator; +uniform float FogStart; +uniform float FogEnd; +uniform vec4 FogColor; +uniform float GameTime; + +uniform vec3 Light0_Direction; +uniform vec3 Light1_Direction; + +in float vertexDistance; +in vec4 vertexColor; +in vec4 lightColor; +in vec4 overlayColor; +in float transition; +flat in int face; +flat in int isCustom; +flat in int isGUI; +flat in int noshadow; +in vec2 uv; +in vec3 Pos; +in vec4 pos0; +in vec4 pos1; +in vec4 pos2; + +out vec4 fragColor; + +void main() { + vec4 color = texture(Sampler0, uv); + + if (isCustom == 1) { + //discard the upside down face between front and back + float y0 = pos0.y / pos0.w; + float y1 = pos1.y / pos1.w; + float y2 = pos2.y / pos2.w; + float maxy = max(max(y0, y1), y2); + bool orientation = (y2 == maxy); + switch (face) { + case 15: if (!orientation) discard; break; + case 17: if (orientation) discard; break; + } + } + + //custom lighting + #define ENTITY + #moj_import + + if (color.a < ALPHA_CUTOUT) discard; + fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor); +} diff --git a/objmc/assets/minecraft/shaders/core/render/armor.vsh b/objmc/assets/minecraft/shaders/core/render/armor.vsh new file mode 100644 index 0000000..7358558 --- /dev/null +++ b/objmc/assets/minecraft/shaders/core/render/armor.vsh @@ -0,0 +1,116 @@ +#version 150 + +#moj_import +#moj_import + +in vec3 Position; +in vec4 Color; +in vec2 UV0; +in ivec2 UV1; +in ivec2 UV2; +in vec3 Normal; + +uniform sampler2D Sampler0; +uniform sampler2D Sampler1; +uniform sampler2D Sampler2; + +uniform mat4 ModelViewMat; +uniform mat4 ProjMat; +uniform mat4 TextureMat; +uniform int FogShape; +uniform float GameTime; + +uniform vec3 Light0_Direction; +uniform vec3 Light1_Direction; + +out float vertexDistance; +out vec4 vertexColor; +out vec4 lightColor; +out vec4 overlayColor; +out float transition; +flat out int face; +flat out int isCustom; +flat out int isGUI; +flat out int noshadow; +out vec2 uv; +out vec3 Pos; +out vec4 pos0; +out vec4 pos1; +out vec4 pos2; + +#define PI 3.1415926535897932 +#define SQ2 0.70710678118 + +#define PART_RIGHT_ARM 0 +#define PART_LEFT_ARM 1 +#define PART_CHEST 2 +#define PART_RIGHT_LEG 3 +#define PART_LEFT_LEG 4 +#define PART_PANT_CHEST 5 +#define PART_RIGHT_FEET 6 +#define PART_LEFT_FEET 7 + +#define SCALE_PLAYER (0.9375/16.) //player, witch, villager, illager, wanderingtrader +#define SCALE_ARMORSTAND (1./16.) //armorstand, zombie, etc +#define SCALE_HUSK (1.0625/16.) //husk +#define SCALE_WITHERSKELETON (1.2/16.) //witherskeleton +#define SCALE_GIANT (6.0/16.) //giant +#define SCALE_BABY (0.5) //babies are half of original size +#define GROW_OUTER 2 +#define GROW_INNER 1 +#define GROW_OUTER_PANTS 1.8 +#define GROW_INNER_PANTS 0.8 + +vec3[] directions = vec3[]( + vec3(-1, -1, -1), vec3(1, -1, -1), vec3(1, 1, -1), vec3(-1, 1, -1)); + +vec3 partsize(int scaleid, int body, int face, int corner) { + float scale = 1; + switch (scaleid) { + case 0: scale = SCALE_PLAYER; break; + case 1: scale = SCALE_ARMORSTAND; break; + case 2: scale = SCALE_HUSK; break; + case 3: scale = SCALE_WITHERSKELETON; break; + case 4: scale = SCALE_GIANT; break; + case 5: scale = SCALE_BABY; break; + } + + vec3 size = vec3(0); + switch (body) { + case PART_RIGHT_ARM: case PART_LEFT_ARM: + size = (vec3(4, 12, 4) + GROW_OUTER) * scale / 2.; break; + case PART_CHEST: + size = (vec3(8, 12, 4) + GROW_OUTER) * scale / 2.; break; + case PART_RIGHT_LEG: case PART_LEFT_LEG: + size = (vec3(4, 12, 4) + GROW_INNER_PANTS) * scale / 2.; break; + case PART_PANT_CHEST: + size = (vec3(8, 12, 4) + GROW_INNER_PANTS) * scale / 2.; break; + case PART_RIGHT_FEET: case PART_LEFT_FEET: + size = (vec3(4, 12, 4) + GROW_OUTER_PANTS) * scale / 2.; break; + } + + switch (face) { + case 0: return size.xzy * directions[corner]; // top + case 1: return size.xzy * directions[(corner + 2) % 4]; //bottom offset by 2 + case 2: return size.zyx * directions[corner]; // right + case 3: return size.xyz * directions[corner]; // front + case 4: return size.zyx * directions[corner]; // left + case 5: return size.xyz * directions[corner]; // back + } + return vec3(0); +} + +#moj_import + +void main() { + uv = UV0; + vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color); + lightColor = texelFetch(Sampler2, UV2 / 16, 0); + overlayColor = vec4(1); + + #moj_import + + vertexDistance = fog_distance(Pos, FogShape); + if (render) gl_Position = ProjMat * ModelViewMat * vec4(Pos, 1.0); + else gl_Position = vec4(0); +} diff --git a/objmc/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json b/objmc/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json new file mode 100644 index 0000000..c3e4f26 --- /dev/null +++ b/objmc/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.json @@ -0,0 +1,28 @@ +{ + "vertex": "minecraft:core/render/armor", + "fragment": "minecraft:core/render/armor", + "defines": { + "values": { + "ALPHA_CUTOUT": "0.1" + }, + "flags": [ + "NO_OVERLAY" + ] + }, + "samplers": [ + { "name": "Sampler0" }, + { "name": "Sampler2" } + ], + "uniforms": [ + { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }, + { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, + { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] }, + { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] }, + { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] }, + { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }, + { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] }, + { "name": "GameTime", "type": "float", "count": 1, "values": [ 1.0 ] } + ] +} diff --git a/objmc/assets/minecraft/shaders/include/objmc_armor.glsl b/objmc/assets/minecraft/shaders/include/objmc_armor.glsl new file mode 100644 index 0000000..1caee46 --- /dev/null +++ b/objmc/assets/minecraft/shaders/include/objmc_armor.glsl @@ -0,0 +1,181 @@ + +isCustom = 0; +Pos = Position; +bool render = true; +bool flip = false; +ivec2 atlasSize = textureSize(Sampler0, 0); +vec2 onepixel = 1./atlasSize; +vec3 posoffset = vec3(0); +float scale = 1; +vec3 rotation = vec3(0); +int headerheight = 0; +bool compression = false; + +pos0 = pos1 = pos2 = vec4(0); +ivec4 t[8]; + +int id = gl_VertexID % 72; +face = (id / 4); +int body = face / 6; +int corner = id % 4; + +ivec4 marker = ivec4(texelFetch(Sampler0, ivec2(0), 0)*255); +if (marker == ivec4(12,34,56,78) || marker == ivec4(12,34,56,79)) { + compression = marker.a == 79; + isCustom = 1; + switch (corner) { + case 0: pos0 = vec4(Position, 1); break; + case 1: pos1 = vec4(Position, 1); break; + case 2: pos2 = vec4(Position, 1); break; + } + + for (int i = 1; i < 8; i++) { + t[i] = getmeta(ivec2(0), i); + } + //1: texsize + ivec2 size = ivec2(t[1].r*256 + t[1].g, t[1].b*256 + t[1].a); + //2: nvertices + int nvertices = t[2].r*16777216 + t[2].g*65536 + t[2].b*256 + t[2].a; + //3: nobjs, ntexs + int nframes = max(t[3].r*65536 + t[3].g*256 + t[3].b, 1); + int ntextures = max(t[3].a, 1); + //4: duration, autoplay, easing + float duration = max(t[4].r*65536 + t[4].g*256 + t[4].b, 1); + bool autoplay = getb(t[4].a, 6); + ivec2 easing = ivec2(getb(t[4].a, 4, 2), getb(t[4].a, 2, 2)); + //5: data heights + int vph = t[5].r*256 + t[5].g; + int vth = t[5].b*256 + t[5].a; + //6: noshadow, autorotate, visibility, colorbehavior + noshadow = getb(t[6].r, 7, 1); + bvec3 visibility = bvec3(getb(t[6].r, 4), getb(t[6].r, 3), getb(t[6].r, 2)); + int colorbehavior = getb(t[6].r, 0, 1)*256 + t[6].g; + + //time in ticks + float time = GameTime * 24000; + int tcolor = 0; + + //face rotation + float yaw = -atan(Normal.x, Normal.z); + float pitch = -atan(Normal.y, length(Normal.xz)); + vec3 Rot = vec3(pitch, yaw, 0); + //back face flips when upside down + if (face == 15) { + if (Normal.y < 0) flip = true; + else render = false; + } + //to origin + posoffset = partsize(0, body, face % 6, corner); + if (flip) posoffset.xy *= -1; + Pos += rotate(Rot) * posoffset; + + isGUI = int(isgui(ProjMat)); + if (((isGUI == 0) && visibility.x) || (bool(isGUI) && visibility.z)) { + //colorbehavior + if (colorbehavior == 219) { //animation frames 0-8388607 + tcolor = (int(Color.r*255)*65536)%32768 + int(Color.g*255)*256 + int(Color.b*255); + //interpolation disabled past 8388608, suso's idea to define starting tick with color + autoplay = (Color.r <= 0.5); + } else { + //bits from colorbehavior + vec3 accuracy = vec3(255./256.); + vec3 accuracy2 = vec3(255./256.); + vec2 tscale = vec2(0, 255./256.); + vec2 thue = vec2(0, 255./256.); + switch ((colorbehavior>>6)&7) { //first 3 bits, r + //time + case 3: tcolor = tcolor*256 + int(Color.r*255); break; + //scale + case 4: tscale.x = Color.r*255; tscale.y *= 256; break; + //hue + case 5: thue.x = Color.r*255; thue.y *= 256; break; + //hurt tint + case 6: if (Color.r != 0) overlayColor = vec4(1,0.7,0.7,1); break; + } + switch ((colorbehavior>>3)&7) { //second 3 bits, g + //time + case 3: tcolor = tcolor*256 + int(Color.g*255); break; + //scale + case 4: tscale.x = tscale.x*256 + Color.g*255; tscale.y *= 256; break; + //hue + case 5: thue.x = thue.x*256 + Color.g*255; thue.y *= 256; break; + //hurt tint + case 6: if (Color.g != 0) overlayColor = vec4(1,0.7,0.7,1); break; + } + switch (colorbehavior&7) { //third 3 bits, b + //time + case 3: tcolor = tcolor*256 + int(Color.b*255); break; + //scale + case 4: tscale.x = tscale.x*256 + Color.b*255; tscale.y *= 256; break; + //hue + case 5: thue.x = thue.x*256 + Color.b*255; thue.y *= 256; break; + //hurt tint + case 6: if (Color.b != 0) overlayColor = vec4(1,0.7,0.7,1); break; + } + if (tscale.x > 0) scale = tscale.x/tscale.y; + if (thue.x > 0) overlayColor = vec4(hrgb(thue.x/thue.y),1); + } + time = autoplay ? time + duration - mod(tcolor, duration) : tcolor; + int frame = int(time * nframes / duration) % nframes; + //relative vertex id from unique face uv + int fid = (gl_VertexID / 72); + int vid = (fid * 4 + corner) % nvertices; + vid += frame * nvertices; + //calculate height offsets + headerheight = 1 + int(ceil(nvertices*0.25/size.x)); + int height = headerheight + (size.y * ntextures); + //read data + ivec2 index = getvert(ivec2(0), size.x, height+vph+vth, vid, compression); + posoffset = getpos(ivec2(0), size.x, height, index.x); + if (nframes > 1) { + int nids = (nframes * nvertices); + //next frame + vid = (vid+nvertices) % nids; + index = getvert(ivec2(0), size.x, height+vph+vth, vid, compression); + vec3 posoffset2 = getpos(ivec2(0), size.x, height, index.x); + //interpolate + transition = fract(time * nframes / duration); + switch (easing.x) { //easing + case 1: //linear + posoffset = mix(posoffset, posoffset2, transition); + break; + case 2: //in-out cubic + transition = transition < 0.5 ? 4 * transition * transition * transition : 1 - pow(-2 * transition + 2, 3) * 0.5; + posoffset = mix(posoffset, posoffset2, transition); + break; + case 3: //4-point bezier + //third point + vid = (vid+nvertices) % nids; + index = getvert(ivec2(0), size.x, height+vph+vth, vid, compression); + vec3 posoffset3 = getpos(ivec2(0), size.x, height, index.x); + //fourth point + vid = (vid+nvertices) % nids; + index = getvert(ivec2(0), size.x, height+vph+vth, vid, compression); + vec3 posoffset4 = getpos(ivec2(0), size.x, height, index.x); + //bezier + posoffset = bezier(posoffset, posoffset2, posoffset3, posoffset4, transition); + break; + } + } + + uv = getuv(ivec2(0), size.x, height+vph, index.y); + uv = (vec2(0, headerheight) + uv*size) / atlasSize + //make sure that faces with same uv beginning/ending renders + + vec2(onepixel.x*0.0001*corner,onepixel.y*0.0001*((corner+1)%4)); + + //rotate top/bottom faces + if (face == 12) Rot.x += PI/2; + else if (face == 13) Rot.x -= PI/2; + else if (flip) posoffset.yz *= -1; + + Pos += rotate(Rot) * posoffset; + + } + + //discard faces that arnt used to calculate rotation + if (!( + ((face == 0 || ((face & 1) == 1)) && (abs(Normal.y) < SQ2)) + )) render = false; + if (body != PART_CHEST) render = false; + if (isGUI == 1) render = false; +} \ No newline at end of file diff --git a/objmc/assets/minecraft/shaders/include/objmc_light.glsl b/objmc/assets/minecraft/shaders/include/objmc_light.glsl index b07db3c..f3e4e87 100644 --- a/objmc/assets/minecraft/shaders/include/objmc_light.glsl +++ b/objmc/assets/minecraft/shaders/include/objmc_light.glsl @@ -18,7 +18,7 @@ else if (noshadow == 0) { float vertical = sign(normal.y) * 0.3 + 0.7; float horizontal = abs(normal.z) * 0.25 + 0.5; float brightness = mix(horizontal, vertical, abs(normal.y)); - color *= vec4(vec3(brightness), 1.0); + color.rgb *= brightness; #endif //entity lighting diff --git a/objmc/assets/minecraft/shaders/include/objmc_main.glsl b/objmc/assets/minecraft/shaders/include/objmc_main.glsl index 7a47e82..3e74fbb 100644 --- a/objmc/assets/minecraft/shaders/include/objmc_main.glsl +++ b/objmc/assets/minecraft/shaders/include/objmc_main.glsl @@ -27,6 +27,21 @@ if (marker == ivec4(12,34,56,78) || marker == ivec4(12,34,56,79)) { // header //| 2^32 | 2^16x2 | 2^32 | 2^24 + 2^8 | 2^24 + \1 2^1 + 2^2 + 2^2 \2| 2^16x2 | 2^1 + 2^2 + 2^3 \1 2^9 \16| //| marker | tex size | nvertices | nobjs, ntexs | duration, autoplay, easing, interp| data heights | noshadow, autorotate, visibility, colorbehavior | + + // header + //| 2^32 | 2^16x2 | 2^32 | 2^32 | 2^32 | 2^16 + 2^16 | 2^12 + 2^2 + 2^2 + 2^2 + 2^1 + 2^3 \10 | + //| marker | tex size | nvertices | npos | nuvs | nobjs, duration | colorbehavior, autoplay, easing, autorotate, noshadow, visibility | + + //colorbehavior + // 0: nothing + // 1, 2, 3: rotation xyz + // 4, 5, 6: position xyz + // 7: scale + // 8: time + // 9: texture variant + // 10: hue/tint + // 11: armor model + for (int i = 1; i < 8; i++) { t[i] = getmeta(topleft, i); } @@ -72,7 +87,6 @@ if (marker == ivec4(12,34,56,78) || marker == ivec4(12,34,56,79)) { } else { //bits from colorbehavior vec3 accuracy = vec3(255./256.); - vec3 accuracy2 = vec3(255./256.); vec2 tscale = vec2(0, 255./256.); vec2 thue = vec2(0, 255./256.); switch ((colorbehavior>>6)&7) { //first 3 bits, r diff --git a/objmc/assets/minecraft/textures/block/shuba.png b/objmc/assets/minecraft/textures/block/shuba.png index e3dbf9d..3f5ed79 100644 Binary files a/objmc/assets/minecraft/textures/block/shuba.png and b/objmc/assets/minecraft/textures/block/shuba.png differ diff --git a/objmc/assets/minecraft/textures/entity/equipment/humanoid/bp.png b/objmc/assets/minecraft/textures/entity/equipment/humanoid/bp.png new file mode 100644 index 0000000..5510ea7 Binary files /dev/null and b/objmc/assets/minecraft/textures/entity/equipment/humanoid/bp.png differ diff --git a/objmc/assets/minecraft/textures/entity/equipment/humanoid/shuba.png b/objmc/assets/minecraft/textures/entity/equipment/humanoid/shuba.png new file mode 100644 index 0000000..3f5ed79 Binary files /dev/null and b/objmc/assets/minecraft/textures/entity/equipment/humanoid/shuba.png differ