pass

package
v0.0.0-...-124f97e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2023 License: GPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

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

func AssignMeshTextures(samplers cache.SamplerCache, msh mesh.Mesh, slots []texture.Slot) [4]uint32

func CameraFromArgs

func CameraFromArgs(args render.Args) uniform.Camera

Types

type AmbientOcclusionDescriptors

type AmbientOcclusionDescriptors struct {
	descriptor.Set
	Position *descriptor.Sampler
	Normal   *descriptor.Sampler
	Noise    *descriptor.Sampler
	Params   *descriptor.Uniform[AmbientOcclusionParams]
}

type AmbientOcclusionParams

type AmbientOcclusionParams struct {
	Projection mat4.T
	Kernel     [SSAOSamples]vec4.T
	Samples    int32
	Scale      float32
	Radius     float32
	Bias       float32
	Power      float32
}

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

func (*AmbientOcclusionPass) Record

func (p *AmbientOcclusionPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

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) Draw

func (m *BasicMaterial) Draw(cmds command.Recorder, msh mesh.Mesh)

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

func NewBlurPass(app vulkan.App, output vulkan.Target, input vulkan.Target) *BlurPass

func (*BlurPass) Destroy

func (p *BlurPass) Destroy()

func (*BlurPass) Name

func (p *BlurPass) Name() string

func (*BlurPass) Record

func (p *BlurPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

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

func (*DeferredGeometryPass) Record

func (p *DeferredGeometryPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

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

func (*DeferredLightPass) Record

func (p *DeferredLightPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

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

func NewDepthPass(
	app vulkan.App,
	depth vulkan.Target,
	gbuffer GeometryBuffer,
) *DepthPass

func (*DepthPass) Destroy

func (p *DepthPass) Destroy()

func (*DepthPass) Name

func (p *DepthPass) Name() string

func (*DepthPass) Record

func (p *DepthPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

type DrawGroup

type DrawGroup struct {
	ID       material.ID
	Material Material
	Meshes   []mesh.Mesh
}

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

func (DrawGroups) Draw

func (groups DrawGroups) Draw(cmds command.Recorder, camera uniform.Camera, lights []light.T)

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) Draw

func (m *ForwardMaterial) Draw(cmds command.Recorder, msh mesh.Mesh)

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 NewForwardPass(
	app vulkan.App,
	target vulkan.Target,
	depth vulkan.Target,
	shadows Shadow,
) *ForwardPass

func (*ForwardPass) Destroy

func (p *ForwardPass) Destroy()

func (*ForwardPass) Name

func (p *ForwardPass) Name() string

func (*ForwardPass) Record

func (p *ForwardPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

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 GuiConfig

type GuiConfig struct {
	Resolution vec2.T
	ZMax       float32
}

type GuiDescriptors

type GuiDescriptors struct {
	descriptor.Set
	Config   *descriptor.Uniform[GuiConfig]
	Quads    *descriptor.Storage[widget.Quad]
	Textures *descriptor.SamplerArray
}

type GuiDrawable

type GuiDrawable interface {
	object.Component
	DrawUI(widget.DrawArgs, *widget.QuadBuffer)
}

type GuiPass

type GuiPass struct {
	// contains filtered or unexported fields
}

func NewGuiPass

func NewGuiPass(app vulkan.App, target vulkan.Target) *GuiPass

func (*GuiPass) Destroy

func (p *GuiPass) Destroy()

func (*GuiPass) Name

func (p *GuiPass) Name() string

func (*GuiPass) Record

func (p *GuiPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

type HemisphereNoise

type HemisphereNoise struct {
	Width  int
	Height int
	// contains filtered or unexported fields
}

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

func NewLinePass(app vulkan.App, target vulkan.Target, depth vulkan.Target) *LinePass

func (*LinePass) Destroy

func (p *LinePass) Destroy()

func (*LinePass) Name

func (p *LinePass) Name() string

func (*LinePass) Record

func (p *LinePass) Record(cmds command.Recorder, args render.Args, scene object.Component)

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

type MaterialCache cache.T[*material.Def, []Material]

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()

func (*ObjectBuffer) Store

func (b *ObjectBuffer) Store(light uniform.Object) int

type OutputDescriptors

type OutputDescriptors struct {
	descriptor.Set
	Output *descriptor.Sampler
}

type OutputPass

type OutputPass struct {
	// contains filtered or unexported fields
}

func NewOutputPass

func NewOutputPass(app vulkan.App, target vulkan.Target, source vulkan.Target) *OutputPass

func (*OutputPass) Destroy

func (p *OutputPass) Destroy()

func (*OutputPass) Name

func (p *OutputPass) Name() string

func (*OutputPass) Record

func (p *OutputPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

type Pass

type Pass interface {
	Name() string
	Record(command.Recorder, render.Args, object.Component)
	Destroy()
}

type PostProcessDescriptors

type PostProcessDescriptors struct {
	descriptor.Set
	Input *descriptor.Sampler
	LUT   *descriptor.Sampler
}

type PostProcessPass

type PostProcessPass struct {
	LUT texture.Ref
	// contains filtered or unexported fields
}

func NewPostProcessPass

func NewPostProcessPass(app vulkan.App, target vulkan.Target, input vulkan.Target) *PostProcessPass

func (*PostProcessPass) Destroy

func (p *PostProcessPass) Destroy()

func (*PostProcessPass) Name

func (p *PostProcessPass) Name() string

func (*PostProcessPass) Record

func (p *PostProcessPass) Record(cmds command.Recorder, args render.Args, scene object.Component)

type Shadow

type Shadow interface {
	Pass

	Shadowmap(lit light.T, cascade int) texture.T
}

func NewShadowPass

func NewShadowPass(app vulkan.App, target vulkan.Target) Shadow

type ShadowCache

type ShadowCache struct {
	// contains filtered or unexported fields
}

func NewShadowCache

func NewShadowCache(samplers cache.SamplerCache, lookup ShadowmapLookupFn) *ShadowCache

func (*ShadowCache) Flush

func (s *ShadowCache) Flush()

Flush the underlying sampler cache

func (*ShadowCache) Lookup

func (s *ShadowCache) Lookup(lit light.T, cascade int) (int, bool)

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

type Shadowmap

type Shadowmap struct {
	Cascades []Cascade
}

type ShadowmapLookupFn

type ShadowmapLookupFn func(light.T, int) texture.T

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL