Skip to content

Commit

Permalink
Add material for generated SpriteMesh
Browse files Browse the repository at this point in the history
  • Loading branch information
Ochmar committed Jan 14, 2024
1 parent a80f8dd commit 24b0537
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions demo/addons/sprite_mesh/sprite_mesh_instance.gd
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ func _generate_sprite_mesh() -> SpriteMesh:
if texture == null:
return sprite_mesh

sprite_mesh.meshes = _generate_meshes()
sprite_mesh.material = _generate_material()
sprite_mesh.meshes = _generate_meshes(sprite_mesh.material)

return sprite_mesh


func _generate_meshes() -> Array[ArrayMesh]:
func _generate_meshes(material: StandardMaterial3D) -> Array[ArrayMesh]:
var meshes: Array[ArrayMesh] = []

var st := SurfaceTool.new()
Expand Down Expand Up @@ -148,7 +148,7 @@ func _generate_meshes() -> Array[ArrayMesh]:
st.generate_tangents()

st.optimize_indices_for_cache()

st.set_material(material)
meshes.append(st.commit())

st.clear()
Expand Down

0 comments on commit 24b0537

Please sign in to comment.