asset manager
This commit is contained in:
parent
0142d5ea6e
commit
945088bd55
6
main.go
6
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()
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user