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 AreaLightSpec
- type BoxCollider2DSpec
- type Camera3DSpec
- type CameraViewport3DSpec
- type CircleCollider2DSpec
- type Collider2DSettingsSpec
- type Collider3DSettingsSpec
- type CollisionPieceSpec
- type CollisionResourceSpec
- type CompileCache
- type CompoundCollider3DSpec
- type ConvexHullCollider3DSpec
- type CoordinateSpace
- type CreateProjectOptions
- type DirectionalLightSpec
- type EmitterSpec
- type EngineConfig
- type EnvironmentSpec
- type FileResource
- type FogSpec
- type FontDecoder
- type ImageDecoder
- type ImageDecoderID
- type ImageFeature
- 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 ModelMaterialSpec
- type ModelNode
- type ModelPose
- type ModelPoseClip
- type ModelRig
- type ModelSpec
- type NineSlice
- type ParticleSpec
- type PointLightSpec
- type PreprocessOptions
- type PreprocessedFile
- 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 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)
- 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) 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) Statistics() ResourceStatistics
- func (r *Resources) Video(id string) (*Video, error)
- type RigidBody2DSpec
- type RigidBody3DSpec
- type RuntimeFeatureID
- type SSAOSpec
- type SSRSpec
- type SceneExitPolicy
- type SceneID
- type ScenePlan
- type SceneSpec
- 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 SpineSpec
- type SpotLightSpec
- 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(x float32) AnimationClipSpec
DefaultAnimationClip creates the initial clip for an animation component that has no authored clip yet. Its first keyframe initializes the horizontal position.
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 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 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 {
Collider3DSettingsSpec
}
func NewCompoundCollider3DSpec ¶
func NewCompoundCollider3DSpec() CompoundCollider3DSpec
func (*CompoundCollider3DSpec) UnmarshalJSON ¶
func (s *CompoundCollider3DSpec) UnmarshalJSON(data []byte) error
type ConvexHullCollider3DSpec ¶
type ConvexHullCollider3DSpec struct {
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 for module assets.
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 (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 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 or audio decoder bundles in project/assets.
func (ImageFeature[I]) ConfigureResources ¶
func (ImageFeature[I]) ConfigureResources(context ResourceLoadContext, _ ResourceEntries) error
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 ModelMaterialSpec ¶
type ModelMaterialSpec struct {
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 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 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)
ShaderTarget ShaderTarget
}
PreprocessOptions selects the 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 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 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.
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) 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) 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 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 ScenePlan ¶
type ScenePlan struct {
ID SceneID
Spec SceneSpec
Instances []ModInstancePlan
Transform ModTransform
}
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 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 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 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 {
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
- decode_source.go
- environment.go
- fog.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
- resource_cache.go
- resource_features.go
- resource_path.go
- resource_values.go
- shader_spec.go
- source.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. |