Documentation ¶
Index ¶
- Variables
- func GetEyePosition(f vmodel.Frame) (pos mgl32.Vec3, ok bool)
- func GetUniformLayout(ctx vk.APIContext, dev *vk.Device) *vk.DescriptorLayout
- func Mat4ToBytes(src []mgl32.Mat4) []byte
- type AnimatePhase
- type AnimatedNodeControl
- type AsSimpleFrame
- type BasicDrawPhase
- type BoudingBox
- type Camera
- type DirectionalLight
- type DrawPhase
- type ImageFrame
- type Layer
- type Light
- type LightPhase
- type MeshNodeControl
- type MultiControl
- type Node
- type NodeControl
- type NullFrame
- type PerspectiveCamera
- type Phase
- type PointLight
- type PredrawPhase
- type ProcessInfo
- type Renderer
- type RotateAnimate
- type Scene
- type ShadowPhase
- type SimpleFrame
- func (s *SimpleFrame) BindFrame() *vk.DescriptorSet
- func (s *SimpleFrame) CopyTo(sl *vk.Slice)
- func (s *SimpleFrame) GetCache() *vk.RenderCache
- func (s *SimpleFrame) GetRenderer() vmodel.Renderer
- func (s *SimpleFrame) GetSimpleFrame() *SimpleFrame
- func (s *SimpleFrame) ViewProjection() (projection, view mgl32.Mat4)
- func (s *SimpleFrame) WriteFrame() *vk.DescriptorSet
- type SimpleShaderFrame
- type SpotLight
- type TransformControl
- type UniformCache
Constants ¶
This section is empty.
Variables ¶
var FrameMaxDynamicSamplers = uint32(0)
Maximum dynamics samplers (=sampled images) per frame instance. You must add dynamics descriptors support to application before using dynamics samplers in frame. Dynamic descriptor sets and pool are allocated with BINDING_UPDATE_AFTER_BIND that should allow relatively large values on all Windows / Linux cards that support dynamic descriptors
var VulkanProj = mgl32.Mat4{1.5, 0, 0, 0, 0, -1.5, 0, 0, 0, 0, 0.5, 0.5, 0, 0, 0, 1}
var VulkanProj = mgl32.Mat4{1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0.5, 0.5, 0, 0, 0, 1}
Functions ¶
func GetEyePosition ¶ added in v0.20.1
func GetUniformLayout ¶
func GetUniformLayout(ctx vk.APIContext, dev *vk.Device) *vk.DescriptorLayout
func Mat4ToBytes ¶
Mat4ToBytes will convert array of matrixes to byte array using slice manipulation. Returned byte slice is not an copy instead if will point to same location that original slice! This helper method can be used to copy matrixies to Vulkan buffers
Types ¶
type AnimatePhase ¶
type AnimatePhase struct {
Cache *vk.RenderCache
}
func (*AnimatePhase) Begin ¶
func (a *AnimatePhase) Begin() (atEnd func())
type AnimatedNodeControl ¶
type AnimatedNodeControl struct { Mat vmodel.Shader Mesh vmodel.Mesh StartTime float64 Skin *vmodel.Skin Animation vmodel.Animation Joints []vmodel.Joint // contains filtered or unexported fields }
func (*AnimatedNodeControl) Process ¶
func (a *AnimatedNodeControl) Process(pi *ProcessInfo)
func (*AnimatedNodeControl) SetAnimationIndex ¶
func (a *AnimatedNodeControl) SetAnimationIndex(fromTime float64, animIndex int)
SetAnimationIndex pick new animation from Skin
type AsSimpleFrame ¶ added in v0.20.1
type AsSimpleFrame interface {
GetSimpleFrame() *SimpleFrame
}
type BasicDrawPhase ¶
type BasicDrawPhase struct { vmodel.DrawContext Cmd *vk.Command Layer Layer // contains filtered or unexported fields }
func (*BasicDrawPhase) Begin ¶
func (d *BasicDrawPhase) Begin() (atEnd func())
func (*BasicDrawPhase) GetDC ¶
func (d *BasicDrawPhase) GetDC(layer Layer) *vmodel.DrawContext
type BoudingBox ¶
type BoudingBox struct {
// contains filtered or unexported fields
}
func (*BoudingBox) Add ¶
func (b *BoudingBox) Add(aabb vmodel.AABB)
func (*BoudingBox) Begin ¶
func (b *BoudingBox) Begin() (atEnd func())
type DirectionalLight ¶
func (*DirectionalLight) Process ¶
func (d *DirectionalLight) Process(pi *ProcessInfo)
type DrawPhase ¶
type DrawPhase interface { Phase GetDC(layer Layer) *vmodel.DrawContext }
func NewDrawPhase ¶
type ImageFrame ¶ added in v0.20.1
type ImageFrame interface { // Add image bound with frame descriptor set. If imageIndex < 0, there where no more slots left AddFrameImage(view *vk.ImageView, sampler *vk.Sampler) (imageIndex vmodel.ImageIndex) }
ImageFrame is frame that supports binding images to Frames descriptor set
type Light ¶
type Light struct { Intensity mgl32.Vec4 Position mgl32.Vec4 // w = 0 for directional light, 1 = point light, 2 = spot light Direction mgl32.Vec4 // depending on light type Attenuation mgl32.Vec4 // 0, 1st and 2nd order, w is shadowmap index ShadowPlane mgl32.Vec4 // Shadow plane (quoternion) // InnerAngle for spotlight InnerAngle float32 // OuterAngle for spotlight OuterAngle float32 // Shadow mapping method. 0 - No map, 1 - Point line cube shadow map ShadowMapMethod float32 // Index for shadow map ShadowMapIndex float32 }
type LightPhase ¶ added in v0.20.1
type LightPhase interface { // Add light to scene. Special is raw reference to light allowing customization in frame / renderer AddLight(standard Light, special interface{}) }
type MeshNodeControl ¶
func (*MeshNodeControl) Process ¶
func (m *MeshNodeControl) Process(pi *ProcessInfo)
type MultiControl ¶
type MultiControl struct {
Controls []NodeControl
}
func NewMultiControl ¶
func NewMultiControl(ctrls ...NodeControl) *MultiControl
func (*MultiControl) Process ¶
func (m *MultiControl) Process(pi *ProcessInfo)
type Node ¶
type Node struct { Ctrl NodeControl Children []*Node }
func NewNode ¶
func NewNode(ctrl NodeControl, children ...*Node) *Node
type NodeControl ¶
type NodeControl interface {
Process(pi *ProcessInfo)
}
type NullFrame ¶ added in v0.20.1
type NullFrame struct { }
func (NullFrame) BindFrame ¶ added in v0.20.1
func (n NullFrame) BindFrame() *vk.DescriptorSet
func (NullFrame) GetCache ¶ added in v0.20.1
func (n NullFrame) GetCache() *vk.RenderCache
func (NullFrame) GetRenderer ¶ added in v0.20.1
func (NullFrame) ViewProjection ¶ added in v0.20.1
type PerspectiveCamera ¶
type PerspectiveCamera struct { Near float32 Far float32 FoV float32 // Position of camera Position mgl32.Vec3 // Target vector Target mgl32.Vec3 // Up vector Up mgl32.Vec3 }
func NewPerspectiveCamera ¶
func NewPerspectiveCamera(far float32) *PerspectiveCamera
func (*PerspectiveCamera) CameraProjection ¶ added in v0.20.1
func (pc *PerspectiveCamera) CameraProjection(size image.Point) (projection, view mgl32.Mat4)
func (*PerspectiveCamera) GetViewMatrix ¶
func (pc *PerspectiveCamera) GetViewMatrix() mgl32.Mat4
type PointLight ¶
type PointLight struct { // Light intensity (and color) Intensity mgl32.Vec3 // Attenuation of light using formula a[0] + a[1]*d + a[2]*d^2 where d is distance from light. // Physically realisting point lights have only a[2] Attenuation mgl32.Vec3 // Maximum distance where light should be visible MaxDistance float32 }
func (*PointLight) Process ¶
func (p *PointLight) Process(pi *ProcessInfo)
type PredrawPhase ¶
type PredrawPhase struct { Scene *Scene Cmd *vk.Command Needeed []vk.SubmitInfo Pending []func() }
func (*PredrawPhase) Begin ¶
func (p *PredrawPhase) Begin() (atEnd func())
type ProcessInfo ¶
type ProcessInfo struct { Phase Phase Time float64 Visible bool World mgl32.Mat4 Frame vmodel.Frame // contains filtered or unexported fields }
func (*ProcessInfo) Get ¶
func (pi *ProcessInfo) Get(key vk.Key) (extra interface{})
Get extra info from processing info. Value is nil if key is not available
func (*ProcessInfo) Set ¶
func (pi *ProcessInfo) Set(key vk.Key, extra interface{})
Set extra value to processing info. Value is only valid while processing continue on this node or some of it's child nodes You can also override value from previous phases. Override remains while processing any child node of this node
type Renderer ¶
type Renderer interface { vk.Disposable Setup(ctx vk.APIContext, dev *vk.Device, mainImage vk.ImageDescription, images int) Render(camera Camera, sc *Scene, rc *vk.RenderCache, mainImage *vk.Image, imageIndex int, infos []vk.SubmitInfo) }
type RotateAnimate ¶
func (*RotateAnimate) Process ¶
func (r *RotateAnimate) Process(pi *ProcessInfo)
type Scene ¶
Scene in container whole rendered "view". Scene will consist hierarchical set of nodes starting from Root node See Update and Process on how to safely changes nodes of scene
func (*Scene) AddNode ¶
func (sc *Scene) AddNode(parent *Node, ctrl NodeControl, children ...*Node) *Node
Add new child node to parent. This method should be called from scene.Update if there is any change that someone is already rendering scene
func (*Scene) Locked ¶
Check if scene is in readonly state. You should use Update method instead of relying on this to property update live scene
func (*Scene) Process ¶
Process will change scene to read only state and process through all phases. Some phases like shadow map rendering might again recursively call Process to render shadow map. Process function keep consistent state of scene until all process invocations have exited
func (*Scene) Update ¶
func (sc *Scene) Update(action func())
Update will allow safe update to live scenes. When render loop is rendering scene or sum subpart of if like shadow maps scene will remain in readonly state so that each phase will see consistent view of scene. Update will schedule changes to next possible moment when scene is not used in read only phase
type ShadowPhase ¶
type SimpleFrame ¶ added in v0.20.1
type SimpleFrame struct { Cache *vk.RenderCache SSF SimpleShaderFrame Renderer vmodel.Renderer // contains filtered or unexported fields }
func GetSimpleFrame ¶ added in v0.20.1
func GetSimpleFrame(f vmodel.Frame) *SimpleFrame
func (*SimpleFrame) BindFrame ¶ added in v0.20.1
func (s *SimpleFrame) BindFrame() *vk.DescriptorSet
func (*SimpleFrame) CopyTo ¶ added in v0.20.1
func (s *SimpleFrame) CopyTo(sl *vk.Slice)
func (*SimpleFrame) GetCache ¶ added in v0.20.1
func (s *SimpleFrame) GetCache() *vk.RenderCache
func (*SimpleFrame) GetRenderer ¶ added in v0.20.1
func (s *SimpleFrame) GetRenderer() vmodel.Renderer
func (*SimpleFrame) GetSimpleFrame ¶ added in v0.20.1
func (s *SimpleFrame) GetSimpleFrame() *SimpleFrame
func (*SimpleFrame) ViewProjection ¶ added in v0.20.1
func (s *SimpleFrame) ViewProjection() (projection, view mgl32.Mat4)
func (*SimpleFrame) WriteFrame ¶ added in v0.20.1
func (s *SimpleFrame) WriteFrame() *vk.DescriptorSet
type SimpleShaderFrame ¶ added in v0.20.1
type SpotLight ¶ added in v0.20.1
type SpotLight struct { Intensity mgl32.Vec3 Direction mgl32.Vec3 Attenuation mgl32.Vec3 // Outer angle in degrees OuterAngle float32 // Optional inner angle in degreen. Same as outerangle if not set InnerAngle float32 MaxDistance float32 }
func (*SpotLight) AsStdLight ¶ added in v0.20.1
func (*SpotLight) Process ¶ added in v0.20.1
func (p *SpotLight) Process(pi *ProcessInfo)
type TransformControl ¶
func (*TransformControl) Process ¶
func (t *TransformControl) Process(pi *ProcessInfo)
type UniformCache ¶
type UniformCache struct {
// contains filtered or unexported fields
}
func GetSmallUniformCache ¶ added in v0.20.1
func GetSmallUniformCache(cache *vk.RenderCache) *UniformCache
GetSmallUniformCache retrieves standard uniform cache with size of 4096 bytes per entry. Use small uniform if 4k if more that you need for uniform
func GetUniformCache ¶
func GetUniformCache(cache *vk.RenderCache) *UniformCache
GetUniformCache retrieves standard uniform cache with size of 63356 bytes per entry 65536 is maximum limit of most NVidias GPU:s.
func NewUniformCache ¶ added in v0.20.1
func NewUniformCache(cache *vk.RenderCache, size uint32, minEntries int) *UniformCache
NewUniformCache allocates cache of uniform descriptors. If cached entries runs out, UniformCache will automatically extends it's size size is maximum size of one uniform buffer and minEntries is initial number of uniforms
func (*UniformCache) Alloc ¶
func (ddc *UniformCache) Alloc(ctx vk.APIContext) (ds *vk.DescriptorSet, sl *vk.Slice)
func (*UniformCache) Bind ¶
func (ddc *UniformCache) Bind(ctx vk.APIContext, dl *vk.DrawItem, set int, content []byte) *vk.DrawItem
func (*UniformCache) Dispose ¶
func (uc *UniformCache) Dispose()
func (*UniformCache) Size ¶ added in v0.20.1
func (uc *UniformCache) Size() uint32