application

package
v0.0.0-...-86d339c Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: GPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const OnAfterRender = "util.application.OnAfterRender"

OnAfterRender is the event generated by Application just after rendering the scene/gui

View Source
const OnBeforeRender = "util.application.OnBeforeRender"

OnBeforeRender is the event generated by Application just before rendering the scene/gui

View Source
const OnQuit = "util.application.OnQuit"

OnQuit is the event generated by Application when the user tries to close the window or the Quit() method is called.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	core.Dispatcher   // Embedded event dispatcher
	core.TimerManager // Embedded timer manager
	// contains filtered or unexported fields
}

func Create

func Create(ops Options) (*Application, error)

Create creates and returns the application object using the specified options. This function must be called only once.

func Get

func Get() *Application

Get returns the application single instance or nil if the application was not created yet

func (*Application) Camera

func (app *Application) Camera() camera.ICamera

Camera returns the current application camera

func (*Application) CameraOrtho

func (app *Application) CameraOrtho() *camera.Orthographic

CameraOrtho returns the application orthographic camera

func (*Application) CameraPersp

func (app *Application) CameraPersp() *camera.Perspective

CameraPersp returns the application perspective camera

func (*Application) ClearUI

func (app *Application) ClearUI()

func (*Application) CreateCamera

func (app *Application) CreateCamera()

func (*Application) FrameCount

func (app *Application) FrameCount() uint64

FrameCount returns the total number of frames since the call to Run()

func (*Application) FrameDelta

func (app *Application) FrameDelta() time.Duration

FrameDelta returns the duration of the previous frame

func (*Application) FrameDeltaSeconds

func (app *Application) FrameDeltaSeconds() float32

FrameDeltaSeconds returns the duration of the previous frame in float32 seconds

func (*Application) FrameRater

func (app *Application) FrameRater() *FrameRater

FrameRater returns the FrameRater object

func (*Application) Gl

func (app *Application) Gl() *gls.GLS

Gl returns the OpenGL state

func (*Application) Gui

func (app *Application) Gui() *gui.Root

func (*Application) InitGls

func (app *Application) InitGls(glctx gl.Context)

func (*Application) Log

func (app *Application) Log() *logger.Logger

Log returns the application logger

func (*Application) Loop

func (app *Application) Loop() error

func (*Application) Orbit

func (app *Application) Orbit() *control.OrbitControl

Orbit returns the current camera orbit control

func (*Application) Renderer

func (app *Application) Renderer() *renderer.Renderer

Renderer returns the application renderer

func (*Application) Run

func (app *Application) Run() error

Run runs the application render loop

func (*Application) RunSeconds

func (app *Application) RunSeconds() float32

RunSeconds returns the elapsed time in seconds since the call to Run()

func (*Application) RunTime

func (app *Application) RunTime() time.Duration

RunTime returns the duration since the call to Run()

func (*Application) Scene

func (app *Application) Scene() *core.Node

Scene returns the current application 3D scene

func (*Application) SetCPUProfile

func (app *Application) SetCPUProfile(fname string)

SetCPUProfile must be called before Run() and sets the file name for cpu profiling. If set the cpu profiling starts before running the render loop and continues till the end of the application.

func (*Application) SetCamera

func (app *Application) SetCamera(cam camera.ICamera)

SetCamera sets the current application camera

func (*Application) SetGui

func (app *Application) SetGui(root *gui.Root)

SetGui sets the root panel of the gui to be rendered

func (*Application) SetOrbit

func (app *Application) SetOrbit(oc *control.OrbitControl)

SetOrbit sets the camera orbit control

func (*Application) SetScene

func (app *Application) SetScene(scene *core.Node)

SetScene sets the 3D scene to be rendered

type FrameRater

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

FrameRater implements a frame rate controller

func NewFrameRater

func NewFrameRater(targetFPS uint) *FrameRater

NewFrameRater returns a frame rate controller object for the specified number of target frames per second

func (*FrameRater) FPS

func (f *FrameRater) FPS(t time.Duration) (float64, float64, bool)

FPS calculates and returns the current measured FPS and the maximum potential FPS after the specified time interval has elapsed. It returns an indication if the results are valid

func (*FrameRater) Start

func (f *FrameRater) Start()

Start should be called at the start of the frame

func (*FrameRater) Wait

func (f *FrameRater) Wait()

Wait should be called at the end of the frame If necessary it will sleep to achieve the desired frame rate

type Options

type Options struct {
	LogPrefix   string // Log prefix (default = "")
	LogLevel    int    // Initial log level (default = DEBUG)
	EnableFlags bool   // Enable command line flags (default = false)
	TargetFPS   uint   // Desired frames per second rate (default = 60)
	Control     bool   //
}

Options defines initial options passed to the application creation function

Jump to

Keyboard shortcuts

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