entity

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base is an object in the game world. By itself entity is nothing more than an identifiable object located at a point in space

func (*Base) Classname

func (entity *Base) Classname() string

Classname gets this entitiy's classname

func (*Base) KeyValues

func (entity *Base) KeyValues() *entity2.Entity

KeyValues returns this entitys keyvalues

func (*Base) New

func (entity *Base) New() IEntity

New entity

func (*Base) SetKeyValues

func (entity *Base) SetKeyValues(keyValues *entity2.Entity)

SetKeyValues set this entity's keyvalues

func (*Base) Transform

func (entity *Base) Transform() *Transform

Transform Returns this entity's transform component

type Camera

type Camera struct {
	*Base
	// contains filtered or unexported fields
}

Camera

func NewCamera

func NewCamera(fov float32, aspectRatio float32) *Camera

NewCamera returns a new camera fov should be provided in radians

func (*Camera) Backwards

func (camera *Camera) Backwards(dt float64)

Backwards

func (*Camera) Forwards

func (camera *Camera) Forwards(dt float64)

Forwards

func (*Camera) Left

func (camera *Camera) Left(dt float64)

Left

func (*Camera) ModelMatrix

func (camera *Camera) ModelMatrix() mgl32.Mat4

ModelMatrix returns identity matrix (camera model is our position!)

func (*Camera) ProjectionMatrix

func (camera *Camera) ProjectionMatrix() mgl32.Mat4

ProjectionMatrix calculates projection matrix. This is unlikely to change throughout program lifetime, but could do

func (*Camera) Right

func (camera *Camera) Right(dt float64)

Right

func (*Camera) Rotate

func (camera *Camera) Rotate(x, y, z float32)

Rotate

func (*Camera) Update

func (camera *Camera) Update(dt float64)

Update updates the camera position

func (*Camera) ViewMatrix

func (camera *Camera) ViewMatrix() mgl32.Mat4

ViewMatrix calculates the cameras View matrix

type EntityId

type EntityId uint

EntityId

type GenericEntity

type GenericEntity struct {
	Base
}

GenericEntity can be used to substitute out an entity that doesn't have a known implementation

func NewGenericEntity

func NewGenericEntity(definition *entity2.Entity) *GenericEntity

NewGenericEntity returns new Entity

type IClassname

type IClassname interface {
	// Classname
	Classname() string
}

IClassname all valid game entities should have a classname, but there may be temporary non-game entities that have classnames

type IEntity

type IEntity interface {
	// KeyValues
	KeyValues() *entity.Entity
	// SetKeyValues
	SetKeyValues(*entity.Entity)
	// Classname
	Classname() string
	// Transform
	Transform() *Transform
	// New
	New() IEntity
}

IEntity Base interface All game entities need to implement this

type Transform

type Transform struct {
	Position mgl32.Vec3
	Rotation mgl32.Vec3
	Scale    mgl32.Vec3
	// contains filtered or unexported fields
}

Transform Represents the transformation of an entity in a 3-dimensional space: position, rotation and scale. Note: Rotation is measured in degrees

func (*Transform) TransformationMatrix added in v0.5.0

func (transform *Transform) TransformationMatrix() mgl32.Mat4

TransformationMatrix computes object transformation matrix

Jump to

Keyboard shortcuts

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