From 945088bd5523d2588173dd83f2d115cf54c932c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BENEDEK=20L=C3=A1szl=C3=B3?= Date: Mon, 23 Dec 2024 15:49:51 +0100 Subject: [PATCH] asset manager --- main.go | 6 +++--- utils/assetmanager/assetmanager.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index fb04bf9..42ac90f 100644 --- a/main.go +++ b/main.go @@ -86,10 +86,10 @@ func main() { model := mgl32.Ident4() controls := fpscontrols.Get(10, 10, mgl32.Vec3{0, 0, -10}, mgl32.Vec2{0, 0}, window) - demoMaterial := am.GetAsset[material.Material](assetManager, "assets/material/demo") - screenMaterial := am.GetAsset[material.Material](assetManager, "assets/material/screen") + demoMaterial := am.GetAsset[material.Material]("assets/material/demo") + screenMaterial := am.GetAsset[material.Material]("assets/material/screen-debug") - teapot := am.GetAsset[geometry.Geometry](assetManager, "assets/geometry/teapot") + teapot := am.GetAsset[geometry.Geometry]("assets/geometry/teapot") for !window.ShouldClose() { glfw.PollEvents() diff --git a/utils/assetmanager/assetmanager.go b/utils/assetmanager/assetmanager.go index a611ade..abaf921 100644 --- a/utils/assetmanager/assetmanager.go +++ b/utils/assetmanager/assetmanager.go @@ -131,8 +131,8 @@ func Get() *AssetManager { return instance } -func GetAsset[T asset.Asset](a *AssetManager, name string) *T { - value, ok := a.assets[name].(T) +func GetAsset[T asset.Asset](name string) *T { + value, ok := instance.assets[name].(T) if !ok { return nil }