Documentation ¶
Overview ¶
Package core contains the scenegraph core types and behaviours. It is imported by sister packages and defines the common types for all components.
Index ¶
- Constants
- func AABBRenderTechnique(camera *Camera, materialBuckets map[*protos.State][]*Node)
- func Clamp(val, c0, c1 float64) float64
- func DebugRenderTechnique(camera *Camera, materialBuckets map[*protos.State][]*Node)
- func DefaultRenderTechnique(camera *Camera, materialBuckets map[*protos.State][]*Node)
- func HashStringToU32(x string) uint32
- func HashU32(x uint32) uint32
- func IMGUIRenderTechnique(camera *Camera, materialBuckets map[*protos.State][]*Node)
- func MakeFrustum(p, v mgl64.Mat4) (f [6]mgl64.Vec4)
- func Mat4DoubleToFloat(d mgl64.Mat4) mgl32.Mat4
- func RenderBatch(camera *Camera, nodes []*Node)
- func RenderBatchedNodes(camera *Camera, nodes []*Node)
- func SetAudioSystem(a AudioSystem)
- func SetIMGUISystem(is IMGUISystem)
- func SetPhysicsSystem(ps PhysicsSystem)
- func SetRenderSystem(rs RenderSystem)
- func SmoothStep(from, to, t float64) float64
- func Vec2DoubleToFloat(d mgl64.Vec2) mgl32.Vec2
- func Vec3DoubleToFloat(d mgl64.Vec3) mgl32.Vec3
- func Vec4DoubleToFloat(d mgl64.Vec4) mgl32.Vec4
- type AABB
- func (a *AABB) Center() mgl64.Vec3
- func (a *AABB) ContainsBox(ib *AABB) bool
- func (a *AABB) ContainsPoint(ip mgl64.Vec3) bool
- func (a *AABB) DistanceToPoint(p mgl64.Vec3) (float64, float64)
- func (a *AABB) ExtendWithBox(ib *AABB)
- func (a *AABB) ExtendWithPoint(ip mgl64.Vec3)
- func (a *AABB) InFrustum(planes [6]mgl64.Vec4) bool
- func (a *AABB) Max() mgl64.Vec3
- func (a *AABB) Min() mgl64.Vec3
- func (a *AABB) Reset()
- func (a *AABB) Size() mgl64.Vec3
- func (a *AABB) String() string
- func (a *AABB) Transformed(m mgl64.Mat4) *AABB
- type AlwaysPassCuller
- type Application
- type AudioSystem
- type BindDescriptorsCommand
- type BindStateCommand
- type BindUniformBufferCommand
- type BoundsCallbackFn
- type Camera
- func (c *Camera) AddNodeToRenderBuckets(n *Node)
- func (c *Camera) ClearColor() mgl32.Vec4
- func (c *Camera) ClearDepth() float64
- func (c *Camera) ClearMode() ClearMode
- func (c *Camera) Framebuffer() Framebuffer
- func (c *Camera) Frustum() [6]mgl64.Vec4
- func (c *Camera) Name() string
- func (c *Camera) Node() *Node
- func (c *Camera) ProjectionMatrix() mgl64.Mat4
- func (c *Camera) RenderOrder() uint8
- func (c *Camera) Reshape(windowSize mgl32.Vec2)
- func (c *Camera) Scene() *Node
- func (c *Camera) SetAutoFrustum(af bool)
- func (c *Camera) SetAutoReshape(autoReshape bool)
- func (c *Camera) SetClearColor(cc mgl32.Vec4)
- func (c *Camera) SetClearDepth(d float64)
- func (c *Camera) SetClearMode(cm ClearMode)
- func (c *Camera) SetClipDistance(cd mgl64.Vec2)
- func (c *Camera) SetFramebuffer(rt Framebuffer)
- func (c *Camera) SetProjectionMatrix(m mgl64.Mat4)
- func (c *Camera) SetProjectionType(projType ProjectionType)
- func (c *Camera) SetRenderOrder(o uint8)
- func (c *Camera) SetRenderTechnique(r CameraRenderFn)
- func (c *Camera) SetScene(s *Node)
- func (c *Camera) SetVerticalFieldOfView(vfov float64)
- func (c *Camera) SetViewMatrix(m mgl64.Mat4)
- func (c *Camera) SetViewport(vp mgl32.Vec4)
- func (c *Camera) ViewMatrix() mgl64.Mat4
- func (c *Camera) Viewport() mgl32.Vec4
- type CameraRenderFn
- type CamerasByRenderOrder
- type ClearCommand
- type ClearMode
- type ClientApplication
- type ClientApplicationCommand
- type ClientApplicationInputComponent
- type CollisionShape
- type Culler
- type DebugCommand
- type DefaultCuller
- type DefaultLightExtractor
- type DefaultPhysicsComponent
- type Descriptors
- func (s *Descriptors) InstanceData() [4]mgl32.Vec4
- func (s *Descriptors) SetInstanceDataField(index int, v mgl32.Vec4)
- func (s *Descriptors) SetTexture(name string, t Texture)
- func (s *Descriptors) Texture(name string) Texture
- func (s *Descriptors) Textures() map[string]Texture
- func (s *Descriptors) Uniform(name string) Uniform
- func (s *Descriptors) UniformBuffer(name string) UniformBuffer
- func (s *Descriptors) UniformBuffers() map[string]UniformBuffer
- func (s *Descriptors) Uniforms() map[string]Uniform
- type DrawCommand
- type DrawIMGUICommand
- type DrawInstancedCommand
- type Framebuffer
- type IMGUICommand
- type IMGUICommandList
- type IMGUIDrawData
- type IMGUISystem
- type InputComponent
- type InputManager
- func (i *InputManager) KeyCallback(window *glfw.Window, key glfw.Key, scancode int, action glfw.Action, ...)
- func (i *InputManager) MouseButtonCallback(window *glfw.Window, button glfw.MouseButton, action glfw.Action, ...)
- func (i *InputManager) MouseMoveCallback(window *glfw.Window, x, y float64)
- func (i *InputManager) MouseScrollCallback(window *glfw.Window, x, y float64)
- func (i *InputManager) State() *InputState
- type InputState
- type InstanceData
- type KeyState
- type Light
- type LightBlock
- type LightExtractor
- type Mesh
- type MouseButtonState
- type MouseCameraInputComponent
- type MouseCameraMoveCommand
- type MouseCameraRotateCommand
- type MousePositionState
- type MouseScrollState
- type MouseState
- type Node
- func (n *Node) Active() bool
- func (n *Node) AddChild(c *Node)
- func (n *Node) Bounds() *AABB
- func (n *Node) Children() []*Node
- func (n *Node) Copy() *Node
- func (n *Node) CullComponent() Culler
- func (n *Node) InputComponent() InputComponent
- func (n *Node) InverseWorldTransform() mgl64.Mat4
- func (n *Node) Light() *Light
- func (n *Node) MaterialData() *Descriptors
- func (n *Node) Mesh() Mesh
- func (n *Node) Name() string
- func (n *Node) Parent() *Node
- func (n *Node) PhysicsComponent() PhysicsComponent
- func (n *Node) RemoveChild(c *Node)
- func (n *Node) RemoveChildren()
- func (n *Node) RigidBody() RigidBody
- func (n *Node) Rotate(eulerAngle float64, axis mgl64.Vec3)
- func (n *Node) Scale(s mgl64.Vec3)
- func (n *Node) SetActive(active bool)
- func (n *Node) SetBoundsCallback(f BoundsCallbackFn)
- func (n *Node) SetChildrenActive(active bool)
- func (n *Node) SetCullComponent(cc Culler)
- func (n *Node) SetInputComponent(ic InputComponent)
- func (n *Node) SetLight(l *Light)
- func (n *Node) SetMesh(m Mesh)
- func (n *Node) SetRigidBody(r RigidBody)
- func (n *Node) SetState(s *protos.State)
- func (n *Node) SetUpdateComponent(uc Updater)
- func (n *Node) SetWorldTransform(transform mgl64.Mat4)
- func (n *Node) State() *protos.State
- func (n *Node) Transform() mgl64.Mat4
- func (n *Node) Translate(vec mgl64.Vec3)
- func (n *Node) UpdateComponent() Updater
- func (n *Node) WorldBounds() *AABB
- func (n *Node) WorldDistance(n2 *Node) float64
- func (n *Node) WorldPosition() mgl64.Vec3
- func (n *Node) WorldTransform() mgl64.Mat4
- type NodeCommand
- type NodesByCameraDistanceNearToFar
- type NodesByMaterial
- type NodesByName
- type PhysicsComponent
- type PhysicsSystem
- type Platform
- type PrimitiveType
- type Program
- type ProjectionType
- type RenderCommand
- type RenderSystem
- type ResourceManager
- type ResourceSystem
- type RigidBody
- type Scene
- type SceneManager
- type SetFramebufferCommand
- type SetViewportCommand
- type ShadowMap
- type Shadower
- type Texture
- type TextureComponentType
- type TextureDescriptor
- type TextureFilter
- type TextureFormat
- type TextureSizedFormat
- type TextureTarget
- type TextureWrapMode
- type TimerHistogram
- type TimerManager
- func (ts *TimerManager) AvgFPS() float64
- func (ts *TimerManager) Dt() float64
- func (ts *TimerManager) FPS() float64
- func (ts *TimerManager) FrameStartTime() float64
- func (ts *TimerManager) Histogram() TimerHistogram
- func (ts *TimerManager) Pause()
- func (ts *TimerManager) Paused() bool
- func (ts *TimerManager) SetDt(dt float64)
- func (ts *TimerManager) Start()
- func (ts *TimerManager) Time() float64
- type Uniform
- type UniformBuffer
- type Updater
- type WindowConfig
- type WindowFlags
- type WindowManager
Examples ¶
Constants ¶
const ( // MaxInstances is the maximum number of modelMatrices in a mesh instance attribute buffer MaxInstances = 2000 // InstanceDataLen is the byte size of an InstanceData value InstanceDataLen = (2*16 + 4*4) * 4 )
Variables ¶
This section is empty.
Functions ¶
func AABBRenderTechnique ¶
AABBRenderTechnique draws AABBs for all nodes
func DebugRenderTechnique ¶
DebugRenderTechnique runs the default render path followed by AABBs
func DefaultRenderTechnique ¶
DefaultRenderTechnique does z pre-pass, diffuse pass, transparency pass
func HashStringToU32 ¶
HashStringToU32 computes an unsigned 32 bit hash value for the given parameter
func IMGUIRenderTechnique ¶
IMGUIRenderTechnique does z pre-pass, diffuse pass, transparency pass
func MakeFrustum ¶
MakeFrustum creates a frustum's 6 planes from a projection and view matrix
func Mat4DoubleToFloat ¶
Mat4DoubleToFloat converts an mgl64.Mat4 into an mgl32.Mat4
func RenderBatch ¶
RenderBatch renders a batch of drawables sharing the same state and descriptors
func RenderBatchedNodes ¶
RenderBatchedNodes splits a list of nodes into batched items per buffers and streams draw calls It assumes all batches share materials and should be used long with Mater
func SetAudioSystem ¶
func SetAudioSystem(a AudioSystem)
SetAudioSystem should be called by implementations on their init function. It registers the implementation as the active audio system.
func SetIMGUISystem ¶
func SetIMGUISystem(is IMGUISystem)
SetIMGUISystem is meant to be called from IMGUISystem implementations on their init method
func SetPhysicsSystem ¶
func SetPhysicsSystem(ps PhysicsSystem)
SetPhysicsSystem is meant to be called from PhysicsSystem implementations on their init method
func SetRenderSystem ¶
func SetRenderSystem(rs RenderSystem)
SetRenderSystem is meant to be called from RenderSystem implementations on their init method to cause the side-effect of setting the core RenderSystem to their provided one.
func SmoothStep ¶
SmoothStep performs hermite interpolation between two values
func Vec2DoubleToFloat ¶
Vec2DoubleToFloat converts an mgl64.Vec2 into an mgl32.Vec2
func Vec3DoubleToFloat ¶
Vec3DoubleToFloat converts an mgl64.Vec3 into an mgl32.Vec3
Types ¶
type AABB ¶
type AABB struct {
// contains filtered or unexported fields
}
AABB defines the smallest enclosing box for a given set of points
func (*AABB) ContainsBox ¶
ContainsBox returns whether the bounding volume fully contains the volume defined by the given bounding box
func (*AABB) ContainsPoint ¶
ContainsPoint returns whether the bounding volume contains the given point
func (*AABB) DistanceToPoint ¶
DistanceToPoint returns the minimum distance from a point to any of the AABBs corners
func (*AABB) ExtendWithBox ¶
ExtendWithBox extends the bounding box to contain the volume defined by the given bounding box
func (*AABB) ExtendWithPoint ¶
ExtendWithPoint extends the bounding box to contain the given point
func (*AABB) InFrustum ¶
InFrustum returns whether the bounding volume is contained in the frustum defined by the given planes
func (*AABB) Transformed ¶
Transformed returns a new ABB which contains the volume specified by the eight corners or the original AABB when multiplied by the passed transform. This can be used, for example, to transform an AABB in object space (OBB) to an AABB in world space.
Example ¶
var a AABB a.ExtendWithPoint(mgl64.Vec3{-10.0, -10.0, -10.0}) a.ExtendWithPoint(mgl64.Vec3{10.0, 10.0, 10.0}) transform := mgl64.QuatRotate(1.5, mgl64.Vec3{0.0, 1.0, 0.0}).Mat4() fmt.Println(transform)
Output:
type AlwaysPassCuller ¶
type AlwaysPassCuller struct{}
AlwaysPassCuller implements a scenegraph culler by always adding the node to the bucket
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application is the top-level runnable gosg App
func (*Application) Start ¶
func (app *Application) Start(acConstructor func() ClientApplication)
Start starts the application runloop by calling all systems/managers Start methods, and calling the ClientApp constructor. On runloop termination, the Stop methods are called in reverse order.
type AudioSystem ¶
type AudioSystem interface { // Start starts the audio system. This is where implementations should detect // hardware devices and initialize them. Start() // Step is called by the application runloop update. Step() // Stop is called by the application after its main loop returns. Implementations // should call their termination/cleanup logic here. Stop() }
AudioSystem is the interface that wraps all audio processing logic.
func GetAudioSystem ¶
func GetAudioSystem() AudioSystem
GetAudioSystem returns the registered window system
type BindDescriptorsCommand ¶
type BindDescriptorsCommand struct {
Descriptors *Descriptors
}
BindDescriptorsCommand bids the passed descriptors
type BindStateCommand ¶
BindStateCommand binds the passed state
type BindUniformBufferCommand ¶
type BindUniformBufferCommand struct { Name string UniformBuffer UniformBuffer }
BindUniformBufferCommand binds the passed uniform buffer
type BoundsCallbackFn ¶
BoundsCallbackFn is called if set to allow the user to specify logic to customise a node's bounds. The bounds will have been grown to include any mesh or children. It's/ up to the user to decide whether to return the same bounds or a new AABB.
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
A Camera represents a scenegraph camera object. It wraps data which holds its transforms (projection and view matrices), clear information, whether it should perform auto reshape on window resizes, a pointer to its node on the scenegraph, as well as clipping distances (near, far planes) and render ordering, target and techniques.
func NewCamera ¶
func NewCamera(name string, projType ProjectionType) *Camera
NewCamera creates and returns a Camera with the given name and projection type.
func (*Camera) AddNodeToRenderBuckets ¶
AddNodeToRenderBuckets adds a node to the camera's renderbuckets for the next render loop
func (*Camera) ClearColor ¶
ClearColor returns the camera's clear color.
func (*Camera) ClearDepth ¶
ClearDepth returns the camera's clear depth.
func (*Camera) Framebuffer ¶
func (c *Camera) Framebuffer() Framebuffer
Framebuffer returns the camera's render target.
func (*Camera) ProjectionMatrix ¶
ProjectionMatrix returns the camera's projection matrix.
func (*Camera) RenderOrder ¶
RenderOrder order returns the camera's render order.
func (*Camera) Reshape ¶
Reshape reshapes the camera's viewport and transforms according to a given window size.
func (*Camera) Scene ¶
Scene returns the camera's scene root. This is the node that it will start culling traversals on. To render an entire scene you would set this to the scene's root node. To render subtrees you would set this to the subtree root node. This allows you to split your scene into subgroups and have cameras render them separately.
func (*Camera) SetAutoFrustum ¶
SetAutoFrustum sets whether the camera should auto set its near/far clip planes
func (*Camera) SetAutoReshape ¶
SetAutoReshape sets whether the camera should reshape its viewport and transforms when the window is resized.
func (*Camera) SetClearColor ¶
SetClearColor sets the camera's clear color.
func (*Camera) SetClearDepth ¶
SetClearDepth sets the camera's clear depth.
func (*Camera) SetClearMode ¶
SetClearMode sets the camera's clear mode.
func (*Camera) SetClipDistance ¶
SetClipDistance sets the camera's near and far clipping planes.
func (*Camera) SetFramebuffer ¶
func (c *Camera) SetFramebuffer(rt Framebuffer)
SetFramebuffer sets the camera's render target.
func (*Camera) SetProjectionMatrix ¶
SetProjectionMatrix sets the camera's projection matrix.
func (*Camera) SetProjectionType ¶
func (c *Camera) SetProjectionType(projType ProjectionType)
SetProjectionType sets the camera's projection type.
func (*Camera) SetRenderOrder ¶
SetRenderOrder sets the camera's render order.
func (*Camera) SetRenderTechnique ¶
func (c *Camera) SetRenderTechnique(r CameraRenderFn)
SetRenderTechnique sets the camera's render technique.
func (*Camera) SetScene ¶
SetScene sets the camera's scene root. See Scene() for more information on what this is.
func (*Camera) SetVerticalFieldOfView ¶
SetVerticalFieldOfView sets the camera's vertical field of view. This is ignored for orthographic projections.
func (*Camera) SetViewMatrix ¶
SetViewMatrix sets the camera's view matrix.
func (*Camera) SetViewport ¶
SetViewport sets the camera's viewport.
func (*Camera) ViewMatrix ¶
ViewMatrix returns the camera's view matrix.
type CameraRenderFn ¶
CameraRenderFn implements a specific drawing method for a slice of nodes viewed by a camera.
type CamerasByRenderOrder ¶
type CamerasByRenderOrder []*Camera
CamerasByRenderOrder is used to sort cameras by the render order field.
func (CamerasByRenderOrder) Len ¶
func (a CamerasByRenderOrder) Len() int
Len implements the sort.Interface interface.
func (CamerasByRenderOrder) Less ¶
func (a CamerasByRenderOrder) Less(i, j int) bool
Less implements the sort.Interface interface.
func (CamerasByRenderOrder) Swap ¶
func (a CamerasByRenderOrder) Swap(i, j int)
Swap implements the sort.Interface interface.
type ClearCommand ¶
ClearCommand clears the current framebuffer
type ClearMode ¶
type ClearMode uint8
ClearMode is used to express the type of framebuffer clearing which will be executed before the rendering logic is called.
type ClientApplication ¶
type ClientApplication interface { InputComponent() ClientApplicationInputComponent Stop() Done() bool }
ClientApplication is the client app, provided by the user
type ClientApplicationCommand ¶
type ClientApplicationCommand interface {
Run(ac ClientApplication)
}
ClientApplicationCommand is a single runnable command
type ClientApplicationInputComponent ¶
type ClientApplicationInputComponent interface {
Run() []ClientApplicationCommand
}
ClientApplicationInputComponent checks the input system state and triggers commands
type CollisionShape ¶
type CollisionShape interface { // AddChildShape adds a child collision shape to this shape. AddChildShape(childshape CollisionShape, position mgl64.Vec3, orientation mgl64.Quat) // AddVertex adds a single vertex. Used for convex hull shapes. AddVertex(mgl64.Vec3) }
CollisionShape is an interface which wraps information used to compute object collisions.
type Culler ¶
type Culler interface { // Run culls a scenegraph node. A scene and camera are provided for visibility/frustum checks. // If the policy dictates the node is to be drawn, then it should be added to the nodeBucket. Run(*Scene, *Camera, *Node) }
Culler is an interface that wraps culling of a scenegraph.
type DefaultCuller ¶
type DefaultCuller struct{}
DefaultCuller implements a scenegraph culler. The policy for this culler is to mark all nodes in frustum for drawing. The node's modelMatrix state uniform is also set from the nodes worldtransform. This may change as we transition away from individual uniforms for instanced/indirect drawing.
type DefaultLightExtractor ¶
type DefaultLightExtractor struct{}
DefaultLightExtractor is a LightExtractor which adds a nodes's light to the bucket if the node is active.
func (*DefaultLightExtractor) Run ¶
func (lc *DefaultLightExtractor) Run(node *Node, lightBucket *[]*Light)
Run implements the LightExtractor interface
type DefaultPhysicsComponent ¶
type DefaultPhysicsComponent struct{}
DefaultPhysicsComponent is a utility physics component which adds all nodes containing a rigid body to the bucket.
func NewDefaultPhysicsComponent ¶
func NewDefaultPhysicsComponent(active bool) *DefaultPhysicsComponent
NewDefaultPhysicsComponent returns a new DefaultPhysicsComponent.
func (*DefaultPhysicsComponent) Run ¶
func (p *DefaultPhysicsComponent) Run(n *Node, nodeBucket *[]*Node)
Run implements the PhysicsComponent interface
type Descriptors ¶
type Descriptors struct {
// contains filtered or unexported fields
}
Descriptors contains material properties for a specific drawable
func (*Descriptors) InstanceData ¶
func (s *Descriptors) InstanceData() [4]mgl32.Vec4
InstanceData returns the descriptor per instance data
func (*Descriptors) SetInstanceDataField ¶
func (s *Descriptors) SetInstanceDataField(index int, v mgl32.Vec4)
SetInstanceDataField returns the descriptor per instance data
func (*Descriptors) SetTexture ¶
func (s *Descriptors) SetTexture(name string, t Texture)
SetTexture sets the material's texture named `name` to the provided texture
func (*Descriptors) Texture ¶
func (s *Descriptors) Texture(name string) Texture
Texture returns the material texture with the specified name
func (*Descriptors) Textures ¶
func (s *Descriptors) Textures() map[string]Texture
Textures returns the material's textures
func (*Descriptors) Uniform ¶
func (s *Descriptors) Uniform(name string) Uniform
Uniform returns the uniform with the given name.
func (*Descriptors) UniformBuffer ¶
func (s *Descriptors) UniformBuffer(name string) UniformBuffer
UniformBuffer returns the uniform buffer with the given name
func (*Descriptors) UniformBuffers ¶
func (s *Descriptors) UniformBuffers() map[string]UniformBuffer
UniformBuffers returns the state's uniform buffers
func (*Descriptors) Uniforms ¶
func (s *Descriptors) Uniforms() map[string]Uniform
Uniforms returns the state's uniform map.
type DrawInstancedCommand ¶
DrawInstancedCommand draws a mesh using instancing
type Framebuffer ¶
type Framebuffer interface { // SetColorAttachment sets the color attachment at the specified index. SetColorAttachment(index int, attachment Texture) // ColorAttachments returns the framebuffer color attachments. ColorAttachments() map[int]Texture // ColorAttachment returns the color attachment at the specified index. ColorAttachment(index int) Texture // SetDepthAttachment sets the depth attachment. SetDepthAttachment(attachment Texture) // DepthAttachment returns the framebuffer depth attachment DepthAttachment() Texture }
Framebuffer is an interface which wraps a render target. This contains information about depth and color attachments, dimensions.
type IMGUICommand ¶
IMGUICommand represents an individual draw command for the RenderSystem to present a part of the UI.
type IMGUICommandList ¶
type IMGUICommandList struct { CmdBufferSize int VertexBufferSize int IndexBufferSize int VertexPointer unsafe.Pointer IndexPointer unsafe.Pointer Commands []IMGUICommand }
IMGUICommandList returns a list of draw commands for the RenderSystem to present the entire UI.
type IMGUIDrawData ¶
type IMGUIDrawData interface { CommandListCount() int GetCommandList(int) *IMGUICommandList }
IMGUIDrawData is an interface which exposes methods for retrieving command lists from implementations.
type IMGUISystem ¶
type IMGUISystem interface { // Start is called at application startup. This is where implementations should check // for fonts, create their textures, etc. Start() // Stop is called at application shutdown. Implementations will want to perform cleanup here. Stop() // StartFrame is called at the draw stage of the runloop. StartFrame(dt float64) // EndFrame is called at the end of the draw stage of the runloop. EndFrame() // Begin creates a new widget and returns whether it is visible. Begin(name string, flags WindowFlags) bool // End closes the current active widget. End() // DisplaySize returns the current display size. DisplaySize() mgl32.Vec2 // SetDisplaySize sets the display size. This is called by the application on every // iteration of the runloop. Implementations should check this for window resizes. SetDisplaySize(mgl32.Vec2) // SetNextWindowPos is used to request a position for the next window that gets created. SetNextWindowPos(mgl32.Vec2) // SetNextWindowSize is used to request a size for the next window that gets created. SetNextWindowSize(mgl32.Vec2) // GetDrawData returns IMGUIDrawData which is used by the RenderSystem to present the UI on screen. GetDrawData() IMGUIDrawData // CollapsingHeader returns a widget with a collapsing header. CollapsingHeader(name string) bool //PlotHistogram draws a histogram on a widget using the passed name and values. minScale and maxScale set // the Y axis scale and size sets the widgets width and height. PlotHistogram(name string, values []float32, minScale, maxScale float32, size mgl32.Vec2) // Image draws a texture on a widget with the provided size. Image(texture Texture, size mgl32.Vec2) // Text displays a text box Text(data string) }
IMGUISystem is the interface that wraps an immediate mode GUI component.
func GetIMGUISystem ¶
func GetIMGUISystem() IMGUISystem
GetIMGUISystem returns the IMGUISystem, thereby exposing it to any package importing core.
type InputComponent ¶
type InputComponent interface { // Run returns commands from a given node to itself. Run(node *Node) []NodeCommand }
InputComponent is an interface which returns NodeCommands from nodes. Each node may have its own input component which checks the manager for input and determines what commands should be output.
type InputManager ¶
type InputManager struct {
// contains filtered or unexported fields
}
InputManager wraps global input state. WindowSystem implementations use the manager to expose input state to the system.
func (*InputManager) KeyCallback ¶
func (i *InputManager) KeyCallback(window *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey)
KeyCallback is called by windowsystems to register key events.
func (*InputManager) MouseButtonCallback ¶
func (i *InputManager) MouseButtonCallback(window *glfw.Window, button glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey)
MouseButtonCallback is called by windowsystems to register mouse button events.
func (*InputManager) MouseMoveCallback ¶
func (i *InputManager) MouseMoveCallback(window *glfw.Window, x, y float64)
MouseMoveCallback is called by windowsystems to register mouse move events.
func (*InputManager) MouseScrollCallback ¶
func (i *InputManager) MouseScrollCallback(window *glfw.Window, x, y float64)
MouseScrollCallback is called by windowsystems to register mouse scroll events.
func (*InputManager) State ¶
func (i *InputManager) State() *InputState
State returns the manager's input state.
type InputState ¶
type InputState struct { Mouse MouseState Keys KeyState }
InputState wraps mouse and keys input state.
func (*InputState) SetKeysValid ¶
func (i *InputState) SetKeysValid(valid bool)
SetKeysValid sets the key state as valid. It will not be processed unless this is set.
func (*InputState) SetMouseValid ¶
func (i *InputState) SetMouseValid(valid bool)
SetMouseValid sets the mouse state as valid. It will not be processed unless this is set.
type InstanceData ¶
type InstanceData struct { ModelMatrix mgl32.Mat4 ModelViewProjectionMatrix mgl32.Mat4 Custom [4]mgl32.Vec4 }
InstanceData holds the per-instance-data when using instanced drawing. It is automatically populated by all the included RenderTechniques. Use node.GetInstanceData() to change its custom values
type KeyState ¶
type KeyState struct { Valid bool Mods map[glfw.Key]bool Active map[glfw.Key]bool Released map[glfw.Key]bool }
KeyState holds key input state.
type Light ¶
type Light struct { Block LightBlock Shadower Shadower }
Light represents a light. It contains a properties block and an optional shadower.
type LightBlock ¶
type LightBlock struct { VPMatrix [maxCascades]mgl32.Mat4 ZCuts [maxCascades]mgl32.Vec4 Position mgl32.Vec4 Color mgl32.Vec4 }
LightBlock holds a light's properties. It is embedded in a sceneblock and passed to every program.
type LightExtractor ¶
type LightExtractor interface { // Run extracts light from a node and adds it to lightBucket. Run(node *Node, lightBucket *[]*Light) }
LightExtractor is an interface which extracts a light from a node and adds it to a bucket.
type Mesh ¶
type Mesh interface { SetPrimitiveType(PrimitiveType) SetPositions(positions []float32) SetNormals(normals []float32) SetTextureCoordinates(coordinates []float32) SetIndices(indices []uint16) SetName(name string) Name() string Draw() DrawInstanced(int, unsafe.Pointer) Bounds() *AABB Lt(Mesh) bool Gt(Mesh) bool }
Mesh is an interface which wraps handling of geometry.
func AABBMesh ¶
func AABBMesh() Mesh
AABBMesh returns a normalized cube centered at the origin. This is used to draw bounding boxes by translating and scaling it according to node bounds.
func NewScreenQuadMesh ¶
NewScreenQuadMesh returns a mesh to be drawn by an orthographic projection camera.
type MouseButtonState ¶
type MouseButtonState struct { Valid bool Active map[glfw.MouseButton]bool Action int }
MouseButtonState holds the mouse button state.
type MouseCameraInputComponent ¶
type MouseCameraInputComponent struct {
// contains filtered or unexported fields
}
MouseCameraInputComponent is a utility inputcomponent for simple camera movement.
func NewMouseCameraInputComponent ¶
func NewMouseCameraInputComponent() *MouseCameraInputComponent
NewMouseCameraInputComponent returns a default inputcomponent for use with camera nodes which uses the mouse wheel to set the camera's velocity on 10x increments (world units/second).
func (*MouseCameraInputComponent) Run ¶
func (ic *MouseCameraInputComponent) Run(node *Node) []NodeCommand
Run implements the InputComponent interface.
type MouseCameraMoveCommand ¶
type MouseCameraMoveCommand struct {
// contains filtered or unexported fields
}
MouseCameraMoveCommand is a utility command for simple camera movement.
func (MouseCameraMoveCommand) Run ¶
func (mc MouseCameraMoveCommand) Run(node *Node)
Run implements the NodeCommand interface
type MouseCameraRotateCommand ¶
type MouseCameraRotateCommand struct {
// contains filtered or unexported fields
}
MouseCameraRotateCommand is a utility command for simple camera movement.
func (MouseCameraRotateCommand) Run ¶
func (rc MouseCameraRotateCommand) Run(node *Node)
Run implements the NodeCommand interface
type MousePositionState ¶
MousePositionState holds the mouse position information.
type MouseScrollState ¶
MouseScrollState holds the mouse scroll state.
type MouseState ¶
type MouseState struct { Valid bool Position MousePositionState Scroll MouseScrollState Buttons MouseButtonState }
MouseState holds mouse input state.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a scenegraph node.
func LoadModel ¶
LoadModel parses model data from a raw resource and returns a node ready to insert into the screnegraph
func (*Node) CullComponent ¶
CullComponent returns the node's culler
func (*Node) InputComponent ¶
func (n *Node) InputComponent() InputComponent
InputComponent returns the node's input component.
func (*Node) InverseWorldTransform ¶
InverseWorldTransform returns the node's inverse world transform.
func (*Node) MaterialData ¶
func (n *Node) MaterialData() *Descriptors
MaterialData returns the node's state
func (*Node) PhysicsComponent ¶
func (n *Node) PhysicsComponent() PhysicsComponent
PhysicsComponent returns the node's physics component.
func (*Node) RemoveChildren ¶
func (n *Node) RemoveChildren()
RemoveChildren removes all of a node's children.
func (*Node) SetBoundsCallback ¶
func (n *Node) SetBoundsCallback(f BoundsCallbackFn)
SetBoundsCallback sets a boundsCallback function
func (*Node) SetChildrenActive ¶
SetChildrenActive marks all of the nodes's children as active.
func (*Node) SetCullComponent ¶
SetCullComponent sets the node's culler.
func (*Node) SetInputComponent ¶
func (n *Node) SetInputComponent(ic InputComponent)
SetInputComponent sets the node's input component.
func (*Node) SetRigidBody ¶
SetRigidBody sets the node's rigid body.
func (*Node) SetUpdateComponent ¶
SetUpdateComponent sets the node's update component.
func (*Node) SetWorldTransform ¶
SetWorldTransform sets the node's world transform. It also sets the node's transform appropriately.
func (*Node) UpdateComponent ¶
UpdateComponent returns the node's update component.
func (*Node) WorldBounds ¶
WorldBounds returns the node's bounds in world-space
func (*Node) WorldDistance ¶
WorldDistance returns the distance between this node and the passed node, computed using node centerpoints/world position
func (*Node) WorldPosition ¶
WorldPosition returns the node's world position
func (*Node) WorldTransform ¶
WorldTransform returns the node's world transform.
type NodeCommand ¶
type NodeCommand interface {
Run(node *Node)
}
NodeCommand is an interface which wraps logic for running a command against a node.
type NodesByCameraDistanceNearToFar ¶
NodesByCameraDistanceNearToFar is used to sort nodes according to camera distance from near to far.
func (NodesByCameraDistanceNearToFar) Len ¶
func (a NodesByCameraDistanceNearToFar) Len() int
Len implements the sort.Interface interface.
func (NodesByCameraDistanceNearToFar) Less ¶
func (a NodesByCameraDistanceNearToFar) Less(i, j int) bool
Less implements the sort.Interface interface.
func (NodesByCameraDistanceNearToFar) Swap ¶
func (a NodesByCameraDistanceNearToFar) Swap(i, j int)
Swap implements the sort.Interface interface.
type NodesByMaterial ¶
type NodesByMaterial []*Node
NodesByMaterial is used to sort nodes according to material.
func (NodesByMaterial) Len ¶
func (a NodesByMaterial) Len() int
Len implements the sort.Interface interface
func (NodesByMaterial) Less ¶
func (a NodesByMaterial) Less(i, j int) bool
Less implements the sort.Interface interface.
func (NodesByMaterial) Swap ¶
func (a NodesByMaterial) Swap(i, j int)
Swap implements the sort.Interface interface.
type NodesByName ¶
type NodesByName struct {
Nodes []*Node
}
NodesByName is used to sort nodes by alphabetic name order.
func (NodesByName) Len ¶
func (a NodesByName) Len() int
Len implements the sort.Interface interface.
func (NodesByName) Less ¶
func (a NodesByName) Less(i, j int) bool
Less implements the sort.Interface interface.
func (NodesByName) Swap ¶
func (a NodesByName) Swap(i, j int)
Swap implements the sort.Interface interface.
type PhysicsComponent ¶
type PhysicsComponent interface { // Run is called on each node which should determine whether it should be added to the simulation step or not. Run(node *Node, nodeBucket *[]*Node) }
PhysicsComponent is an interface which wraps physics handling logic for a scenegraph node
type PhysicsSystem ¶
type PhysicsSystem interface { // Start is called by the application at startup time. Implementations should perform bootstapping here. Start() // Stop is called by the application at shutdown time. Implementations should perform cleanup here. Stop() // Update is called at every cycle of the application runloop with a list of nodes and a time delta from the // previous iteration. Implementations will want to perform all their computation here. Update(dt float64, nodes []*Node) // SetGravity sets the global gravity vector. This is for testing purposes and will be removed. SetGravity(g mgl64.Vec3) // AddRigidBody adds a rigid body to the physics world. AddRigidBody(RigidBody) // RemoveRigidBody removed a rigid body from the physics world. RemoveRigidBody(RigidBody) // CreateRigidBody creates a new rigid body which can be attached to a scenegraph node. CreateRigidBody(mass float32, collisionShape CollisionShape) RigidBody // DeleteRigidBody deletes a rigid body DeleteRigidBody(RigidBody) // NewStaticPlaneShape returns a collision shape. NewStaticPlaneShape(normal mgl64.Vec3, constant float64) CollisionShape // NewSphereShape returns a collision shape. NewSphereShape(radius float64) CollisionShape // NewBoxShape returns a collision shape. NewBoxShape(mgl64.Vec3) CollisionShape // NewCapsuleShape returns a collision shape. NewCapsuleShape(radius float64, height float64) CollisionShape // NewConeShape returns a collision shape. NewConeShape(radius float64, height float64) CollisionShape // NewCylinderShape returns a collision shape. NewCylinderShape(radius float64, height float64) CollisionShape // NewCompoundSphereShape returns a collision shape. NewCompoundShape() CollisionShape // NewConvexHullShape returns a collision shape. NewConvexHullShape() CollisionShape // NewStaticTriangleMeshShape returns a collision shape. NewStaticTriangleMeshShape(Mesh) CollisionShape // DeleteShape deletes a collision shape. DeleteShape(CollisionShape) }
PhysicsSystem is an interface which wraps all physics related logic.
func GetPhysicsSystem ¶
func GetPhysicsSystem() PhysicsSystem
GetPhysicsSystem returns the renderSystem, thereby exposing it to any package importing core.
type Platform ¶
type Platform uint8
Platform is an OS
type PrimitiveType ¶
type PrimitiveType uint8
PrimitiveType is a raster primitive type.
const ( PrimitiveTypeTriangles PrimitiveType = iota PrimitiveTypePoints PrimitiveTypeLines )
Supported primitive types
type Program ¶
type Program interface {
Name() string
}
Program is an interface which wraps a GPU program (OpenGL, etc). This will be removed soon and programs will be accessed by name handle via the resource system or abstracted in opaque material definitions.
type ProjectionType ¶
type ProjectionType uint8
ProjectionType is used to express projection types (ie: perspective, orthographic).
const ( // PerspectiveProjection represents a perspective projection. PerspectiveProjection ProjectionType = iota // OrthographicProjection represents an orthographic projection. OrthographicProjection )
type RenderSystem ¶
type RenderSystem interface { // PrepareWindow initializes a new window PreMakeWindow() PostMakeWindow(cfg WindowConfig, window *glfw.Window) // NewMesh retuns a new mesh. NewMesh() Mesh // ProgramExtension exposes the resource extension of program definitions for the implementation. ProgramExtension() string // NewProgram creates a new program from a list of subprogram source files. NewProgram(name string, data []byte) Program // NewTexture creates a new texture from a byte buffer containing an image file, not raw bitmap. // This always generates RGBA, unsigned byte and will generate mipmaps levels from // smallest dimension, ie: 2048x1024 = 10 mipmap levels; log2(1024) // It also defaults to ClampEdge and mipmapped filtering. NewTextureFromImageData(r []byte, d TextureDescriptor) Texture // NewUniform creates a new empty uniform NewUniform() Uniform // NewUniformBuffer creates a new empty uniform buffer NewUniformBuffer() UniformBuffer // NewRawTexture creates a new texture and allocates storage for it NewTexture(descriptor TextureDescriptor, data []byte) Texture // NewFramebuffer returns a newly created framebuffer NewFramebuffer() Framebuffer // Dispatch runs a rendercommand Dispatch(RenderCommand) // CanBatch returns whether two nodes can be batched in the same drawcall CanBatch(a *Descriptors, b *Descriptors) bool // RenderLog returns a log of the render plan RenderLog() string }
RenderSystem is an interface which wraps all logic related to rendering and memory management of GPU buffers.
func GetRenderSystem ¶
func GetRenderSystem() RenderSystem
GetRenderSystem returns the renderSystem, thereby exposing it to any package importing core.
type ResourceManager ¶
type ResourceManager struct {
// contains filtered or unexported fields
}
ResourceManager wraps a resourcesystem and contains configuration about the location of each resource type.
func GetResourceManager ¶
func GetResourceManager() *ResourceManager
GetResourceManager returns the resource manager. Used by client applications to load assets.
func (*ResourceManager) Model ¶
func (r *ResourceManager) Model(name string) *Node
Model returns a scenegraph node with a subtree of nodes containing meshes which represent a complex model.
func (*ResourceManager) Program ¶
func (r *ResourceManager) Program(name string) Program
Program returns a GPU program.
func (*ResourceManager) ProgramData ¶
func (r *ResourceManager) ProgramData(name string) []byte
ProgramData returns source file contents for a given program or subprogram This is meant to be used by rendersystem implementations to load subresources for a program spec
func (*ResourceManager) SetSystem ¶
func (r *ResourceManager) SetSystem(s ResourceSystem)
SetSystem sets the resource manager's resource system
type ResourceSystem ¶
type ResourceSystem interface { // Model returns a byte array representing a model. Model(string) []byte // Texture returns a byte array representing a texture. Texture(string) []byte // Program returns a byte array representing a program. Program(string) []byte // State returns a byte array representing a raster state State(string) []byte // ProgramData returns a byte array representing program data. ProgramData(string) []byte }
ResourceSystem is an interface which wraps all resource management logic.
type RigidBody ¶
type RigidBody interface { // GetTransform returns the rigid body world transform. GetTransform() mgl64.Mat4 // SetTransform sets the rigid body world transform. SetTransform(mgl64.Mat4) // ApplyImpulse applies `impulse` on the rigid body at its position `localPosition`. ApplyImpulse(impulse mgl64.Vec3, localPosition mgl64.Vec3) }
RigidBody is an interface which wraps a physics rigid body. It contains position, orientation, momentum and collision shape information.
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
Scene represents a scenegraph and contains information about how it should be composed with other scenes on a scene stack. Scenes are not meant to be wrapped by users, but to be data configured for the expected behaviour.
func NewIMGUIScene ¶
func NewIMGUIScene(name string, inputComponent InputComponent) *Scene
NewIMGUIScene returns a Scene which draws a UI. Users will want to use this to display a UI on top of other scenes.
type SceneManager ¶
type SceneManager struct {
// contains filtered or unexported fields
}
SceneManager manages a stack of scenes
func GetSceneManager ¶
func GetSceneManager() *SceneManager
GetSceneManager returns the scene manager.
func (*SceneManager) FrontScene ¶
func (sm *SceneManager) FrontScene() *Scene
FrontScene returns the front scene.
func (*SceneManager) PopScene ¶
func (sm *SceneManager) PopScene() *Scene
PopScene pops a scene from the stack
func (*SceneManager) PushScene ¶
func (sm *SceneManager) PushScene(s *Scene)
PushScene pushes a scene to the stack.
type SetFramebufferCommand ¶
type SetFramebufferCommand struct {
Framebuffer Framebuffer
}
SetFramebufferCommand sets the current framebuffer
type SetViewportCommand ¶
SetViewportCommand sets the current viewport
type ShadowMap ¶
type ShadowMap struct {
// contains filtered or unexported fields
}
ShadowMap is a utility implementation of the Shadower interface which renders shadows by using a cascading shadow map.
type Shadower ¶
type Shadower interface { // Textures returns the shadow textures used by this shadower Textures() []Texture // Render calls the shadower render implementation by assing a light and a scene camera. Render(*Light, *Camera) }
Shadower is an interface which wraps logic to implement shadowing of a light
type Texture ¶
type Texture interface { Descriptor() TextureDescriptor Handle() unsafe.Pointer // Lt is used for sorting Lt(Texture) bool // Gt Gt(Texture) bool // SetFilter SetFilter(TextureFilter) // SetWrapMode SetWrapMode(TextureWrapMode) }
Texture is an interface which wraps both a texture and settings for samplers sampling it
type TextureComponentType ¶
type TextureComponentType int
TextureComponentType specifies the texture component storage type
const ( TextureComponentTypeUNSIGNEDBYTE TextureComponentType = iota TextureComponentTypeFLOAT )
These are the supported texture component storate types
type TextureDescriptor ¶
type TextureDescriptor struct { Width uint32 Height uint32 Mipmaps bool Target TextureTarget Format TextureFormat SizedFormat TextureSizedFormat ComponentType TextureComponentType Filter TextureFilter WrapMode TextureWrapMode }
TextureDescriptor contains the full description of a texture and its sampling parameters It is used as input to texture creation functions and at runtime inside rendersystems to setup samplers and memory allocation
type TextureFilter ¶
type TextureFilter int
TextureFilter specifies the type of interpolation a sampler of this texture will use
const ( TextureFilterNearest TextureFilter = iota TextureFilterLinear TextureFilterMipmapLinear )
These are the supported texture filtering modes
type TextureFormat ¶
type TextureFormat int
TextureFormat holds the texture component layout
const ( TextureFormatR TextureFormat = iota TextureFormatRG TextureFormatRGB TextureFormatRGBA TextureFormatDEPTH )
These are the several supported texture component layouts
type TextureSizedFormat ¶
type TextureSizedFormat int
TextureSizedFormat specified the format and size of a texture's components
const ( TextureSizedFormatR8 TextureSizedFormat = iota TextureSizedFormatR16F TextureSizedFormatR32F TextureSizedFormatRG8 TextureSizedFormatRG16F TextureSizedFormatRG32F TextureSizedFormatRGB8 TextureSizedFormatRGB16F TextureSizedFormatRGB32F TextureSizedFormatRGBA8 TextureSizedFormatRGBA16F TextureSizedFormatRGBA32F TextureSizedFormatDEPTH32F )
These are the several supportex texture component sizes
type TextureTarget ¶
type TextureTarget int
TextureTarget specifies a texture target type (1D, 2D, 2DArray, Cubemap, etc)
const ( TextureTarget1D TextureTarget = iota TextureTarget1DArray TextureTarget2D TextureTarget2DArray TextureTargetCubemapXPositive TextureTargetCubemapXNegative TextureTargetCubemapYPositive TextureTargetCubemapYNegative TextureTargetCubemapZPositive TextureTargetCubemapZNegative )
TextureTargetXXX are the different texture types
type TextureWrapMode ¶
type TextureWrapMode int
TextureWrapMode specifies the type of wrap around a sampler of this texture will use
const ( TextureWrapModeClampEdge TextureWrapMode = iota TextureWrapModeClampBorder TextureWrapModeRepeat )
These are the supported texture wrap modes
type TimerHistogram ¶
TimerHistogram is a generic histogram of values with a min/max range.
type TimerManager ¶
type TimerManager struct {
// contains filtered or unexported fields
}
TimerManager wraps the system's high resolution timer
func GetTimerManager ¶
func GetTimerManager() *TimerManager
GetTimerManager returns the timer manager.
func (*TimerManager) AvgFPS ¶
func (ts *TimerManager) AvgFPS() float64
AvgFPS returns a smoothed average of FPS.
func (*TimerManager) FrameStartTime ¶
func (ts *TimerManager) FrameStartTime() float64
FrameStartTime returns the time at which the current frame started in number of seconds since application startup.
func (*TimerManager) Histogram ¶
func (ts *TimerManager) Histogram() TimerHistogram
Histogram returns the frame duration histogram.
func (*TimerManager) Paused ¶
func (ts *TimerManager) Paused() bool
Paused returns whether the system timer is paused.
func (*TimerManager) SetDt ¶
func (ts *TimerManager) SetDt(dt float64)
SetDt is called by windowsystem implementations to set the time elapsed since last refreshed.
func (*TimerManager) Time ¶
func (ts *TimerManager) Time() float64
Time returns the system time in number of seconds since application startup.
type Uniform ¶
type Uniform interface { // Value returns the Uniform's value Value() interface{} // Set sets the Uniform's value Set(interface{}) // Copy returns a copy of the Uniform Copy() Uniform }
Uniform is an interface which wraps program Uniforms
type UniformBuffer ¶
type UniformBuffer interface { Set(unsafe.Pointer, int) // Lt is used for sorting Lt(UniformBuffer) bool // Gt Gt(UniformBuffer) bool }
UniformBuffer is an interface which wraps program UniformBuffers
type Updater ¶
type Updater interface { // Run updates a scenegraph node. Run(*Node) }
Updater is an interface that wraps updating a node.
type WindowConfig ¶
type WindowConfig struct { Name string Monitor *glfw.Monitor Width, Height, Hz int Fullscreen bool Vsync int }
WindowConfig is used by client applications to request a specific video mode from a monitor by calling InitWindow and passing it as an argument.
type WindowFlags ¶
type WindowFlags int32
WindowFlags holds a set of properties for window layout.
const ( // WindowFlagsNoTitleBar hides the window title bar/ WindowFlagsNoTitleBar WindowFlags = 1 << iota // WindowFlagsNoResize disallows window resizing. WindowFlagsNoResize //WindowFlagsNoMove disallows moving the window. WindowFlagsNoMove // WindowFlagsNoScrollbar hides the scrollbar. WindowFlagsNoScrollbar // WindowFlagsNoScrollWithMouse disallows using wheel for scrolling. WindowFlagsNoScrollWithMouse // WindowFlagsNoCollapse disables window collapsing. WindowFlagsNoCollapse // WindowFlagsAlwaysAutoResize enables window auto resizing. WindowFlagsAlwaysAutoResize // WindowFlagsShowBorders shows the window border. WindowFlagsShowBorders // WindowFlagsNoSavedSettings disabled saving/using saved window settings. WindowFlagsNoSavedSettings // WindowFlagsNoInputs disables input handling. WindowFlagsNoInputs // WindowFlagsMenuBar enables a menubar on the window. WindowFlagsMenuBar // WindowFlagsHorizontalScrollbar enables horizontal scrolling. WindowFlagsHorizontalScrollbar // WindowFlagsNoFocusOnAppearing disables auto focus when displayed. WindowFlagsNoFocusOnAppearing // WindowFlagsNoBringToFrontOnFocus disables moving window to front when focused. WindowFlagsNoBringToFrontOnFocus )
type WindowManager ¶
type WindowManager struct {
// contains filtered or unexported fields
}
WindowManager exposes windowing to client applications
func GetWindowManager ¶
func GetWindowManager() *WindowManager
GetWindowManager Returns the global WindowManager
func (*WindowManager) CursorPosition ¶
func (w *WindowManager) CursorPosition() (float64, float64)
CursorPosition reports the current cursor position in window coordinates
func (*WindowManager) MakeWindow ¶
func (w *WindowManager) MakeWindow()
MakeWindow created the window manager's window using the previously passed config
func (*WindowManager) SetWindowConfig ¶
func (w *WindowManager) SetWindowConfig(cfg WindowConfig)
SetWindowConfig Sets the config for WindowManager created windows
func (*WindowManager) ShouldClose ¶
func (w *WindowManager) ShouldClose() bool
ShouldClose whether a stop signal is being processed
func (*WindowManager) WindowSize ¶
func (w *WindowManager) WindowSize() mgl32.Vec2
WindowSize the window size
Source Files ¶
- aabb.go
- algebra.go
- application.go
- audiosystem.go
- camera.go
- cameracontrol.go
- cullcomponents.go
- descriptors.go
- framebuffer.go
- imguisystem.go
- inputmanager.go
- light.go
- mesh.go
- model.go
- node.go
- package.go
- physics.go
- platform.go
- proceduralutils.go
- program.go
- rendersystem.go
- resourcemanager.go
- scene.go
- scenemanager.go
- shadow.go
- texture.go
- timermanager.go
- uniform.go
- updatecomponents.go
- window.go