Skip to content

Commit

Permalink
feat: material texture (#35)
Browse files Browse the repository at this point in the history
* wip

wip

clippy

clippy

wip

test

wip

format

* clean
  • Loading branch information
leanmendoza authored Aug 16, 2023
1 parent 103d955 commit d3d5bc0
Show file tree
Hide file tree
Showing 13 changed files with 1,218 additions and 163 deletions.
6 changes: 6 additions & 0 deletions godot/.godot/global_script_class_cache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ list=Array[Dictionary]([{
"language": &"GDScript",
"path": "res://src/logic/content_manager.gd"
}, {
"base": &"MeshInstance3D",
"class": &"DCLMeshRenderer",
"icon": "",
"language": &"GDScript",
"path": "res://src/decentraland_components/mesh_renderer.gd"
}, {
"base": &"Camera3D",
"class": &"FreeLookCamera",
"icon": "",
Expand Down
14 changes: 5 additions & 9 deletions godot/src/decentraland_components/gltf_container.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ func _ready():


func load_gltf():
var scene_runner: SceneManager = get_tree().root.get_node("scene_runner")
var content_mapping = scene_runner.get_scene_content_mapping(dcl_scene_id)
var content_manager: ContentManager = get_tree().root.get_node("content_manager")
var content_mapping = Global.scene_runner.get_scene_content_mapping(dcl_scene_id)

self.dcl_gltf_src = dcl_gltf_src.to_lower()
self.file_hash = content_mapping.get("content", {}).get(dcl_gltf_src, "")
Expand All @@ -35,29 +33,27 @@ func load_gltf():
gltf_state = GodotGltfState.NotFound
return

var fetching_resource = content_manager.fetch_gltf(dcl_gltf_src, content_mapping)
var fetching_resource = Global.content_manager.fetch_gltf(dcl_gltf_src, content_mapping)

# TODO: should we set a timeout?
gltf_state = GodotGltfState.Loading

if not fetching_resource:
self._on_gltf_loaded.call_deferred(self.file_hash)
else:
content_manager.content_loading_finished.connect(self._on_gltf_loaded)
Global.content_manager.content_loading_finished.connect(self._on_gltf_loaded)


func _content_manager_resource_loaded(resource_hash: String):
var content_manager: ContentManager = get_tree().root.get_node("content_manager")
content_manager.content_loading_finished.disconnect(self._on_gltf_loaded)

Global.content_manager.content_loading_finished.disconnect(self._on_gltf_loaded)
_on_gltf_loaded(resource_hash)


func _on_gltf_loaded(resource_hash: String):
if resource_hash != file_hash:
return

var node = get_tree().root.get_node("content_manager").get_resource_from_hash(file_hash)
var node = Global.content_manager.get_resource_from_hash(file_hash)
if node == null:
gltf_state = GodotGltfState.FinishedWithError
return
Expand Down
Loading

0 comments on commit d3d5bc0

Please sign in to comment.