asset manager

This commit is contained in:
BENEDEK László 2024-12-23 15:49:51 +01:00
parent 0142d5ea6e
commit 945088bd55
2 changed files with 5 additions and 5 deletions

View File

@ -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()

View File

@ -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
}