Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
47b35e6
add entry
Lilaa3 Jun 6, 2024
6cde935
add (GC)
Lilaa3 Jun 6, 2024
68b6701
implementing this is making me feel so confused
Lilaa3 Jun 7, 2024
19a6efc
fix this
Lilaa3 Jun 7, 2024
9363ba5
should be correct now
Lilaa3 Jun 7, 2024
a838784
use f3d
Lilaa3 Jun 7, 2024
0ebb8c3
triangle exporting
Lilaa3 Jun 7, 2024
b6ecff5
geo modes definitions
Lilaa3 Jun 7, 2024
e5a5538
second attempt
Lilaa3 Jun 7, 2024
0587a68
third attempt
Lilaa3 Jun 7, 2024
e936216
improve definition
Lilaa3 Jun 7, 2024
45a1125
Implement geo modes and their parsing + added bleed support
Lilaa3 Jun 7, 2024
98281e6
point lit geo mode
Lilaa3 Jun 7, 2024
6fbbed0
black formatting
Lilaa3 Jun 7, 2024
1adbc72
fix ucode check, bleed
Lilaa3 Jun 7, 2024
4afc766
Don´t hide positional in f3dex3, put it in Not Useful
Lilaa3 Jun 8, 2024
53a2daf
Improve description
Lilaa3 Jun 8, 2024
bad3ed1
Implement all commands, may need fixes
Lilaa3 Jun 9, 2024
ce8b6df
Finish this
Lilaa3 Jun 9, 2024
890d61e
implement in bleed
Lilaa3 Jun 10, 2024
34a46e7
Texedge alpha ui, write and parse
Lilaa3 Jun 10, 2024
0bd58bc
fix description
Lilaa3 Jun 10, 2024
692d30c
Implement alpha threshold in viewport
Lilaa3 Jun 10, 2024
790f6d9
First implementation of set tile and set image
Lilaa3 Jun 10, 2024
008ca66
First pallete implementation, fixed bleed
Lilaa3 Jun 11, 2024
fe1ae63
Implement "Supports Point Lighting" toggle for f3dex2 family of ucodes
Lilaa3 Jun 11, 2024
50f6436
Merge branch 'main' into ac
Lilaa3 Jun 11, 2024
6d200a3
Removed useless check
Lilaa3 Jun 12, 2024
ef25816
a
Lilaa3 Jun 13, 2024
8e9b470
raise if wrong pallete format
Lilaa3 Jun 13, 2024
76d1b4b
I don´t have a name for this pr
Lilaa3 Jun 14, 2024
983c0ec
Warnings
Lilaa3 Jun 14, 2024
34ac5fe
Add todo
Lilaa3 Jun 15, 2024
b448372
This is unfortunately not valid
Lilaa3 Jun 15, 2024
4adf582
Only allow gequal with equal
Lilaa3 Jun 15, 2024
4c20ed9
Move tex adjust
Lilaa3 Jun 15, 2024
6aaf842
set text adjust
Lilaa3 Jun 15, 2024
f573876
Incomplete implementation
Lilaa3 Jun 17, 2024
41381e8
Some attempts
Lilaa3 Jun 18, 2024
1dfd0e9
A
Lilaa3 Jun 18, 2024
d9e6424
Parsing finished
Lilaa3 Jun 18, 2024
01ba260
Non default mask
Lilaa3 Jun 18, 2024
0f07de0
use fmodel's gbi definition
Lilaa3 Jun 18, 2024
6b9938c
Don´t use image size for slen and tlen
Lilaa3 Jun 18, 2024
ebbd434
Remove a dumb mistake
Lilaa3 Jun 18, 2024
2596987
Black format and move exception for pal format
Lilaa3 Jun 18, 2024
7d56247
check if pallete is not a reference
Lilaa3 Jun 18, 2024
cc9be52
Add comment to explain index choice
Lilaa3 Jun 18, 2024
8ffe827
use palette index
Lilaa3 Jun 18, 2024
8b47194
Remove todo, this is a perfectly fine implementation thank you very much
Lilaa3 Jun 18, 2024
0e16d40
Merge branch 'main' into ac
Lilaa3 Jun 18, 2024
3de697f
Format before first review
Lilaa3 Jun 18, 2024
0aa3f72
Made point lighting into a ucode version
Lilaa3 Jun 19, 2024
89ae555
IA16 is uncommon enough that this is probably not worth it
Lilaa3 Jun 19, 2024
b165e9c
Small typo
Lilaa3 Jun 19, 2024
08d89c9
Remove a leftover
Lilaa3 Jun 19, 2024
9516aed
And a merge conflict mistake
Lilaa3 Jun 19, 2024
534b31e
Improved decal geo modes
Lilaa3 Jun 19, 2024
7391981
Extra dot in description removed
Lilaa3 Jun 19, 2024
732cf4c
Give the user more info
Lilaa3 Jun 19, 2024
3fb8faf
black format
Lilaa3 Jun 19, 2024
fe88346
Change : to =, update order
Lilaa3 Jun 19, 2024
a7f219f
Only warn if being set, add warning for adjust mode
Lilaa3 Jun 20, 2024
f5e284f
Last change
Lilaa3 Jun 20, 2024
cff2651
No need to group alpha and adjust as inputGroup is already a col
Lilaa3 Jun 20, 2024
08f916e
Undo accidental change
Lilaa3 Jun 30, 2024
b741206
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Jul 19, 2024
99e6fd2
black format
Lilaa3 Jul 19, 2024
56e2249
remove blender from info
Lilaa3 Jul 19, 2024
c0b6701
Fixed naming and parsing issues
Lilaa3 Jul 30, 2024
5455be9
add comment remover utility function
Lilaa3 Jul 30, 2024
d3a64a7
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Jul 30, 2024
3116001
Update f3d_material.py
Lilaa3 Jul 30, 2024
019dd1e
Fix writer (forgot to change the arguments)
Lilaa3 Jul 30, 2024
86f3a6f
pick best tri format per vertex load
Lilaa3 Jul 30, 2024
cdcab91
typo and reduce shortening
Lilaa3 Jul 30, 2024
ddd6bec
Texture and palette fixes
Lilaa3 Aug 4, 2024
f90b4c0
Add tri_index
Lilaa3 Aug 4, 2024
023a91e
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Aug 4, 2024
6dca277
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Aug 7, 2024
a098b28
rename decal modes to geo modes
Lilaa3 Aug 7, 2024
b0ed049
Rename ucode
Lilaa3 Aug 7, 2024
8828b38
Add fixed index for the ucode enum
Lilaa3 Aug 7, 2024
2a564f9
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Aug 18, 2024
d6c02b4
Use removeComments
Lilaa3 Aug 18, 2024
be3900d
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Sep 15, 2024
2029002
[F3D] Backport point lit ucode from AC pr
Lilaa3 Sep 15, 2024
24ebe8c
Noted issue
Lilaa3 Oct 9, 2024
f24c254
rewrite textures to use numpy
Lilaa3 Dec 25, 2024
b48e35d
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Dec 26, 2024
9fcf222
fix large texture mode
Lilaa3 Dec 26, 2024
f776dd1
Merge remote-tracking branch 'upstream/main' into ac
Lilaa3 Aug 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
mat_unregister,
check_or_ask_color_management,
)
from .fast64_internal.f3d.f3d_enums import enum_ac_tri_type
from .fast64_internal.f3d.f3d_writer import f3d_writer_register, f3d_writer_unregister
from .fast64_internal.f3d.f3d_parser import f3d_parser_register, f3d_parser_unregister
from .fast64_internal.f3d.flipbook import flipbook_register, flipbook_unregister
Expand Down Expand Up @@ -93,6 +94,8 @@ def draw(self, context):
col = self.layout.column()
col.scale_y = 1.1 # extra padding
prop_split(col, context.scene, "f3d_type", "Microcode")
if context.scene.f3d_type == "F3DZEX2 (Emu64)":
prop_split(col, context.scene.fast64.settings, "ac_tri_type", "Triangle Export Type")
if context.scene.f3d_type in {"F3DEX3", "T3D"}:
prop_split(col, context.scene, "packed_normals_algorithm", "Packed normals alg")
col.prop(context.scene, "saveTextures")
Expand All @@ -104,6 +107,8 @@ def draw(self, context):
"While inlining, all meshes will be restored to world default values.\n You can configure these values in the world properties tab.",
icon="INFO",
)
if context.scene.f3d_type == "F3DZEX2 (Emu64)":
col.box().label(text="Emu64 supports ignore texture restrictions!", icon="INFO")
col.prop(context.scene, "ignoreTextureRestrictions")
if context.scene.ignoreTextureRestrictions:
col.box().label(text="Width/height must be < 1024. Must be png format.")
Expand Down Expand Up @@ -206,6 +211,8 @@ class Fast64Settings_Properties(bpy.types.PropertyGroup):
name="Prefer RGBA Over CI",
description="When enabled, fast64 will default colored textures's format to RGBA even if they fit CI requirements, with the exception of textures that would not fit into TMEM otherwise",
)
ac_tri_type: bpy.props.EnumProperty(name="Triangle Export Type", items=enum_ac_tri_type)

dont_ask_color_management: bpy.props.BoolProperty(name="Don't ask to set color management properties")

repo_settings_tab: bpy.props.BoolProperty(default=True, name="Repo Settings")
Expand Down Expand Up @@ -332,9 +339,9 @@ def upgrade_changed_props():
OOT_ObjectProperties.upgrade_changed_props()
for scene in bpy.data.scenes:
settings: Fast64Settings_Properties = scene.fast64.settings
if settings.internal_game_update_ver != 1:
if settings.internal_game_update_ver < 2:
set_game_defaults(scene, False)
settings.internal_game_update_ver = 1
settings.internal_game_update_ver = 2
if scene.get("decomp_compatible", False):
scene.gameEditorMode = "Homebrew"
del scene["decomp_compatible"]
Expand Down
44 changes: 35 additions & 9 deletions fast64_internal/f3d/f3d_bleed.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
SPLine3D,
SPLineW3D,
SP2Triangles,
SPNTrianglesInit_5b,
SPNTriangles_5b,
SPNTrianglesInit_7b,
SPNTriangles_7b,
SPCullDisplayList,
SPSegment,
SPBranchLessZraw,
Expand All @@ -45,13 +49,16 @@
SPSetOtherMode,
DPLoadBlock,
DPLoadTLUTCmd,
DPLoadTLUT_Dolphin,
DPFullSync,
DPSetRenderMode,
DPSetTextureImage,
DPSetTextureImage_Dolphin,
DPPipeSync,
DPLoadSync,
DPTileSync,
DPSetTile,
DPSetTile_Dolphin,
DPSetTileSize,
DPLoadTile,
FModel,
Expand All @@ -65,6 +72,17 @@
get_F3D_GBI,
)

TRI_CMDS = [
SP2Triangles,
SP1Triangle,
SPLine3D,
SPLineW3D,
SPNTrianglesInit_5b,
SPNTriangles_5b,
SPNTrianglesInit_7b,
SPNTriangles_7b,
]


def get_geo_cmds(
clear_modes: set[str], set_modes: set[str], is_ex2: bool, matWriteMethod: GfxMatWriteMethod
Expand Down Expand Up @@ -155,9 +173,14 @@ def place_in_flaglist(flag: bool, enum: str, set_list: SPSetGeometryMode, clear_
place_in_flaglist(defaults.g_tex_gen, "G_TEXTURE_GEN", setGeo, clearGeo)
place_in_flaglist(defaults.g_tex_gen_linear, "G_TEXTURE_GEN_LINEAR", setGeo, clearGeo)
place_in_flaglist(defaults.g_shade_smooth, "G_SHADING_SMOOTH", setGeo, clearGeo)
if bpy.context.scene.f3d_type == "F3DEX_GBI_2" or bpy.context.scene.f3d_type == "F3DEX_GBI":
if self.f3d.F3DEX_GBI:
place_in_flaglist(defaults.g_clipping, "G_CLIPPING", setGeo, clearGeo)

if self.f3d.POINT_LIT_GBI:
place_in_flaglist(defaults.g_lighting_positional, "G_LIGHTING_POSITIONAL", setGeo, clearGeo)
if self.f3d.F3DZEX2_EMU64:
place_in_flaglist(defaults.g_decal_gequal, "G_DECAL_GEQUAL", setGeo, clearGeo)
place_in_flaglist(defaults.g_decal_equal, "G_DECAL_EQUAL", setGeo, clearGeo)
place_in_flaglist(defaults.g_decal_special, "G_DECAL_SPECIAL", setGeo, clearGeo)
self.default_load_geo = SPLoadGeometryMode(setGeo.flagList)
self.default_set_geo = setGeo
self.default_clear_geo = clearGeo
Expand Down Expand Up @@ -310,14 +333,17 @@ def build_tmem_dict(self, cmd_list: GfxList):
tmem_dict = dict()
tile_dict = {i: 0 for i in range(8)} # an assumption that hopefully never needs correction
for cmd in cmd_list.commands:
if type(cmd) == DPSetTextureImage:
if type(cmd) in (DPSetTextureImage, DPSetTextureImage_Dolphin):
im_buffer = cmd
continue
elif type(cmd) == DPSetTile_Dolphin:
tmem_dict[cmd.name + 15] = im_buffer
elif type(cmd) == DPLoadTLUT_Dolphin:
tmem_dict[cmd.tlut_name] = cmd # loadtlut_dolphin loads on its own
if type(cmd) == DPSetTile:
tile_dict[cmd.tile] = cmd.tmem
if type(cmd) in (DPLoadTLUTCmd, DPLoadTile, DPLoadBlock):
tmem_dict[tile_dict[cmd.tile]] = im_buffer
continue
return tmem_dict

def bleed_textures(self, cur_fmat: FMaterial, last_mat: FMaterial, bleed_state: int):
Expand All @@ -344,7 +370,7 @@ def bleed_textures(self, cur_fmat: FMaterial, last_mat: FMaterial, bleed_state:
continue
if rm_load and type(cmd) == DPSetTile:
commands_bled.commands[j] = None
if rm_load and type(cmd) in (DPLoadTLUTCmd, DPLoadTile, DPLoadBlock):
if rm_load and type(cmd) in (DPLoadTLUTCmd, DPLoadTLUT_Dolphin, DPLoadTile, DPLoadBlock):
commands_bled.commands[j] = None
rm_load = None
continue
Expand Down Expand Up @@ -633,20 +659,20 @@ def bleed_individual_cmd(
SPViewport,
SPDisplayList,
SPBranchList,
SP1Triangle,
SPLine3D,
SPLineW3D,
SP2Triangles,
SPCullDisplayList,
SPSegment,
SPBranchLessZraw,
SPModifyVertex,
SPEndDisplayList,
DPSetTextureImage,
DPSetTextureImage_Dolphin,
DPSetTile_Dolphin,
DPLoadBlock,
DPLoadTile,
DPLoadTLUTCmd,
DPLoadTLUT_Dolphin,
DPFullSync,
*TRI_CMDS,
]:
return False

Expand Down
22 changes: 22 additions & 0 deletions fast64_internal/f3d/f3d_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@
("G_TF_BILERP", "Bilinear", "Standard N64 filtering with 3 point sample"),
]

enumTextAdjust = [
("G_TA_N64", "N64", "Center origin"),
("G_TA_DOLPHIN", "Dolphin", "Top left"),
]

enumTextLUT = [
("G_TT_NONE", "None", "None"),
("G_TT_RGBA16", "RGBA16", "RGBA16"),
Expand Down Expand Up @@ -390,7 +395,14 @@
"Variant of F3DEX2 family using vertex rejection instead of clipping",
5,
),
(
"F3DEX2_PL",
"F3DEX2 (Point Lit)",
"Variant of F3DEX2 family with support for point lighting used in a few games including MM",
11,
),
("F3DEX3", "F3DEX3", "Custom microcode by Sauraen", 6),
("F3DZEX2 (Emu64)", "F3DZEX2 (Emu64)", "Microcode used in Animal Crossing (GC), extended version of F3DZEX", 12),
("", "Homebrew", "", 8),
("RDPQ", "RDPQ", "Base libdragon microcode", 9),
("T3D", "Tiny3D", "Custom libdragon microcode by HailToDodongo", 10),
Expand Down Expand Up @@ -455,3 +467,13 @@
("Segment", "Segment", "Call a segmented DL to set the tint, can change at runtime"),
("Light", "From Light", "Automatically load tint color from selectable light slot. Tint level stored in DL"),
]

enum_ac_tri_type = [
(
"Auto",
"Auto",
"Pick between 5 bit and 7 bit commands depending on triangle count, 7 bit can access more of the vertex buffer, 5 bit has smaller commands",
),
("5b", "5 Bit", "Always use 5 bit commands"),
("7b", "7 Bit", "Always use 7 bit commands"),
]
Loading