Documentation
¶
Index ¶
- Constants
- Variables
- func AreIntersecting(p1, p2 *PolygonMath2D) bool
- func AreIntersectingPoint(p1 *PolygonMath2D, point mgl32.Vec2) bool
- func ColorToVec3(c color.Color) mgl32.Vec3
- func ColorToVec4(c color.Color) mgl32.Vec4
- func DrawCircle2D(pos mgl32.Vec2, radius float32)
- func DrawCube(pos mgl32.Vec3, width, height, depth, pitch, yaw, roll float32)
- func DrawLine2D(pos1, pos2 mgl32.Vec2)
- func DrawLine3D(pos1, pos2 mgl32.Vec3)
- func DrawPoint2D(point mgl32.Vec2)
- func DrawPoint3D(pos mgl32.Vec3)
- func DrawPolygon2D(positions ...mgl32.Vec2)
- func DrawRectangle2D(pos1, pos2, pos3, pos4 mgl32.Vec2)
- func DrawTexture(tex Texture, x, y int)
- func DrawTextureAdv(tex Texture, x, y, width, height int, texReg TextureRegion, flip uint8)
- func DrawTriangle2D(pos1, pos2, pos3 mgl32.Vec2)
- func DrawTriangle3D(pos1, pos2, pos3 mgl32.Vec3)
- func EqualIgnoreCase(str1, str string) bool
- func FromPolar(radius float32, angle float32) mgl32.Vec2
- func GenerateShader2D(shader_type uint8, flags uint32) (n, v, f string)
- func GenerateShader3D(shader_type uint8, flags uint32) (n, v, f string)
- func GenerateShaderBackBuffer(flags uint32) (n, v, f string)
- func GenerateShaderShadowMap(flags uint32) (n, v, f string)
- func GenerateShaderSource3D()
- func GetColorFromData(x, y int, data []byte, width int) color.Color
- func GetFileExtension(file string) string
- func GetFileFromPath(path string) string
- func GetPathFromFile(path string) string
- func GetShaderName2D(shader_type uint8, flags uint32) string
- func GetShaderName3D(flags uint32) string
- func HEXToColor(str string) color.Color
- func HEXToUint4(str byte) uint8
- func HEXToUint8(str string) uint8
- func Init2DShaders()
- func Init3DShaders()
- func InitDefaultValues()
- func Maxi(a, b int32) int32
- func Mesh2DVerticesToFloatArray(vertices []Mesh2DVertex) (array []float32)
- func Mesh3DVerticesToFloatArray(vertices []Mesh3DVertex) (array []float32)
- func Mini(a, b int32) int32
- func ReadAll(r io.Reader) (str string, err error)
- func ScreenPositionToRay(point mgl32.Vec2) mgl32.Vec3
- func ScreenPositionToRayAdv(point mgl32.Vec2, viewportIndex, cameraIndex int32) mgl32.Vec3
- func Shape2DVerticesToFloatArray(vertices []Shape2DVertex) (array []float32)
- func Shape3DVerticesToFloatArray(points []Shape3DVertex) (array []float32)
- func TextureToImage(tex Texture, flipX, flipY bool) image.Image
- func VertexNormalIndex(which int) int
- func VertexPosIndex(which int) int
- func VertexTexCoordIndex(which int) int
- type AABBRenderer
- type Attentuation
- type AudioManager
- type AxisAlignedBoundingBox
- type BlinkableObject
- type Button
- type ButtonCallback
- type Camera2D
- type Camera3D
- func (cam *Camera3D) AddPositionRelative(pos mgl32.Vec3)
- func (cam *Camera3D) AddRotation(rot mgl32.Vec2)
- func (cam *Camera3D) CalculateViewMatrix()
- func (cam *Camera3D) GetInverseViewMatrix() mgl32.Mat4
- func (cam *Camera3D) GetViewMatrix() mgl32.Mat4
- func (cam *Camera3D) Init()
- func (cam *Camera3D) LookAt(position, center, up mgl32.Vec3)
- func (cam *Camera3D) SetRotation(rot mgl32.Vec2)
- type Circle2D
- type Color
- type CubeMap
- type DirectionalLight
- type Entity3D
- func (this *Entity3D) GetParent() interface{}
- func (this *Entity3D) GetShader() Shader
- func (this *Entity3D) GetTransform3D() *TransformableObject3D
- func (this *Entity3D) GetTransformableObject() TransformableObject
- func (this *Entity3D) GetType() RenderType
- func (this *Entity3D) HasDepthTesting() bool
- func (this *Entity3D) InitLevel(level *Level)
- func (this *Entity3D) InitMesh(mesh Mesh3D)
- func (this *Entity3D) InitModel(model *Model3D)
- func (this *Entity3D) InitName(name string)
- func (this *Entity3D) IsVisible() bool
- func (this *Entity3D) NotRelativeCamera() int
- func (this *Entity3D) Render()
- func (this *Entity3D) RendersLast() bool
- func (this *Entity3D) SetChildChannel(channel chan bool, tobj *TransformableObject3D)
- func (this *Entity3D) SetInvisible()
- func (this *Entity3D) SetParent(parent interface{})
- func (this *Entity3D) SetShader(s Shader)
- func (this *Entity3D) SetTransformableObject(tobj TransformableObject)
- func (this *Entity3D) SetType(rtype RenderType)
- func (this *Entity3D) SetVisible()
- func (this *Entity3D) Terminate()
- type ErrorManager
- func (this *ErrorManager) Error(tag, objectName, message string)
- func (this *ErrorManager) Fatal(tag, objectName, message string)
- func (this *ErrorManager) Init()
- func (this *ErrorManager) Log(tag, objectName, message string)
- func (this *ErrorManager) Message(errorLevel uint8, tag string, objectName string, err string)
- func (this *ErrorManager) MessageError(errorLevel uint8, tag string, objectName string, err error)
- func (this *ErrorManager) Reset()
- func (this *ErrorManager) Terminate()
- func (this *ErrorManager) Warning(tag, objectName, message string)
- type ErrorMessage
- type FPSLimiter
- type File
- type FileSeeker
- type Font
- type Framework
- type GoHomeError
- type IdentityProjection
- type InputManager
- func (inmgr *InputManager) Init()
- func (inmgr *InputManager) IsPressed(key Key) bool
- func (inmgr *InputManager) IsTouched(id uint8) bool
- func (inmgr *InputManager) JustPressed(key Key) bool
- func (inmgr *InputManager) JustTouched(id uint8) bool
- func (inmgr *InputManager) PressKey(key Key)
- func (inmgr *InputManager) ReleaseKey(key Key)
- func (inmgr *InputManager) ReleaseTouch(id uint8)
- func (inmgr *InputManager) TimeHeld(key Key) float32
- func (inmgr *InputManager) Touch(id uint8)
- func (inmgr *InputManager) Update(delta_time float32)
- func (inmgr *InputManager) WasPressed(key Key) bool
- func (inmgr *InputManager) WasTouched(id uint8) bool
- type InstancedEntity3D
- func (this *InstancedEntity3D) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
- func (this *InstancedEntity3D) GetShader() Shader
- func (this *InstancedEntity3D) GetTransformableObject() TransformableObject
- func (this *InstancedEntity3D) GetType() RenderType
- func (this *InstancedEntity3D) HasDepthTesting() bool
- func (this *InstancedEntity3D) InitMesh(mesh InstancedMesh3D, numInstances int)
- func (this *InstancedEntity3D) InitModel(model *InstancedModel3D, numInstances int)
- func (this *InstancedEntity3D) IsVisible() bool
- func (this *InstancedEntity3D) NotRelativeCamera() int
- func (this *InstancedEntity3D) Render()
- func (this *InstancedEntity3D) RendersLast() bool
- func (this *InstancedEntity3D) SetInvisible()
- func (this *InstancedEntity3D) SetNumInstances(n int)
- func (this *InstancedEntity3D) SetNumUsedInstances(n int)
- func (this *InstancedEntity3D) SetShader(s Shader)
- func (this *InstancedEntity3D) SetTransformMatrix(rmgr *RenderManager)
- func (this *InstancedEntity3D) SetType(rtype RenderType)
- func (this *InstancedEntity3D) SetVisible()
- func (this *InstancedEntity3D) Terminate()
- func (this *InstancedEntity3D) UpdateInstancedValues()
- type InstancedMesh3D
- type InstancedModel3D
- func (this *InstancedModel3D) AddMesh3D(m InstancedMesh3D)
- func (this *InstancedModel3D) AddValue(valueType int)
- func (this *InstancedModel3D) AddValueFront(valueType int)
- func (this *InstancedModel3D) GetMesh(name string) InstancedMesh3D
- func (this *InstancedModel3D) GetMeshIndex(index int) InstancedMesh3D
- func (this *InstancedModel3D) GetNumInstances() int
- func (this *InstancedModel3D) GetNumUsedInstances() int
- func (this *InstancedModel3D) HasUV() bool
- func (this *InstancedModel3D) Load()
- func (this *InstancedModel3D) LoadedToGPU() bool
- func (this *InstancedModel3D) Render()
- func (this *InstancedModel3D) SetF(index int, value []float32)
- func (this *InstancedModel3D) SetM2(index int, value []mgl32.Mat2)
- func (this *InstancedModel3D) SetM3(index int, value []mgl32.Mat3)
- func (this *InstancedModel3D) SetM4(index int, value []mgl32.Mat4)
- func (this *InstancedModel3D) SetName(index, valueType int, value string)
- func (this *InstancedModel3D) SetNumInstances(n int)
- func (this *InstancedModel3D) SetNumUsedInstances(n int)
- func (this *InstancedModel3D) SetV2(index int, value []mgl32.Vec2)
- func (this *InstancedModel3D) SetV3(index int, value []mgl32.Vec3)
- func (this *InstancedModel3D) SetV4(index int, value []mgl32.Vec4)
- func (this *InstancedModel3D) Terminate()
- type Key
- type Level
- type LevelObject
- type LevelTransformableObject
- type LightCollection
- type LightManager
- func (this *LightManager) AddDirectionalLight(pl *DirectionalLight, lightCollectionIndex int)
- func (this *LightManager) AddPointLight(pl *PointLight, lightCollectionIndex int)
- func (this *LightManager) AddSpotLight(pl *SpotLight, lightCollectionIndex int)
- func (this *LightManager) DisableLighting()
- func (this *LightManager) EnableLighting()
- func (this *LightManager) Init()
- func (this *LightManager) SetAmbientLight(color color.Color, lightCollectionIndex int)
- func (this *LightManager) Update()
- type Line2D
- type Line3D
- type MainLoop
- func (this *MainLoop) DoStuff()
- func (this *MainLoop) Init(fw Framework, r Renderer, ww, wh int, wt string, start_scene Scene) bool
- func (MainLoop) InitManagers()
- func (this *MainLoop) InitRenderer()
- func (this *MainLoop) InitWindow() bool
- func (this *MainLoop) InitWindowAndRenderer()
- func (MainLoop) InnerLoop()
- func (this *MainLoop) Loop()
- func (this *MainLoop) LoopOnce()
- func (this *MainLoop) Quit()
- func (ml *MainLoop) Run(fw Framework, r Renderer, ww, wh int, wt string, start_scene Scene)
- func (this *MainLoop) SetupStartScene()
- type Material
- type Mesh2D
- type Mesh2DVertex
- type Mesh3D
- type Mesh3DVertex
- type Model3D
- func (this *Model3D) AddMesh3D(m Mesh3D)
- func (this *Model3D) Copy() *Model3D
- func (this *Model3D) GetMesh(name string) Mesh3D
- func (this *Model3D) GetMeshIndex(index int) Mesh3D
- func (this *Model3D) HasUV() bool
- func (this *Model3D) Load()
- func (this *Model3D) Render()
- func (this *Model3D) Terminate()
- type Mouse
- func (this *Mouse) ToRay() mgl32.Vec3
- func (this *Mouse) ToRayAdv(viewportIndex, cameraIndex int32) mgl32.Vec3
- func (this *Mouse) ToScreenPosition() (vec mgl32.Vec2)
- func (this *Mouse) ToWorldPosition2D() mgl32.Vec2
- func (this *Mouse) ToWorldPosition2DAdv(cameraIndex int, viewportIndex int) mgl32.Vec2
- type Music
- type NilAudioManager
- func (*NilAudioManager) CreateMusic(name string, samples []byte, format uint8, sampleRate int) Music
- func (*NilAudioManager) CreateSound(name string, samples []byte, format uint8, sampleRate int) Sound
- func (*NilAudioManager) GetVolume() float32
- func (*NilAudioManager) Init()
- func (*NilAudioManager) LoadMusic(name, path string) Music
- func (*NilAudioManager) LoadSound(name, path string) Sound
- func (*NilAudioManager) SetVolume(vol float32)
- func (*NilAudioManager) Terminate()
- type NilCubeMap
- func (*NilCubeMap) Bind(unit uint32)
- func (*NilCubeMap) GetData() ([]byte, int, int)
- func (*NilCubeMap) GetHeight() int
- func (*NilCubeMap) GetKeyColor() color.Color
- func (*NilCubeMap) GetModColor() color.Color
- func (*NilCubeMap) GetName() string
- func (*NilCubeMap) GetWidth() int
- func (*NilCubeMap) Load(data []byte, width, height int, shadowMap bool)
- func (*NilCubeMap) LoadFromImage(img image.Image)
- func (*NilCubeMap) SetBorderColor(col color.Color)
- func (*NilCubeMap) SetBorderDepth(depth float32)
- func (*NilCubeMap) SetFiltering(filtering int)
- func (*NilCubeMap) SetKeyColor(col color.Color)
- func (*NilCubeMap) SetModColor(col color.Color)
- func (*NilCubeMap) SetWrapping(wrapping int)
- func (*NilCubeMap) Terminate()
- func (*NilCubeMap) Unbind(unit uint32)
- type NilFramework
- func (*NilFramework) CreateWindow(windowWidth, windowHeight int, title string) error
- func (*NilFramework) CurserShow()
- func (*NilFramework) CursorDisable()
- func (*NilFramework) CursorDisabled() bool
- func (*NilFramework) CursorHidden() bool
- func (*NilFramework) CursorHide()
- func (*NilFramework) CursorShown() bool
- func (*NilFramework) EndTextInput()
- func (*NilFramework) GetTextInput() string
- func (*NilFramework) Init(ml *MainLoop) error
- func (*NilFramework) LoadLevel(name, path string, loadToGPU bool) *Level
- func (*NilFramework) LoadLevelString(name, contents, fileName string, loadToGPU bool) *Level
- func (*NilFramework) Log(a ...interface{})
- func (*NilFramework) MonitorGetSize() mgl32.Vec2
- func (*NilFramework) OnClose(callback func())
- func (*NilFramework) OnFocus(callback func(focused bool))
- func (*NilFramework) OnMove(callback func(newPosX, newPosY int))
- func (*NilFramework) OnResize(callback func(newWidth, newHeight int))
- func (*NilFramework) OpenFile(file string) (File, error)
- func (*NilFramework) PollEvents()
- func (*NilFramework) ShowYesNoDialog(title, message string) uint8
- func (*NilFramework) StartTextInput()
- func (*NilFramework) Terminate()
- func (*NilFramework) Update()
- func (*NilFramework) WindowClosed() bool
- func (*NilFramework) WindowGetSize() mgl32.Vec2
- func (*NilFramework) WindowIsFullscreen() bool
- func (*NilFramework) WindowSetFullscreen(b bool)
- func (*NilFramework) WindowSetSize(size mgl32.Vec2)
- func (*NilFramework) WindowSwap()
- type NilInstancedMesh3D
- func (*NilInstancedMesh3D) AABB() AxisAlignedBoundingBox
- func (*NilInstancedMesh3D) AddValue(valueType int)
- func (*NilInstancedMesh3D) AddValueFront(valueType int)
- func (*NilInstancedMesh3D) AddVertices(vertices []Mesh3DVertex, indices []uint32)
- func (*NilInstancedMesh3D) CalculateTangents()
- func (*NilInstancedMesh3D) Copy() Mesh3D
- func (*NilInstancedMesh3D) GetIndices() []uint32
- func (*NilInstancedMesh3D) GetMaterial() *Material
- func (*NilInstancedMesh3D) GetName() string
- func (*NilInstancedMesh3D) GetNumIndices() int
- func (*NilInstancedMesh3D) GetNumInstances() int
- func (*NilInstancedMesh3D) GetNumUsedInstances() int
- func (*NilInstancedMesh3D) GetNumVertices() int
- func (*NilInstancedMesh3D) GetVertices() []Mesh3DVertex
- func (*NilInstancedMesh3D) HasUV() bool
- func (*NilInstancedMesh3D) Load()
- func (*NilInstancedMesh3D) LoadedToGPU() bool
- func (*NilInstancedMesh3D) Render()
- func (*NilInstancedMesh3D) SetF(index int, value []float32)
- func (*NilInstancedMesh3D) SetM2(index int, value []mgl32.Mat2)
- func (*NilInstancedMesh3D) SetM3(index int, value []mgl32.Mat3)
- func (*NilInstancedMesh3D) SetM4(index int, value []mgl32.Mat4)
- func (*NilInstancedMesh3D) SetMaterial(mat *Material)
- func (*NilInstancedMesh3D) SetName(index int, value_type int, value string)
- func (*NilInstancedMesh3D) SetNumInstances(n int)
- func (*NilInstancedMesh3D) SetNumUsedInstances(n int)
- func (*NilInstancedMesh3D) SetV2(index int, value []mgl32.Vec2)
- func (*NilInstancedMesh3D) SetV3(index int, value []mgl32.Vec3)
- func (*NilInstancedMesh3D) SetV4(index int, value []mgl32.Vec4)
- func (*NilInstancedMesh3D) Terminate()
- type NilMesh2D
- type NilMesh3D
- func (*NilMesh3D) AABB() AxisAlignedBoundingBox
- func (*NilMesh3D) AddVertices(vertices []Mesh3DVertex, indices []uint32)
- func (*NilMesh3D) CalculateTangents()
- func (*NilMesh3D) Copy() Mesh3D
- func (*NilMesh3D) GetIndices() []uint32
- func (*NilMesh3D) GetMaterial() *Material
- func (*NilMesh3D) GetName() string
- func (*NilMesh3D) GetNumIndices() int
- func (*NilMesh3D) GetNumVertices() int
- func (*NilMesh3D) GetVertices() []Mesh3DVertex
- func (*NilMesh3D) HasUV() bool
- func (*NilMesh3D) Load()
- func (*NilMesh3D) LoadedToGPU() bool
- func (*NilMesh3D) Render()
- func (*NilMesh3D) SetMaterial(mat *Material)
- func (*NilMesh3D) Terminate()
- type NilMusic
- func (*NilMusic) GetDuration() time.Duration
- func (*NilMusic) GetPlayingDuration() time.Duration
- func (*NilMusic) GetVolume() float32
- func (*NilMusic) IsPlaying() bool
- func (*NilMusic) Pause()
- func (*NilMusic) Play(loop bool)
- func (*NilMusic) Resume()
- func (*NilMusic) SetVolume(vol float32)
- func (*NilMusic) Stop()
- func (*NilMusic) Terminate()
- type NilRenderObject
- func (*NilRenderObject) GetShader() Shader
- func (*NilRenderObject) GetTransformableObject() TransformableObject
- func (*NilRenderObject) GetType() RenderType
- func (*NilRenderObject) HasDepthTesting() bool
- func (*NilRenderObject) IsVisible() bool
- func (*NilRenderObject) NotRelativeCamera() int
- func (*NilRenderObject) Render()
- func (*NilRenderObject) RendersLast() bool
- func (*NilRenderObject) SetShader(s Shader)
- func (*NilRenderObject) SetTransformableObject(tobj TransformableObject)
- func (*NilRenderObject) SetType(rtype RenderType)
- type NilRenderTexture
- func (*NilRenderTexture) Bind(unit uint32)
- func (*NilRenderTexture) Blit(rtex RenderTexture)
- func (*NilRenderTexture) ChangeSize(width, height int)
- func (*NilRenderTexture) GetData() ([]byte, int, int)
- func (*NilRenderTexture) GetHeight() int
- func (*NilRenderTexture) GetKeyColor() color.Color
- func (*NilRenderTexture) GetModColor() color.Color
- func (*NilRenderTexture) GetName() string
- func (*NilRenderTexture) GetWidth() int
- func (*NilRenderTexture) Load(data []byte, width, height int, shadowMap bool)
- func (*NilRenderTexture) LoadFromImage(img image.Image)
- func (*NilRenderTexture) SetAsTarget()
- func (*NilRenderTexture) SetBorderColor(col color.Color)
- func (*NilRenderTexture) SetBorderDepth(depth float32)
- func (*NilRenderTexture) SetFiltering(filtering int)
- func (*NilRenderTexture) SetKeyColor(col color.Color)
- func (*NilRenderTexture) SetModColor(col color.Color)
- func (*NilRenderTexture) SetWrapping(wrapping int)
- func (*NilRenderTexture) Terminate()
- func (*NilRenderTexture) Unbind(unit uint32)
- func (*NilRenderTexture) UnsetAsTarget()
- type NilRenderer
- func (*NilRenderer) AfterInit()
- func (*NilRenderer) AfterRender()
- func (*NilRenderer) ClearScreen(c color.Color)
- func (*NilRenderer) CreateCubeMap(name string) CubeMap
- func (*NilRenderer) CreateInstancedMesh3D(name string) InstancedMesh3D
- func (*NilRenderer) CreateMesh2D(name string) Mesh2D
- func (*NilRenderer) CreateMesh3D(name string) Mesh3D
- func (*NilRenderer) CreateRenderTexture(name string, width, height, textures int, ...) RenderTexture
- func (*NilRenderer) CreateShape2DInterface(name string) Shape2DInterface
- func (*NilRenderer) CreateShape3DInterface(name string) Shape3DInterface
- func (*NilRenderer) CreateTexture(name string, multiSampled bool) Texture
- func (*NilRenderer) DecrementTextureUnit(amount uint32)
- func (*NilRenderer) FilterShaderFiles(name, file, shader_type string) string
- func (*NilRenderer) FilterShaderSource(name, source, shader_type string) string
- func (*NilRenderer) GetBackgroundColor() color.Color
- func (*NilRenderer) GetMaxTextures() int32
- func (*NilRenderer) GetName() string
- func (*NilRenderer) GetNativeResolution() mgl32.Vec2
- func (*NilRenderer) GetViewport() Viewport
- func (*NilRenderer) HasFunctionAvailable(name string) bool
- func (*NilRenderer) Init() error
- func (*NilRenderer) InstancedMesh3DFromLoadedMesh3D(mesh Mesh3D) InstancedMesh3D
- func (*NilRenderer) LoadShader(name, vertex_contents, fragment_contents, geometry_contents, ... string) (Shader, error)
- func (*NilRenderer) NextTextureUnit() uint32
- func (*NilRenderer) OnResize(newWidth, newHeight int)
- func (*NilRenderer) PreRender()
- func (*NilRenderer) RenderBackBuffer()
- func (*NilRenderer) SetBacckFaceCulling(b bool)
- func (*NilRenderer) SetBackgroundColor(bgColor color.Color)
- func (*NilRenderer) SetDepthTesting(b bool)
- func (*NilRenderer) SetNativeResolution(width, height int)
- func (*NilRenderer) SetViewport(viewport Viewport)
- func (*NilRenderer) SetWireFrame(b bool)
- func (*NilRenderer) Terminate()
- type NilScene
- type NilShader
- func (*NilShader) AddAttribute(name string, location uint32)
- func (*NilShader) AddShader(shader_type uint8, src string) error
- func (*NilShader) GetName() string
- func (*NilShader) Link() error
- func (*NilShader) SetUniformB(name string, value uint8)
- func (*NilShader) SetUniformF(name string, value float32)
- func (*NilShader) SetUniformI(name string, value int32)
- func (*NilShader) SetUniformIV2(name string, value []int32)
- func (*NilShader) SetUniformIV3(name string, value []int32)
- func (*NilShader) SetUniformIV4(name string, value []int32)
- func (*NilShader) SetUniformLights(lightCollectionIndex int)
- func (*NilShader) SetUniformM2(name string, value mgl32.Mat2)
- func (*NilShader) SetUniformM3(name string, value mgl32.Mat3)
- func (*NilShader) SetUniformM4(name string, value mgl32.Mat4)
- func (*NilShader) SetUniformMaterial(mat Material)
- func (*NilShader) SetUniformUI(name string, value uint32)
- func (*NilShader) SetUniformV2(name string, value mgl32.Vec2)
- func (*NilShader) SetUniformV3(name string, value mgl32.Vec3)
- func (*NilShader) SetUniformV4(name string, value mgl32.Vec4)
- func (*NilShader) Setup() error
- func (*NilShader) Terminate()
- func (*NilShader) Unuse()
- func (*NilShader) Use()
- type NilShape2DInterface
- func (*NilShape2DInterface) AddLines(lines []Line2D)
- func (*NilShape2DInterface) AddPoints(points []Shape2DVertex)
- func (*NilShape2DInterface) AddTriangles(tris []Triangle2D)
- func (*NilShape2DInterface) GetPoints() []Shape2DVertex
- func (*NilShape2DInterface) Init()
- func (*NilShape2DInterface) Load()
- func (*NilShape2DInterface) Render()
- func (*NilShape2DInterface) SetDrawMode(mode uint8)
- func (*NilShape2DInterface) SetLineWidth(width float32)
- func (*NilShape2DInterface) SetPointSize(size float32)
- func (*NilShape2DInterface) Terminate()
- type NilShape3DInterface
- func (*NilShape3DInterface) AddPoints(points []Shape3DVertex)
- func (*NilShape3DInterface) GetPoints() []Shape3DVertex
- func (*NilShape3DInterface) Init()
- func (*NilShape3DInterface) Load()
- func (*NilShape3DInterface) Render()
- func (*NilShape3DInterface) SetDrawMode(drawMode uint8)
- func (*NilShape3DInterface) SetLineWidth(size float32)
- func (*NilShape3DInterface) SetPointSize(size float32)
- func (*NilShape3DInterface) Terminate()
- type NilSound
- func (*NilSound) GetDuration() time.Duration
- func (*NilSound) GetPlayingDuration() time.Duration
- func (*NilSound) GetVolume() float32
- func (*NilSound) IsPlaying() bool
- func (*NilSound) Pause()
- func (*NilSound) Play(loop bool)
- func (*NilSound) Resume()
- func (*NilSound) SetVolume(vol float32)
- func (*NilSound) Stop()
- func (*NilSound) Terminate()
- type NilTexture
- func (*NilTexture) Bind(unit uint32)
- func (*NilTexture) GetData() ([]byte, int, int)
- func (*NilTexture) GetHeight() int
- func (*NilTexture) GetKeyColor() color.Color
- func (*NilTexture) GetModColor() color.Color
- func (*NilTexture) GetName() string
- func (*NilTexture) GetWidth() int
- func (*NilTexture) Load(data []byte, width, height int, shadowMap bool)
- func (*NilTexture) LoadFromImage(img image.Image)
- func (*NilTexture) SetBorderColor(col color.Color)
- func (*NilTexture) SetBorderDepth(depth float32)
- func (*NilTexture) SetFiltering(filtering int)
- func (*NilTexture) SetKeyColor(col color.Color)
- func (*NilTexture) SetModColor(col color.Color)
- func (*NilTexture) SetWrapping(wrapping int)
- func (*NilTexture) Terminate()
- func (*NilTexture) Unbind(unit uint32)
- type Ortho2DProjection
- type Ortho3DProjection
- type ParentObject3D
- type PerspectiveProjection
- type PlaneMath3D
- type PointLight
- type Polygon2D
- type PolygonMath2D
- type Projection
- type QuadMath2D
- type Rectangle2D
- type RenderManager
- func (rmgr *RenderManager) AddObject(robj RenderObject)
- func (rmgr *RenderManager) AddViewport2D(viewport *Viewport)
- func (rmgr *RenderManager) AddViewport3D(viewport *Viewport)
- func (rmgr *RenderManager) GetBackBuffer() RenderTexture
- func (rmgr *RenderManager) Init()
- func (rmgr *RenderManager) NumRenderObjects() int
- func (rmgr *RenderManager) RemoveObject(robj RenderObject)
- func (rmgr *RenderManager) Render(rtype RenderType, cameraIndex, viewportIndex, lightCollectionIndex int)
- func (rmgr *RenderManager) RenderRenderObject(robj RenderObject)
- func (rmgr *RenderManager) RenderRenderObjectAdv(robj RenderObject, cameraIndex, viewportIndex int)
- func (rmgr *RenderManager) SetCamera2D(cam *Camera2D, index int)
- func (rmgr *RenderManager) SetCamera3D(cam *Camera3D, index int)
- func (rmgr *RenderManager) SetProjection2D(proj Projection)
- func (rmgr *RenderManager) SetProjection2DToTexture(texture Texture)
- func (rmgr *RenderManager) SetProjection3D(proj Projection)
- func (rmgr *RenderManager) SetViewport2D(viewport *Viewport, index int)
- func (rmgr *RenderManager) SetViewport3D(viewport *Viewport, index int)
- func (rmgr *RenderManager) Terminate()
- func (rmgr *RenderManager) Update()
- func (rmgr *RenderManager) UpdateProjection2D(viewportIndex int32)
- func (rmgr *RenderManager) UpdateViewports(current Viewport, previous Viewport)
- type RenderObject
- type RenderTexture
- type RenderType
- type Renderer
- type ResourceManager
- func (rsmgr *ResourceManager) CheckLevel(name, path string) (l, q bool, n string)
- func (rsmgr *ResourceManager) CheckModel(name string) (l, q bool)
- func (rsmgr *ResourceManager) DeleteFont(name string)
- func (rsmgr *ResourceManager) DeleteLevel(name string)
- func (rsmgr *ResourceManager) DeleteModel(name string)
- func (rsmgr *ResourceManager) DeleteMusic(name string)
- func (rsmgr *ResourceManager) DeleteShader(name string)
- func (rsmgr *ResourceManager) DeleteSound(name string)
- func (rsmgr *ResourceManager) DeleteTMXMap(name string)
- func (rsmgr *ResourceManager) DeleteTexture(name string)
- func (rsmgr *ResourceManager) GetFont(name string) *Font
- func (rsmgr *ResourceManager) GetLevel(name string) *Level
- func (rsmgr *ResourceManager) GetModel(name string) *Model3D
- func (rsmgr *ResourceManager) GetMusic(name string) Music
- func (rsmgr *ResourceManager) GetShader(name string) Shader
- func (rsmgr *ResourceManager) GetSound(name string) Sound
- func (rsmgr *ResourceManager) GetTMXMap(name string) *tmx.Map
- func (rsmgr *ResourceManager) GetTexture(name string) Texture
- func (rsmgr *ResourceManager) Init()
- func (rsmgr *ResourceManager) LoadFont(name, path string) *Font
- func (rsmgr *ResourceManager) LoadLevel(name, path string, loadToGPU bool) *Level
- func (rsmgr *ResourceManager) LoadLevelString(name, contents, fileName string, loadToGPU bool) *Level
- func (rsmgr *ResourceManager) LoadMusic(name, path string) Music
- func (rsmgr *ResourceManager) LoadShader(...) Shader
- func (rsmgr *ResourceManager) LoadShaderSource(...) Shader
- func (rsmgr *ResourceManager) LoadSound(name, path string) Sound
- func (rsmgr *ResourceManager) LoadTMXMap(name, path string) *tmx.Map
- func (rsmgr *ResourceManager) LoadTexture(name, path string) Texture
- func (rsmgr *ResourceManager) SetLevel(name string, name1 string)
- func (rsmgr *ResourceManager) SetShader(name string, name1 string)
- func (rsmgr *ResourceManager) SetTexture(name string, name1 string)
- func (rsmgr *ResourceManager) Terminate()
- type Scene
- type SceneManager
- type Shader
- type Shape2D
- func (this *Shape2D) AddLines(lines []Line2D)
- func (this *Shape2D) AddPoints(points []Shape2DVertex)
- func (this *Shape2D) AddTriangles(tris []Triangle2D)
- func (this *Shape2D) GetShader() Shader
- func (this *Shape2D) GetTransformableObject() TransformableObject
- func (this *Shape2D) GetType() RenderType
- func (this *Shape2D) Init()
- func (this *Shape2D) IsVisible() bool
- func (this *Shape2D) Load()
- func (this *Shape2D) NotRelativeCamera() int
- func (this *Shape2D) Render()
- func (this *Shape2D) SetDrawMode(mode uint8)
- func (this *Shape2D) SetLineWidth(width float32)
- func (this *Shape2D) SetPointSize(size float32)
- func (this *Shape2D) Terminate()
- type Shape2DInterface
- type Shape2DVertex
- type Shape3D
- func (this *Shape3D) AddLine(line Line3D)
- func (this *Shape3D) AddLines(lines []Line3D)
- func (this *Shape3D) AddPoint(point Shape3DVertex)
- func (this *Shape3D) AddPoints(points []Shape3DVertex)
- func (this *Shape3D) AddTriangle(tri Triangle3D)
- func (this *Shape3D) AddTriangles(tris []Triangle3D)
- func (this *Shape3D) GetPoints() []Shape3DVertex
- func (this *Shape3D) GetShader() Shader
- func (this *Shape3D) GetTransformableObject() TransformableObject
- func (this *Shape3D) GetType() RenderType
- func (this *Shape3D) Init()
- func (this *Shape3D) IsVisible() bool
- func (this *Shape3D) Load()
- func (this *Shape3D) NotRelativeCamera() int
- func (this *Shape3D) Render()
- func (this *Shape3D) SetColor(col color.Color)
- func (this *Shape3D) SetDrawMode(drawMode uint8)
- func (this *Shape3D) SetLineWidth(width float32)
- func (this *Shape3D) SetPointSize(size float32)
- func (this *Shape3D) SetShader(s Shader)
- func (this *Shape3D) SetTransformableObject(tobj TransformableObject)
- func (this *Shape3D) SetType(rtype RenderType)
- func (this *Shape3D) Terminate()
- type Shape3DInterface
- type Shape3DVertex
- type Slider
- type SliderCallback
- type Sound
- type SpotLight
- type Sprite2D
- func (spr *Sprite2D) GetShader() Shader
- func (spr *Sprite2D) GetTransform2D() *TransformableObject2D
- func (spr *Sprite2D) GetTransformableObject() TransformableObject
- func (spr *Sprite2D) GetType() RenderType
- func (spr *Sprite2D) Init(texName string)
- func (spr *Sprite2D) InitTexture(texture Texture)
- func (spr *Sprite2D) IsVisible() bool
- func (spr *Sprite2D) NotRelativeCamera() int
- func (spr *Sprite2D) Render()
- func (spr *Sprite2D) SetInvisible()
- func (spr *Sprite2D) SetShader(s Shader)
- func (spr *Sprite2D) SetTransformableObject(tobj TransformableObject)
- func (spr *Sprite2D) SetType(rtype RenderType)
- func (spr *Sprite2D) SetVisible()
- func (spr *Sprite2D) Terminate()
- type Stringer
- type TestCameraMovement3D
- type Text2D
- func (this *Text2D) GetShader() Shader
- func (this *Text2D) GetTransformableObject() TransformableObject
- func (this *Text2D) GetType() RenderType
- func (this *Text2D) Init(font string, fontSize int, str string)
- func (this *Text2D) IsVisible() bool
- func (this *Text2D) NotRelativeCamera() int
- func (this *Text2D) Render()
- func (this *Text2D) SetFont(name string)
- func (this *Text2D) SetShader(s Shader)
- func (this *Text2D) SetTransformableObject(tobj TransformableObject)
- func (this *Text2D) SetType(rtype RenderType)
- func (this *Text2D) Terminate()
- type Texture
- type TextureRegion
- type TiledMap
- type Touch
- type TransformableObject
- type TransformableObject2D
- type TransformableObject3D
- func (tobj *TransformableObject3D) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
- func (tobj *TransformableObject3D) GetParent() ParentObject3D
- func (tobj *TransformableObject3D) GetPosition() mgl32.Vec3
- func (tobj *TransformableObject3D) GetTransform3D() *TransformableObject3D
- func (tobj *TransformableObject3D) GetTransformMatrix() mgl32.Mat4
- func (tobj *TransformableObject3D) SetChildChannel(channel chan bool, tobj1 *TransformableObject3D)
- func (tobj *TransformableObject3D) SetParent(parent ParentObject3D)
- func (tobj *TransformableObject3D) SetTransformMatrix(rmgr *RenderManager)
- type TransformableObjectInstanced3D
- type Triangle2D
- type Triangle3D
- type Tween
- type TweenBlink
- type TweenPosition2D
- type TweenPosition3D
- type TweenRegion2D
- type TweenRotation2D
- type TweenRotation3D
- type TweenScale2D
- type TweenScale3D
- type TweenTexture2D
- type TweenWait
- type TweenableObject2D
- type TweenableObject3D
- type Tweenset
- func SpriteAnimation2D(texture Texture, framesx, framesy int, frametime float32) Tweenset
- func SpriteAnimation2DOffset(texture Texture, framesx, framesy, offsetx1, offsety1, offsetx2, offsety2 int, ...) Tweenset
- func SpriteAnimation2DRegions(regions []TextureRegion, frametime float32) Tweenset
- func SpriteAnimation2DTextures(textures []Texture, frametime float32) Tweenset
- func (this *Tweenset) Done() bool
- func (this Tweenset) Merge(other Tweenset) Tweenset
- func (this *Tweenset) Pause()
- func (this *Tweenset) Reset()
- func (this *Tweenset) Resume()
- func (this *Tweenset) SetParent(twobj interface{})
- func (this *Tweenset) Start()
- func (this *Tweenset) Stop()
- func (this *Tweenset) Update(delta_time float32)
- type UpdateManager
- func (upmgr *UpdateManager) AddObject(upobj UpdateObject)
- func (upmgr *UpdateManager) BreakUpdateLoop()
- func (upmgr *UpdateManager) Init()
- func (upmgr *UpdateManager) NumUpdateObjects() int
- func (upmgr *UpdateManager) RemoveObject(upobj UpdateObject)
- func (upmgr *UpdateManager) Terminate()
- func (upmgr *UpdateManager) Update(delta_time float32)
- type UpdateObject
- type Viewport
Constants ¶
const ( AUDIO_FORMAT_STEREO8 uint8 = iota AUDIO_FORMAT_STEREO16 uint8 = iota AUDIO_FORMAT_MONO8 uint8 = iota AUDIO_FORMAT_MONO16 uint8 = iota AUDIO_FORMAT_UNKNOWN uint8 = iota )
const ( ENTITY3D_SHADER_NAME string = "3D" ENTITY3D_NO_UV_SHADER_NAME string = "3D NoUV" ENTITY3D_NO_UV_NO_SHADOWS_SHADER_NAME string = "3D NoUV NoShadows" )
const ( ERROR_LEVEL_LOG uint8 = iota ERROR_LEVEL_ERROR uint8 = iota ERROR_LEVEL_WARNING uint8 = iota ERROR_LEVEL_FATAL uint8 = iota )
Used to set which level of messages should be printed
const ( NUM_MEASUREMENTS = 11 NUM_TAKEAWAYS = 2 )
const ( DIALOG_YES = iota DIALOG_NO = iota DIALOG_CANCELLED = iota DIALOG_ERROR = iota )
The differnet results of a dialogue
const ( ENTITY_3D_INSTANCED_SHADER_NAME string = "3D Instanced" ENTITY_3D_INSTANCED_NOUV_SHADER_NAME string = "3D Instanced NoUV" ENTITY_3D_INSTANCED_NO_SHADOWS_SHADER_NAME string = "3D Instanced NoShadows" ENTITY_3D_INSTANCED_NOUV_NO_SHADOWS_SHADER_NAME string = "3D Instanced NoUV NoShadows" ENTITY_3D_INSTANCED_SIMPLE_SHADER_NAME string = "3D Instanced Simple" )
const ( VALUE_FLOAT = iota VALUE_VEC2 = iota VALUE_VEC3 = iota VALUE_VEC4 = iota VALUE_MAT2 = iota VALUE_MAT3 = iota VALUE_MAT4 = iota )
The different types of values that can be used for instancing
const ( AMBIENT_LIGHT_UNIFORM_NAME = "ambientLight" POINT_LIGHTS_UNIFORM_NAME = "pointLights" DIRECTIONAL_LIGHTS_UNIFORM_NAME = "directionalLights" SPOT_LIGHTS_UNIFORM_NAME = "spotLights" POSITION_UNIFORM_NAME = "position" DIRECTION_UNIFORM_NAME = "direction" DIFFUSE_COLOR_UNIFORM_NAME = "diffuseColor" SPECULAR_COLOR_UNIFORM_NAME = "specularColor" INNERCUTOFF_UNIFORM_NAME = "innerCutOff" OUTERCUTOFF_UNIFORM_NAME = "outerCutOff" ATTENTUATION_UNIFORM_NAME = "attentuation" ATTENTUATION_CONSTANT_UNIFORM_NAME = "constant" ATTENTUATION_LINEAR_UNIFORM_NAME = "linear" ATTENTUATION_QUADRATIC_UNIFORM_NAME = "quadratic" NUM_POINT_LIGHTS_UNIFORM_NAME = "numPointLights" NUM_DIRECTIONAL_LIGHTS_UNIFORM_NAME = "numDirectionalLights" NUM_SPOT_LIGHTS_UNIFORM_NAME = "numSpotLights" LIGHT_SPACE_MATRIX_UNIFORM_NAME = "lightSpaceMatrix" SHADOWMAP_UNIFORM_NAME = "shadowmap" CASTSSHADOWS_UNIFORM_NAME = "castsShadows" SHADOW_DISTANCE_UNIFORM_NAME = "shadowDistance" FAR_PLANE_UNIFORM_NAME = "farPlane" SHADOWMAP_SIZE_UNIFORM_NAME = "shadowMapSize" SHADOWMAP_SHADER_NAME = "ShadowMap" SHADOWMAP_INSTANCED_SHADER_NAME = "ShadowMap Instanced" DEFAULT_DIRECTIONAL_LIGHTS_SHADOWMAP_SIZE = 1024 * 4 DEFAULT_SPOT_LIGHTS_SHADOWMAP_SIZE = 1024 )
const ( MATERIAL_UNIFORM_NAME string = "material" MATERIAL_DIFFUSE_COLOR_UNIFORM_NAME string = "diffuseColor" MATERIAL_SPECULAR_COLOR_UNIFORM_NAME string = "specularColor" MATERIAL_SPECULAR_TEXTURE_UNIFORM_NAME string = "specularTexture" MATERIAL_DIFFUSE_TEXTURE_UNIFORM_NAME string = "diffuseTexture" MATERIAL_SHINYNESS_UNIFORM_NAME string = "shinyness" MATERIAL_DIFFUSE_TEXTURE_LOADED_UNIFORM_NAME string = "DiffuseTextureLoaded" MATERIAL_SPECULAR_TEXTURE_LOADED_UNIFORM_NAME string = "SpecularTextureLoaded" MATERIAL_NORMALMAP_LOADED_UNIFORM_NAME string = "NormalMapLoaded" MATERIAL_NORMALMAP_UNIFORM_NAME string = "normalMap" MATERIAL_TRANSPARENCY_UNIFORM_NAME string = "transparency" MAX_SPECULAR_EXPONENT float64 = 50.0 MIN_SPECULAR_EXPONENT float64 = 5.0 )
const ( MESH2DVERTEXSIZE = 2 * 2 * 4 // 2*2*sizeof(float32) INDEXSIZE = 4 // sizeof(unsigned int 32) SHAPE3DVERTEXSIZE = 3*4 + 4*4 SHAPE2DVERTEXSIZE = 2*4 + 4*4 )
const ( NEAR_LEFT_DOWN = 0 NEAR_RIGHT_DOWN = 1 NEAR_RIGHT_UP = 2 NEAR_LEFT_UP = 3 FAR_LEFT_DOWN = 4 FAR_RIGHT_DOWN = 5 FAR_RIGHT_UP = 6 FAR_LEFT_UP = 7 )
const ( VERTEX uint8 = 0 FRAGMENT uint8 = 1 GEOMETRY uint8 = 2 TESSELLETION uint8 = 3 EVELUATION uint8 = 4 COMPUTE uint8 = 5 )
The different parts of a shader
const ( SHADER_TYPE_SPRITE2D uint8 = 1 SHADER_TYPE_SHAPE2D uint8 = 2 SHADER_TYPE_TEXT2D uint8 = 3 SHADER_TYPE_3D uint8 = 4 SHADER_TYPE_SHAPE3D uint8 = 5 )
const ( SHADER_FLAG_INSTANCED uint32 = (1 << 0) SHADER_FLAG_NOUV uint32 = (1 << 1) SHADER_FLAG_NO_SHADOWS uint32 = (1 << 2) SHADER_FLAG_NO_LIGHTING uint32 = (1 << 3) SHADER_FLAG_NO_DIFTEX uint32 = (1 << 4) SHADER_FLAG_NO_SPECTEX uint32 = (1 << 5) SHADER_FLAG_NO_NORMAP uint32 = (1 << 6) NUM_FLAGS_3D = 7 SHADER_FLAG_NO_KEYCOLOR uint32 = (1 << 1) SHADER_FLAG_NO_MODCOLOR uint32 = (1 << 2) SHADER_FLAG_NO_FLIP uint32 = (1 << 3) SHADER_FLAG_NO_TEXTURE_REGION uint32 = (1 << 4) SHADER_FLAG_NO_DEPTH uint32 = (1 << 5) SHADER_FLAG_NO_TEXTURE uint32 = (1 << 6) SHADER_FLAG_DEPTHMAP uint32 = (1 << 7) NUM_FLAGS_2D = 8 )
const ( DRAW_MODE_POINTS uint8 = iota DRAW_MODE_LINES uint8 = iota DRAW_MODE_TRIANGLES uint8 = iota )
The draw modes for the shapes
const ( SPRITE2D_SHADER_NAME string = "2D" SPRITE2D_MESH_NAME string = "SPRITE2D_MESH" FLIP_UNIFORM_NAME string = "flip" TEXTURE_REGION_UNIFORM_NAME string = "textureRegion" DEPTH_UNIFORM_NAME string = "depth" ENABLE_KEY_UNIFORM_NAME string = "enableKey" KEY_COLOR_UNIFORM_NAME string = "keyColor" ENABLE_MOD_UNIFORM_NAME string = "enableMod" MOD_COLOR_UNIFORM_NAME string = "modColor" ENABLE_TEXTURE_REGION_UNIFORM_NAME string = "enableTextureRegion" )
const ( TEST_CAMERA_MOVEMENT_MOVE_SPEED float32 = 30.0 TEST_CAMERA_MOVEMENT_ROTATE_SPEED float32 = 0.5 TEST_CAMERA_MOVEMENT_MOVE_SPEED_MAGNIFIER float32 = 5.0 )
const ( LINE_PADDING = 0 FLIP_NONE = 0 FLIP_HORIZONTAL = 1 FLIP_VERTICAL = 2 FLIP_DIAGONALLY = 3 )
The values used for the flip
const ( TEXT_2D_SHADER_NAME = "Text2D" COLOR_UNIFORM_NAME = "color" )
const ( FILTERING_NEAREST = iota FILTERING_LINEAR = iota FILTERING_NEAREST_MIPMAP_NEAREST = iota FILTERING_LINEAR_MIPMAP_LINEAR = iota WRAPPING_REPEAT = iota WRAPPING_CLAMP_TO_BORDER = iota WRAPPING_CLAMP_TO_EDGE = iota WRAPPING_MIRRORED_REPEAT = iota )
The different filtering and wrapping methods based on OpenGL
const ( // The tween starts with the previous tween TWEEN_TYPE_WITH_PREVIOUS = iota // The tween starts after the previous tween has finished TWEEN_TYPE_AFTER_PREVIOUS = iota // The tween starts as the first tween in the list starts TWEEN_TYPE_ALWAYS = iota )
These constants define when the Tween will be applied
const (
DPI = 72
)
const (
LOOK_DIRECTION_MAGNIFIER float32 = 100.0
)
const (
MESH3DVERTEXSIZE = 3*4 + 3*4 + 2*4 + 3*4
)
const (
NUM_GO_ROUTINES_TEXTURE_LOADING = 10
)
const (
READ_ALL_BUFFER_SIZE = 512 * 512
)
const (
SHADER_FLAG_NO_MS uint32 = (1 << 0)
)
const (
SHAPE3D_SHADER_NAME string = "Shape3D"
)
const (
SHAPE_2D_SHADER_NAME string = "Shape2D"
)
const (
ShaderVersion = "110"
)
Variables ¶
var ( // The relative paths in which will be searched for levels LEVEL_PATHS = [6]string{ "", "models/", "levels/", "assets/", "assets/models/", "assets/levels/", } // The relative paths in which will be searched for materials MATERIAL_PATHS = [8]string{ "", "models/", "levels/", "assets/", "assets/models/", "assets/levels/", "materials/", "assets/materials/", } )
var ( Attributes2D = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "vertex"}, glslgen.Variable{"vec2", "highp", "texCoord"}, } AttributesVertexOnly2D = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "vertex"}, } AttributesShape2D = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "vertex"}, glslgen.Variable{"vec4", "highp", "color"}, } Outputs2D = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "fragTexCoord"}, } OutputsShape2D = []glslgen.Variable{ glslgen.Variable{"vec4", "highp", "fragColor"}, } GlobalsVertex2D = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "globalTexCoord"}, } GlobalsFragment2D = []glslgen.Variable{ glslgen.Variable{"vec4", "highp", "globalColor"}, } MakrosVertex2D = []glslgen.Makro{ glslgen.Makro{"FLIP_NONE", "0"}, glslgen.Makro{"FLIP_HORIZONTAL", "1"}, glslgen.Makro{"FLIP_VERTICAL", "2"}, glslgen.Makro{"FLIP_DIAGONALLY", "3"}, } MakrosFragment2D = []glslgen.Makro{ glslgen.Makro{"KEY_COLOR_PADDING", "0.1"}, glslgen.Makro{"ALPHA_DISCARD_PADDING", "0.1"}, } InitModuleVertex2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"mat3", "highp", "transformMatrix2D"}, glslgen.Variable{"mat4", "highp", "projectionMatrix2D"}, glslgen.Variable{"mat3", "highp", "viewMatrix2D"}, }, Name: "init", Body: "gl_Position = projectionMatrix2D *vec4(vec2(viewMatrix2D*transformMatrix2D*vec3(vertex,1.0)),0.0,1.0);", } InitTexCoordModule2D = glslgen.Module{ Name: "initTexCoord", Body: "globalTexCoord = texCoord;", } DepthModuleVertex2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"float", "highp", "depth"}, }, Name: "initDepth", Body: "gl_Position.z = depth;", } FlipModuleVertex2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"int", "", "flip"}, }, Functions: []glslgen.Function{ glslgen.Function{ "vec2 flipTexCoord(vec2 tc)", `vec2 flippedTexCoord; if(flip == FLIP_NONE) { flippedTexCoord = tc; } else if(flip == FLIP_HORIZONTAL) { flippedTexCoord.x = 1.0-tc.x; flippedTexCoord.y = tc.y; } else if(flip == FLIP_VERTICAL) { flippedTexCoord.x = tc.x; flippedTexCoord.y = 1.0-tc.y; } else if(flip == FLIP_DIAGONALLY) { flippedTexCoord.x = 1.0-tc.x; flippedTexCoord.y = 1.0-tc.y; } else { flippedTexCoord = tc; } return flippedTexCoord;`, }, }, Name: "flipModule", Body: "globalTexCoord = flipTexCoord(globalTexCoord);", } TextureRegionModule = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"vec4", "highp", "textureRegion"}, glslgen.Variable{"bool", "", "enableTextureRegion"}, }, Functions: []glslgen.Function{ glslgen.Function{ "vec2 textureRegionToTexCoord(vec2 tc)", `if(!enableTextureRegion) return tc; // X: 0 -> 0 -> Min X // Y: 0 -> 0 -> Min Y // Z: WIDTH -> 1 -> Max X // W: HEIGHT -> 1 -> Max Y vec2 newTexCoord = tc; newTexCoord.x = newTexCoord.x * (textureRegion.z-textureRegion.x)+textureRegion.x; newTexCoord.y = newTexCoord.y * (textureRegion.w-textureRegion.y)+textureRegion.y; return newTexCoord;`, }, }, Name: "textureRegionModule", Body: "globalTexCoord = textureRegionToTexCoord(globalTexCoord);", } FinishTexCoordModule2D = glslgen.Module{ Name: "finishTexCoord", Body: "fragTexCoord = globalTexCoord;", } FinishFragColorModule2D = glslgen.Module{ Name: "finishFragColor", Body: "fragColor = color;", } InitModuleFragment2D = glslgen.Module{ Name: "init", Body: "globalColor = vec4(1.0,1.0,1.0,1.0);", } TextureModuleFragment2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"sampler2D", "highp", "texture0"}, }, Name: "textureModule", Body: "globalColor = texture2D(texture0,fragTexCoord);", } KeyColorModuleFragment2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "keyColor"}, glslgen.Variable{"bool", "", "enableKey"}, }, Name: "keyColorModule", Body: `if(enableKey) { if(globalColor.r >= keyColor.r - KEY_COLOR_PADDING && globalColor.r <= keyColor.r + KEY_COLOR_PADDING && globalColor.g >= keyColor.g - KEY_COLOR_PADDING && globalColor.g <= keyColor.g + KEY_COLOR_PADDING && globalColor.b >= keyColor.b - KEY_COLOR_PADDING && globalColor.b <= keyColor.b + KEY_COLOR_PADDING) { discard; } }`, } ModColorModuleFragment2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"vec4", "highp", "modColor"}, glslgen.Variable{"bool", "", "enableMod"}, }, Name: "modColorModule", Body: `if(enableMod) { globalColor *= modColor; }`, } DepthMapModuleFragment2D = glslgen.Module{ Name: "depthMapModule", Body: "globalColor = vec4(globalColor.r,globalColor.r,globalColor.r,globalColor.a);", } FinishColorModuleFragment2D = glslgen.Module{ Name: "finishColor", Body: `gl_FragColor = globalColor; if(gl_FragColor.a < ALPHA_DISCARD_PADDING) discard;`, } FragColorModuleFragment2D = glslgen.Module{ Name: "applyFragColor", Body: `gl_FragColor = fragColor; if(gl_FragColor.a < ALPHA_DISCARD_PADDING) discard;`, } ColorModuleFragment2D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"vec4", "highp", "color"}, }, Name: "colorModule", Body: "globalColor *= color;", } )
var ( Attributes3D = []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "vertex"}, glslgen.Variable{"vec3", "highp", "normal"}, glslgen.Variable{"vec2", "highp", "texCoord"}, glslgen.Variable{"vec3", "highp", "tangent"}, } AttributesInstanced3D = []glslgen.Variable{ glslgen.Variable{"mat4", "highp", "transformMatrix3D"}, } UniformModuleVertex3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"mat4", "highp", "viewMatrix3D"}, glslgen.Variable{"mat4", "highp", "inverseViewMatrix3D"}, glslgen.Variable{"mat4", "highp", "projectionMatrix3D"}, }, } UniformNormalModuleVertex3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"mat4", "highp", "transformMatrix3D"}, }, } CalculatePositionModule3D = glslgen.Module{ Name: "calculatePosition", Body: "gl_Position = projectionMatrix3D*viewMatrix3D*transformMatrix3D*vec4(vertex,1.0);", } SetOutputsModuleVertex3D = glslgen.Module{ Name: "setOutputs", Body: `fragViewMatrix3D = viewMatrix3D; fragInverseViewMatrix3D = inverseViewMatrix3D;`, } SetOutputsNormalModuleVertex3D = glslgen.Module{ Name: "setOutputsNormal", Body: `fragPos = (viewMatrix3D*transformMatrix3D*vec4(vertex,1.0)).xyz; fragNormal = (viewMatrix3D*transformMatrix3D*vec4(normal,0.0)).xyz; vec3 norm = normalize(fragNormal); vec3 tang = normalize((viewMatrix3D*transformMatrix3D*vec4(tangent,0.0)).xyz); vec3 bitang = normalize(cross(norm,tang)); fragToTangentSpace = mat3( tang.x,bitang.x,norm.x, tang.y,bitang.y,norm.y, tang.z,bitang.z,norm.z );`, } SetOutputsNoUVModuleVertex3D = glslgen.Module{ Name: "setOutputsNoUV", Body: `fragPos = (transformMatrix3D*vec4(vertex,1.0)).xyz; fragNormal = (transformMatrix3D*vec4(normal,0.0)).xyz;`, } SetOutputTexCoordModuleVertex3D = glslgen.Module{ Name: "setOutputTexCoord", Body: `fragTexCoord = texCoord;`, } GlobalsFragment3D = []glslgen.Variable{ glslgen.Variable{"float", "const highp", "shadowDistance = 50.0"}, glslgen.Variable{"float", "const highp", "transitionDistance = 5.0"}, glslgen.Variable{"float", "const highp", "bias = 0.005"}, glslgen.Variable{"vec4", "highp", "finalDiffuseColor"}, glslgen.Variable{"vec4", "highp", "finalSpecularColor"}, glslgen.Variable{"vec4", "highp", "finalAmbientColor"}, glslgen.Variable{"vec3", "highp", "norm"}, glslgen.Variable{"vec3", "highp", "viewDir"}, } InputsFragment3D = []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "fragPos"}, glslgen.Variable{"vec3", "highp", "fragNormal"}, glslgen.Variable{"mat4", "highp", "fragViewMatrix3D"}, glslgen.Variable{"mat4", "highp", "fragInverseViewMatrix3D"}, } InputsNormalFragment3D = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "fragTexCoord"}, glslgen.Variable{"mat3", "highp", "fragToTangentSpace"}, } LightMakrosFragment3D = []glslgen.Makro{ glslgen.Makro{"MAX_POINT_LIGHTS", "5"}, glslgen.Makro{"MAX_DIRECTIONAL_LIGHTS", "2"}, glslgen.Makro{"MAX_SPOT_LIGHTS", "1"}, glslgen.Makro{"degToRad(deg)", "(deg/180.0*3.14159265359)"}, glslgen.Makro{"MAX_SPECULAR_EXPONENT", "50.0"}, glslgen.Makro{"MIN_SPECULAR_EXPONENT", "5.0"}, } InitialiseModuleFragment3D = glslgen.Module{ Name: "initialise", Body: `finalDiffuseColor = vec4(1.0,1.0,1.0,1.0); finalSpecularColor = vec4(0.0); finalAmbientColor = vec4(0.0);`, } InitialiseNormalModuleFragment3D = glslgen.Module{ Name: "initialiseNormal", Body: `norm = normalize(fragToTangentSpace*fragNormal); viewDir = normalize(fragToTangentSpace*(fragPos*-1.0));`, } InitialiseNoUVModuleFragment3D = glslgen.Module{ Name: "initialiseNoUV", Body: `norm = normalize(fragNormal); vec3 camPos = (fragInverseViewMatrix3D*vec4(0.0,0.0,0.0,1.0)).xyz; viewDir = camPos - fragPos;`, } LightUniformsModule3D = glslgen.Module{ Structs: []glslgen.Struct{ glslgen.Struct{ "Attentuation", []glslgen.Variable{ glslgen.Variable{"float", "highp", "constant"}, glslgen.Variable{"float", "highp", "linear"}, glslgen.Variable{"float", "highp", "quadratic"}, }, }, glslgen.Struct{ "PointLight", []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "position"}, glslgen.Variable{"vec3", "highp", "diffuseColor"}, glslgen.Variable{"vec3", "highp", "specularColor"}, glslgen.Variable{"Attentuation", "", "attentuation"}, }, }, glslgen.Struct{ "DirectionalLight", []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "direction"}, glslgen.Variable{"vec3", "highp", "diffuseColor"}, glslgen.Variable{"vec3", "highp", "specularColor"}, glslgen.Variable{"mat4", "highp", "lightSpaceMatrix"}, glslgen.Variable{"bool", "", "castsShadows"}, glslgen.Variable{"ivec2", "", "shadowMapSize"}, glslgen.Variable{"float", "highp", "shadowDistance"}, }, }, glslgen.Struct{ "SpotLight", []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "position"}, glslgen.Variable{"vec3", "highp", "direction"}, glslgen.Variable{"vec3", "highp", "diffuseColor"}, glslgen.Variable{"vec3", "highp", "specularColor"}, glslgen.Variable{"float", "highp", "innerCutOff"}, glslgen.Variable{"float", "highp", "outerCutOff"}, glslgen.Variable{"Attentuation", "", "attentuation"}, glslgen.Variable{"mat4", "highp", "lightSpaceMatrix"}, glslgen.Variable{"bool", "", "castsShadows"}, glslgen.Variable{"ivec2", "", "shadowMapSize"}, }, }, }, Uniforms: []glslgen.Variable{ glslgen.Variable{"int", "", "numPointLights"}, glslgen.Variable{"int", "", "numDirectionalLights"}, glslgen.Variable{"int", "", "numSpotLights"}, glslgen.Variable{"vec3", "highp", "ambientLight"}, glslgen.Variable{"PointLight", "", "pointLights[MAX_POINT_LIGHTS]"}, glslgen.Variable{"DirectionalLight", "", "directionalLights[MAX_POINT_LIGHTS]"}, glslgen.Variable{"sampler2D", "highp", "directionalLightsshadowmap[MAX_DIRECTIONAL_LIGHTS]"}, glslgen.Variable{"SpotLight", "", "spotLights[MAX_SPOT_LIGHTS]"}, glslgen.Variable{"sampler2D", "highp", "spotLightsshadowmap[MAX_SPOT_LIGHTS]"}, }, Functions: []glslgen.Function{ glslgen.Function{ "vec3 diffuseLighting(vec3 lightDir, vec3 diffuse)", `float diff = max(dot(norm,lightDir),0.0); diffuse *= diff; return diffuse;`, }, glslgen.Function{ "vec3 specularLighting(vec3 lightDir, vec3 specular)", `vec3 reflectDir = reflect(-lightDir, norm); vec3 halfwayDir = normalize(lightDir + viewDir); float spec = max(pow(max(dot(norm,halfwayDir),0.0),calculateShinyness(material.shinyness)),0.0); specular *= spec; return specular;`, }, glslgen.Function{ "void calculatePointLights()", ` for (int i = 0;i<MAX_POINT_LIGHTS;i++) { if(i>=numPointLights) break; calculatePointLight(pointLights[i],i); }`, }, glslgen.Function{ "void calculateDirectionalLights()", ` for (int i = 0;i<MAX_DIRECTIONAL_LIGHTS;i++) { if(i>=numDirectionalLights) break; calculateDirectionalLight(directionalLights[i],i); }`, }, glslgen.Function{ "void calculateSpotLights()", `for(int i=0;i<MAX_SPOT_LIGHTS ; i++) { if(i>=numSpotLights) break; calculateSpotLight(spotLights[i],i); }`, }, glslgen.Function{ "void calculateAllLights()", `calculatePointLights(); calculateDirectionalLights(); calculateSpotLights();`, }, glslgen.Function{ "float calcAttentuation(vec3 lightPosition,Attentuation attentuation)", `float distance = distance(lightPosition,fragPos); float attent = 1.0/(attentuation.quadratic*distance*distance + attentuation.linear*distance + attentuation.constant); return attent;`, }, glslgen.Function{ "float calculateShinyness(float shinyness)", "return max(MAX_SPECULAR_EXPONENT*(pow(max(shinyness,0.0),-3.0)-1.0)+MIN_SPECULAR_EXPONENT,0.0);", }, }, Name: "calculateLights", Body: `finalDiffuseColor = vec4(0.0,0.0,0.0,1.0); finalAmbientColor = vec4(ambientLight,1.0); calculateAllLights();`, } LightCalcSpotAmountNormalModule3D = glslgen.Module{ Functions: []glslgen.Function{ glslgen.Function{ "float calcSpotAmount(vec3 lightDir,vec3 lightDirection,SpotLight pl)", `float theta = dot(lightDir, normalize(fragToTangentSpace*lightDirection)); float spotAmount = 0.0; float outerCutOff = cos(degToRad(pl.outerCutOff)); float innerCutOff = cos(degToRad(pl.innerCutOff)); float epsilon = innerCutOff - outerCutOff; spotAmount = clamp((theta - outerCutOff) / epsilon, 0.0, 1.0); return spotAmount;`, }, }, } LightCalcSpotAmountNoUVModule3D = glslgen.Module{ Functions: []glslgen.Function{ glslgen.Function{ "float calcSpotAmount(vec3 lightDir,vec3 lightDirection,SpotLight pl)", `float theta = dot(lightDir, lightDirection); float spotAmount = 0.0; float outerCutOff = cos(degToRad(pl.outerCutOff)); float innerCutOff = cos(degToRad(pl.innerCutOff)); float epsilon = innerCutOff - outerCutOff; spotAmount = clamp((theta - outerCutOff) / epsilon, 0.0, 1.0); return spotAmount;`, }, }, } LightsAndShadowsFunctionsNoUV3D = glslgen.Module{ Functions: []glslgen.Function{ glslgen.Function{ "float calcShadow(sampler2D shadowMap,mat4 lightSpaceMatrix,float shadowdistance,bool distanceTransition,ivec2 shadowMapSize)", `float distance = 0.0; if(distanceTransition) { distance = length(fragPos); distance = distance - (shadowdistance - transitionDistance); distance = distance / transitionDistance; distance = clamp(1.0-distance,0.0,1.0); } vec4 fragPosLightSpace = lightSpaceMatrix*vec4(fragPos,1.0); vec3 projCoords = clamp((fragPosLightSpace.xyz / fragPosLightSpace.w)*0.5+0.5,-1.0,1.0); float currentDepth = projCoords.z-bias; float shadowresult = 0.0; float closestDepth = texture2D(shadowMap, projCoords.xy).r; vec2 texelSize = 1.0 / vec2(shadowMapSize); for(int x = -1; x <= 1; ++x) { for(int y = -1; y <= 1; ++y) { float pcfDepth = texture2D(shadowMap, projCoords.xy + vec2(x, y) * texelSize).r; shadowresult += currentDepth > pcfDepth ? 0.0 : 1.0; } } shadowresult /= 9.0; if(distanceTransition) { shadowresult = 1.0 - (1.0-shadowresult)*distance; } return shadowresult;`, }, }, Name: "lightsAndShadowCalculationNoUV", } LightsAndShadowsFunctions3D = glslgen.Module{ Functions: []glslgen.Function{ glslgen.Function{ "float calcShadow(sampler2D shadowMap,mat4 lightSpaceMatrix,float shadowdistance,bool distanceTransition,ivec2 shadowMapSize)", `float distance = 0.0; if(distanceTransition) { distance = length(fragPos); distance = distance - (shadowdistance - transitionDistance); distance = distance / transitionDistance; distance = clamp(1.0-distance,0.0,1.0); } vec4 fragPosLightSpace = lightSpaceMatrix*fragInverseViewMatrix3D*vec4(fragPos,1.0); vec3 projCoords = clamp((fragPosLightSpace.xyz / fragPosLightSpace.w)*0.5+0.5,-1.0,1.0); float currentDepth = projCoords.z-bias; float shadowresult = 0.0; float closestDepth = texture2D(shadowMap, projCoords.xy).r; vec2 texelSize = 1.0 / vec2(shadowMapSize); for(int x = -1; x <= 1; ++x) { for(int y = -1; y <= 1; ++y) { float pcfDepth = texture2D(shadowMap, projCoords.xy + vec2(x, y) * texelSize).r; shadowresult += currentDepth > pcfDepth ? 0.0 : 1.0; } } shadowresult /= 9.0; if(distanceTransition) { shadowresult = 1.0 - (1.0-shadowresult)*distance; } return shadowresult;`, }, }, Name: "lightsAndShadowCalculation", } LightsAndShadowsCalculationModule3D = glslgen.Module{ Functions: []glslgen.Function{ calcPointLightFunc, glslgen.Function{ "void calculateDirectionalLight(DirectionalLight dl,int index)", `vec3 lightDirection = (fragViewMatrix3D*vec4(dl.direction*-1.0,0.0)).xyz; vec3 lightDir = normalize(fragToTangentSpace*lightDirection); // Diffuse vec3 diffuse = diffuseLighting(lightDir,dl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,dl.specularColor); // Shadow float shadow = dl.castsShadows ? calcShadow(directionalLightsshadowmap[index],dl.lightSpaceMatrix,dl.shadowDistance,true,dl.shadowMapSize) : 1.0; diffuse *= shadow; specular *= shadow; finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, glslgen.Function{ "void calculateSpotLight(SpotLight pl,int index)", `vec3 lightPosition = (fragViewMatrix3D*vec4(pl.position,1.0)).xyz; vec3 lightDirection = (fragViewMatrix3D*vec4(pl.direction*-1.0,0.0)).xyz; vec3 lightDir = normalize(fragToTangentSpace*(lightPosition-fragPos)); // Spotamount float spotAmount = calcSpotAmount(lightDir,lightDirection,pl); // Diffuse vec3 diffuse = diffuseLighting(lightDir,pl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,pl.specularColor); // Attentuation float attent = calcAttentuation(lightPosition,pl.attentuation); // Shadow float shadow = pl.castsShadows ? calcShadow(spotLightsshadowmap[index],pl.lightSpaceMatrix,50.0,false,pl.shadowMapSize) : 1.0; // float shadow = 1.0; diffuse *= attent * spotAmount * shadow; specular *= attent * spotAmount * shadow; finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, }, } LightCalculationModel3D = glslgen.Module{ Functions: []glslgen.Function{ calcPointLightFunc, glslgen.Function{ "void calculateDirectionalLight(DirectionalLight dl,int index)", `vec3 lightDirection = (fragViewMatrix3D*vec4(dl.direction*-1.0,0.0)).xyz; vec3 lightDir = normalize(fragToTangentSpace*lightDirection); // Diffuse vec3 diffuse = diffuseLighting(lightDir,dl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,dl.specularColor); finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, glslgen.Function{ "void calculateSpotLight(SpotLight pl,int index)", `vec3 lightPosition = (fragViewMatrix3D*vec4(pl.position,1.0)).xyz; vec3 lightDirection = (fragViewMatrix3D*vec4(pl.direction*-1.0,0.0)).xyz; vec3 lightDir = normalize(fragToTangentSpace*(lightPosition-fragPos)); // Spotamount float spotAmount = calcSpotAmount(lightDir,lightDirection,pl); // Diffuse vec3 diffuse = diffuseLighting(lightDir,pl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,pl.specularColor); // Attentuation float attent = calcAttentuation(lightPosition,pl.attentuation); diffuse *= attent * spotAmount; specular *= attent * spotAmount; finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, }, } LightsAndShadowsCalculationNoUVModule3D = glslgen.Module{ Functions: []glslgen.Function{ calcPointLightNoUVFunc, glslgen.Function{ "void calculateDirectionalLight(DirectionalLight dl,int index)", `vec3 lightDirection = -dl.direction; vec3 lightDir = normalize(lightDirection); // Diffuse vec3 diffuse = diffuseLighting(lightDir,dl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,dl.specularColor); // Shadow float shadow = dl.castsShadows ? calcShadow(directionalLightsshadowmap[index],dl.lightSpaceMatrix,dl.shadowDistance,true,dl.shadowMapSize) : 1.0; diffuse *= shadow; specular *= shadow; finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, glslgen.Function{ "void calculateSpotLight(SpotLight pl,int index)", `vec3 lightPosition = pl.position; vec3 lightDirection = -pl.direction; vec3 lightDir = normalize(lightPosition-fragPos); // Spotamount float spotAmount = calcSpotAmount(lightDir,lightDirection,pl); // Diffuse vec3 diffuse = diffuseLighting(lightDir,pl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,pl.specularColor); // Attentuation float attent = calcAttentuation(lightPosition,pl.attentuation); // Shadow float shadow = pl.castsShadows ? calcShadow(spotLightsshadowmap[index],pl.lightSpaceMatrix,50.0,false,pl.shadowMapSize) : 1.0; // float shadow = 1.0; diffuse *= attent * spotAmount * shadow; specular *= attent * spotAmount * shadow; finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, }, } LightCalculationNoUVModule3D = glslgen.Module{ Functions: []glslgen.Function{ calcPointLightNoUVFunc, glslgen.Function{ "void calculateDirectionalLight(DirectionalLight dl,int index)", `vec3 lightDirection = -dl.direction; vec3 lightDir = normalize(lightDirection); // Diffuse vec3 diffuse = diffuseLighting(lightDir,dl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,dl.specularColor); finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, glslgen.Function{ "void calculateSpotLight(SpotLight pl,int index)", `vec3 lightPosition = pl.position; vec3 lightDirection = -pl.direction; vec3 lightDir = normalize(lightPosition-fragPos); // Spotamount float spotAmount = calcSpotAmount(lightDir,lightDirection,pl); // Diffuse vec3 diffuse = diffuseLighting(lightDir,pl.diffuseColor); // Specular vec3 specular = specularLighting(lightDir,pl.specularColor); // Attentuation float attent = calcAttentuation(lightPosition,pl.attentuation); diffuse *= attent * spotAmount; specular *= attent * spotAmount; finalDiffuseColor += vec4(diffuse,0.0); finalSpecularColor += vec4(specular,0.0);`, }, }, } MaterialModule3D = glslgen.Module{ Structs: []glslgen.Struct{ glslgen.Struct{ Name: "Material", Variables: []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "diffuseColor"}, glslgen.Variable{"vec3", "highp", "specularColor"}, glslgen.Variable{"bool", "", "DiffuseTextureLoaded"}, glslgen.Variable{"bool", "", "SpecularTextureLoaded"}, glslgen.Variable{"bool", "", "NormalMapLoaded"}, glslgen.Variable{"float", "highp", "shinyness"}, glslgen.Variable{"float", "highp", "transparency"}, }, }, }, Uniforms: []glslgen.Variable{ glslgen.Variable{"Material", "", "material"}, }, Name: "materialCalculation", Body: `finalDiffuseColor *= vec4(material.diffuseColor,material.transparency); finalSpecularColor *= vec4(material.specularColor,0.0); finalAmbientColor *= vec4(material.diffuseColor,0.0);`, } DiffuseTextureModule3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"sampler2D", "highp", "materialdiffuseTexture"}, }, Name: "diffuseTextureCalculation", Body: `vec4 texDifCol; if(material.DiffuseTextureLoaded) texDifCol = texture2D(materialdiffuseTexture,fragTexCoord); else texDifCol = vec4(1.0); finalDiffuseColor *= texDifCol; finalAmbientColor *= texDifCol;`, } SpecularTextureModule3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"sampler2D", "highp", "materialspecularTexture"}, }, Name: "specularTextureCalculation", Body: `vec4 texSpecCol; if(material.SpecularTextureLoaded) texSpecCol = texture2D(materialspecularTexture,fragTexCoord); else texSpecCol = vec4(1.0); finalSpecularColor *= texSpecCol;`, } NormalMapModule3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"sampler2D", "highp", "materialnormalMap"}, }, Name: "normalMapCalculation", Body: `if(material.NormalMapLoaded) norm = normalize(2.0*(texture2D(materialnormalMap,fragTexCoord)).xyz-1.0);`, } FinalModuleFragment3D = glslgen.Module{ Name: "finalCalculation", Body: `if(finalDiffuseColor.a < 0.1) discard; gl_FragColor = finalDiffuseColor + finalSpecularColor + finalAmbientColor;`, } )
var ( FLAG_NAMES_3D = [NUM_FLAGS_3D]string{ "Instanced", "NoUV", "NoShadows", "NoLighting", "NoDiftex", "NoSpectex", "NoNormap", } FLAG_NAMES_2D = [NUM_FLAGS_2D]string{ "Instanced", "NoKeyColor", "NoModColor", "NoFlip", "NoTextureRegion", "NoDepth", "NoTexture", "DepthMap", } )
var ( GlobalsBBMS = []glslgen.Variable{ glslgen.Variable{"vec2", "highp", "vertices[6]"}, glslgen.Variable{"vec2", "highp", "texCoords[6]"}, } SetValuesModuleBBMS = glslgen.Module{ Name: "setValues", Body: `vertices[0] = vec2(-1.0,-1.0); vertices[1] = vec2(1.0,-1.0); vertices[2] = vec2(1.0,1.0); vertices[3] = vec2(1.0,1.0); vertices[4] = vec2(-1.0,1.0); vertices[5] = vec2(-1.0,-1.0); texCoords[0] = vec2(0.0,0.0); texCoords[1] = vec2(1.0,0.0); texCoords[2] = vec2(1.0,1.0); texCoords[3] = vec2(1.0,1.0); texCoords[4] = vec2(0.0,1.0); texCoords[5] = vec2(0.0,0.0);`, } SetGLPositionBBMS = glslgen.Module{ Name: "setGLPosition", Body: "gl_Position = vec4(vertices[gl_VertexID],0.0,1.0);", } SetGLPositionBBNOMS = glslgen.Module{ Name: "setGLPosition", Body: "gl_Position = vec4(vertex,0.0,1.0);", } TextureMSModule = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"sampler2DMS", "highp", "texture0"}, }, Functions: []glslgen.Function{ glslgen.Function{ "vec4 fetchColor()", `vec4 color = vec4(0.0); ivec2 texCoords = ivec2(fragTexCoord * textureSize(texture0)); for(int i = 0;i<8;i++) { color += texelFetch(texture0,texCoords,i); } color /= 8.0; return color;`, }, }, Name: "textureMSModule", Body: "globalColor = fetchColor();", } SetFragTexCoordModuleBBMS = glslgen.Module{ Name: "setFragTexCoord", Body: "fragTexCoord = texCoords[gl_VertexID];", } )
var ( SetFragTexCoordModuleVertex3D = glslgen.Module{ Name: "setFragTexCoord", Body: "fragTexCoord = texCoord;", } SimpleMaterialModule3D = glslgen.Module{ Structs: []glslgen.Struct{ glslgen.Struct{ Name: "Material", Variables: []glslgen.Variable{ glslgen.Variable{"bool", "", "DiffuseTextureLoaded"}, glslgen.Variable{"float", "highp", "transparency"}, }, }, }, Uniforms: []glslgen.Variable{ glslgen.Variable{"Material", "", "material"}, }, Name: "simpleMaterialModule", Body: `globalColor.a *= material.transparency;`, } ShadowMapDiffuseTextureModule = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"sampler2D", "highp", "materialdiffuseTexture"}, }, Name: "diffuseTextureCalculation", Body: `if(material.DiffuseTextureLoaded) globalColor = texture2D(materialdiffuseTexture,fragTexCoord); else globalColor = vec4(1.0);`, } ShadowMapFinishModuleFragment = glslgen.Module{ Name: "finish", Body: `if(globalColor.a < ALPHA_DISCARD_PADDING) discard;`, } )
var ( AttributesShape3D = []glslgen.Variable{ glslgen.Variable{"vec3", "highp", "vertex"}, glslgen.Variable{"vec4", "highp", "color"}, } UniformModuleMatricesDefault3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"mat4", "highp", "viewMatrix3D"}, glslgen.Variable{"mat4", "highp", "projectionMatrix3D"}, }, Name: "uniformModuleMatricesDefault", } UniformModuleMatricesNormal3D = glslgen.Module{ Uniforms: []glslgen.Variable{ glslgen.Variable{"mat4", "highp", "transformMatrix3D"}, }, Name: "uniformModuleMatricesNormal", } )
var ButtonFont string = "Button"
The name of the font that is used for Button
var ButtonFontSize = 24
The font size that is used for Button
var CircleDetail int = 30
The detail of the curcle. The higher the more detailed
var DrawColor color.Color = Color{255, 255, 255, 255}
The color in which the shapes will be drawn
var ( // The relative paths in which is search for fonts FONT_PATHS = [4]string{ "", "fonts/", "assets/", "assets/fonts/", } )
var Filled bool = true
Wether the shapes should be filled
var LineWidth float32 = 1.0
The line width which will be used
var ( // The relative paths in which is search for audio MUSIC_SOUND_PATHS = [8]string{ "", "sounds/", "sound/", "music/", "assets/", "assets/sounds/", "assets/sound/", "assets/music/", } )
var PointSize float32 = 1.0
The point size which will be used
var ( // The relative paths in which will be searched for shaders SHADER_PATHS = [4]string{ "", "shaders/", "assets/", "assets/shaders/", } )
var ( // The relative paths in which will be searched for textures TEXTURE_PATHS = []string{ "", "textures/", "assets/", "assets/textures/", } )
var ( // The relative paths in which will be searched for tmx files TMX_MAP_PATHS = [4]string{ "", "maps/", "assets/", "assets/maps/", } )
Functions ¶
func AreIntersecting ¶
func AreIntersecting(p1, p2 *PolygonMath2D) bool
Returns wether two Polygons are intersecting
func AreIntersectingPoint ¶
func AreIntersectingPoint(p1 *PolygonMath2D, point mgl32.Vec2) bool
Returns wether a polygon is intersecting with a point
func DrawCircle2D ¶
Draws a 2D circle with pos as the middle with radius
func DrawCube ¶
Draws a cube with pos as the middle and with,height and depth pitch, yaw and roll defines the rotation in degrees
func DrawRectangle2D ¶
Draws a 2D rectangle between pos1,pos2,pos3 and pos4
func DrawTextureAdv ¶
func DrawTextureAdv(tex Texture, x, y, width, height int, texReg TextureRegion, flip uint8)
Draws a specific region of the texture with a flip
func DrawTriangle2D ¶
Draws a 2D triangle between pos1, pos2 and pos3
func DrawTriangle3D ¶
Draws a triangle between pos1,pos2 and pos3
func EqualIgnoreCase ¶
Returns wether one string equals the other ignoring the case
func GenerateShader2D ¶
func GenerateShader3D ¶
func GenerateShaderShadowMap ¶
func GenerateShaderSource3D ¶
func GenerateShaderSource3D()
func GetColorFromData ¶
Converts pixel data to a color
func GetFileExtension ¶
The returns the file extension of a file name
func GetFileFromPath ¶
Returns the file name of a file path
func GetShaderName2D ¶
func GetShaderName3D ¶
func HEXToColor ¶
Converts a hex color value into a real color
func Mesh2DVerticesToFloatArray ¶
func Mesh2DVerticesToFloatArray(vertices []Mesh2DVertex) (array []float32)
Converts a mesh 2d vertex array to a float array used by OpenGL
func Mesh3DVerticesToFloatArray ¶
func Mesh3DVerticesToFloatArray(vertices []Mesh3DVertex) (array []float32)
Converts a mesh 3d vertex array to a float array used by OpenGL
func ScreenPositionToRay ¶
Converts a screen position to a ray pointing from the camera
func ScreenPositionToRayAdv ¶
Same as ScreenPositionToRay with additional viewport and camera arguments
func Shape2DVerticesToFloatArray ¶
func Shape2DVerticesToFloatArray(vertices []Shape2DVertex) (array []float32)
Converts a shape 2d vertex array to a float array used by OpenGL
func Shape3DVerticesToFloatArray ¶
func Shape3DVerticesToFloatArray(points []Shape3DVertex) (array []float32)
Converts a shape 3d vertex array to a float array used by OpenGL
func TextureToImage ¶
Converts a texture to an image
func VertexTexCoordIndex ¶
Returns the index in the float array
Types ¶
type AABBRenderer ¶
type AABBRenderer struct {
AABB *AxisAlignedBoundingBox
Shape3D
}
This class is used for debug purposes It renders an AxisAlignedBoundingBox
func (*AABBRenderer) Init ¶
func (this *AABBRenderer) Init(aabb *AxisAlignedBoundingBox, transform TransformableObject, col color.Color)
Init takes a pointer to the AxisAlignedBoundingBox which should be drawn It also takes the color in which it should be drawn
type Attentuation ¶
type Attentuation struct {
// The constant factor
Constant float32
// The linear factor
Linear float32
// The quadratic factor
Quadratic float32
}
A strcut holding the values for attenuation of lights
func (Attentuation) SetUniforms ¶
func (a Attentuation) SetUniforms(s Shader, variableName string, arrayIndex int)
Sets the uniform values of s
type AudioManager ¶
type AudioManager interface {
// Initialises the AudioManager
Init()
// Creates a new Sound object from samples and the given format and sampleRate
CreateSound(name string, samples []byte, format uint8, sampleRate int) Sound
// Creates a new Music object from samples and the given format and sampleRate
CreateMusic(name string, samples []byte, format uint8, sampleRate int) Music
// Loads a Sound object from a file (.wav)
LoadSound(name, path string) Sound
// Loads a new Music object from a file (.mp3)
LoadMusic(name, path string) Music
// Sets the master volume of the game
SetVolume(vol float32)
// Gets the master volume of the game
GetVolume() float32
// Cleans up all resources
Terminate()
}
This interface handles everything audio related
var AudioMgr AudioManager
The AudioManager that should be used for everything
type AxisAlignedBoundingBox ¶
A bounding box stretching from min to max
func (AxisAlignedBoundingBox) Intersects ¶
func (this AxisAlignedBoundingBox) Intersects(thisPos mgl32.Vec3, other AxisAlignedBoundingBox, otherPos mgl32.Vec3) bool
Returns wether a bounding box intersects with this bounding box
func (*AxisAlignedBoundingBox) String ¶
func (this *AxisAlignedBoundingBox) String() string
Return the values of the bounding box as a string
type BlinkableObject ¶
type BlinkableObject interface {
// Sets the object to be visible
SetVisible()
// Sets the object to be invisible
SetInvisible()
// Returns wether the object is visible
IsVisible() bool
}
An object which has a visibility
type Button ¶
type Button struct {
Sprite2D
// Will be called when the button is pressed
PressCallback ButtonCallback
// Will be called when the mouse hovers over the button
EnterCallback ButtonCallback
// Will be called when the mouse leaves the button
LeaveCallback ButtonCallback
// Wether the mouse has currently entered the button
Entered bool
// The text of the button
Text string
// The modulating color that will be applied when the mouse enters the button
EnterModColor color.Color
// The modulation color that will be applied when the button is clicked
PressModColor color.Color
// The Text2D object that is used for displaying the text
Text2D Text2D
}
A Button that will be rendered to the screen
type ButtonCallback ¶
type ButtonCallback func(btn *Button)
The callback function for all the callbacks of the Button
type Camera2D ¶
type Camera2D struct {
// It's position in world space
Position mgl32.Vec2
// It's zoom (>1.0 -> Zoom In and <1.0 -> Zoom Out)
Zoom float32
// It's rotation in degrees
Rotation float32
// The Origin for rotating and zooming
Origin mgl32.Vec2
// contains filtered or unexported fields
}
A 2D camera used for showing different parts of the world
func (*Camera2D) AddPositionRotated ¶
Adds pos to the position in respect to the current rotation
func (*Camera2D) CalculateViewMatrix ¶
func (cam *Camera2D) CalculateViewMatrix()
Calculates the view matrix of the camera that will be needed for the shader
func (*Camera2D) GetInverseViewMatrix ¶
Returns the inverse of the view matrix of the camera
func (*Camera2D) GetViewMatrix ¶
Returns the view matrix of the camera
type Camera3D ¶
type Camera3D struct {
// It's position in world space
Position mgl32.Vec3
// The direction in which the camera looks
LookDirection mgl32.Vec3
// The up vector of the camera
Up mgl32.Vec3
// The maximum [pitch,yaw] rotation
MaxRotation mgl32.Vec2
// The minimum [pitch,yaw] rotation
MinRotation mgl32.Vec2
// contains filtered or unexported fields
}
A 3D camera used to show different parts of the world
func (*Camera3D) AddPositionRelative ¶
Adds pos to the camera relative to the current rotation
func (*Camera3D) AddRotation ¶
Adds [pitch,yaw] to the current rotation
func (*Camera3D) CalculateViewMatrix ¶
func (cam *Camera3D) CalculateViewMatrix()
Calculates the view matrix of the camera that will be used in the shaders
func (*Camera3D) GetInverseViewMatrix ¶
Returns the inverse view matrix of the camera
func (*Camera3D) GetViewMatrix ¶
Returns the view matrix of the camera
func (*Camera3D) Init ¶
func (cam *Camera3D) Init()
Initialises everything of the camera and applies default values
func (*Camera3D) SetRotation ¶
Sets the rotation of the camera using pitch and yaw Rotates the look direction
type Circle2D ¶
type Circle2D struct {
// The mid point of the circle
Position mgl32.Vec2
// The radius of the circle
Radius float32
// The color of the circle
Col color.Color
}
A circle in 2D space
func (*Circle2D) ToTriangles ¶
func (this *Circle2D) ToTriangles(numTriangles int) (tris []Triangle2D)
Converts the circle into triangles
type Color ¶
A RGBA color
type CubeMap ¶
type CubeMap interface {
// Loads a cube map from data with width and height
Load(data []byte, width, height int, shadowMap bool)
// Loads the cube map from an image
LoadFromImage(img image.Image)
// Binds the cube map to unit
Bind(unit uint32)
// Unbinds cube map
Unbind(unit uint32)
// Returns the width of the cube map
GetWidth() int
// Returns the height of the cube map
GetHeight() int
// Returns the color that will be keyed
GetKeyColor() color.Color
// Returns the modulate color
GetModColor() color.Color
// Cleans everything up
Terminate()
// Sets filtering to the give method
SetFiltering(filtering int)
// Sets wrapping to the given method
SetWrapping(wrapping int)
// Sets the color of the border to col if used
SetBorderColor(col color.Color)
// Sets the depth of the border
SetBorderDepth(depth float32)
// Sets the key color
SetKeyColor(col color.Color)
// Sets the modulate color
SetModColor(col color.Color)
// Returns the name of this cube map
GetName() string
// Returns the data its with and its height
GetData() ([]byte, int, int)
}
This interface represents a cube map with six faces
type DirectionalLight ¶
type DirectionalLight struct {
// The direction in which the light is shining
Direction mgl32.Vec3
// The diffuse color of the light
DiffuseColor color.Color
// The specular color of the light
SpecularColor color.Color
// The shadow map texture of the light
ShadowMap RenderTexture
// Wether the light casts shadows
CastsShadows uint8
// A view matrix using the direction as the look direction
LightSpaceMatrix mgl32.Mat4
ShadowDistance float32
// contains filtered or unexported fields
}
A light with only a direction and no position
func (*DirectionalLight) InitShadowmap ¶
func (this *DirectionalLight) InitShadowmap(width, height int)
Initialises the shadow map of this light
func (*DirectionalLight) RenderShadowMap ¶
func (this *DirectionalLight) RenderShadowMap()
Renders all objects that cast shadows on the shadow map
func (*DirectionalLight) SetUniforms ¶
func (pl *DirectionalLight) SetUniforms(s Shader, arrayIndex int)
Sets the uniforms of s
type Entity3D ¶
type Entity3D struct {
NilRenderObject
// The name of the Entity
Name string
// The 3D Model of the Entity
Model3D *Model3D
// Wether it is visible
Visible bool
// The index of the camera to which it is not relative
// or -1 if it relative to every camera
NotRelativeToCamera int
// Wether it should render after everyting else
RenderLast bool
// Wether the depth test is enabled
DepthTesting bool
// The shader that will be used on this 3D Model
Shader Shader
// The render type of the Entity
RenderType RenderType
// The transform of the Entity
Transform *TransformableObject3D
// contains filtered or unexported fields
}
A 3D RenderObject with a 3D Model
func (*Entity3D) GetParent ¶
func (this *Entity3D) GetParent() interface{}
Returns the parent of this entity
func (*Entity3D) GetTransform3D ¶
func (this *Entity3D) GetTransform3D() *TransformableObject3D
Returns the Transform of the Entity
func (*Entity3D) GetTransformableObject ¶
func (this *Entity3D) GetTransformableObject() TransformableObject
Returns the tranformable object of the Entity
func (*Entity3D) GetType ¶
func (this *Entity3D) GetType() RenderType
Returns the render type of this entity
func (*Entity3D) HasDepthTesting ¶
Returns wether the depth test is enabled on this object
func (*Entity3D) NotRelativeCamera ¶
Returns the index to which camera it is not relative or -1 if it is relative to every camera
func (*Entity3D) Render ¶
func (this *Entity3D) Render()
Renders the entity (a lot of values need to be set up before calling this method, use RenderMgr.RenderRenderObject if you want to render a specific RenderObject)
func (*Entity3D) RendersLast ¶
Wether this Entity renders last
func (*Entity3D) SetChildChannel ¶
func (this *Entity3D) SetChildChannel(channel chan bool, tobj *TransformableObject3D)
Used for calculating the transformation matrices in go routines
func (*Entity3D) SetInvisible ¶
func (this *Entity3D) SetInvisible()
Sets the Entity to be invisible
func (*Entity3D) SetParent ¶
func (this *Entity3D) SetParent(parent interface{})
Sets the parent of this Entity
func (*Entity3D) SetTransformableObject ¶
func (this *Entity3D) SetTransformableObject(tobj TransformableObject)
Sets the transformable object of this Entity
func (*Entity3D) SetType ¶
func (this *Entity3D) SetType(rtype RenderType)
Sets the render type of this entity
type ErrorManager ¶
type ErrorManager struct {
// The currently set error level
// Determines which messages should be printed to the screen
ErrorLevel uint8
// Determines wether everytime a message is written it should be
// printed or ignored
DuplicateMessages bool
// Wether small dialogues should pop up with errors
ShowMessageBoxes bool
// contains filtered or unexported fields
}
The ErrorManager used to log messages and errors
var ErrorMgr ErrorManager
The ErrorManager that should be used for everything
func (*ErrorManager) Error ¶
func (this *ErrorManager) Error(tag, objectName, message string)
Writes a message using the error error level
func (*ErrorManager) Fatal ¶
func (this *ErrorManager) Fatal(tag, objectName, message string)
Writes a message using the fatal error level
func (*ErrorManager) Init ¶
func (this *ErrorManager) Init()
Initialises the ErrorManager with default values
func (*ErrorManager) Log ¶
func (this *ErrorManager) Log(tag, objectName, message string)
Writes a message using the log error level
func (*ErrorManager) Message ¶
func (this *ErrorManager) Message(errorLevel uint8, tag string, objectName string, err string)
Writes an error as a string
func (*ErrorManager) MessageError ¶
func (this *ErrorManager) MessageError(errorLevel uint8, tag string, objectName string, err error)
Writes an error using the error interface
func (*ErrorManager) Warning ¶
func (this *ErrorManager) Warning(tag, objectName, message string)
Writes a message using the warning error level
type ErrorMessage ¶
type ErrorMessage struct {
// The ErrorLevel of the message
ErrorLevel uint8
// The tag of the message (often the type of ObjectName)
Tag string
// The name of the object which this message is about
ObjectName string
// The message itself as an error
Err error
}
An ErrorMessage of the ErrorManager
func (*ErrorMessage) Equals ¶
func (this *ErrorMessage) Equals(other ErrorMessage) bool
Returns wether one ErrorMessage equals the based on every member
func (*ErrorMessage) Error ¶
func (this *ErrorMessage) Error() string
Returns the whole message as a string
type FPSLimiter ¶
type FPSLimiter struct {
// The frames per second to which it should lock
MaxFPS int
// The current FPS
FPS int
// The DeltaTime from the last frame to this
DeltaTime float32
// contains filtered or unexported fields
}
This struct is used to control the time step of the game It smooths the time step and locks the frame rate
var FPSLimit FPSLimiter
The FPSLimiter that should be used for everything
func (*FPSLimiter) AddTime ¶
func (fps *FPSLimiter) AddTime(amount float32)
Adds time to the frame time if some time couldn't be measured by The struct itself
func (*FPSLimiter) EndMeasurement ¶
func (fps *FPSLimiter) EndMeasurement()
Ends the measurement of the frame time
func (*FPSLimiter) Init ¶
func (fps *FPSLimiter) Init()
Initialises the FPSLimiter with default values
func (*FPSLimiter) StartMeasurement ¶
func (fps *FPSLimiter) StartMeasurement()
Starts the measurement of the frame time
type FileSeeker ¶
type FileSeeker interface {
io.ReadSeeker
}
An interface consisting of a io.ReadSeeker
type Font ¶
type Font struct {
// The size in which the font should be drawn
FontSize int
// contains filtered or unexported fields
}
A struct representing a truetype font
func (*Font) DrawString ¶
Draw a string and returns it as a Texture
func (*Font) GetGlyphMaxHeight ¶
Returns the maximum height of a character
func (*Font) GetGlyphMaxWidth ¶
Returns the maximum width of a character
type Framework ¶
type Framework interface {
// Initialises the framework using MainLoop
Init(ml *MainLoop) error
// Update everything
Update()
// Terminate everything
Terminate()
// Get the events on the window
PollEvents()
// Creates a window with the given parameters
CreateWindow(windowWidth, windowHeight int, title string) error
// Returns wether the window is closed
WindowClosed() bool
// Swaps the back buffer (not that of RenderManager) with the front buffer
// used for double buffering
WindowSwap()
// Sets the size of the window
WindowSetSize(size mgl32.Vec2)
// Returns the size of the window
WindowGetSize() mgl32.Vec2
// Sets the window to be fullscreen or not
WindowSetFullscreen(b bool)
// Returns wether the window is in fullscreen
WindowIsFullscreen() bool
// Returns the resolution of the monitor
MonitorGetSize() mgl32.Vec2
// Shows the mouse cursor
CurserShow()
// Hides the mouse cursor (no locking)
CursorHide()
// Hides the mouse cursor (with locking)
CursorDisable()
// Returns wether the mouse cursor is shown
CursorShown() bool
// Returns wether the mouse cursor is hidden
CursorHidden() bool
// Returns wether the mouse cursor is disabled
CursorDisabled() bool
// Opens file for reading (uses the framework related functionality
// on desktop the usual methods can be used without problem)
OpenFile(file string) (File, error)
// Loads the level file (.obj)
LoadLevel(name, path string, loadToGPU bool) *Level
// Loads the level using contents as the file contents
LoadLevelString(name, contents, fileName string, loadToGPU bool) *Level
// Pop ups a dialog with yes and no
// Returns one enum value
ShowYesNoDialog(title, message string) uint8
// Uses framework related logging (logcat on android)
Log(a ...interface{})
// Add a function that should be called when the window resizes
OnResize(callback func(newWidth, newHeight int))
// Add a function that should be called when the window moves
OnMove(callback func(newPosX, newPosY int))
// Add a function that should be called when the window closes
OnClose(callback func())
// Add a function that shoul be called when the window gets focused
OnFocus(callback func(focused bool))
// Starts the input of text
StartTextInput()
// Gets the inputted text
GetTextInput() string
// Ends the input of text
EndTextInput()
}
The interface that handles everything OS related that's not rendering
var Framew Framework
The Framework that should be used for everything
type GoHomeError ¶
type GoHomeError struct {
// contains filtered or unexported fields
}
An useful struct for error handling
type IdentityProjection ¶
type IdentityProjection struct {
}
A projection doing nothing
func (IdentityProjection) CalculateProjectionMatrix ¶
func (IdentityProjection) CalculateProjectionMatrix()
func (IdentityProjection) GetFrustum ¶
func (IdentityProjection) GetFrustum() [8]mgl32.Vec3
func (IdentityProjection) GetProjectionMatrix ¶
func (IdentityProjection) GetProjectionMatrix() mgl32.Mat4
func (IdentityProjection) Update ¶
func (IdentityProjection) Update(newViewport Viewport)
type InputManager ¶
type InputManager struct {
// The data of the mouse
Mouse Mouse
// All registered touches
Touches map[uint8]Touch
// contains filtered or unexported fields
}
The struct that handles every Input
var InputMgr InputManager
The InputManager that should be used for everything
func (*InputManager) Init ¶
func (inmgr *InputManager) Init()
Initialises all members of InputManager
func (*InputManager) IsPressed ¶
func (inmgr *InputManager) IsPressed(key Key) bool
Returns wether key is currently pressed
func (*InputManager) IsTouched ¶
func (inmgr *InputManager) IsTouched(id uint8) bool
Returns wether the touch with id is currently touched
func (*InputManager) JustPressed ¶
func (inmgr *InputManager) JustPressed(key Key) bool
Returns wether key has been just pressed in this frame
func (*InputManager) JustTouched ¶
func (inmgr *InputManager) JustTouched(id uint8) bool
Returns wether the touch with id has been touched in this frame
func (*InputManager) PressKey ¶
func (inmgr *InputManager) PressKey(key Key)
Says that key has been pressed
func (*InputManager) ReleaseKey ¶
func (inmgr *InputManager) ReleaseKey(key Key)
Says that key has been released
func (*InputManager) ReleaseTouch ¶
func (inmgr *InputManager) ReleaseTouch(id uint8)
Says that the touch with id has been released
func (*InputManager) TimeHeld ¶
func (inmgr *InputManager) TimeHeld(key Key) float32
func (*InputManager) Touch ¶
func (inmgr *InputManager) Touch(id uint8)
Says that the touch with id has been touched
func (*InputManager) Update ¶
func (inmgr *InputManager) Update(delta_time float32)
Updates everything and tells the InputManager that the frame is over
func (*InputManager) WasPressed ¶
func (inmgr *InputManager) WasPressed(key Key) bool
Returns wether key was pressed in the last frame
func (*InputManager) WasTouched ¶
func (inmgr *InputManager) WasTouched(id uint8) bool
Returns wether the touched with id was touched in the last frame
type InstancedEntity3D ¶
type InstancedEntity3D struct {
NilRenderObject
// The name of this object
Name string
// The 3D Model
Model3D *InstancedModel3D
// Wether it is visible
Visible bool
// The index of the camera to which it is not relative
// or -1 if it relative to every camera
NotRelativeToCamera int
// Wether it should render after everyting else
RenderLast bool
// Wether the depth test is enabled
DepthTesting bool
// Wether the instanced values should be update in every frame or not
StopUpdatingInstancedValues bool
// The shader of the object
Shader Shader
// The render type of the object
RenderType RenderType
// All transforms of the different instances
Transforms []*TransformableObjectInstanced3D
// contains filtered or unexported fields
}
An Entity3D consisting of multiple instances
func (*InstancedEntity3D) CalculateTransformMatrix ¶
func (this *InstancedEntity3D) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
Calculates the transformation matrices
func (*InstancedEntity3D) GetShader ¶
func (this *InstancedEntity3D) GetShader() Shader
Returns the shader
func (*InstancedEntity3D) GetTransformableObject ¶
func (this *InstancedEntity3D) GetTransformableObject() TransformableObject
Returns this as a transformable object
func (*InstancedEntity3D) GetType ¶
func (this *InstancedEntity3D) GetType() RenderType
Returns the render type
func (*InstancedEntity3D) HasDepthTesting ¶
func (this *InstancedEntity3D) HasDepthTesting() bool
Wether depth testing should be enabled for this object
func (*InstancedEntity3D) InitMesh ¶
func (this *InstancedEntity3D) InitMesh(mesh InstancedMesh3D, numInstances int)
Initialises the object with a mesh and a number of instances
func (*InstancedEntity3D) InitModel ¶
func (this *InstancedEntity3D) InitModel(model *InstancedModel3D, numInstances int)
Initialises the object with a model and a number of instances
func (*InstancedEntity3D) IsVisible ¶
func (this *InstancedEntity3D) IsVisible() bool
Wether it is visible
func (*InstancedEntity3D) NotRelativeCamera ¶
func (this *InstancedEntity3D) NotRelativeCamera() int
Returns the camera to which this is not realtive or -1 if it is relative to all cameras
func (*InstancedEntity3D) Render ¶
func (this *InstancedEntity3D) Render()
Renders the entity (a lot of values need to be set up before calling this method, use RenderMgr.RenderRenderObject if you want to render a specific RenderObject)
func (*InstancedEntity3D) RendersLast ¶
func (this *InstancedEntity3D) RendersLast() bool
Wether this should render after everything
func (*InstancedEntity3D) SetInvisible ¶
func (this *InstancedEntity3D) SetInvisible()
Sets it to be invisible
func (*InstancedEntity3D) SetNumInstances ¶
func (this *InstancedEntity3D) SetNumInstances(n int)
Sets the number of buffered instances
func (*InstancedEntity3D) SetNumUsedInstances ¶
func (this *InstancedEntity3D) SetNumUsedInstances(n int)
Sets the number of rendered instances
func (*InstancedEntity3D) SetShader ¶
func (this *InstancedEntity3D) SetShader(s Shader)
Sets the shader
func (*InstancedEntity3D) SetTransformMatrix ¶
func (this *InstancedEntity3D) SetTransformMatrix(rmgr *RenderManager)
func (*InstancedEntity3D) SetType ¶
func (this *InstancedEntity3D) SetType(rtype RenderType)
Sets the render type
func (*InstancedEntity3D) SetVisible ¶
func (this *InstancedEntity3D) SetVisible()
Sets it to be visible
func (*InstancedEntity3D) Terminate ¶
func (this *InstancedEntity3D) Terminate()
Cleans everything up
func (*InstancedEntity3D) UpdateInstancedValues ¶
func (this *InstancedEntity3D) UpdateInstancedValues()
Updates the values used for instancing
type InstancedMesh3D ¶
type InstancedMesh3D interface {
// Adds vertices and indices to the mesh
AddVertices(vertices []Mesh3DVertex, indices []uint32)
// Loads the vertices and indices to the GPU
Load()
// Calls the draw method for this mesh
Render()
// Cleans everything up
Terminate()
// Sets the material of this mesh
SetMaterial(mat *Material)
// Returns the material of this mesh
GetMaterial() *Material
// Returns the name of this mesh
GetName() string
// Returns the number of vertices of this mesh
GetNumVertices() int
// Returns the number of indices of this mesh
GetNumIndices() int
// Returns all the vertices of this mesh
GetVertices() []Mesh3DVertex
// Returns all the indices of this mesh
GetIndices() []uint32
// Calculates the tangents that will be used for a normal map
CalculateTangents()
// Returns wether the vertices have UV values
// Checks if the uv values are zero
HasUV() bool
// Returns the bounding box from the lowest vertex to the highest vertex
AABB() AxisAlignedBoundingBox
// Creates a new mesh from this mesh
Copy() Mesh3D
// Returns wether Load has been called
LoadedToGPU() bool
// Sets the number of buffered instances
SetNumInstances(n int)
// Returns the number of buffered instances
GetNumInstances() int
// Sets number of instances that will be drawn
SetNumUsedInstances(n int)
// Returns the number of instances that will be drawn
GetNumUsedInstances() int
// Adds a value that will be used for instancing
AddValue(valueType int)
// Adds a value that will be used for instancing to the front
AddValueFront(valueType int)
// Sets the float values of index, value needs to be of size num instances
SetF(index int, value []float32)
// Sets the Vec2 values of index, value needs to be of size num instances
SetV2(index int, value []mgl32.Vec2)
// Sets the vec3 values of index, value needs to be of size num instances
SetV3(index int, value []mgl32.Vec3)
// Sets the vec4 values of index, value needs to be of size num instances
SetV4(index int, value []mgl32.Vec4)
// Sets the Mat2 values of index, value needs to be of size num instances
SetM2(index int, value []mgl32.Mat2)
// Sets the Mat3 values of index, value needs to be of size num instances
SetM3(index int, value []mgl32.Mat3)
// Sets the Mat4 values of index, value needs to be of size num instances
SetM4(index int, value []mgl32.Mat4)
// Sets the name of a value
SetName(index int, value_type int, value string)
}
A mesh that will be drawn using instancing
func InstancedMesh3DFromMesh3D ¶
func InstancedMesh3DFromMesh3D(mesh Mesh3D) (imesh InstancedMesh3D)
Creates a instanced mesh from a Mesh3D
type InstancedModel3D ¶
type InstancedModel3D struct {
// The name of this object
Name string
// The bounding box of this Model
AABB AxisAlignedBoundingBox
// contains filtered or unexported fields
}
A Model3D that renders instanced
func InstancedModel3DFromModel3D ¶
func InstancedModel3DFromModel3D(m *Model3D) (im *InstancedModel3D)
Creates an instanced model from a Model3D
func (*InstancedModel3D) AddMesh3D ¶
func (this *InstancedModel3D) AddMesh3D(m InstancedMesh3D)
Adds a mesh to the drawn meshes
func (*InstancedModel3D) AddValue ¶
func (this *InstancedModel3D) AddValue(valueType int)
Adds an instanced value
func (*InstancedModel3D) AddValueFront ¶
func (this *InstancedModel3D) AddValueFront(valueType int)
Adds an instanced value to the front of the array
func (*InstancedModel3D) GetMesh ¶
func (this *InstancedModel3D) GetMesh(name string) InstancedMesh3D
Returns the mesh with the given name
func (*InstancedModel3D) GetMeshIndex ¶
func (this *InstancedModel3D) GetMeshIndex(index int) InstancedMesh3D
Returns the mesh with the given index
func (*InstancedModel3D) GetNumInstances ¶
func (this *InstancedModel3D) GetNumInstances() int
Returns the number of buffered instances
func (*InstancedModel3D) GetNumUsedInstances ¶
func (this *InstancedModel3D) GetNumUsedInstances() int
Returns the number of drawn instances
func (*InstancedModel3D) HasUV ¶
func (this *InstancedModel3D) HasUV() bool
Returns wether some Meshes have UV values
func (*InstancedModel3D) LoadedToGPU ¶
func (this *InstancedModel3D) LoadedToGPU() bool
Returns wether Load has been called
func (*InstancedModel3D) Render ¶
func (this *InstancedModel3D) Render()
Calls the Render method on all meshes
func (*InstancedModel3D) SetF ¶
func (this *InstancedModel3D) SetF(index int, value []float32)
Sets the float value of index to value, value must be of size num instances
func (*InstancedModel3D) SetM2 ¶
func (this *InstancedModel3D) SetM2(index int, value []mgl32.Mat2)
Sets the Mat2 value of index to value, value must be of size num instances
func (*InstancedModel3D) SetM3 ¶
func (this *InstancedModel3D) SetM3(index int, value []mgl32.Mat3)
Sets the Mat3 value of index to value, value must be of size num instances
func (*InstancedModel3D) SetM4 ¶
func (this *InstancedModel3D) SetM4(index int, value []mgl32.Mat4)
Sets the Mat4 value of index to value, value must be of size num instances
func (*InstancedModel3D) SetName ¶
func (this *InstancedModel3D) SetName(index, valueType int, value string)
Sets the name of an instanced value
func (*InstancedModel3D) SetNumInstances ¶
func (this *InstancedModel3D) SetNumInstances(n int)
Sets the number of buffered instances
func (*InstancedModel3D) SetNumUsedInstances ¶
func (this *InstancedModel3D) SetNumUsedInstances(n int)
Sets the number of drawn instances
func (*InstancedModel3D) SetV2 ¶
func (this *InstancedModel3D) SetV2(index int, value []mgl32.Vec2)
Sets the Vec2 value of index to value, value must be of size num instances
func (*InstancedModel3D) SetV3 ¶
func (this *InstancedModel3D) SetV3(index int, value []mgl32.Vec3)
Sets the Vec3 value of index to value, value must be of size num instances
type Key ¶
type Key uint8
The type that represents a keyboard key and the mouse buttons
const ( KeyUnknown Key = iota KeySpace Key = iota KeyApostrophe Key = iota KeyComma Key = iota KeyMinus Key = iota KeyPeriod Key = iota KeySlash Key = iota Key0 Key = iota Key1 Key = iota Key2 Key = iota Key3 Key = iota Key4 Key = iota Key5 Key = iota Key6 Key = iota Key7 Key = iota Key8 Key = iota Key9 Key = iota KeySemicolon Key = iota KeyEqual Key = iota KeyA Key = iota KeyB Key = iota KeyC Key = iota KeyD Key = iota KeyE Key = iota KeyF Key = iota KeyG Key = iota KeyH Key = iota KeyI Key = iota KeyJ Key = iota KeyK Key = iota KeyL Key = iota KeyM Key = iota KeyN Key = iota KeyO Key = iota KeyP Key = iota KeyQ Key = iota KeyR Key = iota KeyS Key = iota KeyT Key = iota KeyU Key = iota KeyV Key = iota KeyW Key = iota KeyX Key = iota KeyY Key = iota KeyZ Key = iota KeyLeftBracket Key = iota KeyBackslash Key = iota KeyRightBracket Key = iota KeyGraveAccent Key = iota KeyWorld1 Key = iota KeyWorld2 Key = iota KeyEscape Key = iota KeyEnter Key = iota KeyTab Key = iota KeyBackspace Key = iota KeyInsert Key = iota KeyDelete Key = iota KeyRight Key = iota KeyLeft Key = iota KeyDown Key = iota KeyUp Key = iota KeyPageUp Key = iota KeyPageDown Key = iota KeyHome Key = iota KeyEnd Key = iota KeyCapsLock Key = iota KeyScrollLock Key = iota KeyNumLock Key = iota KeyPrintScreen Key = iota KeyPause Key = iota KeyF1 Key = iota KeyF2 Key = iota KeyF3 Key = iota KeyF4 Key = iota KeyF5 Key = iota KeyF6 Key = iota KeyF7 Key = iota KeyF8 Key = iota KeyF9 Key = iota KeyF10 Key = iota KeyF11 Key = iota KeyF12 Key = iota KeyF13 Key = iota KeyF14 Key = iota KeyF15 Key = iota KeyF16 Key = iota KeyF17 Key = iota KeyF18 Key = iota KeyF19 Key = iota KeyF20 Key = iota KeyF21 Key = iota KeyF22 Key = iota KeyF23 Key = iota KeyF24 Key = iota KeyF25 Key = iota KeyKP0 Key = iota KeyKP1 Key = iota KeyKP2 Key = iota KeyKP3 Key = iota KeyKP4 Key = iota KeyKP5 Key = iota KeyKP6 Key = iota KeyKP7 Key = iota KeyKP8 Key = iota KeyKP9 Key = iota KeyKPDecimal Key = iota KeyKPDivide Key = iota KeyKPMultiply Key = iota KeyKPSubtract Key = iota KeyKPAdd Key = iota KeyKPEnter Key = iota KeyKPEqual Key = iota KeyLeftShift Key = iota KeyLeftControl Key = iota KeyLeftAlt Key = iota KeyLeftSuper Key = iota KeyRightShift Key = iota KeyRightControl Key = iota KeyRightAlt Key = iota KeyRightSuper Key = iota KeyMenu Key = iota KeyBack Key = iota KeyLast Key = iota MouseButton1 Key = iota MouseButton2 Key = iota MouseButton3 Key = iota MouseButton4 Key = iota MouseButton5 Key = iota MouseButton6 Key = iota MouseButton7 Key = iota MouseButton8 Key = iota MouseButtonLast Key = iota MouseButtonLeft Key = iota MouseButtonRight Key = iota MouseButtonMiddle Key = iota )
Every key and mouse button as an enum value
type Level ¶
type Level struct {
// The name of the level
Name string
// All objects of the level
LevelObjects []LevelObject
// contains filtered or unexported fields
}
A level containing level objects
func (*Level) AddToScene ¶
func (this *Level) AddToScene()
Adds all objects of the level to the scene
func (*Level) RemoveFromScene ¶
func (this *Level) RemoveFromScene()
Removes all objects of the level from the scene
type LevelObject ¶
type LevelObject struct {
// The name of the object
Name string
// The transform matrix of the object
Transform LevelTransformableObject
// The Entity that is the object
Entity3D
// The model that is the object
*Model3D
}
A struct holding data of an object from a level
type LevelTransformableObject ¶
A wrapper for the TransformableObject
func (*LevelTransformableObject) CalculateTransformMatrix ¶
func (this *LevelTransformableObject) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
Does nothing
func (*LevelTransformableObject) SetTransformMatrix ¶
func (this *LevelTransformableObject) SetTransformMatrix(rmgr *RenderManager)
Sets the transform matrix to the current transform matrix in rendering
type LightCollection ¶
type LightCollection struct {
// The color of the ambient light
AmbientLight color.Color
// All point lights of this collection
PointLights []*PointLight
// All directional lights of this collection
DirectionalLights []*DirectionalLight
// All spot lights of this collection
SpotLights []*SpotLight
}
A collection of point lights, directional lights and spot lights
func (*LightCollection) AddDirectionalLight ¶
func (this *LightCollection) AddDirectionalLight(pl *DirectionalLight)
Adds a directional light to this collection
func (*LightCollection) AddPointLight ¶
func (this *LightCollection) AddPointLight(pl *PointLight)
Adds a point light to this collection
func (*LightCollection) AddSpotLight ¶
func (this *LightCollection) AddSpotLight(pl *SpotLight)
Adds a spot light to this collection
func (*LightCollection) RenderShadowMaps ¶
func (this *LightCollection) RenderShadowMaps()
Renders all shadow maps
type LightManager ¶
type LightManager struct {
// All light collections
LightCollections []LightCollection
// The index of the currently used light collection
CurrentLightCollection int
}
A manager holding multiple light collections
var LightMgr LightManager
The LightManager that should be used for everything
func (*LightManager) AddDirectionalLight ¶
func (this *LightManager) AddDirectionalLight(pl *DirectionalLight, lightCollectionIndex int)
Adds a directional light to a given collection
func (*LightManager) AddPointLight ¶
func (this *LightManager) AddPointLight(pl *PointLight, lightCollectionIndex int)
Adds a point light to a given collection
func (*LightManager) AddSpotLight ¶
func (this *LightManager) AddSpotLight(pl *SpotLight, lightCollectionIndex int)
Adds a spot light to a given collection
func (*LightManager) DisableLighting ¶
func (this *LightManager) DisableLighting()
Sets the current light collection index to -1, not using any lights (uses white as ambient light)
func (*LightManager) EnableLighting ¶
func (this *LightManager) EnableLighting()
Sets the current light collection index to 0
func (*LightManager) Init ¶
func (this *LightManager) Init()
Initialises the values of the light manager
func (*LightManager) SetAmbientLight ¶
func (this *LightManager) SetAmbientLight(color color.Color, lightCollectionIndex int)
Sets the ambient light of the given collection
func (*LightManager) Update ¶
func (this *LightManager) Update()
Updates all light collections / rendering all shadow maps
type MainLoop ¶
type MainLoop struct {
// contains filtered or unexported fields
}
The main struct of the engine handling the start and end
var MainLop MainLoop
The MainLoop that should be used for everything
func (*MainLoop) DoStuff ¶
func (this *MainLoop) DoStuff()
Initialises the managers and starts the loop. Will be called from the framework
func (*MainLoop) InitWindowAndRenderer ¶
func (this *MainLoop) InitWindowAndRenderer()
Initialises the window and the renderer
type Material ¶
type Material struct {
// The name of the material
Name string
// The diffuse color of the material
DiffuseColor color.Color
// The specular color of the material
SpecularColor color.Color
// The diffuse texture of the material
DiffuseTexture Texture
// The specular texture of the material
SpecularTexture Texture
// The normal map of the material
NormalMap Texture
// Defines how much specular light should be applied (0.0-1.0)
Shinyness float32
// The transparency or alpha value of the material
Transparency float32
// Used to tell the shader if this material has a diffuse texture
DiffuseTextureLoaded uint8
// Used to tell the shader if this material has a specular texture
SpecularTextureLoaded uint8
// Used to tell the shader if this material has a normal map
NormalMapLoaded uint8
}
A Material having properties that define the look of 3D geometry
func (*Material) SetShinyness ¶
Sets the shinyness of the material
func (*Material) SetTextures ¶
Loads the textures from the resource manager
type Mesh2D ¶
type Mesh2D interface {
// Add vertices and indices to the mesh
AddVertices(vertices []Mesh2DVertex, indices []uint32)
// Loads vertices and indices to the GPU
Load()
// Call the draw method on the data
Render()
// Cleans everything up
Terminate()
}
A 2D mesh consisting of geometry used for rendering 2D
type Mesh2DVertex ¶
type Mesh2DVertex [4]float32
A vertex of a 2D mesh
func (*Mesh2DVertex) TexCoord ¶
func (m *Mesh2DVertex) TexCoord(u, v float32)
Sets the uv of the mesh
func (*Mesh2DVertex) Vertex ¶
func (m *Mesh2DVertex) Vertex(x, y float32)
Sets the position of the vertex
type Mesh3D ¶
type Mesh3D interface {
// Add vertices and indices to the mesh
AddVertices(vertices []Mesh3DVertex, indices []uint32)
// Load vertices and indices to the GPU
Load()
// Bind the material and call the draw method on the data
Render()
// Cleans everything up
Terminate()
// Sets the material of the mesh
SetMaterial(mat *Material)
// Returns the material of the mesh
GetMaterial() *Material
// Returns the name of the mesh
GetName() string
// Returns the number of vertices of the mesh
GetNumVertices() int
// Returns the number of indices of the mesh
GetNumIndices() int
// Returns all the vertices of the mesh
GetVertices() []Mesh3DVertex
// Returns all the indices of the mesh
GetIndices() []uint32
// Calculates all tangents used for the normal map
CalculateTangents()
// Returns wether this mesh has UV coordinates
HasUV() bool
// Returns the bounding box around the mesh
AABB() AxisAlignedBoundingBox
// Creates a copy of this mesh
Copy() Mesh3D
// Returns wether Load has been called
LoadedToGPU() bool
}
A 3D mesh consisting of geometry used for 3D rendering
type Mesh3DVertex ¶
type Mesh3DVertex [3 + 3 + 2 + 3]float32
A vertex of a 3D mesh
func (*Mesh3DVertex) Equals ¶
func (this *Mesh3DVertex) Equals(other *Mesh3DVertex) bool
Returns wether one vertex is the same as another
type Model3D ¶
type Model3D struct {
// The name of the model
Name string
// The bounding box going around the model
AABB AxisAlignedBoundingBox
// contains filtered or unexported fields
}
A 3D model consisting of multiple meshes
func (*Model3D) GetMeshIndex ¶
Returns the mesh with index
type Mouse ¶
type Mouse struct {
// The current position of the mouse in screen coordinates
Pos [2]int16
// The relative mouse movement to the last frame
DPos [2]int16
// The wheel movement values [Horizontal,Vertical]
Wheel [2]int8
}
A struct holding all data of the mouse
func (*Mouse) ToScreenPosition ¶
Converts the raw mouse coordinates to coordinates adapting to the native resolution
func (*Mouse) ToWorldPosition2D ¶
Converts the mouse screen coordinates to 2D world coordinates
type Music ¶
type Music interface {
// Plays the audio chunk
// loops sets wether it should loop
Play(loop bool)
// Pauses this Music
Pause()
// Resumes it if it has been paused
Resume()
// Stops it so that it will start from the
// beginning the next time you play it
Stop()
// Cleans up all data related to this resource
Terminate()
// Returns wether it is currently playing/ not paused
IsPlaying() bool
// Returns how far the Music has progressed in playing
GetPlayingDuration() time.Duration
// Returns the total duration of this Music
GetDuration() time.Duration
// Sets the volume of this sound (0.0 - 1.0)
SetVolume(vol float32)
// Returns the currently set volume
GetVolume() float32
}
This interface represents a longer chunk of audio
type NilAudioManager ¶
type NilAudioManager struct {
}
An implementation of the AudioManager interface that does nothing
func (*NilAudioManager) CreateMusic ¶
func (*NilAudioManager) CreateSound ¶
func (*NilAudioManager) GetVolume ¶
func (*NilAudioManager) GetVolume() float32
func (*NilAudioManager) Init ¶
func (*NilAudioManager) Init()
func (*NilAudioManager) LoadMusic ¶
func (*NilAudioManager) LoadMusic(name, path string) Music
func (*NilAudioManager) LoadSound ¶
func (*NilAudioManager) LoadSound(name, path string) Sound
func (*NilAudioManager) SetVolume ¶
func (*NilAudioManager) SetVolume(vol float32)
func (*NilAudioManager) Terminate ¶
func (*NilAudioManager) Terminate()
type NilCubeMap ¶
type NilCubeMap struct {
}
An implementation of CubeMap that does nothing
func (*NilCubeMap) Bind ¶
func (*NilCubeMap) Bind(unit uint32)
func (*NilCubeMap) GetHeight ¶
func (*NilCubeMap) GetHeight() int
func (*NilCubeMap) GetKeyColor ¶
func (*NilCubeMap) GetKeyColor() color.Color
func (*NilCubeMap) GetModColor ¶
func (*NilCubeMap) GetModColor() color.Color
func (*NilCubeMap) GetName ¶
func (*NilCubeMap) GetName() string
func (*NilCubeMap) GetWidth ¶
func (*NilCubeMap) GetWidth() int
func (*NilCubeMap) LoadFromImage ¶
func (*NilCubeMap) LoadFromImage(img image.Image)
func (*NilCubeMap) SetBorderColor ¶
func (*NilCubeMap) SetBorderColor(col color.Color)
func (*NilCubeMap) SetBorderDepth ¶
func (*NilCubeMap) SetBorderDepth(depth float32)
func (*NilCubeMap) SetFiltering ¶
func (*NilCubeMap) SetFiltering(filtering int)
func (*NilCubeMap) SetKeyColor ¶
func (*NilCubeMap) SetKeyColor(col color.Color)
func (*NilCubeMap) SetModColor ¶
func (*NilCubeMap) SetModColor(col color.Color)
func (*NilCubeMap) SetWrapping ¶
func (*NilCubeMap) SetWrapping(wrapping int)
func (*NilCubeMap) Terminate ¶
func (*NilCubeMap) Terminate()
func (*NilCubeMap) Unbind ¶
func (*NilCubeMap) Unbind(unit uint32)
type NilFramework ¶
type NilFramework struct {
}
An implementation of Framework that does nothing
func (*NilFramework) CreateWindow ¶
func (*NilFramework) CreateWindow(windowWidth, windowHeight int, title string) error
func (*NilFramework) CurserShow ¶
func (*NilFramework) CurserShow()
func (*NilFramework) CursorDisable ¶
func (*NilFramework) CursorDisable()
func (*NilFramework) CursorDisabled ¶
func (*NilFramework) CursorDisabled() bool
func (*NilFramework) CursorHidden ¶
func (*NilFramework) CursorHidden() bool
func (*NilFramework) CursorHide ¶
func (*NilFramework) CursorHide()
func (*NilFramework) CursorShown ¶
func (*NilFramework) CursorShown() bool
func (*NilFramework) EndTextInput ¶
func (*NilFramework) EndTextInput()
func (*NilFramework) GetTextInput ¶
func (*NilFramework) GetTextInput() string
func (*NilFramework) Init ¶
func (*NilFramework) Init(ml *MainLoop) error
func (*NilFramework) LoadLevel ¶
func (*NilFramework) LoadLevel(name, path string, loadToGPU bool) *Level
func (*NilFramework) LoadLevelString ¶
func (*NilFramework) LoadLevelString(name, contents, fileName string, loadToGPU bool) *Level
func (*NilFramework) Log ¶
func (*NilFramework) Log(a ...interface{})
func (*NilFramework) MonitorGetSize ¶
func (*NilFramework) MonitorGetSize() mgl32.Vec2
func (*NilFramework) OnClose ¶
func (*NilFramework) OnClose(callback func())
func (*NilFramework) OnFocus ¶
func (*NilFramework) OnFocus(callback func(focused bool))
func (*NilFramework) OnMove ¶
func (*NilFramework) OnMove(callback func(newPosX, newPosY int))
func (*NilFramework) OnResize ¶
func (*NilFramework) OnResize(callback func(newWidth, newHeight int))
func (*NilFramework) PollEvents ¶
func (*NilFramework) PollEvents()
func (*NilFramework) ShowYesNoDialog ¶
func (*NilFramework) ShowYesNoDialog(title, message string) uint8
func (*NilFramework) StartTextInput ¶
func (*NilFramework) StartTextInput()
func (*NilFramework) Terminate ¶
func (*NilFramework) Terminate()
func (*NilFramework) Update ¶
func (*NilFramework) Update()
func (*NilFramework) WindowClosed ¶
func (*NilFramework) WindowClosed() bool
func (*NilFramework) WindowGetSize ¶
func (*NilFramework) WindowGetSize() mgl32.Vec2
func (*NilFramework) WindowIsFullscreen ¶
func (*NilFramework) WindowIsFullscreen() bool
func (*NilFramework) WindowSetFullscreen ¶
func (*NilFramework) WindowSetFullscreen(b bool)
func (*NilFramework) WindowSetSize ¶
func (*NilFramework) WindowSetSize(size mgl32.Vec2)
func (*NilFramework) WindowSwap ¶
func (*NilFramework) WindowSwap()
type NilInstancedMesh3D ¶
type NilInstancedMesh3D struct {
}
An implementation of InstancedMesh3D that does nothing
func (*NilInstancedMesh3D) AABB ¶
func (*NilInstancedMesh3D) AABB() AxisAlignedBoundingBox
func (*NilInstancedMesh3D) AddValue ¶
func (*NilInstancedMesh3D) AddValue(valueType int)
func (*NilInstancedMesh3D) AddValueFront ¶
func (*NilInstancedMesh3D) AddValueFront(valueType int)
func (*NilInstancedMesh3D) AddVertices ¶
func (*NilInstancedMesh3D) AddVertices(vertices []Mesh3DVertex, indices []uint32)
func (*NilInstancedMesh3D) CalculateTangents ¶
func (*NilInstancedMesh3D) CalculateTangents()
func (*NilInstancedMesh3D) Copy ¶
func (*NilInstancedMesh3D) Copy() Mesh3D
func (*NilInstancedMesh3D) GetIndices ¶
func (*NilInstancedMesh3D) GetIndices() []uint32
func (*NilInstancedMesh3D) GetMaterial ¶
func (*NilInstancedMesh3D) GetMaterial() *Material
func (*NilInstancedMesh3D) GetName ¶
func (*NilInstancedMesh3D) GetName() string
func (*NilInstancedMesh3D) GetNumIndices ¶
func (*NilInstancedMesh3D) GetNumIndices() int
func (*NilInstancedMesh3D) GetNumInstances ¶
func (*NilInstancedMesh3D) GetNumInstances() int
func (*NilInstancedMesh3D) GetNumUsedInstances ¶
func (*NilInstancedMesh3D) GetNumUsedInstances() int
func (*NilInstancedMesh3D) GetNumVertices ¶
func (*NilInstancedMesh3D) GetNumVertices() int
func (*NilInstancedMesh3D) GetVertices ¶
func (*NilInstancedMesh3D) GetVertices() []Mesh3DVertex
func (*NilInstancedMesh3D) HasUV ¶
func (*NilInstancedMesh3D) HasUV() bool
func (*NilInstancedMesh3D) Load ¶
func (*NilInstancedMesh3D) Load()
func (*NilInstancedMesh3D) LoadedToGPU ¶
func (*NilInstancedMesh3D) LoadedToGPU() bool
func (*NilInstancedMesh3D) Render ¶
func (*NilInstancedMesh3D) Render()
func (*NilInstancedMesh3D) SetF ¶
func (*NilInstancedMesh3D) SetF(index int, value []float32)
func (*NilInstancedMesh3D) SetMaterial ¶
func (*NilInstancedMesh3D) SetMaterial(mat *Material)
func (*NilInstancedMesh3D) SetName ¶
func (*NilInstancedMesh3D) SetName(index int, value_type int, value string)
func (*NilInstancedMesh3D) SetNumInstances ¶
func (*NilInstancedMesh3D) SetNumInstances(n int)
func (*NilInstancedMesh3D) SetNumUsedInstances ¶
func (*NilInstancedMesh3D) SetNumUsedInstances(n int)
func (*NilInstancedMesh3D) Terminate ¶
func (*NilInstancedMesh3D) Terminate()
type NilMesh2D ¶
type NilMesh2D struct {
}
An implementation of Mesh2D that does nothing
func (*NilMesh2D) AddVertices ¶
func (*NilMesh2D) AddVertices(vertices []Mesh2DVertex, indices []uint32)
type NilMesh3D ¶
type NilMesh3D struct {
}
An implementation of Mesh3D that does nothing
func (*NilMesh3D) AABB ¶
func (*NilMesh3D) AABB() AxisAlignedBoundingBox
func (*NilMesh3D) AddVertices ¶
func (*NilMesh3D) AddVertices(vertices []Mesh3DVertex, indices []uint32)
func (*NilMesh3D) CalculateTangents ¶
func (*NilMesh3D) CalculateTangents()
func (*NilMesh3D) GetIndices ¶
func (*NilMesh3D) GetMaterial ¶
func (*NilMesh3D) GetNumIndices ¶
func (*NilMesh3D) GetNumVertices ¶
func (*NilMesh3D) GetVertices ¶
func (*NilMesh3D) GetVertices() []Mesh3DVertex
func (*NilMesh3D) LoadedToGPU ¶
func (*NilMesh3D) SetMaterial ¶
type NilMusic ¶
type NilMusic struct {
}
An implementation of the Music interface that does nothing
func (*NilMusic) GetDuration ¶
func (*NilMusic) GetPlayingDuration ¶
type NilRenderObject ¶
type NilRenderObject struct {
}
An implementation of RenderObject that does nothing
func (*NilRenderObject) GetShader ¶
func (*NilRenderObject) GetShader() Shader
func (*NilRenderObject) GetTransformableObject ¶
func (*NilRenderObject) GetTransformableObject() TransformableObject
func (*NilRenderObject) GetType ¶
func (*NilRenderObject) GetType() RenderType
func (*NilRenderObject) HasDepthTesting ¶
func (*NilRenderObject) HasDepthTesting() bool
func (*NilRenderObject) IsVisible ¶
func (*NilRenderObject) IsVisible() bool
func (*NilRenderObject) NotRelativeCamera ¶
func (*NilRenderObject) NotRelativeCamera() int
func (*NilRenderObject) Render ¶
func (*NilRenderObject) Render()
func (*NilRenderObject) RendersLast ¶
func (*NilRenderObject) RendersLast() bool
func (*NilRenderObject) SetShader ¶
func (*NilRenderObject) SetShader(s Shader)
func (*NilRenderObject) SetTransformableObject ¶
func (*NilRenderObject) SetTransformableObject(tobj TransformableObject)
func (*NilRenderObject) SetType ¶
func (*NilRenderObject) SetType(rtype RenderType)
type NilRenderTexture ¶
type NilRenderTexture struct {
}
An implementation of RenderTexture that does nothing
func (*NilRenderTexture) Bind ¶
func (*NilRenderTexture) Bind(unit uint32)
func (*NilRenderTexture) Blit ¶
func (*NilRenderTexture) Blit(rtex RenderTexture)
func (*NilRenderTexture) ChangeSize ¶
func (*NilRenderTexture) ChangeSize(width, height int)
func (*NilRenderTexture) GetHeight ¶
func (*NilRenderTexture) GetHeight() int
func (*NilRenderTexture) GetKeyColor ¶
func (*NilRenderTexture) GetKeyColor() color.Color
func (*NilRenderTexture) GetModColor ¶
func (*NilRenderTexture) GetModColor() color.Color
func (*NilRenderTexture) GetName ¶
func (*NilRenderTexture) GetName() string
func (*NilRenderTexture) GetWidth ¶
func (*NilRenderTexture) GetWidth() int
func (*NilRenderTexture) Load ¶
func (*NilRenderTexture) Load(data []byte, width, height int, shadowMap bool)
func (*NilRenderTexture) LoadFromImage ¶
func (*NilRenderTexture) LoadFromImage(img image.Image)
func (*NilRenderTexture) SetAsTarget ¶
func (*NilRenderTexture) SetAsTarget()
func (*NilRenderTexture) SetBorderColor ¶
func (*NilRenderTexture) SetBorderColor(col color.Color)
func (*NilRenderTexture) SetBorderDepth ¶
func (*NilRenderTexture) SetBorderDepth(depth float32)
func (*NilRenderTexture) SetFiltering ¶
func (*NilRenderTexture) SetFiltering(filtering int)
func (*NilRenderTexture) SetKeyColor ¶
func (*NilRenderTexture) SetKeyColor(col color.Color)
func (*NilRenderTexture) SetModColor ¶
func (*NilRenderTexture) SetModColor(col color.Color)
func (*NilRenderTexture) SetWrapping ¶
func (*NilRenderTexture) SetWrapping(wrapping int)
func (*NilRenderTexture) Terminate ¶
func (*NilRenderTexture) Terminate()
func (*NilRenderTexture) Unbind ¶
func (*NilRenderTexture) Unbind(unit uint32)
func (*NilRenderTexture) UnsetAsTarget ¶
func (*NilRenderTexture) UnsetAsTarget()
type NilRenderer ¶
type NilRenderer struct {
}
An implementation of Renderer that does nothing
func (*NilRenderer) AfterInit ¶
func (*NilRenderer) AfterInit()
func (*NilRenderer) AfterRender ¶
func (*NilRenderer) AfterRender()
func (*NilRenderer) ClearScreen ¶
func (*NilRenderer) ClearScreen(c color.Color)
func (*NilRenderer) CreateCubeMap ¶
func (*NilRenderer) CreateCubeMap(name string) CubeMap
func (*NilRenderer) CreateInstancedMesh3D ¶
func (*NilRenderer) CreateInstancedMesh3D(name string) InstancedMesh3D
func (*NilRenderer) CreateMesh2D ¶
func (*NilRenderer) CreateMesh2D(name string) Mesh2D
func (*NilRenderer) CreateMesh3D ¶
func (*NilRenderer) CreateMesh3D(name string) Mesh3D
func (*NilRenderer) CreateRenderTexture ¶
func (*NilRenderer) CreateRenderTexture(name string, width, height, textures int, depthBuffer, multiSampled, shadowMap, cubeMap bool) RenderTexture
func (*NilRenderer) CreateShape2DInterface ¶
func (*NilRenderer) CreateShape2DInterface(name string) Shape2DInterface
func (*NilRenderer) CreateShape3DInterface ¶
func (*NilRenderer) CreateShape3DInterface(name string) Shape3DInterface
func (*NilRenderer) CreateTexture ¶
func (*NilRenderer) CreateTexture(name string, multiSampled bool) Texture
func (*NilRenderer) DecrementTextureUnit ¶
func (*NilRenderer) DecrementTextureUnit(amount uint32)
func (*NilRenderer) FilterShaderFiles ¶
func (*NilRenderer) FilterShaderFiles(name, file, shader_type string) string
func (*NilRenderer) FilterShaderSource ¶
func (*NilRenderer) FilterShaderSource(name, source, shader_type string) string
func (*NilRenderer) GetBackgroundColor ¶
func (*NilRenderer) GetBackgroundColor() color.Color
func (*NilRenderer) GetMaxTextures ¶
func (*NilRenderer) GetMaxTextures() int32
func (*NilRenderer) GetName ¶
func (*NilRenderer) GetName() string
func (*NilRenderer) GetNativeResolution ¶
func (*NilRenderer) GetNativeResolution() mgl32.Vec2
func (*NilRenderer) GetViewport ¶
func (*NilRenderer) GetViewport() Viewport
func (*NilRenderer) HasFunctionAvailable ¶
func (*NilRenderer) HasFunctionAvailable(name string) bool
func (*NilRenderer) Init ¶
func (*NilRenderer) Init() error
func (*NilRenderer) InstancedMesh3DFromLoadedMesh3D ¶
func (*NilRenderer) InstancedMesh3DFromLoadedMesh3D(mesh Mesh3D) InstancedMesh3D
func (*NilRenderer) LoadShader ¶
func (*NilRenderer) LoadShader(name, vertex_contents, fragment_contents, geometry_contents, tesselletion_control_contents, eveluation_contents, compute_contents string) (Shader, error)
func (*NilRenderer) NextTextureUnit ¶
func (*NilRenderer) NextTextureUnit() uint32
func (*NilRenderer) OnResize ¶
func (*NilRenderer) OnResize(newWidth, newHeight int)
func (*NilRenderer) PreRender ¶
func (*NilRenderer) PreRender()
func (*NilRenderer) RenderBackBuffer ¶
func (*NilRenderer) RenderBackBuffer()
func (*NilRenderer) SetBacckFaceCulling ¶
func (*NilRenderer) SetBacckFaceCulling(b bool)
func (*NilRenderer) SetBackgroundColor ¶
func (*NilRenderer) SetBackgroundColor(bgColor color.Color)
func (*NilRenderer) SetDepthTesting ¶
func (*NilRenderer) SetDepthTesting(b bool)
func (*NilRenderer) SetNativeResolution ¶
func (*NilRenderer) SetNativeResolution(width, height int)
func (*NilRenderer) SetViewport ¶
func (*NilRenderer) SetViewport(viewport Viewport)
func (*NilRenderer) SetWireFrame ¶
func (*NilRenderer) SetWireFrame(b bool)
func (*NilRenderer) Terminate ¶
func (*NilRenderer) Terminate()
type NilShader ¶
type NilShader struct {
}
An implementation of Shader that does nothing
func (*NilShader) AddAttribute ¶
func (*NilShader) SetUniformB ¶
func (*NilShader) SetUniformF ¶
func (*NilShader) SetUniformI ¶
func (*NilShader) SetUniformIV2 ¶
func (*NilShader) SetUniformIV3 ¶
func (*NilShader) SetUniformIV4 ¶
func (*NilShader) SetUniformLights ¶
func (*NilShader) SetUniformMaterial ¶
func (*NilShader) SetUniformUI ¶
type NilShape2DInterface ¶
type NilShape2DInterface struct {
}
An implementation of Shape2DInterface that does nothing
func (*NilShape2DInterface) AddLines ¶
func (*NilShape2DInterface) AddLines(lines []Line2D)
func (*NilShape2DInterface) AddPoints ¶
func (*NilShape2DInterface) AddPoints(points []Shape2DVertex)
func (*NilShape2DInterface) AddTriangles ¶
func (*NilShape2DInterface) AddTriangles(tris []Triangle2D)
func (*NilShape2DInterface) GetPoints ¶
func (*NilShape2DInterface) GetPoints() []Shape2DVertex
func (*NilShape2DInterface) Init ¶
func (*NilShape2DInterface) Init()
func (*NilShape2DInterface) Load ¶
func (*NilShape2DInterface) Load()
func (*NilShape2DInterface) Render ¶
func (*NilShape2DInterface) Render()
func (*NilShape2DInterface) SetDrawMode ¶
func (*NilShape2DInterface) SetDrawMode(mode uint8)
func (*NilShape2DInterface) SetLineWidth ¶
func (*NilShape2DInterface) SetLineWidth(width float32)
func (*NilShape2DInterface) SetPointSize ¶
func (*NilShape2DInterface) SetPointSize(size float32)
func (*NilShape2DInterface) Terminate ¶
func (*NilShape2DInterface) Terminate()
type NilShape3DInterface ¶
type NilShape3DInterface struct {
}
An implementation of Shape3DInterface that does nothing
func (*NilShape3DInterface) AddPoints ¶
func (*NilShape3DInterface) AddPoints(points []Shape3DVertex)
func (*NilShape3DInterface) GetPoints ¶
func (*NilShape3DInterface) GetPoints() []Shape3DVertex
func (*NilShape3DInterface) Init ¶
func (*NilShape3DInterface) Init()
func (*NilShape3DInterface) Load ¶
func (*NilShape3DInterface) Load()
func (*NilShape3DInterface) Render ¶
func (*NilShape3DInterface) Render()
func (*NilShape3DInterface) SetDrawMode ¶
func (*NilShape3DInterface) SetDrawMode(drawMode uint8)
func (*NilShape3DInterface) SetLineWidth ¶
func (*NilShape3DInterface) SetLineWidth(size float32)
func (*NilShape3DInterface) SetPointSize ¶
func (*NilShape3DInterface) SetPointSize(size float32)
func (*NilShape3DInterface) Terminate ¶
func (*NilShape3DInterface) Terminate()
type NilSound ¶
type NilSound struct {
}
An implementation of the Sound interface that does nothing
func (*NilSound) GetDuration ¶
func (*NilSound) GetPlayingDuration ¶
type NilTexture ¶
type NilTexture struct {
}
An implementation of Texture that does nothing
func (*NilTexture) Bind ¶
func (*NilTexture) Bind(unit uint32)
func (*NilTexture) GetHeight ¶
func (*NilTexture) GetHeight() int
func (*NilTexture) GetKeyColor ¶
func (*NilTexture) GetKeyColor() color.Color
func (*NilTexture) GetModColor ¶
func (*NilTexture) GetModColor() color.Color
func (*NilTexture) GetName ¶
func (*NilTexture) GetName() string
func (*NilTexture) GetWidth ¶
func (*NilTexture) GetWidth() int
func (*NilTexture) LoadFromImage ¶
func (*NilTexture) LoadFromImage(img image.Image)
func (*NilTexture) SetBorderColor ¶
func (*NilTexture) SetBorderColor(col color.Color)
func (*NilTexture) SetBorderDepth ¶
func (*NilTexture) SetBorderDepth(depth float32)
func (*NilTexture) SetFiltering ¶
func (*NilTexture) SetFiltering(filtering int)
func (*NilTexture) SetKeyColor ¶
func (*NilTexture) SetKeyColor(col color.Color)
func (*NilTexture) SetModColor ¶
func (*NilTexture) SetModColor(col color.Color)
func (*NilTexture) SetWrapping ¶
func (*NilTexture) SetWrapping(wrapping int)
func (*NilTexture) Terminate ¶
func (*NilTexture) Terminate()
func (*NilTexture) Unbind ¶
func (*NilTexture) Unbind(unit uint32)
type Ortho2DProjection ¶
type Ortho2DProjection struct {
// The left most value
Left float32
// The right most value
Right float32
// The bottom mose value
Bottom float32
// The top most value
Top float32
// contains filtered or unexported fields
}
A 2-dimensional orthogonal projection
func (*Ortho2DProjection) CalculateProjectionMatrix ¶
func (o2Dp *Ortho2DProjection) CalculateProjectionMatrix()
func (*Ortho2DProjection) GetFrustum ¶
func (o2Dp *Ortho2DProjection) GetFrustum() [8]mgl32.Vec3
func (*Ortho2DProjection) GetProjectionMatrix ¶
func (o2Dp *Ortho2DProjection) GetProjectionMatrix() mgl32.Mat4
func (*Ortho2DProjection) Update ¶
func (o2Dp *Ortho2DProjection) Update(newViewport Viewport)
type Ortho3DProjection ¶
type Ortho3DProjection struct {
// The left most point
Left float32
// The right most point
Right float32
// The bottom most point
Bottom float32
// The top most point
Top float32
// The near plane
Near float32
// The far plane
Far float32
// contains filtered or unexported fields
}
A 3-dimensional orthogonal projection
func (*Ortho3DProjection) CalculateProjectionMatrix ¶
func (this *Ortho3DProjection) CalculateProjectionMatrix()
func (*Ortho3DProjection) GetFrustum ¶
func (this *Ortho3DProjection) GetFrustum() [8]mgl32.Vec3
func (*Ortho3DProjection) GetProjectionMatrix ¶
func (this *Ortho3DProjection) GetProjectionMatrix() mgl32.Mat4
func (*Ortho3DProjection) Update ¶
func (this *Ortho3DProjection) Update(newViewport Viewport)
type ParentObject3D ¶
type ParentObject3D interface {
TweenableObject3D
SetChildChannel(channel chan bool, tobj *TransformableObject3D)
}
An object that is a parent of another object
type PerspectiveProjection ¶
type PerspectiveProjection struct {
// The width of the viewport
Width float32
// The height of the viewport
Height float32
// The field of view
FOV float32
// The near plane at which objects start to clip away
NearPlane float32
// The far plane at which the objects start to clip away
FarPlane float32
// contains filtered or unexported fields
}
A 3-dimensional perspective projection
func (*PerspectiveProjection) CalculateProjectionMatrix ¶
func (pp *PerspectiveProjection) CalculateProjectionMatrix()
func (*PerspectiveProjection) GetFrustum ¶
func (pp *PerspectiveProjection) GetFrustum() [8]mgl32.Vec3
func (*PerspectiveProjection) GetProjectionMatrix ¶
func (pp *PerspectiveProjection) GetProjectionMatrix() mgl32.Mat4
func (*PerspectiveProjection) Update ¶
func (pp *PerspectiveProjection) Update(newViewport Viewport)
type PlaneMath3D ¶
type PlaneMath3D struct {
// The normal pointing from the plane
Normal mgl32.Vec3
// A random point on the plane
Point mgl32.Vec3
}
A Plane used for calculations
type PointLight ¶
type PointLight struct {
// The position of the light in world coordinates
Position mgl32.Vec3
// The diffuse color of the light
DiffuseColor color.Color
// The specular color of the light
SpecularColor color.Color
// The attenuation values of the light
Attentuation
}
A Light with a position emitting in all directions
func (PointLight) SetUniforms ¶
func (pl PointLight) SetUniforms(s Shader, arrayIndex int)
Sets the uniform values of s
type Polygon2D ¶
type Polygon2D struct {
Points []Shape2DVertex
}
The vertices of a 2D polygon
func (*Polygon2D) ToTriangles ¶
func (this *Polygon2D) ToTriangles() (tris []Triangle2D)
Converts the polygon into triangles
type PolygonMath2D ¶
Polygon points used for calculations
func (*PolygonMath2D) Intersects ¶
func (this *PolygonMath2D) Intersects(other PolygonMath2D) bool
Wether one polygon intersects the other
func (*PolygonMath2D) IntersectsPoint ¶
func (this *PolygonMath2D) IntersectsPoint(point mgl32.Vec2) bool
Wether the point is inside the polygon
type Projection ¶
type Projection interface {
// Calculates the projection matrix used in the shader
CalculateProjectionMatrix()
// Returns the projection matrix
GetProjectionMatrix() mgl32.Mat4
// Updates the projection with the new viewport
Update(newViewport Viewport)
// Returns the view frustum
GetFrustum() [8]mgl32.Vec3
}
A projection that is used to correctly display the objects on the screen
type QuadMath2D ¶
A quad used for calculations
func (*QuadMath2D) Intersects ¶
func (this *QuadMath2D) Intersects(other QuadMath2D) bool
Wether this quad intesects with another
func (*QuadMath2D) IntersectsPoint ¶
func (this *QuadMath2D) IntersectsPoint(point mgl32.Vec2) bool
Wether a point intersects with this quad
func (*QuadMath2D) ToPolygon ¶
func (this *QuadMath2D) ToPolygon() PolygonMath2D
Converts this quad into a polygon
type Rectangle2D ¶
type Rectangle2D [4]Shape2DVertex
The vertices of a 2D rectangle
func (*Rectangle2D) ToLines ¶
func (this *Rectangle2D) ToLines() (lines []Line2D)
Converts the triangle into lines going around the rectangle
func (*Rectangle2D) ToTriangles ¶
func (this *Rectangle2D) ToTriangles() (tris [2]Triangle2D)
Converts the rectangle into 2 triangles
type RenderManager ¶
type RenderManager struct {
CurrentShader Shader
// The projetion used for 2D objects
Projection2D Projection
// The projection used for 3D objects
Projection3D Projection
// If set this shader is forced onto every 3D object
ForceShader3D Shader
// If set this shader is forced onto every 2D object
ForceShader2D Shader
// The back buffer that will be rendered to the screen
// and onto which BackBuffer2D and 3D will be rendered
BackBufferMS RenderTexture
// The BackBuffer to which all 2D objects will be rendered
BackBuffer2D RenderTexture
// The BackBuffer to which all 3D objects will be rendered
BackBuffer3D RenderTexture
// The shader used for rendering the back buffers
BackBufferShader Shader
// Wether the objects should be rendered to the back buffers or directly to the screen
EnableBackBuffer bool
// Wether the objects should be rendered in wire frame mode
WireFrameMode bool
// Wether the projection should be updated every frame based on the viewport
UpdateProjectionWithViewport bool
// Wether the back buffers of the last frame should be rendered before the objects
RenderToScreenFirst bool
// If false ReRender must be set to true everytime you want to re-render the scene
AutoRender bool
// If true the scene will be re-rendered
ReRender bool
// contains filtered or unexported fields
}
The manager that handles the rendering of all objects
var RenderMgr RenderManager
The RenderManager that should be used for everything
func (*RenderManager) AddObject ¶
func (rmgr *RenderManager) AddObject(robj RenderObject)
Adds a RenderObject to the scene so that it will be rendered
func (*RenderManager) AddViewport2D ¶
func (rmgr *RenderManager) AddViewport2D(viewport *Viewport)
Adds a 2D viewport to the scene
func (*RenderManager) AddViewport3D ¶
func (rmgr *RenderManager) AddViewport3D(viewport *Viewport)
Adds a 3D viewport to the scene
func (*RenderManager) GetBackBuffer ¶
func (rmgr *RenderManager) GetBackBuffer() RenderTexture
Returns the back buffer as a RenderTexture
func (*RenderManager) Init ¶
func (rmgr *RenderManager) Init()
Initialises all values of the manager
func (*RenderManager) NumRenderObjects ¶
func (rmgr *RenderManager) NumRenderObjects() int
Returns the number of currently added RenderObjects
func (*RenderManager) RemoveObject ¶
func (rmgr *RenderManager) RemoveObject(robj RenderObject)
Removes a RenderObject from the scene so that it won't be rendered
func (*RenderManager) Render ¶
func (rmgr *RenderManager) Render(rtype RenderType, cameraIndex, viewportIndex, lightCollectionIndex int)
Renders a certain render type to a certain viewport using a certain light collection
func (*RenderManager) RenderRenderObject ¶
func (rmgr *RenderManager) RenderRenderObject(robj RenderObject)
Renders a RenderObject (used for custom rendering)
func (*RenderManager) RenderRenderObjectAdv ¶
func (rmgr *RenderManager) RenderRenderObjectAdv(robj RenderObject, cameraIndex, viewportIndex int)
Same as RenderRenderObject but with additional arguments for camera and viewport
func (*RenderManager) SetCamera2D ¶
func (rmgr *RenderManager) SetCamera2D(cam *Camera2D, index int)
Attaches a 2D camera to an index
func (*RenderManager) SetCamera3D ¶
func (rmgr *RenderManager) SetCamera3D(cam *Camera3D, index int)
Attaches a 3D camera to an index
func (*RenderManager) SetProjection2D ¶
func (rmgr *RenderManager) SetProjection2D(proj Projection)
Sets the projection used for 2D rendering
func (*RenderManager) SetProjection2DToTexture ¶
func (rmgr *RenderManager) SetProjection2DToTexture(texture Texture)
Takes the dimensions of a texture and uses it for a projection
func (*RenderManager) SetProjection3D ¶
func (rmgr *RenderManager) SetProjection3D(proj Projection)
Sets the projection used for 3D rendering
func (*RenderManager) SetViewport2D ¶
func (rmgr *RenderManager) SetViewport2D(viewport *Viewport, index int)
Sets the 2D viewport of a certain index
func (*RenderManager) SetViewport3D ¶
func (rmgr *RenderManager) SetViewport3D(viewport *Viewport, index int)
Sets the 3D viewport of a certain index
func (*RenderManager) Update ¶
func (rmgr *RenderManager) Update()
Updates the manger / renders everything
func (*RenderManager) UpdateProjection2D ¶
func (rmgr *RenderManager) UpdateProjection2D(viewportIndex int32)
Updates the 2D projection using the viewport of viewportIndex
func (*RenderManager) UpdateViewports ¶
func (rmgr *RenderManager) UpdateViewports(current Viewport, previous Viewport)
Updates the viewport based on a viewport of the GPU
type RenderObject ¶
type RenderObject interface {
// Calls the draw method of the data in the GPU
Render()
// Sets the shader used for rendering
SetShader(s Shader)
// Returns the shader used for rendering
GetShader() Shader
// Set the render type of the object
SetType(rtype RenderType)
// Returns the render type of the object
GetType() RenderType
// Returns wether this object should be rendered
IsVisible() bool
// Returns to which camera this object is not relative to
NotRelativeCamera() int
// Sets the transformable object of the RenderObject
SetTransformableObject(tobj TransformableObject)
// Returns the transformable object of the RenderObject
GetTransformableObject() TransformableObject
// Returns wether this object will be rendered after everything else
RendersLast() bool
// Returns wether depth testing is enabled for this object
HasDepthTesting() bool
}
An object that can be rendered
type RenderTexture ¶
type RenderTexture interface {
// Is not used. It there just make RenderTexture able to be a Texture
Load(data []byte, width, height int, shadowMap bool)
// Is not used. It there just make RenderTexture able to be a Texture
LoadFromImage(img image.Image)
// Returns the name of the texture
GetName() string
// Renders everything after that to this render texture
SetAsTarget()
// Renders everything to the previously set render target or to the screen
UnsetAsTarget()
// Copies the contents of this render texture to rtex
Blit(rtex RenderTexture)
// Binds this texture to unit
Bind(unit uint32)
// Unbinds this texture
Unbind(unit uint32)
// Returns the width of the texture in pixels
GetWidth() int
// Returns the height of the texture in pixels
GetHeight() int
// Returns the key color
GetKeyColor() color.Color
// Returns the modulate color
GetModColor() color.Color
// Recreates the texture with a new size
ChangeSize(width, height int)
// Cleans everything up
Terminate()
// Sets the filter method used for this texture
SetFiltering(filtering int)
// Sets the wrapping method used for this texture
SetWrapping(wrapping int)
// Sets the border color for this texture
SetBorderColor(col color.Color)
// Sets the border depth for this texture
SetBorderDepth(depth float32)
// Sets the key color which tells the texture which color should be ignored
SetKeyColor(col color.Color)
// Sets the modulate color
SetModColor(col color.Color)
// Returns the pixels of the texture as a byte array
GetData() ([]byte, int, int)
}
A Texture to which you can render
type RenderType ¶
type RenderType uint16
const ( TYPE_3D_NORMAL RenderType = (1 << 1) TYPE_2D_NORMAL RenderType = (1 << 2) TYPE_3D_INSTANCED RenderType = (1 << 3) TYPE_2D_INSTANCED RenderType = (1 << 4) TYPE_CASTS_SHADOWS RenderType = (1 << 5) TYPE_2D RenderType = TYPE_2D_NORMAL | TYPE_2D_INSTANCED TYPE_3D RenderType = TYPE_3D_NORMAL | TYPE_3D_INSTANCED TYPE_EVERYTHING RenderType = (1 << 16) - 1 )
The different render types. Determines which projection, back buffer, camera etc. will be used for the RenderObject
func (RenderType) Compatible ¶
func (this RenderType) Compatible(rtype RenderType) bool
Returns if a RenderType can be drawn using a render type
type Renderer ¶
type Renderer interface {
// Initialises the renderer
Init() error
// Gets called after the initialisation of the engine
AfterInit()
// Cleans everything up
Terminate()
// Clears the screen with the given color
ClearScreen(c color.Color)
// Loads a shader given the contents of shaders
LoadShader(name, vertex_contents, fragment_contents, geometry_contents, tesselletion_control_contents, eveluation_contents, compute_contents string) (Shader, error)
// Creates a texture without data
CreateTexture(name string, multiSampled bool) Texture
// Creates a Mesh2D
CreateMesh2D(name string) Mesh2D
// Creates a Mesh3D
CreateMesh3D(name string) Mesh3D
// Creates a RenderTexture from the given parameters
CreateRenderTexture(name string, width, height, textures int, depthBuffer, multiSampled, shadowMap, cubeMap bool) RenderTexture
// Creates a cube map
CreateCubeMap(name string) CubeMap
// Creates an instanced mesh 3d
CreateInstancedMesh3D(name string) InstancedMesh3D
// Creates a shape 3d interface
CreateShape3DInterface(name string) Shape3DInterface
// Creates a shape 2d interface
CreateShape2DInterface(name string) Shape2DInterface
// Enables or disables wire frame render mode
SetWireFrame(b bool)
// Sets the current viewport for the GPU
SetViewport(viewport Viewport)
// Returns the current viewport of the GPU
GetViewport() Viewport
// Sets the resolution of the back buffer
SetNativeResolution(width, height int)
// Returns the resolution of the back buffer
GetNativeResolution() mgl32.Vec2
// Gets called when the window resizes
OnResize(newWidth, newHeight int)
// Gets called before rendering a RenderObject
PreRender()
// Gets called after rendering a RenderObject
AfterRender()
// Sets the clear color
SetBackgroundColor(bgColor color.Color)
// Returns the clear color
GetBackgroundColor() color.Color
// Returns the name of the renderer
GetName() string
// Calls the draw methods of the back buffer
RenderBackBuffer()
// Enable or disable back face culling
SetBacckFaceCulling(b bool)
// Enable or disable depth testing
SetDepthTesting(b bool)
// Returns the number maximum textures supported by the GPU
GetMaxTextures() int
// Increments the texture unit used for textures
NextTextureUnit() uint32
// Decrements the texture unit used for textures
DecrementTextureUnit(amount uint32)
// Returns wether the given function is supported by the hardware
HasFunctionAvailable(name string) bool
// Returns a InstancedMesh3D created from an already loaded Mesh3D
InstancedMesh3DFromLoadedMesh3D(mesh Mesh3D) InstancedMesh3D
}
This interface handles every low level rendering operation
var Render Renderer
The Renderer that should be used for everything
type ResourceManager ¶
type ResourceManager struct {
Models map[string]*Model3D
Levels map[string]*Level
// Wether models can have the same name
LoadModelsWithSameName bool
// contains filtered or unexported fields
}
The manager that handles all resources
var ResourceMgr ResourceManager
The ResourceManager that should be used for everything
func (*ResourceManager) CheckLevel ¶
func (rsmgr *ResourceManager) CheckLevel(name, path string) (l, q bool, n string)
func (*ResourceManager) CheckModel ¶
func (rsmgr *ResourceManager) CheckModel(name string) (l, q bool)
func (*ResourceManager) DeleteFont ¶
func (rsmgr *ResourceManager) DeleteFont(name string)
Deletes the font with name from the manager
func (*ResourceManager) DeleteLevel ¶
func (rsmgr *ResourceManager) DeleteLevel(name string)
Deletes the level with name from the manager
func (*ResourceManager) DeleteModel ¶
func (rsmgr *ResourceManager) DeleteModel(name string)
Deletes the model with name from the manager
func (*ResourceManager) DeleteMusic ¶
func (rsmgr *ResourceManager) DeleteMusic(name string)
Deletes the music with name from the manager
func (*ResourceManager) DeleteShader ¶
func (rsmgr *ResourceManager) DeleteShader(name string)
Deletes the shader with name from the manager
func (*ResourceManager) DeleteSound ¶
func (rsmgr *ResourceManager) DeleteSound(name string)
Deletes the sound with name from the manager
func (*ResourceManager) DeleteTMXMap ¶
func (rsmgr *ResourceManager) DeleteTMXMap(name string)
Deletes the tmx map with name from the manager
func (*ResourceManager) DeleteTexture ¶
func (rsmgr *ResourceManager) DeleteTexture(name string)
Deletes the texture with name from the manager
func (*ResourceManager) GetFont ¶
func (rsmgr *ResourceManager) GetFont(name string) *Font
Returns the font width name
func (*ResourceManager) GetLevel ¶
func (rsmgr *ResourceManager) GetLevel(name string) *Level
Returns the level with name
func (*ResourceManager) GetModel ¶
func (rsmgr *ResourceManager) GetModel(name string) *Model3D
Returns the model with name
func (*ResourceManager) GetMusic ¶
func (rsmgr *ResourceManager) GetMusic(name string) Music
Returns the music with name
func (*ResourceManager) GetShader ¶
func (rsmgr *ResourceManager) GetShader(name string) Shader
Returns the shader with name
func (*ResourceManager) GetSound ¶
func (rsmgr *ResourceManager) GetSound(name string) Sound
Returns the sound with name
func (*ResourceManager) GetTMXMap ¶
func (rsmgr *ResourceManager) GetTMXMap(name string) *tmx.Map
Returns the tmx map with name
func (*ResourceManager) GetTexture ¶
func (rsmgr *ResourceManager) GetTexture(name string) Texture
Returns the texture with name
func (*ResourceManager) Init ¶
func (rsmgr *ResourceManager) Init()
Initialises all values of the manager
func (*ResourceManager) LoadFont ¶
func (rsmgr *ResourceManager) LoadFont(name, path string) *Font
Loads the font from path and stores it in name
func (*ResourceManager) LoadLevel ¶
func (rsmgr *ResourceManager) LoadLevel(name, path string, loadToGPU bool) *Level
Loads the level from path and stores it in name
func (*ResourceManager) LoadLevelString ¶
func (rsmgr *ResourceManager) LoadLevelString(name, contents, fileName string, loadToGPU bool) *Level
Loads the level from the file contents
func (*ResourceManager) LoadMusic ¶
func (rsmgr *ResourceManager) LoadMusic(name, path string) Music
Loads a music from path and stores it with name
func (*ResourceManager) LoadShader ¶
func (rsmgr *ResourceManager) LoadShader(name, vertex_path, fragment_path, geometry_path, tesselletion_control_path, eveluation_path, compute_path string) Shader
Loads a shader from the given paths and stores it in name
func (*ResourceManager) LoadShaderSource ¶
func (rsmgr *ResourceManager) LoadShaderSource(name, vertex, fragment, geometry, tesselletion_control, eveluation, compute string) Shader
Loads a shader from file contents
func (*ResourceManager) LoadSound ¶
func (rsmgr *ResourceManager) LoadSound(name, path string) Sound
Loads a sound from path and stores it in name
func (*ResourceManager) LoadTMXMap ¶
func (rsmgr *ResourceManager) LoadTMXMap(name, path string) *tmx.Map
Loads the tmx map from path and stores it in name
func (*ResourceManager) LoadTexture ¶
func (rsmgr *ResourceManager) LoadTexture(name, path string) Texture
Loads a texture from path and stores it in name
func (*ResourceManager) SetLevel ¶
func (rsmgr *ResourceManager) SetLevel(name string, name1 string)
Sets the level with name1 to name
func (*ResourceManager) SetShader ¶
func (rsmgr *ResourceManager) SetShader(name string, name1 string)
Sets the shader with name1 to name
func (*ResourceManager) SetTexture ¶
func (rsmgr *ResourceManager) SetTexture(name string, name1 string)
Sets the texture of name1 to name
type Scene ¶
type Scene interface {
// Init is called when you switch scenes
Init()
// Update is called every frame
Update(delta_time float32)
// Terminate is called on the current scene when the scene is switched
Terminate()
}
A scene that can be switched
type SceneManager ¶
type SceneManager struct {
// contains filtered or unexported fields
}
The manager that handles the scene switching
var SceneMgr SceneManager
The SceneManager that should be used for everything
func (*SceneManager) GetCurrentScene ¶
func (scmgr *SceneManager) GetCurrentScene() Scene
Returns the current scene
func (*SceneManager) Init ¶
func (scmgr *SceneManager) Init()
func (*SceneManager) SwitchScene ¶
func (scmgr *SceneManager) SwitchScene(scn Scene)
Switch to another scene
func (*SceneManager) Terminate ¶
func (scmgr *SceneManager) Terminate()
Calls Terminate on the current scene
type Shader ¶
type Shader interface {
// Adds a shader of shader_type with its source code to this shader
AddShader(shader_type uint8, src string) error
// Links all shaders
Link() error
// Sets all values up
Setup() error
// Cleans everything up
Terminate()
// Use this shader for the following draw calls
Use()
// Don't use this shader anymore
Unuse()
// Sets the value of a uniform Vec2
SetUniformV2(name string, value mgl32.Vec2)
// Sets the value of a uniform Vec3
SetUniformV3(name string, value mgl32.Vec3)
// Sets the value of a uniform Vec4
SetUniformV4(name string, value mgl32.Vec4)
// Sets the value of a uniform ivec2
SetUniformIV2(name string, value []int32)
// Sets the value of a uniform ivec3
SetUniformIV3(name string, value []int32)
// Sets the value of a uniform ivec4
SetUniformIV4(name string, value []int32)
// Sets the value of a uniform float
SetUniformF(name string, value float32)
// Sets the value of a uniform int
SetUniformI(name string, value int32)
// Sets the value of a uniform unsigned int
SetUniformUI(name string, value uint32)
// Sets the value of a uniform bool
SetUniformB(name string, value uint8)
// Sets the value of a uniform Mat2
SetUniformM2(name string, value mgl32.Mat2)
// Sets the value of a uniform Mat3
SetUniformM3(name string, value mgl32.Mat3)
// Sets the value of a uniform Mat4
SetUniformM4(name string, value mgl32.Mat4)
// Sets the value of a uniform material
SetUniformMaterial(mat Material)
// Sets the value of all uniforms of lights
SetUniformLights(lightCollectionIndex int)
// Returns the name of this shader
GetName() string
// Adds a vertex attribute
AddAttribute(name string, location uint32)
}
A shader controls how a mesh is rendered
func LoadGeneratedShader2D ¶
func LoadGeneratedShader3D ¶
type Shape2D ¶
type Shape2D struct {
NilRenderObject
// The name of the shape
Name string
// The transform of the shape
Transform *TransformableObject2D
// Wether the shape is visible
Visible bool
// The index of the camera to which this shape is not relative to
NotRelativeToCamera int
// The depth of this shape (0-255)
Depth uint8
// contains filtered or unexported fields
}
A 2D shape as a RenderObject
func (*Shape2D) AddPoints ¶
func (this *Shape2D) AddPoints(points []Shape2DVertex)
Add points to the shape
func (*Shape2D) AddTriangles ¶
func (this *Shape2D) AddTriangles(tris []Triangle2D)
Add triangles to the shape
func (*Shape2D) GetTransformableObject ¶
func (this *Shape2D) GetTransformableObject() TransformableObject
Returns the transformable object used for this shape
func (*Shape2D) GetType ¶
func (this *Shape2D) GetType() RenderType
Returns the render type of this shape
func (*Shape2D) NotRelativeCamera ¶
Returns the index of the camera to which this shape is not relative to
func (*Shape2D) SetDrawMode ¶
Set the draw mode (POINTS,LINES,TRIANGLES)
func (*Shape2D) SetLineWidth ¶
Set the width of the lines
type Shape2DInterface ¶
type Shape2DInterface interface {
// Initialises the values
Init()
// Add points to the shape
AddPoints(points []Shape2DVertex)
// Add lines to the shape
AddLines(lines []Line2D)
// Add triangles to the shape
AddTriangles(tris []Triangle2D)
// Returns all vertices
GetPoints() []Shape2DVertex
// Sets the draw mode
SetDrawMode(mode uint8)
// Sets the point size
SetPointSize(size float32)
// Sets the line width
SetLineWidth(width float32)
// Loads everything to the GPU
Load()
// Calls the draw method on the data
Render()
// Cleans everything up
Terminate()
}
An interface that handles all low level stuff concerning shape2d
type Shape2DVertex ¶
type Shape2DVertex [2 + 4]float32 // Position + Color
A vertex of a Shape2D
func (*Shape2DVertex) Make ¶
func (this *Shape2DVertex) Make(pos mgl32.Vec2, col color.Color)
Creates a vertex from pos and col
func (*Shape2DVertex) Vec2 ¶
func (this *Shape2DVertex) Vec2() mgl32.Vec2
Returns the position of the vertex
type Shape3D ¶
type Shape3D struct {
NilRenderObject
// The name of this shape
Name string
// The transform of this shape
Transform *TransformableObject3D
// Wether this shape is visible
Visible bool
// The index of the camera to which this shape is relative
NotRelativeToCamera int
// contains filtered or unexported fields
}
A 3D shape as a RenderObject
func (*Shape3D) AddPoint ¶
func (this *Shape3D) AddPoint(point Shape3DVertex)
Add a point to the shape
func (*Shape3D) AddPoints ¶
func (this *Shape3D) AddPoints(points []Shape3DVertex)
Add multiple points to the shape
func (*Shape3D) AddTriangle ¶
func (this *Shape3D) AddTriangle(tri Triangle3D)
Add a triangle to the shape
func (*Shape3D) AddTriangles ¶
func (this *Shape3D) AddTriangles(tris []Triangle3D)
Add multiple triangles to the shape
func (*Shape3D) GetPoints ¶
func (this *Shape3D) GetPoints() []Shape3DVertex
Returns all points of the shape
func (*Shape3D) GetTransformableObject ¶
func (this *Shape3D) GetTransformableObject() TransformableObject
Returns the transformable object of this shape
func (*Shape3D) GetType ¶
func (this *Shape3D) GetType() RenderType
Returns the render type of the shape
func (*Shape3D) NotRelativeCamera ¶
Returns the index of the camera to which this shape is not relative to
func (*Shape3D) SetDrawMode ¶
Set the draw mode (POINTS,LINES,TRIANGLES)
func (*Shape3D) SetTransformableObject ¶
func (this *Shape3D) SetTransformableObject(tobj TransformableObject)
Sets the transformable object of this shape
func (*Shape3D) SetType ¶
func (this *Shape3D) SetType(rtype RenderType)
Sets the render type of the shape
type Shape3DInterface ¶
type Shape3DInterface interface {
// Initialises everything
Init()
// Adds points to the shape
AddPoints(points []Shape3DVertex)
// Returns all points
GetPoints() []Shape3DVertex
// Set the draw mode (POINTS,LINES,TRIANGLES)
SetDrawMode(drawMode uint8)
// Sets the point size
SetPointSize(size float32)
// Sets the line width
SetLineWidth(size float32)
// Loads all data to the GPU
Load()
// Calls the draw method for the data
Render()
// Cleans everything up
Terminate()
}
An interface that handels low level stuff concerning 3D shapes
type Shape3DVertex ¶
type Shape3DVertex [3 + 4]float32 // Position + Color
The vertex of a vertex of a shape 3D
func (*Shape3DVertex) SetColor ¶
func (this *Shape3DVertex) SetColor(col color.Color)
Sets the color of the vertex
type Slider ¶
type Slider struct {
// The horizontal line of the slider
Long Sprite2D
// The small circle on the horizontal line
Circle Sprite2D
// Wether the mouse has entered the slider
Entered bool
// The current value of the slider
Value float32
// The step size of the slider
StepSize float32
// The modulate color that will be applied when the mouse enters the slider
EnterModColor color.Color
// The modulate color that will be applied when the slider is pressed
PressModColor color.Color
// Will be called when the mouse enters the slider
EnterCallback SliderCallback
// Will be called when the mouse leaves the slider
LeaveCallback SliderCallback
// Will be called when the value of the slider has changed
ValueChangedCallback SliderCallback
// contains filtered or unexported fields
}
A Slider that will be rendered to the screen
type SliderCallback ¶
type SliderCallback func(sld *Slider)
type Sound ¶
type Sound interface {
// Plays the audio chunk
// loops sets wether it should loop
Play(loop bool)
// Pauses this Sound
Pause()
// Resumes it if it has been paused
Resume()
// Stops it so that it will start from the
// beginning the next time you play it
Stop()
// Cleans up all data related to this resource
Terminate()
// Returns wether it is currently playing/ not paused
IsPlaying() bool
// Returns how far the Sound has progressed in playing
GetPlayingDuration() time.Duration
// Returns the total duration of this sound
GetDuration() time.Duration
// Sets the volume of this sound (0.0 - 1.0)
SetVolume(vol float32)
// Returns the currently set volume
GetVolume() float32
}
This interface represents short chunks of audio
type SpotLight ¶
type SpotLight struct {
// The position of the light
Position mgl32.Vec3
// The direction of the light
Direction mgl32.Vec3
// The diffuse color of the light
DiffuseColor color.Color
// The specular color of the light
SpecularColor color.Color
// The angle at which the light starts to fade away in degrees
InnerCutOff float32
// The angle at which the light is completely faded away in degrees
OuterCutOff float32
// The attenuation values of this light
Attentuation
// The shadow map of this light
ShadowMap RenderTexture
// Wether this light should cast shadows
CastsShadows uint8
// A view matrix that uses the position and direction of the light
LightSpaceMatrix mgl32.Mat4
// The near plane used for the rendering of the shadow map
NearPlane float32
// The far plane used for the rendering of the shadow map
FarPlane float32
}
A light with a position and a direction
func (*SpotLight) InitShadowmap ¶
Initialises the shadow map of this light
func (*SpotLight) RenderShadowMap ¶
func (this *SpotLight) RenderShadowMap()
Renders all objects that cast shadows onto this shadow map
func (*SpotLight) SetUniforms ¶
Sets the uniforms of s
type Sprite2D ¶
type Sprite2D struct {
NilRenderObject
// The Texture that will be drawn
Texture Texture
// Wether this object is visible
Visible bool
// The index of the camera to which this object is not relative to
NotRelativeToCamera int
// The flip of the Texture (HORIZONTAL,VERTICAL,DIAGONALLY)
Flip uint8
// The name of this object
Name string
// The shader used for rendering
Shader Shader
// The render type of this object
RenderType RenderType
// The transform used to get the transform matrix
Transform *TransformableObject2D
// The region of the texture that will be displayed
TextureRegion TextureRegion
// The depth of this object (0-255)
Depth uint8
// contains filtered or unexported fields
}
An object used to render textures or regions of textures to the screen
func (*Sprite2D) GetTransform2D ¶
func (spr *Sprite2D) GetTransform2D() *TransformableObject2D
Returns the transformable object 2d of this sprite
func (*Sprite2D) GetTransformableObject ¶
func (spr *Sprite2D) GetTransformableObject() TransformableObject
Returns the transformable object of this sprite
func (*Sprite2D) GetType ¶
func (spr *Sprite2D) GetType() RenderType
Returns the render type of this object
func (*Sprite2D) InitTexture ¶
Initialises the sprite with a texture
func (*Sprite2D) NotRelativeCamera ¶
Returns the index of the camera to which this object is not relative to
func (*Sprite2D) SetInvisible ¶
func (spr *Sprite2D) SetInvisible()
Sets this object to be invisible
func (*Sprite2D) SetTransformableObject ¶
func (spr *Sprite2D) SetTransformableObject(tobj TransformableObject)
Sets the transformable object of this sprite
func (*Sprite2D) SetType ¶
func (spr *Sprite2D) SetType(rtype RenderType)
Sets the render type of this object
type TestCameraMovement3D ¶
type TestCameraMovement3D struct {
// The speed in which the camera moves
MoveSpeed float32
// The speed in which the camera rotates
LookSpeed float32
// contains filtered or unexported fields
}
A struct used to add some camera movement to the game. Useful for testing
func (*TestCameraMovement3D) Init ¶
func (this *TestCameraMovement3D) Init(cam *Camera3D)
Initialises the object with a camera
func (*TestCameraMovement3D) Update ¶
func (this *TestCameraMovement3D) Update(delta_time float32)
type Text2D ¶
type Text2D struct {
NilRenderObject
// The transform of the object
Transform *TransformableObject2D
// Wether this object is visible
Visible bool
// The index of the camera to which this object is not relative to
NotRelativeToCamera int
// The size of the font
FontSize int
// The text that will be displayed
Text string
// The depth of the object (0-255)
Depth uint8
// The color of the text
Color color.Color
// The flip used for rendering
Flip uint8
// contains filtered or unexported fields
}
A text/string rendered to the screen
func (*Text2D) GetTransformableObject ¶
func (this *Text2D) GetTransformableObject() TransformableObject
Returns the transformable object of this object
func (*Text2D) GetType ¶
func (this *Text2D) GetType() RenderType
Returns the render type of this object
func (*Text2D) NotRelativeCamera ¶
Returns the index of the camera to which this object is not relative to
func (*Text2D) SetTransformableObject ¶
func (this *Text2D) SetTransformableObject(tobj TransformableObject)
Sets the transformable object of this object
func (*Text2D) SetType ¶
func (this *Text2D) SetType(rtype RenderType)
Sets the render type of this object
type Texture ¶
type Texture interface {
// Creates the texture from pixels and its dimensions
Load(data []byte, width, height int, shadowMap bool)
// Creates the texture from an image
LoadFromImage(img image.Image)
// Binds the texture to a binding point
Bind(unit uint32)
// Unbinds the texture (unit needs to be the same as in Bind)
Unbind(unit uint32)
// Returns the width of the texture in pixels
GetWidth() int
// Returns the height of the texture in pixels
GetHeight() int
// Returns the key color that will be ignored when rendering
GetKeyColor() color.Color
// Returns the modulate color that will be multiplied with the texture's color
GetModColor() color.Color
// Cleans everything up
Terminate()
// Sets the filtering method
SetFiltering(filtering int)
// Sets the wrapping method
SetWrapping(wrapping int)
// Sets the border color used with WRAPPING_CLAMP_TO_BORDER
SetBorderColor(col color.Color)
// Sets the border depth used for shadow maps
SetBorderDepth(depth float32)
// Sets the key color
SetKeyColor(col color.Color)
// Sets the modulate color
SetModColor(col color.Color)
// Returns the name of this texture
GetName() string
// Returns the pixels and its dimensions
GetData() ([]byte, int, int)
}
A texture or an image in memory
type TextureRegion ¶
A struct representing a part of a texture
func (*TextureRegion) FromVec4 ¶
func (this *TextureRegion) FromVec4(v mgl32.Vec4)
Gets the struct values from a Vec4
func (TextureRegion) Height ¶
func (this TextureRegion) Height() float32
Returns the height of the texture region
func (TextureRegion) Normalize ¶
func (this TextureRegion) Normalize(tex Texture) TextureRegion
Calculates the uv values of the region
func (TextureRegion) String ¶
func (this TextureRegion) String() string
Returns the values of the struct as a string
func (TextureRegion) Vec4 ¶
func (this TextureRegion) Vec4() mgl32.Vec4
Returns the whole struct as a Vec4
func (TextureRegion) Width ¶
func (this TextureRegion) Width() float32
Returns the width of the texture region
type TransformableObject ¶
type TransformableObject interface {
// Calculates the transformation matrix
CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
// Sets the current transformation matrix
SetTransformMatrix(rmgr *RenderManager)
}
An interface used for handling the transformation matrices
type TransformableObject2D ¶
type TransformableObject2D struct {
// The position in the world
Position mgl32.Vec2
// The size of the object in pixels
Size mgl32.Vec2
// The scale that will be multiplied with the size
Scale mgl32.Vec2
// The rotation
Rotation float32
// Defines where the [0,0] position is.
// Takes [0.0-1.0] normalised for size*scale
Origin mgl32.Vec2
// The anchor that will be used for the rotation
// Takes [0.0-1.0] normalised for size*scale
RotationPoint mgl32.Vec2
// contains filtered or unexported fields
}
A transform storing everything needed for the transformation matrix
func (*TransformableObject2D) CalculateTransformMatrix ¶
func (tobj *TransformableObject2D) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
func (*TransformableObject2D) GetTransformMatrix ¶
func (tobj *TransformableObject2D) GetTransformMatrix() mgl32.Mat3
Returns the Mat3 representing the transformation of this object
func (*TransformableObject2D) SetTransformMatrix ¶
func (tobj *TransformableObject2D) SetTransformMatrix(rmgr *RenderManager)
Sets the current transformation matrix in the render manager
type TransformableObject3D ¶
type TransformableObject3D struct {
// The position in the world
Position mgl32.Vec3
// The scale the multiplies all vertices
Scale mgl32.Vec3
// The rotation represented as a Quaternion
Rotation mgl32.Quat
IgnoreParentRotation bool
IgnoreParentScale bool
// contains filtered or unexported fields
}
A transform storing everything needed for the transform matrix
func DefaultTransformableObject3D ¶
func DefaultTransformableObject3D() *TransformableObject3D
Returns a transformable object with an identity matrix
func (*TransformableObject3D) CalculateTransformMatrix ¶
func (tobj *TransformableObject3D) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
Calculates the transform matrix
func (*TransformableObject3D) GetParent ¶
func (tobj *TransformableObject3D) GetParent() ParentObject3D
Returns the parent of this transform
func (*TransformableObject3D) GetPosition ¶
func (tobj *TransformableObject3D) GetPosition() mgl32.Vec3
The position based on the parent transform
func (*TransformableObject3D) GetTransform3D ¶
func (tobj *TransformableObject3D) GetTransform3D() *TransformableObject3D
Returns itself
func (*TransformableObject3D) GetTransformMatrix ¶
func (tobj *TransformableObject3D) GetTransformMatrix() mgl32.Mat4
Returns the transform matrix that represents the transformation of this object
func (*TransformableObject3D) SetChildChannel ¶
func (tobj *TransformableObject3D) SetChildChannel(channel chan bool, tobj1 *TransformableObject3D)
Used for calculating the transform matrix
func (*TransformableObject3D) SetParent ¶
func (tobj *TransformableObject3D) SetParent(parent ParentObject3D)
Sets the parent of this transform to which this is relative to
func (*TransformableObject3D) SetTransformMatrix ¶
func (tobj *TransformableObject3D) SetTransformMatrix(rmgr *RenderManager)
Sets the current transform matrix in the render manager
type TransformableObjectInstanced3D ¶
type TransformableObjectInstanced3D struct {
TransformableObject3D
// contains filtered or unexported fields
}
A transformable object used for instancing
func (*TransformableObjectInstanced3D) CalculateTransformMatrix ¶
func (tobj *TransformableObjectInstanced3D) CalculateTransformMatrix(rmgr *RenderManager, notRelativeToCamera int)
Calculates the transform matrix
func (*TransformableObjectInstanced3D) GetTransformMatrix ¶
func (tobj *TransformableObjectInstanced3D) GetTransformMatrix() mgl32.Mat4
Returns the transform matrix that represents this transformation
func (*TransformableObjectInstanced3D) SetTransformMatrixPointer ¶
func (tobj *TransformableObjectInstanced3D) SetTransformMatrixPointer(tmp *mgl32.Mat4)
Sets a pointer to a matrix so that it can be used for instancing
type Triangle2D ¶
type Triangle2D [3]Shape2DVertex
The vertices of a 3D triangle
func (*Triangle2D) ToLines ¶
func (this *Triangle2D) ToLines() (lines []Line2D)
Converts the triangle to lines going around the triangle
type Tween ¶
type Tween interface {
// Starts the tween on a given object (Sprite2D, Entity3D, etc.)
Start(parent interface{})
// Updates the tween and returns wether the tween has finished
Update(delta_time float32) bool
// Returns the type of this tween
GetType() uint8
// Is called when the tween has finished
End()
// Is called when the whole TweenSet is reset
Reset()
// Creates a copy of this tween
Copy() Tween
}
Essentially an animation
type TweenBlink ¶
type TweenBlink struct {
// The count of blinks
Amount int
// The time on blink needs in seconds
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that lets its parent blink for given amount of times
func (*TweenBlink) Copy ¶
func (this *TweenBlink) Copy() Tween
func (*TweenBlink) End ¶
func (this *TweenBlink) End()
func (*TweenBlink) GetType ¶
func (this *TweenBlink) GetType() uint8
func (*TweenBlink) Reset ¶
func (this *TweenBlink) Reset()
func (*TweenBlink) Start ¶
func (this *TweenBlink) Start(parent interface{})
func (*TweenBlink) Update ¶
func (this *TweenBlink) Update(delta_time float32) bool
type TweenPosition2D ¶
type TweenPosition2D struct {
// The position to which the parent should move
Destination mgl32.Vec2
// The time in which it should do this in seconds
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that moves its parent to a certain position
func (*TweenPosition2D) Copy ¶
func (this *TweenPosition2D) Copy() Tween
func (*TweenPosition2D) End ¶
func (this *TweenPosition2D) End()
func (*TweenPosition2D) GetType ¶
func (this *TweenPosition2D) GetType() uint8
func (*TweenPosition2D) Reset ¶
func (this *TweenPosition2D) Reset()
func (*TweenPosition2D) Start ¶
func (this *TweenPosition2D) Start(parent interface{})
func (*TweenPosition2D) Update ¶
func (this *TweenPosition2D) Update(delta_time float32) bool
type TweenPosition3D ¶
type TweenPosition3D struct {
// The position the parent should reach
Destination mgl32.Vec3
// The time it should need for the movement
Time float32
// The type of the tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that moves a 3D object to a certain position
func (*TweenPosition3D) Copy ¶
func (this *TweenPosition3D) Copy() Tween
func (*TweenPosition3D) End ¶
func (this *TweenPosition3D) End()
func (*TweenPosition3D) GetType ¶
func (this *TweenPosition3D) GetType() uint8
func (*TweenPosition3D) Reset ¶
func (this *TweenPosition3D) Reset()
func (*TweenPosition3D) Start ¶
func (this *TweenPosition3D) Start(parent interface{})
func (*TweenPosition3D) Update ¶
func (this *TweenPosition3D) Update(delta_time float32) bool
type TweenRegion2D ¶
type TweenRegion2D struct {
// The texture region the parent should have
Destination TextureRegion
// The time it should have this region
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that changes the texture region of a Sprite2D like a sprite animation
func (*TweenRegion2D) Copy ¶
func (this *TweenRegion2D) Copy() Tween
func (*TweenRegion2D) End ¶
func (this *TweenRegion2D) End()
func (*TweenRegion2D) GetType ¶
func (this *TweenRegion2D) GetType() uint8
func (*TweenRegion2D) Reset ¶
func (this *TweenRegion2D) Reset()
func (*TweenRegion2D) Start ¶
func (this *TweenRegion2D) Start(parent interface{})
func (*TweenRegion2D) Update ¶
func (this *TweenRegion2D) Update(delta_time float32) bool
type TweenRotation2D ¶
type TweenRotation2D struct {
// The rotation to which it should rotate
Destination float32
// The time in which it should do this
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that rotates its parent to a certain rotation
func (*TweenRotation2D) Copy ¶
func (this *TweenRotation2D) Copy() Tween
func (*TweenRotation2D) End ¶
func (this *TweenRotation2D) End()
func (*TweenRotation2D) GetType ¶
func (this *TweenRotation2D) GetType() uint8
func (*TweenRotation2D) Reset ¶
func (this *TweenRotation2D) Reset()
func (*TweenRotation2D) Start ¶
func (this *TweenRotation2D) Start(parent interface{})
func (*TweenRotation2D) Update ¶
func (this *TweenRotation2D) Update(delta_time float32) bool
type TweenRotation3D ¶
type TweenRotation3D struct {
// The rotation that should be reached
Destination mgl32.Quat
// The time needed for the rotation
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that rotates a 3D object
func (*TweenRotation3D) Copy ¶
func (this *TweenRotation3D) Copy() Tween
func (*TweenRotation3D) End ¶
func (this *TweenRotation3D) End()
func (*TweenRotation3D) GetType ¶
func (this *TweenRotation3D) GetType() uint8
func (*TweenRotation3D) Reset ¶
func (this *TweenRotation3D) Reset()
func (*TweenRotation3D) Start ¶
func (this *TweenRotation3D) Start(parent interface{})
func (*TweenRotation3D) Update ¶
func (this *TweenRotation3D) Update(delta_time float32) bool
type TweenScale2D ¶
type TweenScale2D struct {
// The scale the parent should reach
Destination mgl32.Vec2
// The time needed for the tween in seconds
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that scales its parent to a given value
func (*TweenScale2D) Copy ¶
func (this *TweenScale2D) Copy() Tween
func (*TweenScale2D) End ¶
func (this *TweenScale2D) End()
func (*TweenScale2D) GetType ¶
func (this *TweenScale2D) GetType() uint8
func (*TweenScale2D) Reset ¶
func (this *TweenScale2D) Reset()
func (*TweenScale2D) Start ¶
func (this *TweenScale2D) Start(parent interface{})
func (*TweenScale2D) Update ¶
func (this *TweenScale2D) Update(delta_time float32) bool
type TweenScale3D ¶
type TweenScale3D struct {
// The scale that should be reached
Destination mgl32.Vec3
// The time needed for the transformation
Time float32
// The type of the tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that scales a 3D object to a certain value
func (*TweenScale3D) Copy ¶
func (this *TweenScale3D) Copy() Tween
func (*TweenScale3D) End ¶
func (this *TweenScale3D) End()
func (*TweenScale3D) GetType ¶
func (this *TweenScale3D) GetType() uint8
func (*TweenScale3D) Reset ¶
func (this *TweenScale3D) Reset()
func (*TweenScale3D) Start ¶
func (this *TweenScale3D) Start(parent interface{})
func (*TweenScale3D) Update ¶
func (this *TweenScale3D) Update(delta_time float32) bool
type TweenTexture2D ¶
type TweenTexture2D struct {
// The texture the parent should have
Destination Texture
// The the parent should have the Texture
Time float32
// The type of the tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that changes the texture of a Sprite2D
func (*TweenTexture2D) Copy ¶
func (this *TweenTexture2D) Copy() Tween
func (*TweenTexture2D) End ¶
func (this *TweenTexture2D) End()
func (*TweenTexture2D) GetType ¶
func (this *TweenTexture2D) GetType() uint8
func (*TweenTexture2D) Reset ¶
func (this *TweenTexture2D) Reset()
func (*TweenTexture2D) Start ¶
func (this *TweenTexture2D) Start(parent interface{})
func (*TweenTexture2D) Update ¶
func (this *TweenTexture2D) Update(delta_time float32) bool
type TweenWait ¶
type TweenWait struct {
// The amount of time it should do nothing in seconds
Time float32
// The type of this tween
TweenType uint8
// contains filtered or unexported fields
}
A tween that does nothing for a given amount of time
type TweenableObject2D ¶
type TweenableObject2D interface {
GetTransform2D() *TransformableObject2D
}
An object that can be used by tweens
type TweenableObject3D ¶
type TweenableObject3D interface {
GetTransform3D() *TransformableObject3D
}
An object that can be used by tweens
type Tweenset ¶
type Tweenset struct {
// All the tweens
Tweens []Tween
// Wether this should loop
Loop bool
// Wether this should loop backwards
LoopBackwards bool
ElapsedTime float32
// contains filtered or unexported fields
}
A struct that holds multiple tweens and so creates an animation
func SpriteAnimation2D ¶
Creates a sprite animation. texture is the Texture used by the animation. framesx tells how much frames are on the x axis. framesy tells how much frames are on the y axis. frametime tells how long one frame should last.
func SpriteAnimation2DOffset ¶
func SpriteAnimation2DOffset(texture Texture, framesx, framesy, offsetx1, offsety1, offsetx2, offsety2 int, frametime float32) Tweenset
Creates a sprite animation (same as SpriteAnimation2D) with additional offsets that define where the frames start and end on the texture
func SpriteAnimation2DRegions ¶
func SpriteAnimation2DRegions(regions []TextureRegion, frametime float32) Tweenset
Creates a sprite animation using multiple texture regions
func SpriteAnimation2DTextures ¶
Creates a sprite animation using multiple textures
func (*Tweenset) Done ¶
Returns wether this animation has finished (if this animation loops it will never return true)
func (*Tweenset) Resume ¶
func (this *Tweenset) Resume()
Resumes the animation if it has been paused
func (*Tweenset) SetParent ¶
func (this *Tweenset) SetParent(twobj interface{})
Sets which object to apply this animation to
type UpdateManager ¶
type UpdateManager struct {
// contains filtered or unexported fields
}
This manager handles the updating of all objects
var UpdateMgr UpdateManager
The UpdateManager that should be used for everything
func (*UpdateManager) AddObject ¶
func (upmgr *UpdateManager) AddObject(upobj UpdateObject)
Adds an object to the loop
func (*UpdateManager) BreakUpdateLoop ¶
func (upmgr *UpdateManager) BreakUpdateLoop()
Tells the manager to break out of the update loop
func (*UpdateManager) Init ¶
func (upmgr *UpdateManager) Init()
func (*UpdateManager) NumUpdateObjects ¶
func (upmgr *UpdateManager) NumUpdateObjects() int
Returns the number of currently attached update objects
func (*UpdateManager) RemoveObject ¶
func (upmgr *UpdateManager) RemoveObject(upobj UpdateObject)
Removes an object from the loop
func (*UpdateManager) Terminate ¶
func (upmgr *UpdateManager) Terminate()
Removes all update objects
func (*UpdateManager) Update ¶
func (upmgr *UpdateManager) Update(delta_time float32)
Gets called every frame from the framework
type UpdateObject ¶
type UpdateObject interface {
// Gets called every frame with the time elapsed from the last frame to the current in seconds
Update(delta_time float32)
}
An object that gets updated in every frame
type Viewport ¶
type Viewport struct {
// The index of the camera belonging to this viewport
CameraIndex int
// The position and dimensions of the viewport
X, Y, Width, Height int
// Wether the viewport should adjust base don the window size
StrapToWindow bool
}
A viewport that is on a certain part of the screen. Showing a certain part of the world
Source Files
¶
- aabbrenderer.go
- audiomanager.go
- camera2d.go
- camera3d.go
- cubemap.go
- drawfunctions.go
- drawutils.go
- entity3d.go
- errormanager.go
- font.go
- fpslimiter.go
- framework.go
- gui.go
- inputmanager.go
- instancedentity3d.go
- instancedmesh3d.go
- instancedmodel3d.go
- keys.go
- level.go
- light.go
- mainloop.go
- material.go
- math.go
- mesh2d.go
- mesh3d.go
- model3d.go
- preloader.go
- projection.go
- renderer.go
- rendermanager.go
- renderobject.go
- rendertexture.go
- resourceloadaudio.go
- resourceloadfont.go
- resourceloadlevel.go
- resourceloadshader.go
- resourceloadtexture.go
- resourceloadtmx.go
- resourcemanager.go
- resourceutils.go
- scenemanager.go
- seperatingaxis.go
- shader.go
- shadermodules2dopengl.go
- shadermodules3dopengl.go
- shadermodulesbackbufferopengl.go
- shadermodulesshadowmapopengl.go
- shadermodulesshape3dopengl.go
- shape2d.go
- shape2dinterface.go
- shape3d.go
- shape3dinterface.go
- sprite2D.go
- testcameramovement3d.go
- text2d.go
- texture.go
- tiledmap.go
- transformableobject2d.go
- transformableobject3d.go
- transformableobjectinstanced3d.go
- tweenableobject.go
- tweens.go
- tweenset.go
- updatemanager.go
- utils.go