Documentation ¶
Overview ¶
Package gorgeutil provides certain things like premade lights, camera entity structs
Index ¶
- Constants
- func AddUI(a Contexter) *gorgeui.UI
- func KeyDirection(g *gorge.Context, boost, top, right, bottom, left input.Key) func(gorge.EventUpdate) gm.Vec2
- func KeyDirectionV(g *gorge.Context) func(gorge.EventUpdate) gm.Vec2
- func NewUI() *gorgeui.UI
- func Wrapper(fns ...func(*Context)) gorge.InitFunc
- type Basic
- type Camera
- func AddCamera(a Contexter, fov, near, far float32) *Camera
- func AddOrthoCamera(a Contexter, size, near, far float32) *Camera
- func AddPerspectiveCamera(a Contexter, fov, near, far float32) *Camera
- func AddUICamera(a entityAdder) *Camera
- func NewCamera() *Camera
- func NewOrthoCamera(size, near, far float32) *Camera
- func NewPerspectiveCamera(fov, near, far float32) *Camera
- func NewUICamera() *Camera
- type CameraRig
- type Context
- func (c Context) Camera() *Camera
- func (c Context) Cube() *Entity
- func (c Context) DirectionalLight() *Light
- func (c Context) Light() *Light
- func (c Context) OrthoCamera(size, near, far float32) *Camera
- func (c Context) PerspectiveCamera(fov, near, far float32) *Camera
- func (c Context) Plane(dir primitive.PlaneDir) *Entity
- func (c Context) PointLight() *Light
- func (c Context) Renderable(mesh gorge.Mesher, mat gorge.Materialer) *Entity
- func (c Context) Sphere(sector, stack int) *Entity
- func (c Context) SpotLight() *Light
- func (c Context) TrackballCamera() *CameraRig
- func (c Context) UI(cam cameraEntity) *gorgeui.UI
- func (c Context) UICamera() *Camera
- type Contexter
- type Entity
- func AddCube(g gorge.Contexter) *Entity
- func AddPlane(a Contexter, dir primitive.PlaneDir) *Entity
- func AddSphere(a entityAdder, sector, stack int) *Entity
- func NewCube() *Entity
- func NewPlane(dir primitive.PlaneDir) *Entity
- func NewRenderable(mesh gorge.Mesher, mat gorge.Materialer) *Entity
- func NewSphere(sector, stack int) *Entity
- type Geom
- type GeomEntity
- type Gimbal
- type Light
- type MaterialType
- type MeshEntity
- type PBRMaterial
- func (m *PBRMaterial) Material() *gorge.Material
- func (m *PBRMaterial) SetBaseColor(v gm.Vec4)
- func (m *PBRMaterial) SetBaseColorMap(tex *gorge.Texture)
- func (m *PBRMaterial) SetBaseUVTransform(v gm.Mat3)
- func (m *PBRMaterial) SetHDR(b bool)
- func (m *PBRMaterial) SetIBL(b bool)
- func (m *PBRMaterial) SetMetallicFactor(v float32)
- func (m *PBRMaterial) SetMetallicMap(tex *gorge.Texture)
- func (m *PBRMaterial) SetMetallicRoughnessMap(tex *gorge.Texture)
- func (m *PBRMaterial) SetNormalMap(tex *gorge.Texture)
- func (m *PBRMaterial) SetNormalScale(v float32)
- func (m *PBRMaterial) SetOcclusionMap(tex *gorge.Texture)
- func (m *PBRMaterial) SetOcclusionStrength(v float32)
- func (m *PBRMaterial) SetRoughnessFactor(v float32)
- func (m *PBRMaterial) SetRoughnessMap(tex *gorge.Texture)
- func (m *PBRMaterial) SetType(t MaterialType)
- type ParticleEmitter
- type ParticleEntity
Constants ¶
const ( MaterialMetallicRoughness = iota MaterialUnlit )
Material types
Variables ¶
This section is empty.
Functions ¶
func KeyDirection ¶
func KeyDirection( g *gorge.Context, boost, top, right, bottom, left input.Key, ) func(gorge.EventUpdate) gm.Vec2
KeyDirection returns a vec2 based on the direction of the key - Boost - Top, Right, Bottom, Left
func KeyDirectionV ¶
Types ¶
type Basic ¶
type Basic struct { gorge.Container PointLight *Light DirLight *Light CamRig *CameraRig // contains filtered or unexported fields }
Basic default scene handler. TODO: {lpf} it should be moved to gorgeutil.
type Camera ¶
type Camera struct { Name string gorge.TransformComponent gorge.CameraComponent }
Camera basic camera entity.
func AddOrthoCamera ¶
func AddPerspectiveCamera ¶
func AddUICamera ¶
func AddUICamera(a entityAdder) *Camera
func NewCamera ¶
func NewCamera() *Camera
NewCamera returns a camera entity with transform and camera components.
func NewOrthoCamera ¶
NewOrthoCamera returns a camera defaulted to ortho projection.
func NewPerspectiveCamera ¶
NewPerspectiveCamera returns a default perspective camera.
func NewUICamera ¶
func NewUICamera() *Camera
NewUICamera returns an ortho camera with a specific CullMask 1<<17 for UI.
type CameraRig ¶
type CameraRig struct { *gorge.TransformComponent Vert *gorge.TransformComponent Camera cameraEntity // contains filtered or unexported fields }
CameraRig thing
func AddTrackballCamera ¶
func NewTrackballCamera ¶
func NewTrackballCamera(c cameraEntity) *CameraRig
NewTrackballCamera attaches events and all to make a trackball
func (*CameraRig) GetEntities ¶
GetEntities returns the underlying camera entities.
func (*CameraRig) HandleEvent ¶
HandleEvent implements the event handler interface.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context extends gorge context with default entity instantiators.
func FromContext ¶
FromContext returns a gorgeutil context
func (Context) DirectionalLight ¶
DirectionalLight creates and adds a directional light to a gorge context.
func (Context) OrthoCamera ¶
OrthoCamera creates and adds a camera with default ortho projection options to a gorge context.
func (Context) PerspectiveCamera ¶
PerspectiveCamera creates and adds a camera with default perspective options to a gorge context.
func (Context) PointLight ¶
PointLight creates and adds a light to gorge context.
func (Context) Renderable ¶
Renderable creates and adds a renderable to gorge context.
func (Context) TrackballCamera ¶
TrackballCamera returns a trackball camera controlled from pointer events.
type Entity ¶
type Entity struct { Name string gorge.TransformComponent *gorge.RenderableComponent *gorge.ColorableComponent }
Entity entity.
func NewRenderable ¶
func NewRenderable(mesh gorge.Mesher, mat gorge.Materialer) *Entity
NewRenderable returns a new renderable.
type Geom ¶
type Geom struct { *gorge.TransformComponent *gorge.Material gorge.Container // contains filtered or unexported fields }
Geom helper to draw per frame debug information.
func (*Geom) SetCullMask ¶
func (dg *Geom) SetCullMask(m gorge.CullMaskFlags)
SetCullMask sets the cull mask for the debug renderables.
type GeomEntity ¶
type GeomEntity struct { gorge.TransformComponent gorge.RenderableComponent }
GeomEntity generic renderable entity.
type Gimbal ¶
type Gimbal struct { Entities []gorge.Entity *gorge.TransformComponent }
Gimbal Compost object
func (Gimbal) GetEntities ¶
GetEntities implement the gorge entity container.
type Light ¶
type Light struct { Name string gorge.TransformComponent gorge.LightComponent }
Light is a light entity which can be used directly on gorge.
func AddDirectionalLight ¶
func AddPointLight ¶
func AddSpotLight ¶
func NewDirectionalLight ¶
func NewDirectionalLight() *Light
NewDirectionalLight returns a directional light.
type MeshEntity ¶
type MeshEntity struct { *gorge.TransformComponent *gorge.RenderableComponent *gorge.ColorableComponent }
MeshEntity thing
func (MeshEntity) String ¶
func (e MeshEntity) String() string
type PBRMaterial ¶
type PBRMaterial struct {
// contains filtered or unexported fields
}
PBRMaterial returns a material controller based on gltf default shader.
func NewPBRMaterial ¶
func NewPBRMaterial() *PBRMaterial
NewPBRMaterial returns a new PBRMaterial with MetallicRoughness type.
func NewUnlitMaterial ¶
func NewUnlitMaterial() *PBRMaterial
NewUnlitMaterial returns a pbr material with unlit defined.
func (*PBRMaterial) Material ¶
func (m *PBRMaterial) Material() *gorge.Material
Material implements gorge materialer
func (*PBRMaterial) SetBaseColor ¶
func (m *PBRMaterial) SetBaseColor(v gm.Vec4)
SetBaseColor sets the base color factor.
func (*PBRMaterial) SetBaseColorMap ¶
func (m *PBRMaterial) SetBaseColorMap(tex *gorge.Texture)
SetBaseColorMap sets the base texture.
func (*PBRMaterial) SetBaseUVTransform ¶
func (m *PBRMaterial) SetBaseUVTransform(v gm.Mat3)
SetBaseUVTransform sets the UV transform matrix.
func (*PBRMaterial) SetHDR ¶
func (m *PBRMaterial) SetHDR(b bool)
SetHDR enables hdr lighting on the shader.
func (*PBRMaterial) SetMetallicFactor ¶
func (m *PBRMaterial) SetMetallicFactor(v float32)
SetMetallicFactor sets the metallic factor.
func (*PBRMaterial) SetMetallicMap ¶
func (m *PBRMaterial) SetMetallicMap(tex *gorge.Texture)
SetMetallicMap separate metallic sampler.
func (*PBRMaterial) SetMetallicRoughnessMap ¶
func (m *PBRMaterial) SetMetallicRoughnessMap(tex *gorge.Texture)
SetMetallicRoughnessMap sets the combined texture of metallic and roughness.
func (*PBRMaterial) SetNormalMap ¶
func (m *PBRMaterial) SetNormalMap(tex *gorge.Texture)
SetNormalMap sets the normal map.
func (*PBRMaterial) SetNormalScale ¶
func (m *PBRMaterial) SetNormalScale(v float32)
SetNormalScale sets the normal scale.
func (*PBRMaterial) SetOcclusionMap ¶
func (m *PBRMaterial) SetOcclusionMap(tex *gorge.Texture)
SetOcclusionMap sets the normal map.
func (*PBRMaterial) SetOcclusionStrength ¶
func (m *PBRMaterial) SetOcclusionStrength(v float32)
SetOcclusionStrength sets the occlusion strength.
func (*PBRMaterial) SetRoughnessFactor ¶
func (m *PBRMaterial) SetRoughnessFactor(v float32)
SetRoughnessFactor sets the metallic factor.
func (*PBRMaterial) SetRoughnessMap ¶
func (m *PBRMaterial) SetRoughnessMap(tex *gorge.Texture)
SetRoughnessMap separate roughness sampler.
func (*PBRMaterial) SetType ¶
func (m *PBRMaterial) SetType(t MaterialType)
SetType sets the material mode.
type ParticleEmitter ¶
type ParticleEmitter struct { gorge.TransformComponent particle.EmitterComponent Life float32 Friction float32 Gravity gm.Vec3 Spread float32 SpeedMul float32 Rotation float32 Color *anim.Channel[gm.Vec4] Scale *anim.Channel[gm.Vec3] // contains filtered or unexported fields }
ParticleEmitter is a particle emitter and a controller.
func AddParticleEmitter ¶
func AddParticleEmitter(a entityAdder) *ParticleEmitter
func NewParticleEmitter ¶
func NewParticleEmitter() *ParticleEmitter
func (*ParticleEmitter) InitParticle ¶
func (c *ParticleEmitter) InitParticle(p *ParticleEntity)
func (*ParticleEmitter) UpdateParticle ¶
func (c *ParticleEmitter) UpdateParticle(p *ParticleEntity, dt float32)