Documentation ¶
Index ¶
- Constants
- func AlignedOrientation(width float32, vector mgl32.Vec3) mgl32.Mat4
- type Camera
- func (c *Camera) CameraContainsSphere(windowSize mgl32.Vec2, radius float32, point mgl32.Vec3) bool
- func (c *Camera) FrustrumContainsSphere(windowSize, start, end mgl32.Vec2, radius float32, point mgl32.Vec3) bool
- func (c *Camera) GetDirection() mgl32.Vec3
- func (c *Camera) GetMouseVector(windowSize, mouse mgl32.Vec2) mgl32.Vec3
- func (c *Camera) GetWindowVector(windowSize mgl32.Vec2, point mgl32.Vec3) mgl32.Vec3
- func (c *Camera) SetOrientation(orientation mgl32.Quat)
- func (c *Camera) SetScale(scale mgl32.Vec3)
- func (c *Camera) SetTranslation(translation mgl32.Vec3)
- type CubeMap
- type Entity
- type FPSMeter
- type Geometry
- func CreateBeam(width float32, vector mgl32.Vec3) *Geometry
- func CreateBox(width, height float32) *Geometry
- func CreateBoxWithOffset(width, height, offsetX, offsetY float32) *Geometry
- func CreateCube() *Geometry
- func CreateGeometry(indicies []uint32, verticies []float32) *Geometry
- func CreateSkyBox() *Geometry
- func (geometry *Geometry) BoundingRadius() float32
- func (geometry *Geometry) Center() mgl32.Vec3
- func (geometry *Geometry) ClearBuffers()
- func (geometry *Geometry) Copy() *Geometry
- func (geometry *Geometry) Destroy(renderer Renderer)
- func (geometry *Geometry) Draw(renderer Renderer, transform mgl32.Mat4)
- func (geometry *Geometry) MaximalPointFromGeometry() mgl32.Vec3
- func (geometry *Geometry) Optimize(destination *Geometry, transform mgl32.Mat4)
- func (geometry *Geometry) OrthoOrder() int
- func (geometry *Geometry) RayIntersect(start, direction mgl32.Vec3) (point mgl32.Vec3, ok bool)
- func (geometry *Geometry) SetColor(color color.Color)
- func (geometry *Geometry) SetParent(parent *Node)
- func (geometry *Geometry) SetUVs(uvs ...float32)
- func (geometry *Geometry) Transform(transform mgl32.Mat4)
- type Light
- type LightType
- type Material
- type Node
- func (node *Node) Add(spatial Spatial)
- func (node *Node) BoundingRadius() float32
- func (node *Node) Center() mgl32.Vec3
- func (node *Node) Destroy(renderer Renderer)
- func (node *Node) Draw(renderer Renderer, transform mgl32.Mat4)
- func (node *Node) DrawChild(renderer Renderer, transform mgl32.Mat4, child Spatial)
- func (node *Node) Optimize(geometry *Geometry, transform mgl32.Mat4)
- func (node *Node) OptimizeNode() *Geometry
- func (node *Node) OrthoOrder() int
- func (node *Node) RayIntersect(start, direction mgl32.Vec3) (point mgl32.Vec3, ok bool)
- func (node *Node) RelativePosition(n *Node) (mgl32.Vec3, error)
- func (node *Node) Remove(spatial Spatial, destroy bool)
- func (node *Node) RemoveAll(destroy bool)
- func (node *Node) SetFrustrumCullingRecursive(enable bool)
- func (node *Node) SetOrientation(orientation mgl32.Quat)
- func (node *Node) SetParent(parent *Node)
- func (node *Node) SetRotation(angle float32, axis mgl32.Vec3)
- func (node *Node) SetScale(scale mgl32.Vec3)
- func (node *Node) SetTranslation(translation mgl32.Vec3)
- type Renderer
- type RendererParams
- type SceneGraph
- func (sceneGraph *SceneGraph) Add(spatial Spatial)
- func (sceneGraph *SceneGraph) AddTransparent(spatial Spatial)
- func (sceneGraph *SceneGraph) Remove(spatial Spatial, destroy bool)
- func (sceneGraph *SceneGraph) RemoveTransparent(spatial Spatial, destroy bool)
- func (sceneGraph *SceneGraph) RenderScene(renderer Renderer, cameraLocation mgl32.Vec3)
- type Shader
- type Spatial
- type Texture
- type Transparency
Constants ¶
const VertexStride = 12
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Camera ¶
The camera Entity
func CreateCamera ¶
func CreateCamera() *Camera
func (*Camera) CameraContainsSphere ¶
CameraContainsSphere - determines if a sphere in contained in the frustrum given by the camera. sphere is given by point and radius
func (*Camera) FrustrumContainsSphere ¶
func (c *Camera) FrustrumContainsSphere(windowSize, start, end mgl32.Vec2, radius float32, point mgl32.Vec3) bool
FrustrumContainsSphere - determines if a sphere in contained in the frustrum given by start/end vectors on the screen. sphere is given by point and radius
func (*Camera) GetDirection ¶
func (*Camera) GetMouseVector ¶
GetMouseVector - Returns a normal vector given by the mouse position
func (*Camera) GetWindowVector ¶
GetWindowVector - Returns the screen position of the given world vector
func (*Camera) SetOrientation ¶
func (*Camera) SetTranslation ¶
type CubeMap ¶
type Entity ¶
type Entity interface { SetScale(scale mgl32.Vec3) SetTranslation(translation mgl32.Vec3) SetOrientation(orientation mgl32.Quat) }
An Entity is something that can be scaled, positioned and rotated (orientation)
type Geometry ¶
type Geometry struct {
VboId, IboId uint32
Loaded bool
VboDirty bool
Indicies []uint32
Verticies []float32
// contains filtered or unexported fields
}
Geometry
func CreateBeam ¶
CreateBeam - creates a square prism oriented along the vector
func CreateBoxWithOffset ¶
func CreateCube ¶
func CreateCube() *Geometry
func CreateGeometry ¶
vericies format : x,y,z, nx,ny,nz, u,v, r,g,b,a indicies format : f1,f2,f3 (triangles)
func CreateSkyBox ¶
func CreateSkyBox() *Geometry
func (*Geometry) BoundingRadius ¶
func (*Geometry) ClearBuffers ¶
func (geometry *Geometry) ClearBuffers()
func (*Geometry) MaximalPointFromGeometry ¶
Gets the furthest point from the origin in this geometry
func (*Geometry) OrthoOrder ¶
func (*Geometry) RayIntersect ¶
type Node ¶
type Node struct { Transform mgl32.Mat4 Scale mgl32.Vec3 Translation mgl32.Vec3 Orientation mgl32.Quat FrustrumCulling bool OrthoOrderValue int Shader *Shader Material *Material CubeMap *CubeMap RendererParams *RendererParams // contains filtered or unexported fields }
Node
func (*Node) BoundingRadius ¶
func (*Node) OptimizeNode ¶
func (*Node) OrthoOrder ¶
func (*Node) RayIntersect ¶
func (*Node) RelativePosition ¶
RelativePosition - find the position of n relative to node (n must be a child of node)
func (*Node) SetFrustrumCullingRecursive ¶
func (*Node) SetOrientation ¶
func (*Node) SetTranslation ¶
type Renderer ¶
type Renderer interface { SetInit(callback func()) SetUpdate(callback func()) SetRender(callback func()) SetCamera(camera *Camera) Camera() *Camera Start() BackGroundColor(r, g, b, a float32) WindowDimensions() mgl32.Vec2 LockCursor(lock bool) UseRendererParams(params RendererParams) DrawGeometry(geometry *Geometry, transform mgl32.Mat4) DestroyGeometry(geometry *Geometry) UseMaterial(material *Material) DestroyMaterial(material *Material) UseCubeMap(cubeMap *CubeMap) DestroyCubeMap(cubeMap *CubeMap) UseShader(shader *Shader) CreatePostEffect(shader *Shader) DestroyPostEffects(shader *Shader) AddLight(light *Light) RemoveLight(light *Light) }
type RendererParams ¶
type RendererParams struct { CullBackface bool DepthTest bool DepthMask bool Unlit bool Transparency }
func DefaultRendererParams ¶
func DefaultRendererParams() RendererParams
func NewRendererParams ¶
func NewRendererParams() *RendererParams
type SceneGraph ¶
type SceneGraph struct {
// contains filtered or unexported fields
}
func (*SceneGraph) Add ¶
func (sceneGraph *SceneGraph) Add(spatial Spatial)
func (*SceneGraph) AddTransparent ¶
func (sceneGraph *SceneGraph) AddTransparent(spatial Spatial)
func (*SceneGraph) Remove ¶
func (sceneGraph *SceneGraph) Remove(spatial Spatial, destroy bool)
func (*SceneGraph) RemoveTransparent ¶
func (sceneGraph *SceneGraph) RemoveTransparent(spatial Spatial, destroy bool)
func (*SceneGraph) RenderScene ¶
func (sceneGraph *SceneGraph) RenderScene(renderer Renderer, cameraLocation mgl32.Vec3)
type Shader ¶
type Shader struct { Program uint32 Loaded bool Uniforms map[string]interface{} FragDataLocations []string InputBuffers int TextureUnits map[string]int32 FragSrc, VertSrc, GeoSrc string // contains filtered or unexported fields }
func (*Shader) AddTexture ¶
AddTexture - allocates a texture unit to the shader
type Spatial ¶
type Spatial interface { Draw(renderer Renderer, transform mgl32.Mat4) Optimize(geometry *Geometry, transform mgl32.Mat4) Destroy(renderer Renderer) Center() mgl32.Vec3 BoundingRadius() float32 OrthoOrder() int SetParent(parent *Node) }
A Spatial is something that can be Added to scenegraph nodes