Skip to content

Commit

Permalink
blacked
Browse files Browse the repository at this point in the history
  • Loading branch information
sauraen committed Jul 7, 2024
1 parent 37ab683 commit 5295b4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
29 changes: 16 additions & 13 deletions fast64_internal/f3d/f3d_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,11 +1702,18 @@ def update_node_values_of_material(material: Material, context):
nodes["UV"].node_tree = bpy.data.node_groups["UV"]

shdcol_inputs = nodes["Shade Color"].inputs
for propName in ["g_ambocclusion", "g_packed_normals", "g_lighttoalpha",
"g_lighting_specular", "g_fresnel_color", "g_fresnel_alpha",
"g_fog", "g_lighting"]:
for propName in [
"g_ambocclusion",
"g_packed_normals",
"g_lighttoalpha",
"g_lighting_specular",
"g_fresnel_color",
"g_fresnel_alpha",
"g_fog",
"g_lighting",
]:
shdcol_inputs[propName.upper()].default_value = getattr(f3dMat.rdp_settings, propName)

shdcol_inputs["AO Ambient"].default_value = f3dMat.ao_ambient
shdcol_inputs["AO Directional"].default_value = f3dMat.ao_directional
shdcol_inputs["AO Point"].default_value = f3dMat.ao_point
Expand Down Expand Up @@ -2254,7 +2261,7 @@ def createOrUpdateSceneProperties():
_nodeFogFar: NodeSocketFloat = tree_interface.new_socket(
"FogFar", socket_type="NodeSocketFloat", in_out="OUTPUT"
)

_nodeAmbientColor: NodeSocketColor = tree_interface.new_socket(
"AmbientColor", socket_type="NodeSocketColor", in_out="OUTPUT"
)
Expand Down Expand Up @@ -2285,17 +2292,13 @@ def createOrUpdateSceneProperties():
_nodeBlender_Game_Scale: NodeSocketFloat = new_group.outputs.new("NodeSocketFloat", "Blender_Game_Scale")
_nodeFogNear: NodeSocketInt = new_group.outputs.new("NodeSocketInt", "FogNear")
_nodeFogFar: NodeSocketInt = new_group.outputs.new("NodeSocketInt", "FogFar")

_nodeAmbientColor: NodeSocketColor = new_group.outputs.new("NodeSocketColor", "AmbientColor")
_nodeLight0Color: NodeSocketColor = new_group.outputs.new("NodeSocketColor", "Light0Color")
_nodeLight0Dir: NodeSocketVectorDirection = new_group.outputs.new(
"NodeSocketVectorDirection", "Light0Dir"
)
_nodeLight0Dir: NodeSocketVectorDirection = new_group.outputs.new("NodeSocketVectorDirection", "Light0Dir")
_nodeLight0Size: NodeSocketInt = new_group.outputs.new("NodeSocketInt", "Light0Size")
_nodeLight1Color: NodeSocketColor = new_group.outputs.new("NodeSocketColor", "Light1Color")
_nodeLight1Dir: NodeSocketVectorDirection = new_group.outputs.new(
"NodeSocketVectorDirection", "Light1Dir"
)
_nodeLight1Dir: NodeSocketVectorDirection = new_group.outputs.new("NodeSocketVectorDirection", "Light1Dir")
_nodeLight1Size: NodeSocketInt = new_group.outputs.new("NodeSocketInt", "Light1Size")

# Set outputs from render settings
Expand All @@ -2316,7 +2319,7 @@ def createScenePropertiesForMaterial(material: Material):
scene_props.name = "SceneProperties"
scene_props.location = (-320, -23)
scene_props.node_tree = bpy.data.node_groups["SceneProperties"]

# Fog links to reroutes and the CalcFog block
node_tree.links.new(scene_props.outputs["FogEnable"], node_tree.nodes["FogEnable"].inputs[0])
node_tree.links.new(scene_props.outputs["FogColor"], node_tree.nodes["FogColor"].inputs[0])
Expand Down
6 changes: 4 additions & 2 deletions fast64_internal/render_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ def interpColors(cola, colb, fade):
renderSettings.light1Direction = -renderSettings.light0Direction
renderSettings.fogPreviewColor = interpColors(la.fogColor, lb.fogColor, fade)
renderSettings.fogPreviewPosition = ( # fogFar is always 1000 in OoT
la.fogNear + int(float(lb.fogNear - la.fogNear) * fade), 1000
la.fogNear + int(float(lb.fogNear - la.fogNear) * fade),
1000,
)
renderSettings.clippingPlanes = ( # zNear seems to always be 10 in OoT
10.0, la.zFar + float(lb.zFar - la.zFar) * fade
10.0,
la.zFar + float(lb.zFar - la.zFar) * fade,
)


Expand Down

0 comments on commit 5295b4d

Please sign in to comment.