Documentation
¶
Index ¶
- Constants
- func ClampFloat32(value, minimum, maximum float32) float32
- func ClampFloat64(value, minimum, maximum float64) float64
- func MarshalModulePlan(plan *ProjectPlan) ([]byte, error)
- func NormalizeEnvironmentPath(value string) (string, error)
- func NormalizeLocalResourcePath(value string) (string, error)
- func NormalizeResourcePath(value string) (string, error)
- func ParseColor(value string, alpha float32) (graphics.ColorRGBA, error)
- func Queue2DEntityUploads(queue *graphics.UploadQueue, world *ecs.World, entity ecs.Entity)
- func QueueEntityUploads(queue *graphics.UploadQueue, world *ecs.World, entity ecs.Entity)
- func QueueParticlesEntityUploads(queue *graphics.UploadQueue, world *ecs.World, entity ecs.Entity)
- func QueueSpatialEntityUploads(queue *graphics.UploadQueue, world *ecs.World, entity ecs.Entity)
- func QueueSpineEntityUploads(queue *graphics.UploadQueue, world *ecs.World, entity ecs.Entity)
- func QueueTilemapsEntityUploads(queue *graphics.UploadQueue, world *ecs.World, entity ecs.Entity)
- func ResolveLocalResourcePath(baseDir, value string) (string, error)
- func ResolveModResourcePath(id ModID, file string) (string, error)
- func ResolveResourcePath(baseDir, value string) (string, error)
- func ScenePath(id SceneID) string
- func ValidateProjectSpec(spec ProjectSpec) error
- type AmbientLightSpec
- type AnimationClipSpec
- type AnimationComponentSpec
- type AnimationEventSpec
- type AnimationKeyframeSpec
- type AnimationSpecValue
- type AnimationTrackSpec
- type AppConfig
- type AreaLightSpec
- type BoxCollider2DSpec
- type Bundle
- func Load(source iofs.FS, root string) (*Bundle, error)
- func LoadConfiguredWith[F ResourceFeature](source iofs.FS, root string, config EngineConfig) (*Bundle, error)
- func LoadDefault() (*Bundle, error)
- func LoadDefaultConfigured[F ResourceFeature](config EngineConfig) (*Bundle, error)
- func LoadDirectoryConfigured[F ResourceFeature](dir string, config EngineConfig) (*Bundle, error)
- func LoadDirectoryFromManifest[F ResourceFeature](dir string) (*Bundle, error)
- func LoadDirectoryWithProfile[P LoadProfile, F ResourceFeature](dir string) (*Bundle, error)
- func MustDefault() *Bundle
- func MustLoadDefault(loader func(string) (*Bundle, error)) *Bundle
- func (b *Bundle) AppConfig() AppConfig
- func (b *Bundle) BeginPreloadScene(world *ecs.World, id SceneID) (*ScenePreloader, error)
- func (b *Bundle) ClearColor() (graphics.ColorRGBA, bool)
- func (b *Bundle) CompileAnimationClip(spec AnimationClipSpec) (*scene.AnimationClip, error)
- func (b *Bundle) Dispose() error
- func (b *Bundle) EntrySceneID() SceneID
- func (b *Bundle) Has3D() bool
- func (b *Bundle) HasUI() bool
- func (b *Bundle) InstantiateEntryScene(world *ecs.World) (*SceneInstance, error)
- func (b *Bundle) InstantiateScene(world *ecs.World, id SceneID) (*SceneInstance, error)
- func (b *Bundle) ModelAnimation(modelID, animationName string) (*scene.AnimationClip, error)
- func (b *Bundle) ModelDeformation(modelID string) (render3d.Deformation, error)
- func (b *Bundle) ModelMaterials(modelID string) ([]graphics.StandardMaterial, error)
- func (b *Bundle) ModelMorphTargets(modelID string) ([]ModelMorphTarget, error)
- func (b *Bundle) ModelNodes(modelID string) ([]ModelNode, error)
- func (b *Bundle) ModelRig(modelID string) (*ModelRig, error)
- func (b *Bundle) ModelSkeleton(modelID string) ([]ModelJoint, error)
- func (b *Bundle) ModelSkinWeights(modelID string) ([]ModelSkinVertex, error)
- func (b *Bundle) PreloadScene(id SceneID) error
- func (b *Bundle) PreloadSceneFor(device *render.Device, id SceneID) error
- func (b *Bundle) PreloadScenes(ids ...SceneID) error
- func (b *Bundle) Resources() *Resources
- func (b *Bundle) SceneIDs() []SceneID
- func (b *Bundle) ValidateSceneFeatures(id SceneID, installed func(RuntimeFeatureID) bool) error
- func (b *Bundle) ViewportSize() (int, int, bool)
- func (b *Bundle) WindowIcon() []byte
- func (b *Bundle) WindowIconDecoder() window.IconDecoder
- func (b *Bundle) WindowSize() (int, int, bool)
- type Camera3DSpec
- type CameraViewport3DSpec
- type CircleCollider2DSpec
- type Collider2DSettingsSpec
- type Collider3DSettingsSpec
- type CollisionPieceSpec
- type CollisionResourceSpec
- type CompileCache
- type CompoundCollider3DSpec
- type ControlSpec
- type ConvexHullCollider3DSpec
- type CoordinateSpace
- type CreateProjectOptions
- type DirectionalLightSpec
- type EmitterSpec
- type EngineConfig
- type EnvironmentSpec
- type FileResource
- type FogSpec
- type FontDecoder
- type Hooks
- type IconFeature
- type ImageDecoder
- type ImageDecoderID
- type ImageFeature
- type LoadProfile
- type MeshSpec
- type MeshVertexSpec
- type ModCamera2DSpec
- type ModCollisionSpec
- type ModComponents
- type ModContentFeatures
- type ModElementPlan
- type ModElementSpec
- type ModHTMLSpec
- type ModID
- type ModInputSpec
- type ModInstancePlan
- type ModInstanceSpec
- type ModMaterial2D
- type ModMaterial2DSpec
- type ModPlan
- type ModResourcePlan
- type ModResourceSpec
- type ModSpec
- type ModSpineSpec
- type ModSpriteSpec
- type ModTransform
- type ModTransformSpec
- type ModelAnimationSource
- type ModelAnimationTrackSource
- type ModelJoint
- type ModelMaterialSpec
- type ModelMorphTarget
- type ModelNode
- type ModelPose
- type ModelPoseClip
- type ModelRig
- type ModelSkinVertex
- type ModelSpec
- type NineSlice
- type ParticleSpec
- type PointLightSpec
- type PreprocessOptions
- type PreprocessedFile
- func PreprocessManifests(source iofs.FS, options PreprocessOptions) ([]PreprocessedFile, error)
- func PreprocessModShaders(source fs.FS, mod *ModPlan, options PreprocessOptions) ([]PreprocessedFile, error)
- func PreprocessModuleAssets(source fs.FS, plan *ProjectPlan, options PreprocessOptions) ([]PreprocessedFile, error)
- type ProjectPlan
- func CompileProject(source fs.FS, root string) (*ProjectPlan, error)
- func CompileProjectDefinitions(source fs.FS, root string, definitions []ModID) (*ProjectPlan, error)
- func CompileProjectDirectory(directory string) (*ProjectPlan, error)
- func CreateProjectDirectory(directory string, options CreateProjectOptions) (*ProjectPlan, error)
- func OpenModuleProject() (*ProjectPlan, fs.FS, error)
- func ReadModulePlan(source fs.FS) (*ProjectPlan, error)
- type ProjectSpec
- type PunctualShadowSpec
- type Render2DAnimationsProfile
- type Render2DProfile
- type ResourceComponentSpec
- type ResourceEntries
- type ResourceFeature
- type ResourceFeatureSet
- type ResourceID
- type ResourceLoadContext
- func (context ResourceLoadContext) OpenBlob(path string) (*resource.Blob, error)
- func (context ResourceLoadContext) ReadFile(path string) ([]byte, error)
- func (context ResourceLoadContext) RegisterNamedResource[T any](kind, id string, registration ResourceRegistration[T]) error
- func (context ResourceLoadContext) SetFontDecoder(decoder FontDecoder)
- func (context ResourceLoadContext) SetImageDecoder(decoder ImageDecoder)
- func (context ResourceLoadContext) SetWindowIconDecoder(decoder window.IconDecoder)
- type ResourceRegistration
- type ResourceStatistics
- type Resources
- func (r *Resources) AppendModContent(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContent2D(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentAnimation(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentHTML(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentLayout(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentParticles(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentPhysics2D(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentSpatial(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentSpine(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentTilemaps(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) AppendModContentTrail(b *ecs.Bundle, c ModComponents) error
- func (r *Resources) Atlas(path string) (*graphics.Atlas, error)
- func (r *Resources) AtlasWithOptions(path string, options graphics.TextureOptions) (*graphics.Atlas, error)
- func (r *Resources) Dispose() error
- func (r *Resources) Font(id string) (*onixtext.Font, error)
- func (r *Resources) HTML(id string) (string, error)
- func (resources *Resources) LoadNamedResource[T any](kind, id string) (T, error)
- func (r *Resources) Material2DShader(id string) (*graphics.Material2DShader, error)
- func (r *Resources) MeshShader(id string) (*graphics.MeshShader, error)
- func (r *Resources) ModContent(c ModComponents) (ecs.Bundle, error)
- func (r *Resources) ModelRig(name string) (*ModelRig, error)
- func (r *Resources) ParseColor(value string, alpha float32) (graphics.ColorRGBA, error)
- func (r *Resources) Shader(id string) (render.ShaderDescriptor, error)
- func (r *Resources) Spine(id string) (*spineruntime.Resource, error)
- func (r *Resources) Statistics() ResourceStatistics
- func (r *Resources) Video(id string) (*Video, error)
- type RigidBody2DSpec
- type RigidBody3DSpec
- type RuntimeFeatureID
- type SSAOSpec
- type SSRSpec
- type SceneCatalogEntry
- type SceneComponent
- type SceneComponents
- func (c *SceneComponents) Add(component SceneComponent)
- func (components SceneComponents) Clone() SceneComponents
- func (c SceneComponents) Empty() bool
- func (c SceneComponents) Has(component SceneComponent) bool
- func (c SceneComponents) Has2D() bool
- func (c SceneComponents) Has3D() bool
- func (c SceneComponents) HasPhysics2D() bool
- func (c SceneComponents) HasPhysics3D() bool
- func (c SceneComponents) IsZero() bool
- func (c SceneComponents) VisualsEmpty() bool
- type SceneExitPolicy
- type SceneID
- type SceneInstance
- func (s *SceneInstance) ApplyNode(spec SceneNodeSpec) error
- func (s *SceneInstance) ApplyNodeUnder(parentID string, spec SceneNodeSpec) error
- func (scene *SceneInstance) BindControl[T any](id string, component T) error
- func (scene *SceneInstance) BindControlEntity[T any](entity ecs.Entity, component T) error
- func (s *SceneInstance) BindScripts() error
- func (s *SceneInstance) Bounds(entity ecs.Entity) (float32, float32, float32, float32, bool)
- func (s *SceneInstance) BoundsByID(id string) (float32, float32, float32, float32, bool)
- func (s *SceneInstance) Child(parent ecs.Entity, id string) (ecs.Entity, error)
- func (s *SceneInstance) CloneChildrenUnder(parent ecs.Entity, templateID, prefix string) (map[string]ecs.Entity, error)
- func (s *SceneInstance) CloneNodeUnder(parent ecs.Entity, templateID, prefix string) (map[string]ecs.Entity, error)
- func (s *SceneInstance) CloneRootsUnder(parent ecs.Entity, prefix string) (map[string]ecs.Entity, error)
- func (scene *SceneInstance) Component[T any](id string) (*T, error)
- func (s *SceneInstance) DispatchInputScripts(context *ecs.SystemContext, reader *ecs.MessageReader[scene.InputEvent]) error
- func (s *SceneInstance) Dispose()
- func (s *SceneInstance) Entity(id string) (ecs.Entity, error)
- func (s *SceneInstance) EntityAt(path string) (ecs.Entity, error)
- func (s *SceneInstance) EntityBySlot(slot ecs.EntitySlot) (ecs.Entity, bool)
- func (s *SceneInstance) ID(entity ecs.Entity) string
- func (s *SceneInstance) IsUI(entity ecs.Entity) bool
- func (s *SceneInstance) MustChild(parent ecs.Entity, id string) ecs.Entity
- func (s *SceneInstance) MustEntity(id string) ecs.Entity
- func (s *SceneInstance) MustEntityAt(path string) ecs.Entity
- func (s *SceneInstance) MustSlot(id string) ecs.EntitySlot
- func (s *SceneInstance) Path(id string) string
- func (s *SceneInstance) Pick(worldPosition, viewportPosition mgl32.Vec2) (string, bool)
- func (s *SceneInstance) RefreshTransforms() error
- func (s *SceneInstance) RemoveNodes(ids ...string) int
- func (s *SceneInstance) RenderItems() []SceneRenderItem
- func (s *SceneInstance) ReplaceNodes(specs []SceneNodeSpec) error
- func (scene *SceneInstance) RequireComponent[T any](id string) (ecs.EntitySlot, error)
- func (s *SceneInstance) Resources() *Resources
- func (s *SceneInstance) SceneID() SceneID
- func (s *SceneInstance) SetModelResource(spec ModelSpec) error
- func (s *SceneInstance) SetParticleResource(spec ParticleSpec) error
- func (s *SceneInstance) SetScriptRegistry(registry ScriptRegistry) error
- func (s *SceneInstance) SetSpineResource(spec SpineSpec) error
- func (s *SceneInstance) SetTilemapResource(spec TilemapSpec) error
- func (s *SceneInstance) Slot(id string) (ecs.EntitySlot, error)
- func (s *SceneInstance) Switch(id SceneID) error
- func (s *SceneInstance) TransformMatrix2D(entity ecs.Entity) (mgl32.Mat4, bool)
- func (s *SceneInstance) UpdateScripts(context *ecs.SystemContext) error
- type SceneNodeSpec
- type ScenePlan
- type ScenePreloader
- func (p *ScenePreloader) Activate(current *SceneInstance) error
- func (p *ScenePreloader) Advance(budget time.Duration) (bool, error)
- func (p *ScenePreloader) AdvanceFor(device *render.Device, budget graphics.UploadBudget) (ready bool, err error)
- func (p *ScenePreloader) CPUReady() bool
- func (p *ScenePreloader) Discard()
- func (p *ScenePreloader) GPUReadyFor(device *render.Device) bool
- func (p *ScenePreloader) Ready() bool
- func (p *ScenePreloader) ReadyFor(device *render.Device) bool
- type SceneRenderItem
- type SceneSpec
- type ScriptBinding
- type ScriptComponentSpec
- type ScriptContext
- type ScriptRegistry
- type SegmentCollider2DSpec
- type ShaderCompileRequest
- type ShaderCompileResult
- type ShaderCompiler
- type ShaderComponentSpec
- type ShaderSources
- type ShaderSpec
- type ShaderTarget
- type ShadowSpec
- type SizeConfig
- type SlotFieldValue
- type SlotPlan
- type SlotSpec
- type SlotValue
- type SpineComponentSpec
- type SpineSpec
- type SpotLightSpec
- type SpriteComponentSpec
- type SpriteTrailSpec
- type TextComponentSpec
- type TextShadow
- type TextureSpec
- type TileRun
- type TilemapSpec
- type TriangleMeshCollider3DSpec
- type ValueSchema
- type ValueType
- type Video
- type WindowConfig
Constants ¶
const ( DefaultSceneFile = "main.json" SceneDirectory = "resources/scenes" ModFileName = "mod.json" )
const ModulePlanFile = "resources/modules.bin"
Variables ¶
This section is empty.
Functions ¶
func ClampFloat32 ¶
func ClampFloat64 ¶
func MarshalModulePlan ¶
func MarshalModulePlan(plan *ProjectPlan) ([]byte, error)
MarshalModulePlan is build-time work. The binary retains resolved indices, typed slot defaults and behavior entries for every registered scene.
func NormalizeEnvironmentPath ¶
NormalizeEnvironmentPath accepts a baked PNG atlas, RGBE HDR, or Ultra HDR JPEG panorama.
func NormalizeLocalResourcePath ¶
NormalizeLocalResourcePath validates a file reference that cannot contain parent segments.
func NormalizeResourcePath ¶
NormalizeResourcePath validates and canonicalizes a project-relative file reference. Parent segments are retained so projects mounted below an fs.FS root can share repository resources; ResolveResourcePath enforces that root.
func ParseColor ¶
ParseColor shares the engine's authored CSS color parser with module loaders.
func Queue2DEntityUploads ¶
Queue2DEntityUploads collects sprites, animation frames, text and 2D materials.
func QueueEntityUploads ¶
QueueEntityUploads collects authored resources and prepared text into the shared upload queue. It does not acquire handles or invoke a render driver.
func QueueSpineEntityUploads ¶
func ResolveLocalResourcePath ¶
ResolveLocalResourcePath resolves a file that must remain below baseDir.
func ResolveModResourcePath ¶
ResolveModResourcePath accepts arbitrary module-owned folder layouts. File references cannot escape a module and are never resolved at project scope.
func ResolveResourcePath ¶
ResolveResourcePath resolves a project-relative file reference without allowing it to escape the mounted resource source.
func ValidateProjectSpec ¶
func ValidateProjectSpec(spec ProjectSpec) error
Types ¶
type AmbientLightSpec ¶
func NewAmbientLightSpec ¶
func NewAmbientLightSpec() AmbientLightSpec
func (*AmbientLightSpec) UnmarshalJSON ¶
func (s *AmbientLightSpec) UnmarshalJSON(data []byte) error
type AnimationClipSpec ¶
type AnimationClipSpec struct {
FloatTracks []AnimationTrackSpec[float32] `json:"floatTracks,omitempty"`
TextureTracks []AnimationTrackSpec[TextureSpec] `json:"textureTracks,omitempty"`
BoolTracks []AnimationTrackSpec[bool] `json:"boolTracks,omitempty"`
Events []AnimationEventSpec `json:"events,omitempty"`
Duration float32 `json:"duration"`
SampleRate float32 `json:"sampleRate"`
Loop bool `json:"loop"`
}
func DefaultAnimationClip ¶
func DefaultAnimationClip(spec SceneNodeSpec) AnimationClipSpec
DefaultAnimationClip creates the initial clip for an animation component that has no authored clip yet. Scene loading and the editor use the same first keyframe.
func (AnimationClipSpec) Clone ¶
func (s AnimationClipSpec) Clone() AnimationClipSpec
Clone returns an independent authoring copy, including texture slice data.
func (AnimationClipSpec) HasContent ¶
func (s AnimationClipSpec) HasContent() bool
HasContent reports whether the clip contains authored animation data.
func (AnimationClipSpec) Validate ¶
func (s AnimationClipSpec) Validate() error
Validate validates an inline animation clip.
type AnimationComponentSpec ¶
type AnimationComponentSpec struct {
Clip AnimationClipSpec `json:"clip,omitzero"`
Speed float32 `json:"speed,omitempty"`
}
AnimationComponentSpec attaches one immutable inline clip to a node.
func (*AnimationComponentSpec) UnmarshalJSON ¶
func (s *AnimationComponentSpec) UnmarshalJSON(data []byte) error
type AnimationEventSpec ¶
type AnimationKeyframeSpec ¶
type AnimationKeyframeSpec[T AnimationSpecValue] struct { Value T `json:"value"` InTangent T `json:"inTangent,omitzero"` OutTangent T `json:"outTangent,omitzero"` Tween scene.AnimationTween `json:"tween,omitempty"` Curve scene.AnimationCurve `json:"curve,omitzero"` Time float32 `json:"time"` }
func (AnimationKeyframeSpec[T]) EffectiveAnimationTween ¶
func (key AnimationKeyframeSpec[T]) EffectiveAnimationTween(defaultTween scene.AnimationTween) scene.AnimationTween
EffectiveAnimationTween returns the curve used for the segment starting at key, defaulting to the track's type-specific curve.
type AnimationSpecValue ¶ added in v0.1.11
type AnimationSpecValue interface {
float32 | bool | TextureSpec
}
AnimationSpecValue is a keyframe value supported by the project file format.
type AnimationTrackSpec ¶
type AnimationTrackSpec[T AnimationSpecValue] struct { Binding scene.AnimationBinding `json:"binding"` TimeTween scene.AnimationTween `json:"timeTween,omitempty"` Keyframes []AnimationKeyframeSpec[T] `json:"keyframes"` TimeCurve scene.AnimationCurve `json:"timeCurve,omitzero"` }
type AppConfig ¶
type AppConfig struct {
Viewport SizeConfig
Window WindowConfig
}
type AreaLightSpec ¶
type AreaLightSpec struct {
Color string `json:"color"`
Unit graphics.LightUnit `json:"unit"`
Shape render3d.AreaLightShape `json:"shape"`
Intensity float32 `json:"intensity"`
Range float32 `json:"range"`
Width float32 `json:"width"`
Height float32 `json:"height"`
Radius float32 `json:"radius"`
}
func NewAreaLightSpec ¶
func NewAreaLightSpec() AreaLightSpec
func (*AreaLightSpec) UnmarshalJSON ¶
func (s *AreaLightSpec) UnmarshalJSON(data []byte) error
type BoxCollider2DSpec ¶
type BoxCollider2DSpec struct {
Collider2DSettingsSpec
Offset [2]float64 `json:"offset,omitempty"`
Width float64 `json:"width,omitempty"`
Height float64 `json:"height,omitempty"`
Rotation float64 `json:"rotation,omitempty"`
}
func NewBoxCollider2DSpec ¶
func NewBoxCollider2DSpec() BoxCollider2DSpec
func (*BoxCollider2DSpec) UnmarshalJSON ¶
func (s *BoxCollider2DSpec) UnmarshalJSON(data []byte) error
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
func LoadConfiguredWith ¶
func LoadConfiguredWith[F ResourceFeature](source iofs.FS, root string, config EngineConfig) (*Bundle, error)
LoadConfiguredWith loads a project using explicit resource and runtime feature selections.
func LoadDefault ¶
func LoadDefaultConfigured ¶
func LoadDefaultConfigured[F ResourceFeature](config EngineConfig) (*Bundle, error)
LoadDefaultConfigured loads a project from the resource source mounted by generated build code.
func LoadDirectoryConfigured ¶
func LoadDirectoryConfigured[F ResourceFeature](dir string, config EngineConfig) (*Bundle, error)
LoadDirectoryConfigured loads a project using an explicit EngineConfig while retaining the caller's statically selected resource feature type.
func LoadDirectoryFromManifest ¶
func LoadDirectoryFromManifest[F ResourceFeature](dir string) (*Bundle, error)
LoadDirectoryFromManifest loads a project using the explicit EngineConfig stored in resources/project.json. The resource feature type remains a compile-time decoder/link boundary while runtime features stay project data.
func LoadDirectoryWithProfile ¶
func LoadDirectoryWithProfile[P LoadProfile, F ResourceFeature](dir string) (*Bundle, error)
LoadDirectoryWithProfile loads a project through a statically selected scene/resource profile. The profile type is a link boundary: only the resource and scene builders implemented by P are reachable from the final executable.
func MustDefault ¶
func MustDefault() *Bundle
MustDefault loads the mounted project resource package and panics on error.
func MustLoadDefault ¶
MustLoadDefault invokes a generated project loader against the mounted resource package and panics when loading fails.
func (*Bundle) BeginPreloadScene ¶
BeginPreloadScene starts an incremental scene preload. Advance must be called until Ready reports true before Activate may be used.
func (*Bundle) CompileAnimationClip ¶
func (b *Bundle) CompileAnimationClip(spec AnimationClipSpec) (*scene.AnimationClip, error)
CompileAnimationClip compiles an inline authoring clip against this bundle's texture resources. The returned clip is independent of any scene instance and can be shared across instances and editor previews.
func (*Bundle) EntrySceneID ¶
func (*Bundle) InstantiateEntryScene ¶
func (b *Bundle) InstantiateEntryScene(world *ecs.World) (*SceneInstance, error)
func (*Bundle) InstantiateScene ¶
func (*Bundle) ModelAnimation ¶
func (b *Bundle) ModelAnimation(modelID, animationName string) (*scene.AnimationClip, error)
ModelAnimation returns a compiled ECS clip exported by a glTF/FBX model. The clip is immutable and can be shared by multiple Animator components.
func (*Bundle) ModelDeformation ¶
func (b *Bundle) ModelDeformation(modelID string) (render3d.Deformation, error)
ModelDeformation creates reusable runtime state sized for the model's morph targets, joints and rigid nodes. Initial matrices preserve the source pose.
func (*Bundle) ModelMaterials ¶
func (b *Bundle) ModelMaterials(modelID string) ([]graphics.StandardMaterial, error)
ModelMaterials returns imported PBR descriptors. Texture paths are resolved through the same resource cache used by authored model materials.
func (*Bundle) ModelMorphTargets ¶
func (b *Bundle) ModelMorphTargets(modelID string) ([]ModelMorphTarget, error)
ModelMorphTargets returns imported morph data without copying its delta arrays. The model cache owns the returned slices for the bundle lifetime.
func (*Bundle) ModelNodes ¶
ModelNodes returns immutable node metadata owned by the model cache.
func (*Bundle) ModelSkeleton ¶
func (b *Bundle) ModelSkeleton(modelID string) ([]ModelJoint, error)
ModelSkeleton returns the immutable skeleton metadata imported for a model.
func (*Bundle) ModelSkinWeights ¶
func (b *Bundle) ModelSkinWeights(modelID string) ([]ModelSkinVertex, error)
ModelSkinWeights returns the imported skin influences in mesh vertex order.
func (*Bundle) PreloadScene ¶
PreloadScene synchronously prepares CPU resources in an isolated world. PreloadSceneFor optionally uploads them to an explicit device; interactive loading uses BeginPreloadScene.
func (*Bundle) PreloadSceneFor ¶
PreloadSceneFor prepares CPU resources and optionally uploads to the supplied device.
func (*Bundle) PreloadScenes ¶
PreloadScenes preloads registered scenes in order.
func (*Bundle) ValidateSceneFeatures ¶
func (b *Bundle) ValidateSceneFeatures(id SceneID, installed func(RuntimeFeatureID) bool) error
ValidateSceneFeatures verifies that installed reports all runtime features needed to materialize scene id. It keeps the check at the scene boundary so loading a project cannot silently produce an unrendered or unanimated scene.
func (*Bundle) WindowIcon ¶
func (*Bundle) WindowIconDecoder ¶
func (b *Bundle) WindowIconDecoder() window.IconDecoder
WindowIconDecoder returns the decoder selected by the project's resource feature. A nil value means window icons are not configured.
type Camera3DSpec ¶
type Camera3DSpec struct {
SSAO *SSAOSpec `json:"ssao,omitempty"`
SSR *SSRSpec `json:"ssr,omitempty"`
Environment *EnvironmentSpec `json:"environment,omitempty"`
Fog *FogSpec `json:"fog,omitempty"`
ClearColor string `json:"clearColor"`
ToneMapping graphics.ToneMapping `json:"toneMapping,omitempty"`
Quality render3d.Quality `json:"quality,omitempty"`
Exposure graphics.Exposure `json:"exposure"`
Order int `json:"order"`
Viewport CameraViewport3DSpec `json:"viewport"`
Near float32 `json:"near"`
Fov float32 `json:"fov"`
FXAA bool `json:"fxaa,omitempty"`
}
func NewCamera3DSpec ¶
func NewCamera3DSpec() Camera3DSpec
func (*Camera3DSpec) UnmarshalJSON ¶
func (s *Camera3DSpec) UnmarshalJSON(data []byte) error
type CameraViewport3DSpec ¶
type CircleCollider2DSpec ¶
type CircleCollider2DSpec struct {
Collider2DSettingsSpec
Offset [2]float64 `json:"offset,omitempty"`
Radius float64 `json:"radius,omitempty"`
}
func NewCircleCollider2DSpec ¶
func NewCircleCollider2DSpec() CircleCollider2DSpec
func (*CircleCollider2DSpec) UnmarshalJSON ¶
func (s *CircleCollider2DSpec) UnmarshalJSON(data []byte) error
type Collider2DSettingsSpec ¶
type Collider2DSettingsSpec struct {
Friction float64 `json:"friction,omitempty"`
Restitution float64 `json:"restitution,omitempty"`
Sensor bool `json:"sensor,omitempty"`
Group int32 `json:"group,omitempty"`
Categories uint64 `json:"categories,omitempty"`
Mask uint64 `json:"mask,omitempty"`
CollisionType uint32 `json:"collisionType,omitempty"`
}
func NewCollider2DSettingsSpec ¶
func NewCollider2DSettingsSpec() Collider2DSettingsSpec
type Collider3DSettingsSpec ¶
type Collider3DSettingsSpec struct {
Friction float64 `json:"friction,omitempty"`
Restitution float64 `json:"restitution,omitempty"`
Sensor bool `json:"sensor,omitempty"`
Group int32 `json:"group,omitempty"`
Categories uint64 `json:"categories,omitempty"`
Mask uint64 `json:"mask,omitempty"`
CollisionType uint32 `json:"collisionType,omitempty"`
}
func NewCollider3DSettingsSpec ¶
func NewCollider3DSettingsSpec() Collider3DSettingsSpec
type CollisionPieceSpec ¶
type CollisionResourceSpec ¶
type CollisionResourceSpec struct {
Cooked *enginephysics.CookedCollision `json:"-"`
Mode enginephysics.CollisionMode `json:"mode"`
Vertices [][3]float64 `json:"vertices,omitempty"`
Indices []uint32 `json:"indices,omitempty"`
Pieces []CollisionPieceSpec `json:"pieces,omitempty"`
}
CollisionResourceSpec is the interchange format for collision geometry exported by an offline baker such as CoACD. The runtime only consumes this deterministic geometry and never invokes the decomposition tool.
Collision resources are kept under resources/ and use a .collision.json suffix. A convex decomposition resource stores one convex piece per entry; piece indices are optional because the hull is reconstructed from support vertices, but are validated when present.
type CompileCache ¶
type CompileCache struct {
// contains filtered or unexported fields
}
CompileCache retains immutable module plans between authoring transactions. Scenes are always rebuilt so changed slots, types and hierarchy are validated. A cache belongs to one sequential compilation owner.
func (*CompileCache) Compile ¶
func (cache *CompileCache) Compile(source fs.FS, root string, definitions []ModID) (*ProjectPlan, error)
type CompoundCollider3DSpec ¶
type CompoundCollider3DSpec struct {
Model string `json:"model,omitempty"`
Collider3DSettingsSpec
}
func NewCompoundCollider3DSpec ¶
func NewCompoundCollider3DSpec() CompoundCollider3DSpec
func (*CompoundCollider3DSpec) UnmarshalJSON ¶
func (s *CompoundCollider3DSpec) UnmarshalJSON(data []byte) error
type ControlSpec ¶
type ConvexHullCollider3DSpec ¶
type ConvexHullCollider3DSpec struct {
Model string `json:"model,omitempty"`
Collider3DSettingsSpec
}
func NewConvexHullCollider3DSpec ¶
func NewConvexHullCollider3DSpec() ConvexHullCollider3DSpec
func (*ConvexHullCollider3DSpec) UnmarshalJSON ¶
func (s *ConvexHullCollider3DSpec) UnmarshalJSON(data []byte) error
type CoordinateSpace ¶
type CoordinateSpace string
const ( CoordinateSpaceWorld CoordinateSpace = "world" CoordinateSpaceUI CoordinateSpace = "ui" )
type CreateProjectOptions ¶
type CreateProjectOptions struct {
Title string
// Used when there is no enclosing go.mod. EngineDirectory selects a local
// engine checkout; EngineVersion selects a published module version.
ModulePath string
EngineDirectory string
EngineVersion string
Width int
Height int
}
CreateProjectOptions configures the authoring scaffold. Module folders and their private resource layouts are created by the module author.
type DirectionalLightSpec ¶
type DirectionalLightSpec struct {
Shadows *ShadowSpec `json:"shadows,omitempty"`
Color string `json:"color"`
Illuminance float32 `json:"illuminance"`
}
func NewDirectionalLightSpec ¶
func NewDirectionalLightSpec() DirectionalLightSpec
func (*DirectionalLightSpec) UnmarshalJSON ¶
func (s *DirectionalLightSpec) UnmarshalJSON(data []byte) error
type EmitterSpec ¶
type EmitterSpec struct {
Particles []string `json:"particles"`
Width float32 `json:"width"`
Height float32 `json:"height"`
Count int `json:"count"`
Rate float32 `json:"rate"`
Lifetime float32 `json:"lifetime"`
SpeedMin float32 `json:"speedMin"`
SpeedMax float32 `json:"speedMax"`
SizeMin float32 `json:"sizeMin"`
SizeMax float32 `json:"sizeMax"`
Direction float32 `json:"direction"`
Spread float32 `json:"spread"`
GravityX float32 `json:"gravityX"`
GravityY float32 `json:"gravityY"`
AlphaStart float32 `json:"alphaStart"`
AlphaEnd float32 `json:"alphaEnd"`
Loop bool `json:"loop"`
}
EmitterSpec is a module component that spawns particles. It carries only emission behaviour; the sprite and colour of each particle come from the elements named by Particles, whose particle components declare textures.
type EngineConfig ¶
type EngineConfig struct {
Features []RuntimeFeatureID `json:"features,omitempty"`
Resources []ResourceID `json:"resources,omitempty"`
ImageDecoders []ImageDecoderID `json:"imageDecoders,omitempty"`
// TextureCompressionExcludes lists project-relative resources that must keep
// their source pixels, for example "resources/ui.png". This is useful for
// pixel-art and other assets where block compression is visibly lossy.
TextureCompressionExcludes []string `json:"textureCompressionExcludes,omitempty"`
// TextureCompression enables build-time block compression. When an engine
// section is present and the field is omitted, project loading defaults it to
// true; set it to false for source-texture builds.
TextureCompression bool `json:"textureCompression,omitempty"`
}
EngineConfig contains explicit project-level runtime and resource choices. The editor turns feature IDs into static InstallSystems calls during code generation.
func ReadEngineConfig ¶
func ReadEngineConfig(source iofs.FS, root string) (EngineConfig, error)
ReadEngineConfig reads the engine section of a project manifest. A project without a manifest reports the zero config, which leaves optional features off.
func (EngineConfig) HasFeature ¶
func (config EngineConfig) HasFeature(id RuntimeFeatureID) bool
HasFeature reports whether a runtime feature is explicitly enabled.
func (EngineConfig) HasResource ¶
func (config EngineConfig) HasResource(id ResourceID) bool
HasResource reports whether a resource family is explicitly enabled.
func (EngineConfig) Validate ¶
func (config EngineConfig) Validate() error
Validate checks IDs, duplicates, and explicit feature dependencies.
type EnvironmentSpec ¶
type FileResource ¶
type FogSpec ¶
type FogSpec struct {
Mode render3d.FogMode `json:"mode"`
Color string `json:"color"`
Brightness float32 `json:"brightness"`
Start float32 `json:"start"`
End float32 `json:"end"`
Density float32 `json:"density"`
}
func NewFogSpec ¶
func NewFogSpec() *FogSpec
func (*FogSpec) UnmarshalJSON ¶
type FontDecoder ¶
FontDecoder decodes a project font selected by an injected resource feature.
type Hooks ¶
type Hooks[T any] struct { Install func(*T, *ScriptContext) error Update func(*T, *ScriptContext) error Input func(*T, *ScriptContext, *scene.InputEventContext) error Destroy func(*T, *ScriptContext) error InputMask scene.InputMask }
Hooks supplies statically typed lifecycle methods. Only registration creates closures; update traversal reuses scene-owned contexts and entity lists.
type IconFeature ¶
type IconFeature[K window.IconDecoder] struct{}
IconFeature installs the decoder used by a project's window.icon setting.
func (IconFeature[K]) ConfigureResources ¶
func (IconFeature[K]) ConfigureResources(context ResourceLoadContext, _ ResourceEntries) error
type ImageDecoder ¶
type ImageDecoder interface {
DecodeImage([]byte, string, graphics.TextureOptions) (*graphics.Texture, error)
}
ImageDecoder decodes scene images selected by an injected resource feature.
type ImageDecoderID ¶
type ImageDecoderID string
ImageDecoderID identifies one statically linked image format decoder.
const ( ImageDecoderGIF ImageDecoderID = "gif" ImageDecoderJPEG ImageDecoderID = "jpeg" ImageDecoderPNG ImageDecoderID = "png" ImageDecoderWebP ImageDecoderID = "webp" )
type ImageFeature ¶
type ImageFeature[I ImageDecoder] struct{}
ImageFeature installs a statically selected image decoder without importing the font, icon, or audio decoder bundles in project/assets.
func (ImageFeature[I]) ConfigureResources ¶
func (ImageFeature[I]) ConfigureResources(context ResourceLoadContext, _ ResourceEntries) error
type LoadProfile ¶
type LoadProfile interface {
// contains filtered or unexported methods
}
LoadProfile is the compile-time boundary for project resource and scene support. Profiles intentionally use unexported methods so applications can select only engine-owned implementations through generic APIs. Each profile installs its resources directly on the bundle so unsupported resource families stay outside its static call graph.
type MeshSpec ¶
type MeshSpec struct {
Primitive string `json:"primitive,omitempty"`
Vertices []MeshVertexSpec `json:"vertices,omitempty"`
Indices []uint32 `json:"indices,omitempty"`
Sectors int `json:"sectors,omitempty"`
Stacks int `json:"stacks,omitempty"`
Size float32 `json:"size,omitempty"`
Radius float32 `json:"radius,omitempty"`
}
type MeshVertexSpec ¶
type ModCamera2DSpec ¶
type ModCollisionSpec ¶
type ModCollisionSpec struct {
Emit string `json:"emit"`
}
Collision publishes solver results without exposing either module's ECS IDs.
type ModComponents ¶
type ModComponents struct {
RigidBody3D *RigidBody3DSpec `json:"rigidBody3D,omitempty"`
AmbientLight *AmbientLightSpec `json:"ambientLight,omitempty"`
Anchor *scene.Anchor `json:"anchor,omitempty"`
Sprite *ModSpriteSpec `json:"sprite,omitempty"`
Trail *SpriteTrailSpec `json:"trail,omitempty"`
Material *ModMaterial2DSpec `json:"material,omitempty"`
Shader *ShaderComponentSpec `json:"shader,omitempty"`
Input *ModInputSpec `json:"input,omitempty"`
SegmentCollider2D *SegmentCollider2DSpec `json:"segmentCollider2D,omitempty"`
Animation *AnimationComponentSpec `json:"animation,omitempty"`
HTML *ModHTMLSpec `json:"html,omitempty"`
Emitter *EmitterSpec `json:"emitter,omitempty"`
Particle *TextureSpec `json:"particle,omitempty"`
Tilemap *TilemapSpec `json:"tilemap,omitempty"`
Layout *engineui.Layout `json:"layout,omitempty"`
TriangleMeshCollider3D *TriangleMeshCollider3DSpec `json:"triangleMeshCollider3D,omitempty"`
Text *TextComponentSpec `json:"text,omitempty"`
Spine *ModSpineSpec `json:"spine,omitempty"`
ConvexHullCollider3D *ConvexHullCollider3DSpec `json:"convexHullCollider3D,omitempty"`
CompoundCollider3D *CompoundCollider3DSpec `json:"compoundCollider3D,omitempty"`
Camera *Camera3DSpec `json:"camera,omitempty"`
Camera2D *ModCamera2DSpec `json:"camera2D,omitempty"`
Model *ModelSpec `json:"model,omitempty"`
DirectionalLight *DirectionalLightSpec `json:"directionalLight,omitempty"`
PointLight *PointLightSpec `json:"pointLight,omitempty"`
SpotLight *SpotLightSpec `json:"spotLight,omitempty"`
AreaLight *AreaLightSpec `json:"areaLight,omitempty"`
RigidBody2D *RigidBody2DSpec `json:"rigidBody2D,omitempty"`
Collision *ModCollisionSpec `json:"collision,omitempty"`
CircleCollider2D *CircleCollider2DSpec `json:"circleCollider2D,omitempty"`
BoxCollider2D *BoxCollider2DSpec `json:"boxCollider2D,omitempty"`
Size []float32 `json:"size,omitempty"`
}
func (ModComponents) ContentFeatures ¶
func (c ModComponents) ContentFeatures() (features ModContentFeatures)
type ModContentFeatures ¶
type ModContentFeatures uint16
const ( ModContentAnimations ModContentFeatures = 1 << iota ModContentLayout ModContentTrail ModContentHTML ModContentParticles ModContentTilemaps ModContentSpine ModContentSpatial ModContentPhysics2D ModContentAll = (ModContentPhysics2D << 1) - 1 )
type ModElementPlan ¶
type ModElementPlan struct {
Spec ModElementSpec
Parent int32
Transform ModTransform
}
type ModElementSpec ¶
type ModElementSpec struct {
Components ModComponents `json:"components,omitzero"`
Visible *bool `json:"visible,omitempty"`
ID string `json:"id"`
Parent string `json:"parent,omitempty"`
Space CoordinateSpace `json:"space,omitempty"`
Transform ModTransformSpec `json:"transform,omitzero"`
}
Elements are private implementation details of one module. Scene messages and placements cannot address them; only the owning behavior can obtain a handle.
type ModHTMLSpec ¶
type ModInputSpec ¶
type ModInstancePlan ¶
type ModInstanceSpec ¶
type ModInstanceSpec struct {
Slots map[string]json.RawMessage `json:"slots,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Visible *bool `json:"visible,omitempty"`
ID string `json:"id"`
Mod ModID `json:"mod"`
Placement ModTransformSpec `json:"placement,omitzero"`
Children []ModInstanceSpec `json:"children,omitempty"`
}
type ModMaterial2D ¶
type ModMaterial2D struct {
Custom [4][4]float32
}
ModMaterial2D keeps material uniforms per instance.
func (ModMaterial2D) Material2D ¶
func (m ModMaterial2D) Material2D() graphics.Material2DData
type ModMaterial2DSpec ¶
type ModMaterial2DSpec struct {
Custom [4][4]float32 `json:"custom,omitzero"`
}
type ModPlan ¶
type ModPlan struct {
Spec ModSpec
ID ModID
Resources []ModResourcePlan
Slots []SlotPlan
Elements []ModElementPlan
Transform ModTransform
}
type ModResourcePlan ¶
type ModResourceSpec ¶
type ModSpec ¶
type ModSpec struct {
Components ModComponents `json:"components,omitzero"`
Resources map[string]ModResourceSpec `json:"resources,omitempty"`
Slots map[string]SlotSpec `json:"slots,omitempty"`
Name string `json:"name,omitempty"`
Space CoordinateSpace `json:"space,omitempty"`
Behavior string `json:"behavior,omitempty"`
Transform ModTransformSpec `json:"transform,omitzero"`
Elements []ModElementSpec `json:"elements,omitempty"`
}
type ModSpineSpec ¶
type ModSpriteSpec ¶
type ModSpriteSpec struct {
Texture *TextureSpec `json:"texture,omitempty"`
Alpha *float32 `json:"alpha,omitempty"`
Color string `json:"color,omitempty"`
Size []float32 `json:"size,omitempty"`
}
type ModTransform ¶
type ModTransformSpec ¶
type ModelAnimationSource ¶
type ModelAnimationSource struct {
Name string `json:"name"`
Tracks []ModelAnimationTrackSource `json:"tracks"`
BlendMode int `json:"blendMode,omitempty"`
Duration float32 `json:"duration"`
}
ModelAnimationSource is a named collection of vector/quaternion keyframe tracks. Paths identify imported nodes; unique node names are also accepted.
type ModelJoint ¶
ModelJoint is an imported skin joint in model-local space.
type ModelMaterialSpec ¶
type ModelMaterialSpec struct {
Shader string `json:"shader,omitempty"`
BaseColor string `json:"baseColor,omitempty"`
Emissive string `json:"emissive,omitempty"`
IOR float32 `json:"ior,omitempty"`
EmissiveStrength float32 `json:"emissiveStrength,omitempty"`
Metallic float32 `json:"metallic,omitempty"`
PerceptualRoughness float32 `json:"roughness,omitempty"`
MetallicSet bool `json:"-"`
RoughnessSet bool `json:"-"`
IORSet bool `json:"-"`
EmissiveStrengthSet bool `json:"-"`
}
func (ModelMaterialSpec) MarshalJSON ¶
func (s ModelMaterialSpec) MarshalJSON() ([]byte, error)
func (*ModelMaterialSpec) UnmarshalJSON ¶
func (s *ModelMaterialSpec) UnmarshalJSON(data []byte) error
type ModelMorphTarget ¶
type ModelMorphTarget struct {
Name string
PositionDelta [][3]float32
NormalDelta [][3]float32
TangentDelta [][3]float32
}
ModelMorphTarget is an imported morph target and its per-vertex deltas.
type ModelNode ¶
ModelNode retains the source node index, hierarchy and initial transforms. Path is the unambiguous animation binding, including for duplicate names.
type ModelPose ¶
type ModelPose struct {
Deformation render3d.Deformation
// contains filtered or unexported fields
}
func (*ModelPose) NodeMatrix ¶
NodeMatrix returns an animated node in model space for weapon/socket attachments.
type ModelPoseClip ¶
type ModelRig ¶
type ModelRig struct {
// contains filtered or unexported fields
}
ModelRig shares immutable hierarchy and animation data between instances. ModelPose owns the per-instance buffers; sampling performs no allocations.
type ModelSkinVertex ¶
ModelSkinVertex contains up to four joint influences for one model vertex.
type ModelSpec ¶
type ModelSpec struct {
Mesh *MeshSpec `json:"mesh,omitempty"`
AnimationPath string `json:"animationPath,omitempty"`
ID string `json:"id"`
Path string `json:"path,omitempty"`
Collision enginephysics.CollisionMode `json:"collision,omitempty"`
CollisionPath string `json:"collisionPath,omitempty"`
Material ModelMaterialSpec `json:"material,omitempty"`
}
func (ModelSpec) CookCollision ¶
func (s ModelSpec) CookCollision(mesh *graphics.Mesh) (enginephysics.CookedCollision, error)
CookCollision converts a render mesh into the immutable collision resource selected by the model's import mode. It is intended for the asset-loading stage; collider synchronization only receives the returned baked value.
type NineSlice ¶
type ParticleSpec ¶
type ParticleSpec struct {
Texture *TextureSpec `json:"texture"`
ID string `json:"id"`
Colors []string `json:"colors"`
Count int `json:"count"`
SpeedMin float32 `json:"speedMin"`
SizeMax float32 `json:"sizeMax"`
Rate float32 `json:"rate"`
Lifetime float32 `json:"lifetime"`
Width float32 `json:"width"`
SpeedMax float32 `json:"speedMax"`
SizeMin float32 `json:"sizeMin"`
Height float32 `json:"height"`
Direction float32 `json:"direction"`
Spread float32 `json:"spread"`
GravityX float32 `json:"gravityX"`
GravityY float32 `json:"gravityY"`
AlphaStart float32 `json:"alphaStart"`
AlphaEnd float32 `json:"alphaEnd"`
Loop bool `json:"loop"`
}
type PointLightSpec ¶
type PointLightSpec struct {
Shadows *PunctualShadowSpec `json:"shadows,omitempty"`
Color string `json:"color"`
Unit graphics.LightUnit `json:"unit"`
Intensity float32 `json:"intensity"`
LuxDistance float32 `json:"luxDistance"`
Range float32 `json:"range"`
Radius float32 `json:"radius"`
}
func NewPointLightSpec ¶
func NewPointLightSpec() PointLightSpec
func (PointLightSpec) Light ¶
func (s PointLightSpec) Light() (render3d.PointLight, error)
func (*PointLightSpec) UnmarshalJSON ¶
func (s *PointLightSpec) UnmarshalJSON(data []byte) error
type PreprocessOptions ¶
type PreprocessOptions struct {
ShaderCompiler ShaderCompiler
// Progress reports the module and asset family about to be compiled.
Progress func(module, asset string, completed, total int)
// TextureEncoder replaces model images with a runtime texture container.
// External glTF images are read during model preprocessing so their material
// sampling options select the same compression profile as embedded images.
TextureEncoder func([]byte, string, graphics.TextureOptions) ([]byte, error)
Root string
ShaderTarget ShaderTarget
}
PreprocessOptions selects the project root and build target for resource compilation.
type PreprocessedFile ¶
type PreprocessedFile struct {
Path string
// SourcePath identifies the source resource's path when Data is generated
// rather than replacing a file already collected from disk.
SourcePath string
Data []byte
SourceSize int
Remove bool
}
PreprocessedFile is a source resource replacement or removal.
func PreprocessManifests ¶
func PreprocessManifests(source iofs.FS, options PreprocessOptions) ([]PreprocessedFile, error)
PreprocessManifests compiles project, resource, catalog, and scene manifests.
func PreprocessModShaders ¶
func PreprocessModShaders(source fs.FS, mod *ModPlan, options PreprocessOptions) ([]PreprocessedFile, error)
PreprocessModShaders compiles element shader components using the module's private filesystem. Sources shared by elements are compiled only once.
func PreprocessModuleAssets ¶
func PreprocessModuleAssets(source fs.FS, plan *ProjectPlan, options PreprocessOptions) ([]PreprocessedFile, error)
PreprocessModuleAssets compiles native asset families from the module plan. Authoring manifests are never loaded here. Paths stay relative to each module until the resulting private files are placed in the project resource package.
type ProjectPlan ¶
type ProjectPlan struct {
Mods []ModPlan
Scenes []ScenePlan
Spec ProjectSpec
Entry uint32
}
Plans contain resolved indices and typed values. JSON bytes are authoring data only; dispatch and slot updates do not need to decode JSON or use any.
func CompileProject ¶
func CompileProject(source fs.FS, root string) (*ProjectPlan, error)
CompileProject reads project, scene, and module documents. Compilation owns allocations; the resulting plans use indices and typed data.
func CompileProjectDefinitions ¶
func CompileProjectDefinitions(source fs.FS, root string, definitions []ModID) (*ProjectPlan, error)
CompileProjectDefinitions also validates definitions already opened by an authoring tool, even when a nested definition has no remaining scene instance.
func CompileProjectDirectory ¶
func CompileProjectDirectory(directory string) (*ProjectPlan, error)
func CreateProjectDirectory ¶
func CreateProjectDirectory(directory string, options CreateProjectOptions) (*ProjectPlan, error)
CreateProjectDirectory creates the module-system project entry. Existing entry files are never overwritten, including user main.go. It returns the same compiled representation used by the authoring validator.
func OpenModuleProject ¶
func OpenModuleProject() (*ProjectPlan, fs.FS, error)
OpenModuleProject uses the mounted package source in published applications. Authoring builds without a package mount read the current project directory.
func ReadModulePlan ¶
func ReadModulePlan(source fs.FS) (*ProjectPlan, error)
func (*ProjectPlan) RuntimeFeatures ¶
func (p *ProjectPlan) RuntimeFeatures() []RuntimeFeatureID
RuntimeFeatures includes explicitly selected systems and systems required by used content. Unreferenced definitions do not add features to the executable.
type ProjectSpec ¶
type ProjectSpec struct {
Types map[ValueType]ValueSchema `json:"types,omitempty"`
Entry SceneID `json:"entry"`
ClearColor string `json:"clearColor,omitempty"`
Engine EngineConfig `json:"engine,omitempty"`
Scenes []SceneID `json:"scenes,omitempty"`
Viewport SizeConfig `json:"viewport,omitempty"`
Window WindowConfig `json:"window,omitempty"`
}
ProjectSpec selects the entry and scene order. Scene files live in resources/scenes; compilation discovers additional scenes in that directory.
type PunctualShadowSpec ¶
type PunctualShadowSpec struct {
Resolution int `json:"resolution"`
Near float32 `json:"near"`
Bias float32 `json:"bias"`
NormalBias float32 `json:"normalBias"`
}
func NewPunctualShadowSpec ¶
func NewPunctualShadowSpec() *PunctualShadowSpec
func (PunctualShadowSpec) Settings ¶
func (s PunctualShadowSpec) Settings() render3d.PunctualShadowSettings
func (*PunctualShadowSpec) UnmarshalJSON ¶
func (s *PunctualShadowSpec) UnmarshalJSON(data []byte) error
type Render2DAnimationsProfile ¶
type Render2DAnimationsProfile struct{}
Render2DAnimationsProfile adds the 2D animator to Render2DProfile.
type Render2DProfile ¶
type Render2DProfile struct{}
Render2DProfile is the smallest scene profile. It materializes only the 2D transform, sprite, and text components used by the renderer.
type ResourceComponentSpec ¶
type ResourceComponentSpec struct {
Resource string `json:"resource"`
}
type ResourceEntries ¶
type ResourceEntries struct {
Audio []FileResource
}
ResourceEntries is the manifest subset handled by an injected feature.
type ResourceFeature ¶
type ResourceFeature interface {
ConfigureResources(ResourceLoadContext, ResourceEntries) error
}
ResourceFeature provides project resource implementations selected by the application. Feature types are composed at the generic loading boundary so unused implementations are not reachable from the final binary.
type ResourceFeatureSet ¶
type ResourceFeatureSet[A, B ResourceFeature] struct{}
ResourceFeatureSet composes two statically selected resource features. A nil interface type argument is skipped so callers may use ResourceFeature when a slot is intentionally empty.
func (ResourceFeatureSet[A, B]) ConfigureResources ¶
func (ResourceFeatureSet[A, B]) ConfigureResources(context ResourceLoadContext, entries ResourceEntries) error
type ResourceID ¶
type ResourceID string
ResourceID identifies one resource family enabled by a project.
const ( ResourceImages ResourceID = "images" ResourceFonts ResourceID = "fonts" ResourceAudio ResourceID = "audio" ResourceVideos ResourceID = "videos" ResourceParticles ResourceID = "particles" ResourceTilemaps ResourceID = "tilemaps" ResourceModels ResourceID = "models" ResourceSpine ResourceID = "spine" ResourceShaders ResourceID = "shaders" ResourceHTML ResourceID = "html" )
type ResourceLoadContext ¶
type ResourceLoadContext struct {
// contains filtered or unexported fields
}
ResourceLoadContext gives a feature controlled access to the resource store.
func (ResourceLoadContext) OpenBlob ¶
func (context ResourceLoadContext) OpenBlob(path string) (*resource.Blob, error)
OpenBlob opens and pins a path relative to the project directory. Ownership of the returned Blob is transferred to the caller.
func (ResourceLoadContext) ReadFile ¶
func (context ResourceLoadContext) ReadFile(path string) ([]byte, error)
ReadFile reads a path relative to the project directory.
func (ResourceLoadContext) RegisterNamedResource ¶
func (context ResourceLoadContext) RegisterNamedResource[T any](kind, id string, registration ResourceRegistration[T]) error
RegisterNamedResource installs one lazily loaded feature resource. The concrete resource type remains outside the project core package.
func (ResourceLoadContext) SetFontDecoder ¶
func (context ResourceLoadContext) SetFontDecoder(decoder FontDecoder)
SetFontDecoder configures the font decoder used by project font resources.
func (ResourceLoadContext) SetImageDecoder ¶
func (context ResourceLoadContext) SetImageDecoder(decoder ImageDecoder)
SetImageDecoder configures the image decoder used by scene sprites and atlases. Passing nil disables image resources for this project.
func (ResourceLoadContext) SetWindowIconDecoder ¶
func (context ResourceLoadContext) SetWindowIconDecoder(decoder window.IconDecoder)
SetWindowIconDecoder configures the decoder used when a project declares a window icon.
type ResourceRegistration ¶
ResourceRegistration defines both halves of a named resource lifecycle. Dispose may be nil for values that own no explicit native resources.
type ResourceStatistics ¶
ResourceStatistics reports aggregate behavior of the typed runtime caches.
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
func OpenModResources ¶
func OpenModResources(source fs.FS, mod *ModPlan, feature ResourceFeature) (_ *Resources, resultErr error)
OpenModResources installs only this definition's private resource namespace. The scoped filesystem also confines references in HTML, atlases and models. Instances share this store, while mutable ECS components remain per instance.
func (*Resources) AppendModContent ¶
func (r *Resources) AppendModContent(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContent2D ¶
func (r *Resources) AppendModContent2D(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentAnimation ¶
func (r *Resources) AppendModContentAnimation(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentHTML ¶
func (r *Resources) AppendModContentHTML(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentLayout ¶
func (r *Resources) AppendModContentLayout(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentParticles ¶
func (r *Resources) AppendModContentParticles(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentPhysics2D ¶
func (r *Resources) AppendModContentPhysics2D(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentSpatial ¶
func (r *Resources) AppendModContentSpatial(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentSpine ¶
func (r *Resources) AppendModContentSpine(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentTilemaps ¶
func (r *Resources) AppendModContentTilemaps(b *ecs.Bundle, c ModComponents) error
func (*Resources) AppendModContentTrail ¶
func (r *Resources) AppendModContentTrail(b *ecs.Bundle, c ModComponents) error
func (*Resources) AtlasWithOptions ¶
func (*Resources) HTML ¶
HTML returns the source of a named HTML resource, loaded lazily on first use.
func (*Resources) LoadNamedResource ¶
LoadNamedResource returns a lazily loaded resource registered by a feature.
func (*Resources) Material2DShader ¶
func (r *Resources) Material2DShader(id string) (*graphics.Material2DShader, error)
func (*Resources) MeshShader ¶
func (r *Resources) MeshShader(id string) (*graphics.MeshShader, error)
func (*Resources) ModContent ¶
func (r *Resources) ModContent(c ModComponents) (ecs.Bundle, error)
ModContent builds private component values; it has no scene/entity registry.
func (*Resources) ModelRig ¶
ModelRig reads a model already loaded by this module's private content.
func (*Resources) ParseColor ¶
func (*Resources) Shader ¶
func (r *Resources) Shader(id string) (render.ShaderDescriptor, error)
Shader returns the descriptor for a named shader resource. The source files are read only on first access.
func (*Resources) Statistics ¶
func (r *Resources) Statistics() ResourceStatistics
type RigidBody2DSpec ¶
type RigidBody2DSpec struct {
Type string `json:"type,omitempty"`
Mass float64 `json:"mass,omitempty"`
Inertia float64 `json:"inertia,omitempty"`
GravityScale float64 `json:"gravityScale,omitempty"`
LinearDamping float64 `json:"linearDamping,omitempty"`
AngularDamping float64 `json:"angularDamping,omitempty"`
Velocity [2]float64 `json:"velocity,omitempty"`
AngularVelocity float64 `json:"angularVelocity,omitempty"`
FixedRotation bool `json:"fixedRotation,omitempty"`
}
func NewRigidBody2DSpec ¶
func NewRigidBody2DSpec() RigidBody2DSpec
func (*RigidBody2DSpec) UnmarshalJSON ¶
func (s *RigidBody2DSpec) UnmarshalJSON(data []byte) error
type RigidBody3DSpec ¶
type RigidBody3DSpec struct {
Type string `json:"type,omitempty"`
Mass float64 `json:"mass,omitempty"`
Inertia float64 `json:"inertia,omitempty"`
GravityScale float64 `json:"gravityScale,omitempty"`
LinearDamping float64 `json:"linearDamping,omitempty"`
AngularDamping float64 `json:"angularDamping,omitempty"`
Velocity [3]float64 `json:"velocity,omitempty"`
AngularVelocity [3]float64 `json:"angularVelocity,omitempty"`
FixedRotation bool `json:"fixedRotation,omitempty"`
}
func NewRigidBody3DSpec ¶
func NewRigidBody3DSpec() RigidBody3DSpec
func (*RigidBody3DSpec) UnmarshalJSON ¶
func (s *RigidBody3DSpec) UnmarshalJSON(data []byte) error
type RuntimeFeatureID ¶
type RuntimeFeatureID string
RuntimeFeatureID identifies one engine-owned runtime feature in a project manifest. IDs are persisted instead of Go type names so manifests remain stable when a feature's implementation changes.
const ( FeatureRender2D RuntimeFeatureID = "render2d" FeatureRender3D RuntimeFeatureID = "render3d" FeatureInput2D RuntimeFeatureID = "input2d" FeatureAnimations2D RuntimeFeatureID = "animations2d" FeatureSpriteTrails2D RuntimeFeatureID = "sprite-trails2d" FeatureParticles2D RuntimeFeatureID = "particles2d" FeatureTilemaps2D RuntimeFeatureID = "tilemaps2d" FeatureSpine2D RuntimeFeatureID = "spine2d" FeaturePhysics2D RuntimeFeatureID = "physics2d" FeaturePhysics3D RuntimeFeatureID = "physics3d" FeatureUIControls RuntimeFeatureID = "ui-controls" FeatureUIWidgets RuntimeFeatureID = "ui-widgets" FeatureUITextInput RuntimeFeatureID = "ui-text-input" FeatureUIMarkdown RuntimeFeatureID = "ui-markdown" FeatureUIHTML RuntimeFeatureID = "ui-html" FeatureWebView RuntimeFeatureID = "webview" FeatureFileDialogs RuntimeFeatureID = "file-dialogs" )
func (RuntimeFeatureID) Dependencies ¶ added in v0.1.10
func (id RuntimeFeatureID) Dependencies() []RuntimeFeatureID
Dependencies lists the runtime features required in a project's engine configuration.
type SSAOSpec ¶
type SSAOSpec struct {
Radius float32 `json:"radius"`
Bias float32 `json:"bias"`
Strength float32 `json:"strength"`
ResolutionScale float32 `json:"resolutionScale"`
Samples int `json:"samples"`
}
A nil camera SSAO spec disables the depth prepass.
func NewSSAOSpec ¶
func NewSSAOSpec() *SSAOSpec
func (*SSAOSpec) Settings ¶
func (s *SSAOSpec) Settings() render3d.SSAOSettings
func (*SSAOSpec) UnmarshalJSON ¶
type SSRSpec ¶
type SSRSpec struct {
MaxDistance float32 `json:"maxDistance"`
Thickness float32 `json:"thickness"`
Strength float32 `json:"strength"`
MaxRoughness float32 `json:"maxRoughness"`
EdgeFade float32 `json:"edgeFade"`
Steps int `json:"steps"`
}
A nil camera SSR spec disables screen-space reflection targets.
func NewSSRSpec ¶
func NewSSRSpec() *SSRSpec
func (*SSRSpec) Settings ¶
func (s *SSRSpec) Settings() render3d.SSRSettings
func (*SSRSpec) UnmarshalJSON ¶
type SceneCatalogEntry ¶
type SceneComponent ¶
type SceneComponent string
const ( SceneComponentSprite SceneComponent = "sprite" SceneComponentAnimation SceneComponent = "animation" SceneComponentText SceneComponent = "text" SceneComponentHTML SceneComponent = "html" SceneComponentParticle SceneComponent = "particle" SceneComponentTilemap SceneComponent = "tilemap" SceneComponentSpine SceneComponent = "spine" SceneComponentModel SceneComponent = "model" SceneComponentCamera SceneComponent = "camera" SceneComponentAmbientLight SceneComponent = "ambientlight" SceneComponentDirectionalLight SceneComponent = "directionallight" SceneComponentPointLight SceneComponent = "pointlight" SceneComponentSpotLight SceneComponent = "spotlight" SceneComponentAreaLight SceneComponent = "arealight" SceneComponentRigidBody2D SceneComponent = "rigidbody2d" SceneComponentCircleCollider2D SceneComponent = "circlecollider2d" SceneComponentBoxCollider2D SceneComponent = "boxcollider2d" SceneComponentSegmentCollider2D SceneComponent = "segmentcollider2d" SceneComponentRigidBody3D SceneComponent = "rigidbody3d" SceneComponentTriangleMeshCollider3D SceneComponent = "trianglemeshcollider3d" SceneComponentConvexHullCollider3D SceneComponent = "convexhullcollider3d" SceneComponentCompoundCollider3D SceneComponent = "compoundcollider3d" SceneComponentLayout SceneComponent = "layout" SceneComponentWidget SceneComponent = "widget" )
type SceneComponents ¶
type SceneComponents struct {
Sprite *SpriteComponentSpec `json:"sprite,omitempty"`
Animation *AnimationComponentSpec `json:"animation,omitempty"`
Text *TextComponentSpec `json:"text,omitempty"`
HTML *ResourceComponentSpec `json:"html,omitempty"`
Particle *ResourceComponentSpec `json:"particle,omitempty"`
Tilemap *ResourceComponentSpec `json:"tilemap,omitempty"`
Spine *SpineComponentSpec `json:"spine,omitempty"`
Model *ResourceComponentSpec `json:"model,omitempty"`
Camera *Camera3DSpec `json:"camera,omitempty"`
AmbientLight *AmbientLightSpec `json:"ambientLight,omitempty"`
DirectionalLight *DirectionalLightSpec `json:"directionalLight,omitempty"`
PointLight *PointLightSpec `json:"pointLight,omitempty"`
SpotLight *SpotLightSpec `json:"spotLight,omitempty"`
AreaLight *AreaLightSpec `json:"areaLight,omitempty"`
RigidBody2D *RigidBody2DSpec `json:"rigidBody2D,omitempty"`
CircleCollider2D *CircleCollider2DSpec `json:"circleCollider2D,omitempty"`
BoxCollider2D *BoxCollider2DSpec `json:"boxCollider2D,omitempty"`
SegmentCollider2D *SegmentCollider2DSpec `json:"segmentCollider2D,omitempty"`
RigidBody3D *RigidBody3DSpec `json:"rigidBody3D,omitempty"`
TriangleMeshCollider3D *TriangleMeshCollider3DSpec `json:"triangleMeshCollider3D,omitempty"`
ConvexHullCollider3D *ConvexHullCollider3DSpec `json:"convexHullCollider3D,omitempty"`
CompoundCollider3D *CompoundCollider3DSpec `json:"compoundCollider3D,omitempty"`
}
func Components ¶
func Components(values ...SceneComponent) SceneComponents
func (*SceneComponents) Add ¶
func (c *SceneComponents) Add(component SceneComponent)
Add attaches one component without changing components already attached to the node.
func (SceneComponents) Clone ¶
func (components SceneComponents) Clone() SceneComponents
Clone returns an independent authoring copy, including nested animation and texture data.
func (SceneComponents) Empty ¶
func (c SceneComponents) Empty() bool
func (SceneComponents) Has ¶
func (c SceneComponents) Has(component SceneComponent) bool
Has reports whether the authored component set contains component. Scene nodes are component compositions; no component is implicitly selected as a node kind.
func (SceneComponents) Has2D ¶
func (c SceneComponents) Has2D() bool
func (SceneComponents) Has3D ¶
func (c SceneComponents) Has3D() bool
func (SceneComponents) HasPhysics2D ¶
func (c SceneComponents) HasPhysics2D() bool
func (SceneComponents) HasPhysics3D ¶
func (c SceneComponents) HasPhysics3D() bool
func (SceneComponents) IsZero ¶
func (c SceneComponents) IsZero() bool
func (SceneComponents) VisualsEmpty ¶
func (c SceneComponents) VisualsEmpty() bool
type SceneExitPolicy ¶
type SceneExitPolicy string
SceneExitPolicy controls the departing scene's lifetime. The zero value uses the switch request's Retain setting, which defaults to destruction.
const ( SceneExitDestroy SceneExitPolicy = "destroy" SceneExitRetain SceneExitPolicy = "retain" )
type SceneInstance ¶
type SceneInstance struct {
World *ecs.World
Entities map[string]ecs.Entity
EntityIDs map[ecs.Entity]string
Roots []ecs.Entity
// contains filtered or unexported fields
}
func (*SceneInstance) ApplyNode ¶
func (s *SceneInstance) ApplyNode(spec SceneNodeSpec) error
func (*SceneInstance) ApplyNodeUnder ¶
func (s *SceneInstance) ApplyNodeUnder(parentID string, spec SceneNodeSpec) error
ApplyNodeUnder creates a missing node under an existing parent. Updating an existing node preserves its current hierarchy.
func (*SceneInstance) BindControl ¶
func (scene *SceneInstance) BindControl[T any](id string, component T) error
BindControl installs an explicitly selected runtime behavior on an authored control root.
func (*SceneInstance) BindControlEntity ¶
func (scene *SceneInstance) BindControlEntity[T any](entity ecs.Entity, component T) error
BindControlEntity installs behavior on a runtime entity created from a scene template. It is the entity-based counterpart to BindControl.
func (*SceneInstance) BindScripts ¶
func (s *SceneInstance) BindScripts() error
BindScripts binds the scene's authored script components. It is idempotent for one scene generation and is also used after a scene hierarchy rebuild.
func (*SceneInstance) BoundsByID ¶
func (*SceneInstance) CloneChildrenUnder ¶
func (s *SceneInstance) CloneChildrenUnder(parent ecs.Entity, templateID, prefix string) (map[string]ecs.Entity, error)
CloneChildrenUnder clones the authored children of a scene node under an existing runtime entity. The cloned nodes get a unique ID prefix and remain part of the scene so their authored UI composition can be bound normally.
func (*SceneInstance) CloneNodeUnder ¶
func (s *SceneInstance) CloneNodeUnder(parent ecs.Entity, templateID, prefix string) (map[string]ecs.Entity, error)
CloneNodeUnder clones one authored scene node and its descendants under an existing entity. It is useful for data-driven UI that keeps one editable item template in the scene and creates the remaining items at runtime.
func (*SceneInstance) CloneRootsUnder ¶
func (s *SceneInstance) CloneRootsUnder(parent ecs.Entity, prefix string) (map[string]ecs.Entity, error)
CloneRootsUnder clones all authored root nodes under an existing runtime entity. The cloned nodes get a unique ID prefix and remain part of the scene so their authored UI composition can be bound normally.
func (*SceneInstance) Component ¶
func (scene *SceneInstance) Component[T any](id string) (*T, error)
Component resolves a named scene node and acquires write access. Use RequireComponent once at installation and slot access for repeated updates.
func (*SceneInstance) DispatchInputScripts ¶
func (s *SceneInstance) DispatchInputScripts(context *ecs.SystemContext, reader *ecs.MessageReader[scene.InputEvent]) error
DispatchInputScripts delivers global input to every bound input script and routes pointer input only to the event target or its bubbling path.
func (*SceneInstance) Dispose ¶
func (s *SceneInstance) Dispose()
Dispose despawns every entity owned by the scene.
func (*SceneInstance) EntityBySlot ¶
func (s *SceneInstance) EntityBySlot(slot ecs.EntitySlot) (ecs.Entity, bool)
EntityBySlot resolves a slot created from this scene's world without a string lookup. It returns false for stale entities and slots from another world.
func (*SceneInstance) MustEntity ¶
func (s *SceneInstance) MustEntity(id string) ecs.Entity
func (*SceneInstance) MustEntityAt ¶
func (s *SceneInstance) MustEntityAt(path string) ecs.Entity
func (*SceneInstance) MustSlot ¶
func (s *SceneInstance) MustSlot(id string) ecs.EntitySlot
MustSlot is the panic-on-error form of Slot for setup code.
func (*SceneInstance) Path ¶
func (s *SceneInstance) Path(id string) string
func (*SceneInstance) Pick ¶
func (s *SceneInstance) Pick(worldPosition, viewportPosition mgl32.Vec2) (string, bool)
func (*SceneInstance) RefreshTransforms ¶
func (s *SceneInstance) RefreshTransforms() error
func (*SceneInstance) RemoveNodes ¶
func (s *SceneInstance) RemoveNodes(ids ...string) int
RemoveNodes despawns the requested game objects and their ECS descendants.
func (*SceneInstance) RenderItems ¶
func (s *SceneInstance) RenderItems() []SceneRenderItem
func (*SceneInstance) ReplaceNodes ¶
func (s *SceneInstance) ReplaceNodes(specs []SceneNodeSpec) error
ReplaceNodes replaces the authored scene hierarchy while retaining the scene world and loaded project resources.
func (*SceneInstance) RequireComponent ¶
func (scene *SceneInstance) RequireComponent[T any](id string) (ecs.EntitySlot, error)
RequireComponent validates a named node without marking its component changed. The returned slot rejects retired entities and slots used in another world.
func (*SceneInstance) Resources ¶
func (s *SceneInstance) Resources() *Resources
Resources returns the resources owned by the scene's project bundle.
func (*SceneInstance) SceneID ¶
func (s *SceneInstance) SceneID() SceneID
func (*SceneInstance) SetModelResource ¶
func (s *SceneInstance) SetModelResource(spec ModelSpec) error
func (*SceneInstance) SetParticleResource ¶
func (s *SceneInstance) SetParticleResource(spec ParticleSpec) error
func (*SceneInstance) SetScriptRegistry ¶
func (s *SceneInstance) SetScriptRegistry(registry ScriptRegistry) error
SetScriptRegistry installs the registry used by this scene and binds all currently authored script components. Calling it again replaces bindings using the new registry. A binding error leaves the scene unbound.
func (*SceneInstance) SetSpineResource ¶
func (s *SceneInstance) SetSpineResource(spec SpineSpec) error
func (*SceneInstance) SetTilemapResource ¶
func (s *SceneInstance) SetTilemapResource(spec TilemapSpec) error
func (*SceneInstance) Slot ¶
func (s *SceneInstance) Slot(id string) (ecs.EntitySlot, error)
Slot resolves an authored or runtime entity name once into a generation checked lookup handle. Reuse the returned slot in frame code instead of rebuilding string IDs for every access.
func (*SceneInstance) Switch ¶
func (s *SceneInstance) Switch(id SceneID) error
func (*SceneInstance) TransformMatrix2D ¶
TransformMatrix2D returns the resolved matrix for a world or UI entity.
func (*SceneInstance) UpdateScripts ¶
func (s *SceneInstance) UpdateScripts(context *ecs.SystemContext) error
UpdateScripts runs script types in registry order and their bound entities in ascending handle order. Typed queries visit only this scene's entity lists; the hot loop uses no string lookup and reuses contexts at each call depth.
type SceneNodeSpec ¶
type SceneNodeSpec struct {
Components SceneComponents `json:"components,omitzero"`
Control *ControlSpec `json:"control,omitempty"`
Layout *engineui.Layout `json:"layout,omitempty"`
Widget *engineui.Widget `json:"widget,omitempty"`
Visible *bool `json:"visible,omitempty"`
ID string `json:"id"`
CoordinateSpace CoordinateSpace `json:"coordinateSpace,omitempty"`
TargetCamera string `json:"targetCamera,omitempty"`
Scripts []ScriptComponentSpec `json:"scripts,omitempty"`
Children []SceneNodeSpec `json:"children,omitempty"`
RenderLayers []uint `json:"renderLayers,omitempty"`
Height int `json:"height"`
Width int `json:"width"`
Order int `json:"order,omitempty"`
Anchor scene.Anchor `json:"anchor"`
RotationY float32 `json:"rotationY,omitempty"`
Alpha float32 `json:"alpha,omitempty"`
ScaleY float32 `json:"scaleY,omitempty"`
Rotation float32 `json:"rotation,omitempty"`
RotationX float32 `json:"rotationX,omitempty"`
Z float32 `json:"z,omitempty"`
RotationZ float32 `json:"rotationZ,omitempty"`
ScaleX float32 `json:"scaleX,omitempty"`
X float32 `json:"x"`
Y float32 `json:"y"`
ScaleZ float32 `json:"scaleZ,omitempty"`
BlockInput bool `json:"blockInput,omitempty"`
PassThrough bool `json:"passThrough,omitempty"`
Disabled bool `json:"disabled,omitempty"`
}
SceneNodeSpec is the authoring representation of one entity in a scene. Runtime code operates on ecs.Entity values produced from these nodes.
func (SceneNodeSpec) Has3DComponents ¶
func (s SceneNodeSpec) Has3DComponents() bool
func (SceneNodeSpec) HasComponent ¶
func (s SceneNodeSpec) HasComponent(component SceneComponent) bool
HasComponent reports whether the node contains component.
func (SceneNodeSpec) IsEmpty ¶
func (s SceneNodeSpec) IsEmpty() bool
func (*SceneNodeSpec) UnmarshalJSON ¶
func (s *SceneNodeSpec) UnmarshalJSON(data []byte) error
type ScenePlan ¶
type ScenePlan struct {
ID SceneID
Spec SceneSpec
Instances []ModInstancePlan
Transform ModTransform
}
type ScenePreloader ¶
type ScenePreloader struct {
// contains filtered or unexported fields
}
ScenePreloader incrementally builds a scene in the active world. Its nodes remain hidden and its cameras inactive until Activate is called.
func (*ScenePreloader) Activate ¶
func (p *ScenePreloader) Activate(current *SceneInstance) error
Activate replaces current with this already-built scene without spawning it a second time. Both scenes must belong to the same world.
func (*ScenePreloader) Advance ¶
func (p *ScenePreloader) Advance(budget time.Duration) (bool, error)
Advance builds scene nodes until the supplied time budget is exhausted. A non-positive budget still completes one unit of work so callers always make progress in deterministic tests.
func (*ScenePreloader) AdvanceFor ¶
func (p *ScenePreloader) AdvanceFor(device *render.Device, budget graphics.UploadBudget) (ready bool, err error)
AdvanceFor commits CPU results and uploads on the caller's render thread. Reading and decoding continue on the worker while this method returns.
func (*ScenePreloader) CPUReady ¶
func (p *ScenePreloader) CPUReady() bool
func (*ScenePreloader) Discard ¶
func (p *ScenePreloader) Discard()
Discard removes the hidden scene when the preload is no longer needed.
func (*ScenePreloader) GPUReadyFor ¶
func (p *ScenePreloader) GPUReadyFor(device *render.Device) bool
func (*ScenePreloader) Ready ¶
func (p *ScenePreloader) Ready() bool
Ready reports whether construction, resource loading, and static text measurement have completed, and uploads are ready for the owning world's frame device.
type SceneRenderItem ¶
type SceneSpec ¶
type SceneSpec struct {
Behavior string `json:"behavior,omitempty"`
// ExitPolicy overrides the switch's Retain setting when set. Overlays
// always retain their background scene until it is explicitly disposed.
ExitPolicy SceneExitPolicy `json:"exitPolicy,omitempty"`
Modules []ModInstanceSpec `json:"modules"`
Transform ModTransformSpec `json:"transform,omitzero"`
}
type ScriptBinding ¶
type ScriptBinding struct {
Bind func(*ScriptContext, ScriptComponentSpec) error
Update func(*ScriptContext) error
Input func(*ScriptContext, *scene.InputEventContext) error
Destroy func(*ScriptContext) error
Remove func(*ScriptContext) error
Name string
// InputMask limits which input categories reach Input. Zero subscribes to all categories.
InputMask scene.InputMask
}
ScriptBinding is the lifecycle bridge produced by Script for a component type. Bind installs the typed component and invokes its install hook. Update, Input and Destroy are optional. Remove clears the typed component when a binding is replaced while a scene remains alive.
type ScriptComponentSpec ¶
type ScriptComponentSpec struct {
Values map[string]json.RawMessage `json:"values,omitempty"`
Name string `json:"name"`
}
ScriptComponentSpec describes one user-authored script component attached to a scene node. Values are kept as JSON so the editor can round-trip fields discovered from the user's Go source without coupling the project package to that source package.
func (ScriptComponentSpec) DecodeScriptValues ¶
func (spec ScriptComponentSpec) DecodeScriptValues[T any](target *T) error
DecodeScriptValues applies editor-authored values to a typed script value. This is only used while a scene is instantiated; generated update paths do not use JSON or reflection.
type ScriptContext ¶
type ScriptContext struct {
Scene *SceneInstance
World *ecs.World
Commands *ecs.Commands
Entity ecs.Entity
// contains filtered or unexported fields
}
ScriptContext is the per-call context passed to a script component. Entity is set to the entity currently being processed by the generated script system. The context value must not be retained across callbacks.
func (*ScriptContext) ListenInput ¶
func (context *ScriptContext) ListenInput(target ecs.Entity) error
ListenInput routes input events from target to the script currently being installed. Registrations are removed with the owning script.
type ScriptRegistry ¶
type ScriptRegistry struct {
// contains filtered or unexported fields
}
ScriptRegistry contains generated script bindings in deterministic order.
func NewScriptRegistry ¶
func NewScriptRegistry(bindings ...ScriptBinding) ScriptRegistry
NewScriptRegistry creates a registry from generated bindings.
func (ScriptRegistry) Empty ¶
func (r ScriptRegistry) Empty() bool
Empty reports whether the registry contains no generated script bindings.
func (ScriptRegistry) InputMask ¶
func (r ScriptRegistry) InputMask() scene.InputMask
InputMask reports the input categories handled by registered scripts.
type SegmentCollider2DSpec ¶
type SegmentCollider2DSpec struct {
Collider2DSettingsSpec
Start [2]float64 `json:"start"`
End [2]float64 `json:"end"`
Radius float64 `json:"radius,omitempty"`
}
func NewSegmentCollider2DSpec ¶
func NewSegmentCollider2DSpec() SegmentCollider2DSpec
func (*SegmentCollider2DSpec) UnmarshalJSON ¶
func (s *SegmentCollider2DSpec) UnmarshalJSON(data []byte) error
type ShaderCompileRequest ¶
type ShaderCompileRequest struct {
ID string
SourcePath string
Source []byte
Target ShaderTarget
}
type ShaderCompileResult ¶
type ShaderCompiler ¶
type ShaderCompiler interface {
CompileShader(ShaderCompileRequest) (ShaderCompileResult, error)
}
ShaderCompiler converts one WGSL module into the native representation for a single build target. The compiler is invoked only during preprocessing; runtime packages contain the returned native bytes.
type ShaderComponentSpec ¶
type ShaderComponentSpec struct {
WGSLVertex string `json:"wgslVertex,omitempty"`
WGSLFragment string `json:"wgslFragment,omitempty"`
Compiled ShaderSources `json:"-"`
Custom [4][4]float32 `json:"custom,omitzero"`
}
ShaderComponentSpec authors WGSL stages and per-element uniforms. Compiled is generated by the build tools and retained only in binary plans.
func (ShaderComponentSpec) HasSource ¶
func (s ShaderComponentSpec) HasSource() bool
func (ShaderComponentSpec) SourcePaths ¶
func (s ShaderComponentSpec) SourcePaths() [2]string
type ShaderSources ¶
type ShaderSources struct {
DirectXVertex string `json:"directXVertex,omitempty"`
DirectXFragment string `json:"directXFragment,omitempty"`
WGSLVertex string `json:"wgslVertex,omitempty"`
WGSLFragment string `json:"wgslFragment,omitempty"`
VulkanVertex string `json:"vulkanVertex,omitempty"`
VulkanFragment string `json:"vulkanFragment,omitempty"`
Metal string `json:"metal,omitempty"`
WebGL2Vertex string `json:"webGL2Vertex,omitempty"`
WebGL2Fragment string `json:"webGL2Fragment,omitempty"`
WebGPUVertex string `json:"webGPUVertex,omitempty"`
WebGPUFragment string `json:"webGPUFragment,omitempty"`
WebGL2Generated bool `json:"webGL2Generated,omitempty"`
}
ShaderSources holds the source paths used by shader compilation and loading.
func (ShaderSources) HasSource ¶
func (s ShaderSources) HasSource() bool
func (ShaderSources) SourcePaths ¶
func (s ShaderSources) SourcePaths() [11]string
func (ShaderSources) Validate ¶
func (s ShaderSources) Validate() error
type ShaderSpec ¶
type ShaderSpec struct {
ID string `json:"id"`
ShaderSources
}
ShaderSpec maps one named shader resource to the native source files used by Onix's render backends. Missing stages inherit the built-in pipeline stage.
func (ShaderSpec) Validate ¶
func (s ShaderSpec) Validate() error
type ShaderTarget ¶
type ShaderTarget uint8
const ( ShaderTargetAll ShaderTarget = iota ShaderTargetVulkan ShaderTargetMetal ShaderTargetWebGL2 ShaderTargetWebGPU ShaderTargetDirectX )
func (ShaderTarget) String ¶
func (target ShaderTarget) String() string
type ShadowSpec ¶
type ShadowSpec struct {
Resolution int `json:"resolution"`
Radius float32 `json:"radius"`
Depth float32 `json:"depth"`
Bias float32 `json:"bias"`
NormalBias float32 `json:"normalBias"`
Cascades int `json:"cascades,omitempty"`
Distance float32 `json:"distance,omitempty"`
SplitLambda float32 `json:"splitLambda,omitempty"`
CascadeBlend float32 `json:"cascadeBlend,omitempty"`
}
func NewShadowSpec ¶
func NewShadowSpec() *ShadowSpec
func (ShadowSpec) Settings ¶
func (s ShadowSpec) Settings() render3d.ShadowSettings
func (*ShadowSpec) UnmarshalJSON ¶
func (s *ShadowSpec) UnmarshalJSON(data []byte) error
type SizeConfig ¶
type SizeConfig struct {
Mode window.ViewportMode `json:"mode,omitempty"`
Width int `json:"width"`
Height int `json:"height"`
}
type SlotFieldValue ¶
type SlotPlan ¶
type SlotPlan struct {
Name string
Type ValueType
Default SlotValue
Writable bool
Placement ModTransform
}
type SlotSpec ¶
type SlotSpec struct {
Type ValueType `json:"type"`
Default json.RawMessage `json:"default,omitempty"`
Writable *bool `json:"writable,omitempty"`
Placement ModTransformSpec `json:"placement,omitzero"`
}
type SpineComponentSpec ¶
type SpineComponentSpec struct {
Resource string `json:"resource"`
Animation string `json:"animation,omitempty"`
Skin string `json:"skin,omitempty"`
Loop bool `json:"loop"`
Speed float32 `json:"speed,omitempty"`
}
func (*SpineComponentSpec) UnmarshalJSON ¶
func (s *SpineComponentSpec) UnmarshalJSON(data []byte) error
type SpineSpec ¶
type SpineSpec struct {
ID string `json:"id"`
Skeleton string `json:"skeleton"`
Atlas string `json:"atlas"`
Texture string `json:"texture"`
}
SpineSpec groups the three files that form one Spine export.
type SpotLightSpec ¶
type SpotLightSpec struct {
Shadows *PunctualShadowSpec `json:"shadows,omitempty"`
Color string `json:"color"`
Shape render3d.SpotLightShape `json:"shape"`
Unit graphics.LightUnit `json:"unit"`
Radius float32 `json:"radius"`
Range float32 `json:"range"`
LuxDistance float32 `json:"luxDistance"`
Intensity float32 `json:"intensity"`
InnerConeAngle float32 `json:"innerConeAngle"`
OuterConeAngle float32 `json:"outerConeAngle"`
AspectRatio float32 `json:"aspectRatio"`
Width float32 `json:"width"`
Height float32 `json:"height"`
Reflector bool `json:"reflector"`
RangeAttenuation bool `json:"rangeAttenuation"`
}
func NewSpotLightSpec ¶
func NewSpotLightSpec() SpotLightSpec
func (*SpotLightSpec) UnmarshalJSON ¶
func (s *SpotLightSpec) UnmarshalJSON(data []byte) error
type SpriteComponentSpec ¶
type SpriteComponentSpec struct {
Texture *TextureSpec `json:"texture,omitempty"`
Trail *SpriteTrailSpec `json:"trail,omitempty"`
}
func (*SpriteComponentSpec) UnmarshalJSON ¶
func (s *SpriteComponentSpec) UnmarshalJSON(data []byte) error
type SpriteTrailSpec ¶
type SpriteTrailSpec struct {
Lifetime float32 `json:"lifetime,omitempty"`
Interval float32 `json:"interval,omitempty"`
MinDistance float32 `json:"minDistance,omitempty"`
AlphaStart float32 `json:"alphaStart,omitempty"`
AlphaEnd float32 `json:"alphaEnd,omitempty"`
MaxSamples int `json:"maxSamples,omitempty"`
}
type TextComponentSpec ¶
type TextComponentSpec struct {
Shadow *TextShadow `json:"shadow,omitempty"`
Color string `json:"color,omitempty"`
Font string `json:"font,omitempty"`
WrapMode string `json:"wrapMode,omitempty"`
OutlineColor string `json:"outlineColor,omitempty"`
Value string `json:"value,omitempty"`
TextAlignment string `json:"textAlignment,omitempty"`
FontSize float64 `json:"fontSize,omitempty"`
LineHeight float32 `json:"lineHeight,omitempty"`
OutlineWidth float32 `json:"outlineWidth,omitempty"`
LetterSpacing float32 `json:"letterSpacing,omitempty"`
MaxWidth float32 `json:"maxWidth,omitempty"`
WrapWidth float32 `json:"wrapWidth,omitempty"`
}
type TextShadow ¶
type TextureSpec ¶
type TilemapSpec ¶
type TilemapSpec struct {
ID string `json:"id"`
Tileset string `json:"tileset,omitempty"`
Tiles []int `json:"tiles"`
TileRuns []TileRun `json:"-"`
Width int `json:"width"`
Height int `json:"height"`
TileWidth int `json:"tileWidth"`
TileHeight int `json:"tileHeight"`
}
func (*TilemapSpec) Compact ¶
func (s *TilemapSpec) Compact()
func (*TilemapSpec) Expand ¶
func (s *TilemapSpec) Expand() error
func (*TilemapSpec) Normalize ¶
func (s *TilemapSpec) Normalize()
func (TilemapSpec) Validate ¶
func (s TilemapSpec) Validate() error
type TriangleMeshCollider3DSpec ¶
type TriangleMeshCollider3DSpec struct {
Model string `json:"model,omitempty"`
Collider3DSettingsSpec
}
func NewTriangleMeshCollider3DSpec ¶
func NewTriangleMeshCollider3DSpec() TriangleMeshCollider3DSpec
func (*TriangleMeshCollider3DSpec) UnmarshalJSON ¶
func (s *TriangleMeshCollider3DSpec) UnmarshalJSON(data []byte) error
type ValueSchema ¶
type Video ¶
type Video struct {
// contains filtered or unexported fields
}
Video owns a pinned encoded video blob. Bytes returns an immutable borrowed view; ReadAll returns an independent mutable copy.
type WindowConfig ¶
type WindowConfig struct {
TPS *int `json:"tps"`
Vsync *bool `json:"vsync"`
Antialias *bool `json:"antialias,omitempty"`
AlwaysOnTop *bool `json:"alwaysOnTop,omitempty"`
Border *bool `json:"border,omitempty"`
Shadow *bool `json:"shadow,omitempty"`
FPS *int `json:"fps"`
ShowInTaskbar *bool `json:"showInTaskbar,omitempty"`
Resizable *bool `json:"resizable,omitempty"`
Title string `json:"title"`
Icon string `json:"icon"`
DRMDevice string `json:"drmDevice,omitempty"`
Decorations window.DecorationMode `json:"decorations,omitempty"`
RenderScale float64 `json:"renderScale,omitempty"`
Height int `json:"height"`
Width int `json:"width"`
MaxDevicePixelRatio float64 `json:"maxDevicePixelRatio,omitempty"`
CornerRadius int `json:"cornerRadius,omitempty"`
TitleBarHeight float64 `json:"titleBarHeight,omitempty"`
DRMConnectorID uint32 `json:"drmConnectorId,omitempty"`
Transparent bool `json:"transparent,omitempty"`
}
Source Files
¶
- animation_spec.go
- bundle.go
- collision_resource.go
- component.go
- decode_source.go
- environment.go
- fog.go
- load_directory.go
- math.go
- mod_animation.go
- mod_binary.go
- mod_compile.go
- mod_content.go
- mod_content_2d.go
- mod_content_features.go
- mod_create.go
- mod_features.go
- mod_html.go
- mod_material.go
- mod_model.go
- mod_physics.go
- mod_preprocess.go
- mod_shader.go
- mod_shader_preprocess.go
- mod_source.go
- mod_spec.go
- mod_values.go
- model_animation_source.go
- model_asset.go
- model_fbx_source.go
- model_pose.go
- model_resource.go
- model_resource_source.go
- model_spec.go
- model_surface.go
- model_surface_source.go
- particle_spec.go
- photometric_lights.go
- physics_spec.go
- preparation.go
- preprocess.go
- preprocessed_file.go
- profile_2d.go
- resource_cache.go
- resource_features.go
- resource_path.go
- resource_values.go
- scene.go
- scene_components.go
- scene_preload.go
- scene_visual_components.go
- scripts.go
- shader_spec.go
- source.go
- spawn_plan.go
- spine_spec.go
- sprite_trail_spec.go
- ssao.go
- ssr.go
- system_profile.go
- texture_spec.go
- tilemap_spec.go
- video.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package assets contains opt-in project resource implementations.
|
Package assets contains opt-in project resource implementations. |
|
Package projectaudio provides an opt-in audio resource feature for project bundles.
|
Package projectaudio provides an opt-in audio resource feature for project bundles. |