Documentation ¶
Index ¶
- Constants
- func AssignMeshTextures(samplers cache.SamplerCache, msh mesh.Mesh, slots []texture.Slot) [4]uint32
- func CameraFromArgs(args render.Args) uniform.Camera
- type AmbientOcclusionDescriptors
- type AmbientOcclusionParams
- type AmbientOcclusionPass
- type BasicDescriptors
- type BasicMaterial
- type BlurDescriptors
- type BlurPass
- type Cascade
- type DeferredDescriptors
- type DeferredGeometryPass
- type DeferredLightPass
- type DeferredMatCache
- type DeferredMaterial
- func (m *DeferredMaterial) Begin(camera uniform.Camera, lights []light.T)
- func (m *DeferredMaterial) Bind(cmds command.Recorder)
- func (m *DeferredMaterial) Destroy()
- func (m *DeferredMaterial) Draw(cmds command.Recorder, msh mesh.Mesh)
- func (m *DeferredMaterial) End()
- func (m *DeferredMaterial) ID() material.ID
- type DepthMatCache
- type DepthPass
- type DrawGroup
- type DrawGroups
- type ForwardDescriptors
- type ForwardMatCache
- type ForwardMaterial
- func (m *ForwardMaterial) Begin(camera uniform.Camera, lights []light.T)
- func (m *ForwardMaterial) Bind(cmds command.Recorder)
- func (m *ForwardMaterial) Destroy()
- func (m *ForwardMaterial) Draw(cmds command.Recorder, msh mesh.Mesh)
- func (m *ForwardMaterial) End()
- func (m *ForwardMaterial) ID() material.ID
- type ForwardPass
- type GeometryBuffer
- type GuiConfig
- type GuiDescriptors
- type GuiDrawable
- type GuiPass
- type HemisphereNoise
- type LightBuffer
- type LightDescriptors
- type LightShader
- type LineMatCache
- type LinePass
- type Material
- type MaterialCache
- func NewDeferredMaterialCache(app vulkan.App, pass renderpass.T, frames int) MaterialCache
- func NewDepthMaterialCache(app vulkan.App, pass renderpass.T, frames int) MaterialCache
- func NewForwardMaterialCache(app vulkan.App, pass renderpass.T, frames int, lookup ShadowmapLookupFn) MaterialCache
- func NewLineMaterialCache(app vulkan.App, pass renderpass.T, frames int) MaterialCache
- func NewShadowMaterialMaker(app vulkan.App, pass renderpass.T, frames int) MaterialCache
- type ObjectBuffer
- type OutputDescriptors
- type OutputPass
- type Pass
- type PostProcessDescriptors
- type PostProcessPass
- type Shadow
- type ShadowCache
- type ShadowMatCache
- type Shadowmap
- type ShadowmapLookupFn
Constants ¶
View Source
const ( DiffuseAttachment attachment.Name = "diffuse" NormalsAttachment attachment.Name = "normals" PositionAttachment attachment.Name = "position" OutputAttachment attachment.Name = "output" )
View Source
const LightingSubpass renderpass.Name = "lighting"
View Source
const MainSubpass = renderpass.Name("main")
View Source
const SSAOSamples = 32
Variables ¶
This section is empty.
Functions ¶
func AssignMeshTextures ¶
Types ¶
type AmbientOcclusionDescriptors ¶
type AmbientOcclusionDescriptors struct { descriptor.Set Position *descriptor.Sampler Normal *descriptor.Sampler Noise *descriptor.Sampler Params *descriptor.Uniform[AmbientOcclusionParams] }
type AmbientOcclusionParams ¶
type AmbientOcclusionPass ¶
type AmbientOcclusionPass struct {
// contains filtered or unexported fields
}
func NewAmbientOcclusionPass ¶
func NewAmbientOcclusionPass(app vulkan.App, target vulkan.Target, gbuffer GeometryBuffer) *AmbientOcclusionPass
func (*AmbientOcclusionPass) Destroy ¶
func (p *AmbientOcclusionPass) Destroy()
func (*AmbientOcclusionPass) Name ¶
func (p *AmbientOcclusionPass) Name() string
type BasicDescriptors ¶
type BasicDescriptors struct { descriptor.Set Camera *descriptor.Uniform[uniform.Camera] Objects *descriptor.Storage[uniform.Object] }
type BasicMaterial ¶
type BasicMaterial struct { Instance *material.Instance[*BasicDescriptors] Objects *ObjectBuffer Meshes cache.MeshCache // contains filtered or unexported fields }
Basic Materials only contain camera & object descriptors They can be used for various untextured objects, such as shadow/depth passes and lines.
func (*BasicMaterial) Begin ¶
func (m *BasicMaterial) Begin(camera uniform.Camera, lights []light.T)
func (*BasicMaterial) Bind ¶
func (m *BasicMaterial) Bind(cmds command.Recorder)
func (*BasicMaterial) Destroy ¶
func (m *BasicMaterial) Destroy()
func (*BasicMaterial) End ¶
func (m *BasicMaterial) End()
func (*BasicMaterial) ID ¶
func (m *BasicMaterial) ID() material.ID
type BlurDescriptors ¶
type BlurDescriptors struct { descriptor.Set Input *descriptor.Sampler }
type BlurPass ¶
type BlurPass struct {
// contains filtered or unexported fields
}
func NewBlurPass ¶
type Cascade ¶
type Cascade struct { Texture texture.T Frame framebuffer.T Mats MaterialCache }
type DeferredDescriptors ¶
type DeferredDescriptors struct { descriptor.Set Camera *descriptor.Uniform[uniform.Camera] Objects *descriptor.Storage[uniform.Object] Textures *descriptor.SamplerArray }
type DeferredGeometryPass ¶
type DeferredGeometryPass struct {
// contains filtered or unexported fields
}
func NewDeferredGeometryPass ¶
func NewDeferredGeometryPass( app vulkan.App, depth vulkan.Target, gbuffer GeometryBuffer, ) *DeferredGeometryPass
func (*DeferredGeometryPass) Destroy ¶
func (p *DeferredGeometryPass) Destroy()
func (*DeferredGeometryPass) Name ¶
func (p *DeferredGeometryPass) Name() string
type DeferredLightPass ¶
type DeferredLightPass struct {
// contains filtered or unexported fields
}
func NewDeferredLightingPass ¶
func NewDeferredLightingPass( app vulkan.App, target vulkan.Target, gbuffer GeometryBuffer, shadows Shadow, occlusion vulkan.Target, ) *DeferredLightPass
func (*DeferredLightPass) Destroy ¶
func (p *DeferredLightPass) Destroy()
func (*DeferredLightPass) Name ¶
func (p *DeferredLightPass) Name() string
type DeferredMatCache ¶
type DeferredMatCache struct {
// contains filtered or unexported fields
}
func (*DeferredMatCache) Delete ¶
func (m *DeferredMatCache) Delete(mat []Material)
func (*DeferredMatCache) Destroy ¶
func (m *DeferredMatCache) Destroy()
func (*DeferredMatCache) Instantiate ¶
func (m *DeferredMatCache) Instantiate(def *material.Def, callback func([]Material))
func (*DeferredMatCache) Name ¶
func (m *DeferredMatCache) Name() string
type DeferredMaterial ¶
type DeferredMaterial struct { Instance *material.Instance[*DeferredDescriptors] Objects *ObjectBuffer Textures cache.SamplerCache Meshes cache.MeshCache // contains filtered or unexported fields }
func (*DeferredMaterial) Begin ¶
func (m *DeferredMaterial) Begin(camera uniform.Camera, lights []light.T)
func (*DeferredMaterial) Bind ¶
func (m *DeferredMaterial) Bind(cmds command.Recorder)
func (*DeferredMaterial) Destroy ¶
func (m *DeferredMaterial) Destroy()
func (*DeferredMaterial) Draw ¶
func (m *DeferredMaterial) Draw(cmds command.Recorder, msh mesh.Mesh)
func (*DeferredMaterial) End ¶
func (m *DeferredMaterial) End()
func (*DeferredMaterial) ID ¶
func (m *DeferredMaterial) ID() material.ID
type DepthMatCache ¶
type DepthMatCache struct {
// contains filtered or unexported fields
}
func (*DepthMatCache) Delete ¶
func (m *DepthMatCache) Delete(mat []Material)
func (*DepthMatCache) Destroy ¶
func (m *DepthMatCache) Destroy()
func (*DepthMatCache) Instantiate ¶
func (m *DepthMatCache) Instantiate(def *material.Def, callback func([]Material))
func (*DepthMatCache) Name ¶
func (m *DepthMatCache) Name() string
type DepthPass ¶
type DepthPass struct {
// contains filtered or unexported fields
}
func NewDepthPass ¶
type DrawGroups ¶
type DrawGroups []DrawGroup
func DepthSortGroups ¶
func DepthSortGroups(cache MaterialCache, frame int, cam uniform.Camera, meshes []mesh.Mesh) DrawGroups
func MaterialGroups ¶
func MaterialGroups(cache MaterialCache, frame int, meshes []mesh.Mesh) DrawGroups
Sort meshes by material
func OrderedGroups ¶
func OrderedGroups(cache MaterialCache, frame int, meshes []mesh.Mesh) DrawGroups
Sort meshes by material according to depth. Consecutive meshes in the depth order are grouped if they have the same material
type ForwardDescriptors ¶
type ForwardDescriptors struct { descriptor.Set Camera *descriptor.Uniform[uniform.Camera] Objects *descriptor.Storage[uniform.Object] Lights *descriptor.Storage[uniform.Light] Textures *descriptor.SamplerArray }
type ForwardMatCache ¶
type ForwardMatCache struct {
// contains filtered or unexported fields
}
func (*ForwardMatCache) Delete ¶
func (m *ForwardMatCache) Delete(mat []Material)
func (*ForwardMatCache) Destroy ¶
func (m *ForwardMatCache) Destroy()
func (*ForwardMatCache) Instantiate ¶
func (m *ForwardMatCache) Instantiate(def *material.Def, callback func([]Material))
func (*ForwardMatCache) Name ¶
func (m *ForwardMatCache) Name() string
type ForwardMaterial ¶
type ForwardMaterial struct { Instance *material.Instance[*ForwardDescriptors] Objects *ObjectBuffer Lights *LightBuffer Shadows *ShadowCache Textures cache.SamplerCache Meshes cache.MeshCache // contains filtered or unexported fields }
func (*ForwardMaterial) Begin ¶
func (m *ForwardMaterial) Begin(camera uniform.Camera, lights []light.T)
func (*ForwardMaterial) Bind ¶
func (m *ForwardMaterial) Bind(cmds command.Recorder)
func (*ForwardMaterial) Destroy ¶
func (m *ForwardMaterial) Destroy()
func (*ForwardMaterial) End ¶
func (m *ForwardMaterial) End()
func (*ForwardMaterial) ID ¶
func (m *ForwardMaterial) ID() material.ID
type ForwardPass ¶
type ForwardPass struct {
// contains filtered or unexported fields
}
func NewForwardPass ¶
func (*ForwardPass) Destroy ¶
func (p *ForwardPass) Destroy()
func (*ForwardPass) Name ¶
func (p *ForwardPass) Name() string
type GeometryBuffer ¶
type GeometryBuffer interface { Width() int Height() int Frames() int Diffuse() []image.T Normal() []image.T Position() []image.T Destroy() }
func NewGbuffer ¶
func NewGbuffer(device device.T, size vulkan.TargetSize) (GeometryBuffer, error)
type GuiDescriptors ¶
type GuiDescriptors struct { descriptor.Set Config *descriptor.Uniform[GuiConfig] Quads *descriptor.Storage[widget.Quad] Textures *descriptor.SamplerArray }
type GuiDrawable ¶
type HemisphereNoise ¶
func NewHemisphereNoise ¶
func NewHemisphereNoise(width, height int) *HemisphereNoise
func (*HemisphereNoise) ImageData ¶
func (n *HemisphereNoise) ImageData() *image.Data
func (*HemisphereNoise) Key ¶
func (n *HemisphereNoise) Key() string
func (*HemisphereNoise) TextureArgs ¶
func (n *HemisphereNoise) TextureArgs() texture.Args
func (*HemisphereNoise) Version ¶
func (n *HemisphereNoise) Version() int
type LightBuffer ¶
type LightBuffer struct {
// contains filtered or unexported fields
}
func NewLightBuffer ¶
func NewLightBuffer(capacity int) *LightBuffer
func (*LightBuffer) Flush ¶
func (b *LightBuffer) Flush(desc *descriptor.Storage[uniform.Light])
func (*LightBuffer) Reset ¶
func (b *LightBuffer) Reset()
func (*LightBuffer) Store ¶
func (b *LightBuffer) Store(light uniform.Light)
type LightDescriptors ¶
type LightDescriptors struct { descriptor.Set Camera *descriptor.Uniform[uniform.Camera] Lights *descriptor.Storage[uniform.Light] Diffuse *descriptor.Sampler Normal *descriptor.Sampler Position *descriptor.Sampler Occlusion *descriptor.Sampler Shadow *descriptor.SamplerArray }
type LightShader ¶
type LightShader interface { Bind(command.Buffer, int) Descriptors(int) *LightDescriptors Destroy() }
func NewLightShader ¶
func NewLightShader(app vulkan.App, pass renderpass.T, gbuffer GeometryBuffer, occlusion vulkan.Target) LightShader
type LineMatCache ¶
type LineMatCache struct {
// contains filtered or unexported fields
}
func (*LineMatCache) Delete ¶
func (m *LineMatCache) Delete(mat []Material)
func (*LineMatCache) Destroy ¶
func (m *LineMatCache) Destroy()
func (*LineMatCache) Instantiate ¶
func (m *LineMatCache) Instantiate(def *material.Def, callback func([]Material))
func (*LineMatCache) Name ¶
func (m *LineMatCache) Name() string
type LinePass ¶
type LinePass struct {
// contains filtered or unexported fields
}
func NewLinePass ¶
type Material ¶
type Material interface { ID() material.ID Destroy() // Begin is called prior to drawing, once per frame. // Its purpose is to clear object buffers and set up per-frame data such as cameras & lighting. Begin(uniform.Camera, []light.T) // BeginGroup is called just prior to recording draw calls. // Its called once for each group, and may be called multiple times each frame. // The primary use for it is to bind the material prior to drawing each group. Bind(command.Recorder) // Draw is called for each mesh in the group. // Its purpose is to set up per-draw data such as object transforms and textures // as well as issuing the draw call. Draw(command.Recorder, mesh.Mesh) // End is called after all draw groups have been processed. // It runs once per frame and is primarily responsible for flushing uniform buffers. End() }
Material implements render logic for a specific material.
type MaterialCache ¶
func NewDeferredMaterialCache ¶
func NewDeferredMaterialCache(app vulkan.App, pass renderpass.T, frames int) MaterialCache
func NewDepthMaterialCache ¶
func NewDepthMaterialCache(app vulkan.App, pass renderpass.T, frames int) MaterialCache
func NewForwardMaterialCache ¶
func NewForwardMaterialCache(app vulkan.App, pass renderpass.T, frames int, lookup ShadowmapLookupFn) MaterialCache
func NewLineMaterialCache ¶
func NewLineMaterialCache(app vulkan.App, pass renderpass.T, frames int) MaterialCache
func NewShadowMaterialMaker ¶
func NewShadowMaterialMaker(app vulkan.App, pass renderpass.T, frames int) MaterialCache
type ObjectBuffer ¶
type ObjectBuffer struct {
// contains filtered or unexported fields
}
func NewObjectBuffer ¶
func NewObjectBuffer(capacity int) *ObjectBuffer
func (*ObjectBuffer) Flush ¶
func (b *ObjectBuffer) Flush(desc *descriptor.Storage[uniform.Object])
func (*ObjectBuffer) Reset ¶
func (b *ObjectBuffer) Reset()
type OutputDescriptors ¶
type OutputDescriptors struct { descriptor.Set Output *descriptor.Sampler }
type OutputPass ¶
type OutputPass struct {
// contains filtered or unexported fields
}
func NewOutputPass ¶
func (*OutputPass) Destroy ¶
func (p *OutputPass) Destroy()
func (*OutputPass) Name ¶
func (p *OutputPass) Name() string
type PostProcessDescriptors ¶
type PostProcessDescriptors struct { descriptor.Set Input *descriptor.Sampler LUT *descriptor.Sampler }
type PostProcessPass ¶
func NewPostProcessPass ¶
func (*PostProcessPass) Destroy ¶
func (p *PostProcessPass) Destroy()
func (*PostProcessPass) Name ¶
func (p *PostProcessPass) Name() string
type ShadowCache ¶
type ShadowCache struct {
// contains filtered or unexported fields
}
func NewShadowCache ¶
func NewShadowCache(samplers cache.SamplerCache, lookup ShadowmapLookupFn) *ShadowCache
type ShadowMatCache ¶
type ShadowMatCache struct {
// contains filtered or unexported fields
}
func (*ShadowMatCache) Delete ¶
func (m *ShadowMatCache) Delete(mat []Material)
func (*ShadowMatCache) Destroy ¶
func (m *ShadowMatCache) Destroy()
func (*ShadowMatCache) Instantiate ¶
func (m *ShadowMatCache) Instantiate(def *material.Def, callback func([]Material))
func (*ShadowMatCache) Name ¶
func (m *ShadowMatCache) Name() string
Source Files ¶
- basic_material.go
- blur.go
- deferred_cache.go
- deferred_geometry.go
- deferred_lighting.go
- deferred_material.go
- depth_cache.go
- depth_pass.go
- depth_sorter.go
- draw_group.go
- forward.go
- forward_cache.go
- forward_material.go
- gbuffer.go
- gui_pass.go
- light_buffer.go
- light_shader.go
- line_cache.go
- lines.go
- material.go
- object_buffer.go
- output.go
- pass.go
- postprocess.go
- shadow.go
- shadow_cache.go
- shadow_mat_cache.go
- ssao.go
Click to show internal directories.
Click to hide internal directories.