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()
|
model := mgl32.Ident4()
|
||||||
controls := fpscontrols.Get(10, 10, mgl32.Vec3{0, 0, -10}, mgl32.Vec2{0, 0}, window)
|
controls := fpscontrols.Get(10, 10, mgl32.Vec3{0, 0, -10}, mgl32.Vec2{0, 0}, window)
|
||||||
|
|
||||||
demoMaterial := am.GetAsset[material.Material](assetManager, "assets/material/demo")
|
demoMaterial := am.GetAsset[material.Material]("assets/material/demo")
|
||||||
screenMaterial := am.GetAsset[material.Material](assetManager, "assets/material/screen")
|
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() {
|
for !window.ShouldClose() {
|
||||||
glfw.PollEvents()
|
glfw.PollEvents()
|
||||||
|
@ -131,8 +131,8 @@ func Get() *AssetManager {
|
|||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAsset[T asset.Asset](a *AssetManager, name string) *T {
|
func GetAsset[T asset.Asset](name string) *T {
|
||||||
value, ok := a.assets[name].(T)
|
value, ok := instance.assets[name].(T)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user