Skip to content

Commit

Permalink
Misc. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Dec 10, 2024
1 parent dd0b7e1 commit 8cc4236
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions addons/material_maker/engine/nodes/gen_graph.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ var transmits_seed : bool = true

var current_mesh : Mesh = null


signal graph_changed()
signal connections_changed(removed_connections, added_connections)
signal hierarchy_changed()


func _ready() -> void:
super._ready()

func emit_hierarchy_changed():
var top = self
while top.get_parent() != null and top.get_parent().get_script() == get_script():
Expand Down
2 changes: 2 additions & 0 deletions addons/material_maker/engine/nodes/gen_meshmap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const MESH_MAPS : Array[Dictionary] = [


func _ready() -> void:
super._ready()
if get_parent() is MMGenGraph:
set_current_mesh(get_parent().get_current_mesh())

Expand Down Expand Up @@ -114,6 +115,7 @@ func get_output_defs(_show_hidden : bool = false) -> Array:

func set_current_mesh(m : Mesh) -> void:
if current_mesh != m:
print("Setting mesh ", m)
current_mesh = m
update_map()

Expand Down
7 changes: 3 additions & 4 deletions addons/material_maker/engine/pipeline/pipeline.gd
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ func get_output_parameters_declarations() -> String:
return output_parameters_declarations

func create_texture(rd : RenderingDevice, texture_size : Vector2i, texture_type : int, usage_bits : int):
if texture_size.x == 0 or texture_size.y == 0:
return RID()
var fmt : RDTextureFormat = RDTextureFormat.new()
var texture_type_struct : Dictionary = TEXTURE_TYPE[texture_type]
fmt.width = texture_size.x
Expand All @@ -393,11 +395,8 @@ func create_texture(rd : RenderingDevice, texture_size : Vector2i, texture_type
fmt.texture_type = RenderingDevice.TEXTURE_TYPE_2D

var view : RDTextureView = RDTextureView.new()

var data = PackedByteArray()
data.resize(fmt.height*fmt.width*texture_type_struct.channels*texture_type_struct.bytes_per_channel)

return rd.texture_create(fmt, view, [data])
return rd.texture_create(fmt, view, [])

func create_output_texture(rd : RenderingDevice, texture_size : Vector2i, texture_type : int, is_framebuffer : bool = false) -> RID:
var usage_bits : int
Expand Down
11 changes: 8 additions & 3 deletions addons/material_maker/engine/pipeline/rendering_pipeline.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ func create_framebuffer(rd : RenderingDevice, texture_rid : RID, depth_rid : RID
framebuffer_textures.append(depth_rid)
var framebuffer : RID
framebuffer = rd.framebuffer_create(framebuffer_textures)
if not rd.framebuffer_is_valid(framebuffer):
print("Framebuffer is invalid")
return framebuffer

func bind_buffer_uniforms(rd : RenderingDevice, draw_list : int, shader : RID, buffers : Array[PackedByteArray], set : int, rids : RIDs):
Expand Down Expand Up @@ -63,13 +65,16 @@ func in_thread_render(size : Vector2i, texture_type : int, target_texture : MMTe
depth_stencil_state,
blend
)
rids.add(pipeline, "pipeline")
if not rd.render_pipeline_is_valid(pipeline):
print("Invalid render pipeline")

# pre dev6
#var draw_list : int = rd.draw_list_begin(framebuffer, RenderingDevice.INITIAL_ACTION_CLEAR, RenderingDevice.FINAL_ACTION_READ, RenderingDevice.INITIAL_ACTION_CLEAR, RenderingDevice.FINAL_ACTION_READ, clearColors)
# dev6
var draw_list : int = rd.draw_list_begin(framebuffer, RenderingDevice.INITIAL_ACTION_CLEAR, clearColors, true, 1.0, Rect2(), RenderingDevice.OPAQUE_PASS)

#var draw_list : int = rd.draw_list_begin(framebuffer, RenderingDevice.INITIAL_ACTION_CLEAR, clearColors, true, 0.0, Rect2(), RenderingDevice.OPAQUE_PASS)
var draw_list : int = rd.draw_list_begin(framebuffer, RenderingDevice.INITIAL_ACTION_CLEAR, clearColors, 1.0, 0)
rd.draw_list_bind_render_pipeline(draw_list, pipeline)

var uniform_set_1 : RID = RID()
Expand Down

0 comments on commit 8cc4236

Please sign in to comment.