Files
aego/asset/builtin.go
T
sanspie 17cb5e4291 Stage 2-5: assets, scene/ECS, editor, 3D, and Aego Script
Stage 2: render pipeline and UI toolkit over gpu/platform.
Stage 3: schema registry, asset pipeline + runtime loader, scene graph and ECS.
Stage 4: editor — docking, inspector, scene/game views, play mode, asset browser, console, profiler; 4.5 adds the 3D foundation (mixed 2D/3D spaces, meshes, depth).
Stage 5: Aego Script — compiler (lexer/parser/types/resolver/checker/asm/compiler), bytecode with verifier and register VM, instance runtime, stdlib, native bindings, and editor/CLI integration (aego run/edit/check/test/dump).
2026-10-08 13:17:28 +03:00

62 lines
1.4 KiB
Go

package asset
import (
"aego/core/ids"
"aego/render/mesh"
)
const builtinHi uint64 = 0xae90000000000000
var (
BuiltinCube = ids.AssetID{Hi: builtinHi, Lo: 1}
BuiltinPlane = ids.AssetID{Hi: builtinHi, Lo: 2}
BuiltinSphere = ids.AssetID{Hi: builtinHi, Lo: 3}
BuiltinCylinder = ids.AssetID{Hi: builtinHi, Lo: 4}
BuiltinWhite = ids.AssetID{Hi: builtinHi, Lo: 16}
)
type Builtin struct {
ID ids.AssetID
Name string
Kind ArtifactKind
}
var builtins = [...]Builtin{
{ID: BuiltinCube, Name: "engine/meshes/cube", Kind: ArtMesh},
{ID: BuiltinPlane, Name: "engine/meshes/plane", Kind: ArtMesh},
{ID: BuiltinSphere, Name: "engine/meshes/sphere", Kind: ArtMesh},
{ID: BuiltinCylinder, Name: "engine/meshes/cylinder", Kind: ArtMesh},
{ID: BuiltinWhite, Name: "engine/textures/white", Kind: ArtTexture},
}
func Builtins() []Builtin {
return builtins[:]
}
func IsBuiltin(id ids.AssetID) bool {
return id.Hi == builtinHi
}
func LookupBuiltin(id ids.AssetID) (Builtin, bool) {
for _, b := range builtins {
if b.ID == id {
return b, true
}
}
return Builtin{}, false
}
func BuiltinMesh(id ids.AssetID) (*mesh.Data, bool) {
switch id {
case BuiltinCube:
return mesh.Cube(1), true
case BuiltinPlane:
return mesh.Plane(10, 10, 10), true
case BuiltinSphere:
return mesh.Sphere(0.5, 16, 24), true
case BuiltinCylinder:
return mesh.Cylinder(0.5, 1, 24), true
}
return nil, false
}