game

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("resource not found")
	ErrStillLoading = errors.New("resource still loading")
)

Functions

This section is empty.

Types

type Animation added in v0.9.0

type Animation struct {
	// contains filtered or unexported fields
}

func (*Animation) Apply added in v0.9.0

func (a *Animation) Apply(timestamp float64)

func (*Animation) EndTime added in v0.9.0

func (a *Animation) EndTime() float64

func (*Animation) Length added in v0.9.0

func (a *Animation) Length() float64

func (*Animation) Name added in v0.9.0

func (a *Animation) Name() string

func (*Animation) StartTime added in v0.9.0

func (a *Animation) StartTime() float64

type AnimationBindingDefinitionInfo added in v0.9.0

type AnimationBindingDefinitionInfo struct {
	NodeIndex            int
	NodeName             string //alternative in case of isolated animation
	TranslationKeyframes KeyframeList[dprec.Vec3]
	RotationKeyframes    KeyframeList[dprec.Quat]
	ScaleKeyframes       KeyframeList[dprec.Vec3]
}

type AnimationDefinition added in v0.9.0

type AnimationDefinition struct {
	// contains filtered or unexported fields
}

type AnimationDefinitionInfo added in v0.9.0

type AnimationDefinitionInfo struct {
	Name      string
	StartTime float64
	EndTime   float64
	Bindings  []AnimationBindingDefinitionInfo
}

type AnimationInfo added in v0.9.0

type AnimationInfo struct {
	Model      *Model
	Definition *AnimationDefinition
}

type BodyNodeSource added in v0.14.0

type BodyNodeSource struct {
	Body physics.Body
}

func (BodyNodeSource) ApplyTo added in v0.14.0

func (s BodyNodeSource) ApplyTo(node *hierarchy.Node)

type BoneNodeTarget added in v0.14.0

type BoneNodeTarget struct {
	Armature  *graphics.Armature
	BoneIndex int
}

func (BoneNodeTarget) ApplyFrom added in v0.14.0

func (t BoneNodeTarget) ApplyFrom(node *hierarchy.Node)

type CameraNodeTarget added in v0.14.0

type CameraNodeTarget struct {
	Camera *graphics.Camera
}

func (CameraNodeTarget) ApplyFrom added in v0.14.0

func (t CameraNodeTarget) ApplyFrom(node *hierarchy.Node)

type Controller

type Controller struct {
	app.NopController
	// contains filtered or unexported fields
}

func NewController added in v0.9.0

func NewController(registry asset.Registry, shaders graphics.ShaderCollection) *Controller

func (*Controller) Engine added in v0.9.0

func (c *Controller) Engine() *Engine

func (*Controller) OnCreate added in v0.9.0

func (c *Controller) OnCreate(window app.Window)

func (*Controller) OnDestroy added in v0.9.0

func (c *Controller) OnDestroy(window app.Window)

func (*Controller) OnFramebufferResize added in v0.12.0

func (c *Controller) OnFramebufferResize(window app.Window, width, height int)

func (*Controller) OnRender added in v0.9.0

func (c *Controller) OnRender(window app.Window)

type CubeTexture added in v0.9.0

type CubeTexture struct {
	// contains filtered or unexported fields
}

type DirectionalLightNodeTarget added in v0.14.0

type DirectionalLightNodeTarget struct {
	Light                 *graphics.DirectionalLight
	UseOnlyParentPosition bool
}

func (DirectionalLightNodeTarget) ApplyFrom added in v0.14.0

func (t DirectionalLightNodeTarget) ApplyFrom(node *hierarchy.Node)

type Engine added in v0.9.0

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine added in v0.9.0

func NewEngine(opts ...EngineOption) *Engine

func (*Engine) ActiveScene added in v0.9.0

func (e *Engine) ActiveScene() *Scene

func (*Engine) Create added in v0.9.0

func (e *Engine) Create()

func (*Engine) CreateAnimationDefinition added in v0.9.0

func (e *Engine) CreateAnimationDefinition(info AnimationDefinitionInfo) *AnimationDefinition

func (*Engine) CreateResourceSet added in v0.9.0

func (e *Engine) CreateResourceSet() *ResourceSet

func (*Engine) CreateScene added in v0.9.0

func (e *Engine) CreateScene() *Scene

func (*Engine) Destroy added in v0.9.0

func (e *Engine) Destroy()

func (*Engine) ECS added in v0.9.0

func (e *Engine) ECS() *ecs.Engine

func (*Engine) GFXWorker added in v0.9.0

func (e *Engine) GFXWorker() Worker

func (*Engine) Graphics added in v0.9.0

func (e *Engine) Graphics() *graphics.Engine

func (*Engine) IOWorker added in v0.9.0

func (e *Engine) IOWorker() Worker

func (*Engine) Physics added in v0.9.0

func (e *Engine) Physics() *physics.Engine

func (*Engine) Registry added in v0.9.0

func (e *Engine) Registry() asset.Registry

func (*Engine) Render added in v0.9.0

func (e *Engine) Render(viewport graphics.Viewport)

func (*Engine) ResetDeltaTime added in v0.9.0

func (e *Engine) ResetDeltaTime()

func (*Engine) SetActiveScene added in v0.9.0

func (e *Engine) SetActiveScene(scene *Scene)

func (*Engine) Update added in v0.9.0

func (e *Engine) Update()

type EngineOption added in v0.9.0

type EngineOption func(e *Engine)

func WithECS added in v0.9.0

func WithECS(ecsEngine *ecs.Engine) EngineOption

func WithGFXWorker added in v0.9.0

func WithGFXWorker(worker Worker) EngineOption

func WithGraphics added in v0.9.0

func WithGraphics(gfxEngine *graphics.Engine) EngineOption

func WithIOWorker added in v0.9.0

func WithIOWorker(worker Worker) EngineOption

func WithPhysics added in v0.9.0

func WithPhysics(physicsEngine *physics.Engine) EngineOption

func WithRegistry added in v0.9.0

func WithRegistry(registry asset.Registry) EngineOption

type Keyframe added in v0.9.0

type Keyframe[T any] struct {
	Timestamp float64
	Value     T
}

type KeyframeList added in v0.9.0

type KeyframeList[T any] []Keyframe[T]

func (KeyframeList[T]) Keyframe added in v0.9.0

func (l KeyframeList[T]) Keyframe(timestamp float64) (Keyframe[T], Keyframe[T], float64)

type MeshNodeTarget added in v0.14.0

type MeshNodeTarget struct {
	Mesh *graphics.Mesh
}

func (MeshNodeTarget) ApplyFrom added in v0.14.0

func (t MeshNodeTarget) ApplyFrom(node *hierarchy.Node)

type Model added in v0.9.0

type Model struct {
	// contains filtered or unexported fields
}

func (*Model) Animations added in v0.9.0

func (m *Model) Animations() []*Animation

func (*Model) BodyInstances added in v0.9.0

func (m *Model) BodyInstances() []physics.Body

func (*Model) FindAnimation added in v0.9.0

func (m *Model) FindAnimation(name string) *Animation

func (*Model) FindNode added in v0.10.0

func (m *Model) FindNode(name string) *hierarchy.Node

func (*Model) Root added in v0.9.0

func (m *Model) Root() *hierarchy.Node

type ModelDefinition added in v0.9.0

type ModelDefinition struct {
	// contains filtered or unexported fields
}

func (*ModelDefinition) FindAnimation added in v0.9.0

func (d *ModelDefinition) FindAnimation(name string) *AnimationDefinition

type ModelInfo added in v0.9.0

type ModelInfo struct {
	// Name specifies the name of this instance. This should not be
	// confused with the name of the definition.
	Name string

	// Definition specifies the template from which this instance will
	// be created.
	Definition *ModelDefinition

	// Position is used to specify a location for the model instance.
	Position dprec.Vec3

	// Rotation is used to specify a rotation for the model instance.
	Rotation dprec.Quat

	// Scale is used to specify a scale for the model instance.
	Scale dprec.Vec3

	// IsDynamic determines whether the model can be repositioned once
	// placed in the Scene.
	// (i.e. whether it should be added to the scene hierarchy)
	IsDynamic bool

	// PrepareAnimations indicates whether animation definitions should be
	// instantiated for this model.
	PrepareAnimations bool
}

ModelInfo contains the information necessary to place a Model instance into a Scene.

type Operation added in v0.9.0

type Operation struct {
	// contains filtered or unexported fields
}

func NewOperation added in v0.9.0

func NewOperation() Operation

func (Operation) Complete added in v0.9.0

func (o Operation) Complete(err error)

func (Operation) Wait added in v0.9.0

func (o Operation) Wait() error

type Playback added in v0.10.0

type Playback struct {
	// contains filtered or unexported fields
}

func (*Playback) Advance added in v0.10.0

func (p *Playback) Advance(amount float64)

func (*Playback) Delete added in v0.10.0

func (p *Playback) Delete()

func (*Playback) EndTime added in v0.10.0

func (p *Playback) EndTime() float64

func (*Playback) Head added in v0.10.0

func (p *Playback) Head() float64

func (*Playback) Length added in v0.10.0

func (p *Playback) Length() float64

func (*Playback) Loop added in v0.10.0

func (p *Playback) Loop() bool

func (*Playback) Name added in v0.10.0

func (p *Playback) Name() string

func (*Playback) Pause added in v0.10.0

func (p *Playback) Pause()

func (*Playback) Play added in v0.10.0

func (p *Playback) Play()

func (*Playback) Seek added in v0.10.0

func (p *Playback) Seek(head float64)

func (*Playback) SetEndTime added in v0.10.0

func (p *Playback) SetEndTime(endTime float64)

func (*Playback) SetLoop added in v0.10.0

func (p *Playback) SetLoop(loop bool)

func (*Playback) SetName added in v0.10.0

func (p *Playback) SetName(name string)

func (*Playback) SetSpeed added in v0.10.0

func (p *Playback) SetSpeed(speed float64)

func (*Playback) SetStartTime added in v0.10.0

func (p *Playback) SetStartTime(startTime float64)

func (*Playback) Speed added in v0.10.0

func (p *Playback) Speed() float64

func (*Playback) StartTime added in v0.10.0

func (p *Playback) StartTime() float64

func (*Playback) Stop added in v0.10.0

func (p *Playback) Stop()

type PointLightNodeTarget added in v0.14.0

type PointLightNodeTarget struct {
	Light *graphics.PointLight
}

func (PointLightNodeTarget) ApplyFrom added in v0.14.0

func (t PointLightNodeTarget) ApplyFrom(node *hierarchy.Node)

type ResourceSet added in v0.9.0

type ResourceSet struct {
	// contains filtered or unexported fields
}

func (*ResourceSet) CreateResourceSet added in v0.9.0

func (s *ResourceSet) CreateResourceSet() *ResourceSet

func (*ResourceSet) Delete added in v0.9.0

func (s *ResourceSet) Delete()

Delete schedules all resources managed by this ResourceSet for deletion. After this method returns, the resources are not guaranteed to have been released.

Calling this method twice is not allowed. Allocating new resources after this method has been called is also not allowed.

func (*ResourceSet) OpenCubeTexture added in v0.9.0

func (s *ResourceSet) OpenCubeTexture(id string) async.Promise[*CubeTexture]

func (*ResourceSet) OpenModel added in v0.9.0

func (s *ResourceSet) OpenModel(id string) async.Promise[*ModelDefinition]

func (*ResourceSet) OpenModelByName added in v0.9.0

func (s *ResourceSet) OpenModelByName(name string) async.Promise[*ModelDefinition]

func (*ResourceSet) OpenScene added in v0.9.0

func (s *ResourceSet) OpenScene(id string) async.Promise[*SceneDefinition]

func (*ResourceSet) OpenSceneByName added in v0.9.0

func (s *ResourceSet) OpenSceneByName(name string) async.Promise[*SceneDefinition]

func (*ResourceSet) OpenTwoDTexture added in v0.9.0

func (s *ResourceSet) OpenTwoDTexture(id string) async.Promise[*TwoDTexture]

type Scene added in v0.9.0

type Scene struct {
	// contains filtered or unexported fields
}

func (*Scene) CreateAnimation added in v0.9.0

func (s *Scene) CreateAnimation(info AnimationInfo) *Animation

func (*Scene) CreateModel added in v0.9.0

func (s *Scene) CreateModel(info ModelInfo) *Model

func (*Scene) Delete added in v0.9.0

func (s *Scene) Delete()

func (*Scene) ECS added in v0.9.0

func (s *Scene) ECS() *ecs.Scene

func (*Scene) FindModel added in v0.10.0

func (s *Scene) FindModel(name string) *Model

func (*Scene) FindPlayback added in v0.10.0

func (s *Scene) FindPlayback(name string) *Playback

func (*Scene) Freeze added in v0.10.0

func (s *Scene) Freeze()

func (*Scene) Graphics added in v0.9.0

func (s *Scene) Graphics() *graphics.Scene

func (*Scene) Initialize added in v0.9.0

func (s *Scene) Initialize(definition *SceneDefinition)

func (*Scene) IsFrozen added in v0.10.0

func (s *Scene) IsFrozen() bool

func (*Scene) Physics added in v0.9.0

func (s *Scene) Physics() *physics.Scene

func (*Scene) PlayAnimation added in v0.10.0

func (s *Scene) PlayAnimation(animation *Animation) *Playback

func (*Scene) Render added in v0.10.0

func (s *Scene) Render(viewport graphics.Viewport)

func (*Scene) Root added in v0.9.0

func (s *Scene) Root() *hierarchy.Node

func (*Scene) SubscribePostAnimation added in v0.14.0

func (s *Scene) SubscribePostAnimation(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePostNode added in v0.14.0

func (s *Scene) SubscribePostNode(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePostPhysics added in v0.14.0

func (s *Scene) SubscribePostPhysics(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePostUpdate added in v0.14.0

func (s *Scene) SubscribePostUpdate(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePreAnimation added in v0.14.0

func (s *Scene) SubscribePreAnimation(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePreNode added in v0.14.0

func (s *Scene) SubscribePreNode(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePrePhysics added in v0.14.0

func (s *Scene) SubscribePrePhysics(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) SubscribePreUpdate added in v0.14.0

func (s *Scene) SubscribePreUpdate(callback timestep.UpdateCallback) *timestep.UpdateSubscription

func (*Scene) Unfreeze added in v0.10.0

func (s *Scene) Unfreeze()

func (*Scene) Update added in v0.9.0

func (s *Scene) Update(elapsedTime time.Duration)

type SceneDefinition added in v0.9.0

type SceneDefinition struct {
	// contains filtered or unexported fields
}

type SpotLightNodeTarget added in v0.14.0

type SpotLightNodeTarget struct {
	Light *graphics.SpotLight
}

func (SpotLightNodeTarget) ApplyFrom added in v0.14.0

func (t SpotLightNodeTarget) ApplyFrom(node *hierarchy.Node)

type TwoDTexture added in v0.9.0

type TwoDTexture struct {
	// contains filtered or unexported fields
}

type Worker added in v0.9.0

type Worker interface {
	Schedule(fn func() error) Operation
	ScheduleVoid(fn func()) Operation
}

type WorkerFunc added in v0.9.0

type WorkerFunc func(fn func() error) Operation

func (WorkerFunc) Schedule added in v0.9.0

func (f WorkerFunc) Schedule(fn func() error) Operation

func (WorkerFunc) ScheduleVoid added in v0.9.0

func (f WorkerFunc) ScheduleVoid(fn func()) Operation

Directories

Path Synopsis
Package hierarchy provides the means to represent a hierarchy of 3D objects.
Package hierarchy provides the means to represent a hierarchy of 3D objects.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL