Skip to content

package rendering

import "kaiju/rendering"

Constants

FontJustifyLeft

FontJustify(iota)

FontJustifyCenter

FontJustifyRight

FontBaselineBottom

FontBaseline(iota)

FontBaselineCenter

FontBaselineTop

FontCondensedBold

FontFace("fonts/OpenSans_Condensed-Bold")

FontCondensedBoldItalic

FontFace("fonts/OpenSans_Condensed-BoldItalic")

FontCondensedExtraBold

FontFace("fonts/OpenSans_Condensed-ExtraBold")

FontCondensedExtraBoldItalic

FontFace("fonts/OpenSans_Condensed-ExtraBoldItalic")

FontCondensedItalic

FontFace("fonts/OpenSans_Condensed-Italic")

FontCondensedLight

FontFace("fonts/OpenSans_Condensed-Light")

FontCondensedLightItalic

FontFace("fonts/OpenSans_Condensed-LightItalic")

FontCondensedMedium

FontFace("fonts/OpenSans_Condensed-Medium")

FontCondensedMediumItalic

FontFace("fonts/OpenSans_Condensed-MediumItalic")

FontCondensedRegular

FontFace("fonts/OpenSans_Condensed-Regular")

FontCondensedSemiBold

FontFace("fonts/OpenSans_Condensed-SemiBold")

FontCondensedSemiBoldItalic

FontFace("fonts/OpenSans_Condensed-SemiBoldItalic")

FontSemiCondensedBold

FontFace("fonts/OpenSans_SemiCondensed-Bold")

FontSemiCondensedBoldItalic

FontFace("fonts/OpenSans_SemiCondensed-BoldItalic")

FontSemiCondensedExtraBold

FontFace("fonts/OpenSans_SemiCondensed-ExtraBold")

FontSemiCondensedExtraBoldItalic

FontFace("fonts/OpenSans_SemiCondensed-ExtraBoldItalic")

FontSemiCondensedItalic

FontFace("fonts/OpenSans_SemiCondensed-Italic")

FontSemiCondensedLight

FontFace("fonts/OpenSans_SemiCondensed-Light")

FontSemiCondensedLightItalic

FontFace("fonts/OpenSans_SemiCondensed-LightItalic")

FontSemiCondensedMedium

FontFace("fonts/OpenSans_SemiCondensed-Medium")

FontSemiCondensedMediumItalic

FontFace("fonts/OpenSans_SemiCondensed-MediumItalic")

FontSemiCondensedRegular

FontFace("fonts/OpenSans_SemiCondensed-Regular")

FontSemiCondensedSemiBold

FontFace("fonts/OpenSans_SemiCondensed-SemiBold")

FontSemiCondensedSemiBoldItalic

FontFace("fonts/OpenSans_SemiCondensed-SemiBoldItalic")

FontBold

FontFace("fonts/OpenSans-Bold")

FontBoldItalic

FontFace("fonts/OpenSans-BoldItalic")

FontExtraBold

FontFace("fonts/OpenSans-ExtraBold")

FontExtraBoldItalic

FontFace("fonts/OpenSans-ExtraBoldItalic")

FontItalic

FontFace("fonts/OpenSans-Italic")

FontLight

FontFace("fonts/OpenSans-Light")

FontLightItalic

FontFace("fonts/OpenSans-LightItalic")

FontMedium

FontFace("fonts/OpenSans-Medium")

FontMediumItalic

FontFace("fonts/OpenSans-MediumItalic")

FontRegular

FontFace("fonts/OpenSans-Regular")

FontSemiBold

FontFace("fonts/OpenSans-SemiBold")

FontSemiBoldItalic

FontFace("fonts/OpenSans-SemiBoldItalic")

DefaultFontEMSize

14.0

MaxJoints

50

MaxSkinInstances

20

QuaternionSize

[int(unsafe](../int(unsafe).[Sizeof(matrix](../int(unsafe#Sizeof(matrix)

CubeMapSides

6

BytesInPixel

4

MaxCommandBuffers

15

Functions

TextureKeys

func TextureKeys(textures []*Texture) []string

VertexFaceNormal

func VertexFaceNormal(verts [3]Vertex) matrix.Vec3

Types

Canvas

interface

type Canvas interface {
    Create(renderer Renderer) error
    Draw(renderer Renderer, drawings []ShaderDraw)
    Pass(name string) *RenderPass
    Color() *Texture
    ShaderPipeline(name string) FuncPipeline
    Destroy(renderer Renderer)
}

CombineCanvas

struct

type CombineCanvas struct {
    // Has unexported fields.
}

CombineCanvas.Color

func (r *CombineCanvas) Color() *Texture

CombineCanvas.Create

func (r *CombineCanvas) Create(renderer Renderer) error

CombineCanvas.Destroy

func (r *CombineCanvas) Destroy(renderer Renderer)

CombineCanvas.Draw

func (r *CombineCanvas) Draw(renderer Renderer, drawings []ShaderDraw)

CombineCanvas.Pass

func (r *CombineCanvas) Pass(name string) *RenderPass

CombineCanvas.ShaderPipeline

func (r *CombineCanvas) ShaderPipeline(name string) FuncPipeline

DescriptorSetLayoutStructure

struct

type DescriptorSetLayoutStructure struct {
    Types []DescriptorSetLayoutStructureType
}

DescriptorSetLayoutStructureType

struct

type DescriptorSetLayoutStructureType struct {
    Type           vk.DescriptorType
    Flags          vk.ShaderStageFlagBits
    Count, Binding uint32
}

DrawInstance

interface

type DrawInstance interface {
    Destroy()
    IsDestroyed() bool
    Activate()
    Deactivate()
    IsActive() bool
    Size() int
    SetModel(model matrix.Mat4)
    UpdateModel()
    DataPointer() unsafe.Pointer
    // Returns true if it should write the data, otherwise false
    UpdateNamedData(index, capacity int, name string) bool
    NamedDataPointer(name string) unsafe.Pointer
    NamedDataInstanceSize(name string) int
    // Has unexported methods.
}

DrawInstanceGroup

struct

type DrawInstanceGroup struct {
    Mesh *Mesh
    InstanceDriverData
    Textures  []*Texture
    Instances []DrawInstance

    // Has unexported fields.
}

NewDrawInstanceGroup

func NewDrawInstanceGroup(mesh *Mesh, dataSize int) DrawInstanceGroup

DrawInstanceGroup.AddInstance

func (d *DrawInstanceGroup) AddInstance(instance DrawInstance, renderer Renderer, shader *Shader)

DrawInstanceGroup.AlterPadding

func (d *DrawInstanceGroup) AlterPadding(blockSize int)

DrawInstanceGroup.AnyVisible

func (d *DrawInstanceGroup) AnyVisible() bool

DrawInstanceGroup.Destroy

func (d *DrawInstanceGroup) Destroy(renderer Renderer)

DrawInstanceGroup.IsEmpty

func (d *DrawInstanceGroup) IsEmpty() bool

DrawInstanceGroup.IsReady

func (d *DrawInstanceGroup) IsReady() bool

DrawInstanceGroup.TotalSize

func (d *DrawInstanceGroup) TotalSize() int

DrawInstanceGroup.UpdateData

func (d *DrawInstanceGroup) UpdateData(renderer Renderer)

DrawInstanceGroup.VisibleCount

func (d *DrawInstanceGroup) VisibleCount() int

DrawInstanceGroup.VisibleSize

func (d *DrawInstanceGroup) VisibleSize() int

Drawing

struct

type Drawing struct {
    Renderer    Renderer
    Shader      *Shader
    Mesh        *Mesh
    Textures    []*Texture
    ShaderData  DrawInstance
    Transform   *matrix.Transform
    CanvasId    string
    UseBlending bool
    // Has unexported fields.
}

Drawing.IsValid

func (d *Drawing) IsValid() bool

Drawings

struct

type Drawings struct {
    // Has unexported fields.
}

NewDrawings

func NewDrawings() Drawings

Drawings.AddDrawing

func (d *Drawings) AddDrawing(drawing *Drawing)

Drawings.AddDrawings

func (d *Drawings) AddDrawings(drawings []Drawing, target Canvas)

Drawings.Destroy

func (d *Drawings) Destroy(renderer Renderer)

Drawings.HasDrawings

func (d *Drawings) HasDrawings() bool

Drawings.PreparePending

func (d *Drawings) PreparePending()

Drawings.Render

func (d *Drawings) Render(renderer Renderer)

FontBaseline

int

type FontBaseline int

FontCache

struct

type FontCache struct {
    FaceMutex sync.RWMutex
    // Has unexported fields.
}

NewFontCache

func NewFontCache(renderer Renderer, assetDb *assets.Database) FontCache

FontCache.Destroy

func (cache *FontCache) Destroy()

FontCache.EMSize

func (cache *FontCache) EMSize(face FontFace) float32

FontCache.Init

func (cache *FontCache) Init(renderer Renderer, assetDb *assets.Database, caches RenderCaches)

FontCache.LineCountWithin

func (cache *FontCache) LineCountWithin(face FontFace, text string, scale, maxWidth float32) int

FontCache.MeasureCharacter

func (cache FontCache) MeasureCharacter(face string, r rune, pixelSize float32) matrix.Vec2

FontCache.MeasureString

func (cache *FontCache) MeasureString(face FontFace, text string, scale float32) float32

FontCache.MeasureStringWithin

func (cache *FontCache) MeasureStringWithin(face FontFace, text string, scale, maxWidth float32, lineHeight float32) matrix.Vec2

FontCache.PointOffsetWithin

func (cache *FontCache) PointOffsetWithin(face FontFace, text string, point matrix.Vec2, scale, maxWidth float32) int

FontCache.RenderMeshes

func (cache *FontCache) RenderMeshes(caches RenderCaches,

text string, x, y, z, scale, maxWidth float32, fgColor, bgColor matrix.Color, justify FontJustify, baseline FontBaseline, rootScale matrix.Vec3, instanced, is3D bool, face FontFace, lineHeight float32) []Drawing

FontCache.StringRectsWithinNew

func (cache *FontCache) StringRectsWithinNew(face FontFace, text string, scale, maxWidth float32) []matrix.Vec4

FontFace

string

type FontFace string

FontFace.IsBold

func (f FontFace) IsBold() bool

FontFace.IsExtraBold

func (f FontFace) IsExtraBold() bool

FontFace.IsItalic

func (f FontFace) IsItalic() bool

FontJustify

int

type FontJustify int

FuncPipeline

func

type FuncPipeline func(renderer Renderer, shader *Shader, shaderStages []vk.PipelineShaderStageCreateInfo) bool

GlobalShaderData

struct

type GlobalShaderData struct {
    View           matrix.Mat4
    Projection     matrix.Mat4
    UIView         matrix.Mat4
    UIProjection   matrix.Mat4
    CameraPosition matrix.Vec3

    UICameraPosition matrix.Vec3

    ScreenSize matrix.Vec2
    Time       float32
    // Has unexported fields.
}

InstanceCopyData

struct

type InstanceCopyData struct {
    // Has unexported fields.
}

InstanceCopyDataNew

func InstanceCopyDataNew(padding int) InstanceCopyData

InstanceDriverData

struct

type InstanceDriverData struct {
    // Has unexported fields.
}

InstanceGroupSkinningData

struct

type InstanceGroupSkinningData struct {
}

LayoutBufferDescription

struct

type LayoutBufferDescription struct {
    Name     string
    Type     string
    Capacity int
}

LayoutBufferDescription.TotalByteCapacity

func (l *LayoutBufferDescription) TotalByteCapacity() int

LayoutBufferDescription.TypeSize

func (l *LayoutBufferDescription) TypeSize() int

Mesh

struct

type Mesh struct {
    MeshId MeshId

    Details meshDetails
    // Has unexported fields.
}

NewMesh

func NewMesh(key string, verts []Vertex, indexes []uint32) *Mesh

NewMeshCube

func NewMeshCube(cache *MeshCache) *Mesh

NewMeshCubeInverse

func NewMeshCubeInverse(cache *MeshCache) *Mesh

NewMeshFrustum

func NewMeshFrustum(cache *MeshCache, key string, inverseProjection matrix.Mat4) *Mesh

NewMeshGrid

func NewMeshGrid(cache *MeshCache, key string, points []matrix.Vec3, vertColor matrix.Color) *Mesh

NewMeshLine

func NewMeshLine(cache *MeshCache, key string, p0, p1 matrix.Vec3, vertColor matrix.Color) *Mesh

NewMeshOffsetQuad

func NewMeshOffsetQuad(cache *MeshCache, key string, sideOffsets matrix.Vec4) *Mesh

NewMeshPlane

func NewMeshPlane(cache *MeshCache) *Mesh

NewMeshPoint

func NewMeshPoint(cache *MeshCache, key string, position matrix.Vec3, vertColor matrix.Color) *Mesh

NewMeshQuad

func NewMeshQuad(cache *MeshCache) *Mesh

NewMeshScreenQuad

func NewMeshScreenQuad(cache *MeshCache) *Mesh

NewMeshSkyboxCube

func NewMeshSkyboxCube(cache *MeshCache) *Mesh

NewMeshTexturableCube

func NewMeshTexturableCube(cache *MeshCache) *Mesh

NewMeshTriangle

func NewMeshTriangle(cache *MeshCache) *Mesh

NewMeshUnitQuad

func NewMeshUnitQuad(cache *MeshCache) *Mesh

NewMeshWireCube

func NewMeshWireCube(cache *MeshCache, key string, vertColor matrix.Color) *Mesh

NewMeshWireQuad

func NewMeshWireQuad(cache *MeshCache, key string, vertColor matrix.Color) *Mesh

Mesh.DelayedCreate

func (m *Mesh) DelayedCreate(renderer Renderer)

Mesh.Destroy

func (m *Mesh) Destroy(renderer Renderer)

Mesh.IsReady

func (m Mesh) IsReady() bool

Mesh.Key

func (m Mesh) Key() string

Mesh.SetKey

func (m *Mesh) SetKey(key string)

MeshCache

struct

type MeshCache struct {
    // Has unexported fields.
}

NewMeshCache

func NewMeshCache(renderer Renderer, assetDatabase *assets.Database) MeshCache

MeshCache.AddMesh

func (m *MeshCache) AddMesh(mesh *Mesh) *Mesh

Try to add the mesh to the cache, if it already exists, return the existing mesh

MeshCache.CreatePending

func (m *MeshCache) CreatePending()

MeshCache.Destroy

func (m *MeshCache) Destroy()

MeshCache.FindMesh

func (m *MeshCache) FindMesh(key string) (*Mesh, bool)

MeshCache.Mesh

func (m *MeshCache) Mesh(key string, verts []Vertex, indexes []uint32) *Mesh

MeshCullMode

int

type MeshCullMode = int

const ( MeshCullModeBack MeshCullMode = iota MeshCullModeFront MeshCullModeNone )

MeshDrawMode

int

type MeshDrawMode = int

const ( MeshDrawModePoints MeshDrawMode = iota MeshDrawModeLines MeshDrawModeTriangles MeshDrawModePatches )

MeshId

struct

type MeshId struct {
    // Has unexported fields.
}

MeshId.IsValid

func (m MeshId) IsValid() bool

OITCanvas

struct

type OITCanvas struct {
    ClearColor matrix.Color

    // Has unexported fields.
}

OITCanvas.Color

func (r *OITCanvas) Color() *Texture

OITCanvas.Create

func (r *OITCanvas) Create(renderer Renderer) error

OITCanvas.Destroy

func (r *OITCanvas) Destroy(renderer Renderer)

OITCanvas.Draw

func (r *OITCanvas) Draw(renderer Renderer, drawings []ShaderDraw)

OITCanvas.Initialize

func (r *OITCanvas) Initialize(renderer Renderer, width, height float32)

OITCanvas.Pass

func (r *OITCanvas) Pass(name string) *RenderPass

OITCanvas.ShaderPipeline

func (r *OITCanvas) ShaderPipeline(name string) FuncPipeline

OutlineCanvas

struct

type OutlineCanvas struct {
    // Has unexported fields.
}

OutlineCanvas.Color

func (r *OutlineCanvas) Color() *Texture

OutlineCanvas.Create

func (r *OutlineCanvas) Create(renderer Renderer) error

OutlineCanvas.Destroy

func (r *OutlineCanvas) Destroy(renderer Renderer)

OutlineCanvas.Draw

func (r *OutlineCanvas) Draw(renderer Renderer, drawings []ShaderDraw)

OutlineCanvas.Pass

func (r *OutlineCanvas) Pass(name string) *RenderPass

OutlineCanvas.ShaderPipeline

func (r *OutlineCanvas) ShaderPipeline(name string) FuncPipeline

RenderCaches

interface

type RenderCaches interface {
    ShaderCache() *ShaderCache
    TextureCache() *TextureCache
    MeshCache() *MeshCache
    FontCache() *FontCache
}

RenderPass

struct

type RenderPass struct {
    Handle vk.RenderPass
    Buffer vk.Framebuffer

    // Has unexported fields.
}

NewRenderPass

func NewRenderPass(device vk.Device, dbg *debugVulkan, attachments []vk.AttachmentDescription, subPasses []vk.SubpassDescription, dependencies []vk.SubpassDependency) (RenderPass, error)

RenderPass.CreateFrameBuffer

func (p *RenderPass) CreateFrameBuffer(vr *Vulkan,

imageViews []vk.ImageView, width, height int) error

RenderPass.Destroy

func (p *RenderPass) Destroy()

RenderTargetDraw

struct

type RenderTargetDraw struct {
    Target Canvas
    // Has unexported fields.
}

Renderer

interface

type Renderer interface {
    Initialize(caches RenderCaches, width, height int32) error
    ReadyFrame(camera cameras.Camera, uiCamera cameras.Camera, runtime float32) bool
    CreateShader(shader *Shader, assetDatabase *assets.Database)
    CreateMesh(mesh *Mesh, verts []Vertex, indices []uint32)
    CreateTexture(texture *Texture, textureData *TextureData)
    TextureReadPixel(texture *Texture, x, y int) matrix.Color
    TextureWritePixels(texture *Texture, x, y, width, height int, pixels []byte)
    Draw(drawings []RenderTargetDraw)
    BlitTargets(targets ...RenderTargetDraw)
    SwapFrame(width, height int32) bool
    Resize(width, height int)
    AddPreRun(preRun func())
    DestroyGroup(group *DrawInstanceGroup)
    DestroyTexture(texture *Texture)
    DestroyShader(shader *Shader)
    DestroyMesh(mesh *Mesh)
    Destroy()
    RegisterCanvas(name string, canvas Canvas)
    Canvas(name string) (Canvas, bool)
    DefaultCanvas() Canvas
    WaitForRender()
}

RenderingContainer

interface

type RenderingContainer interface {
    GetDrawableSize() (int32, int32)
    GetInstanceExtensions() []string
    PlatformWindow() unsafe.Pointer
    PlatformInstance() unsafe.Pointer
}

Shader

struct

type Shader struct {
    Key        string
    RenderId   ShaderId
    VertPath   string
    FragPath   string
    GeomPath   string
    CtrlPath   string
    EvalPath   string
    RenderPass *RenderPass
    DriverData ShaderDriverData

    // Has unexported fields.
}

NewShader

func NewShader(vertPath, fragPath, geomPath, ctrlPath, evalPath,

key string, renderPass RenderPass) Shader

Shader.AddSubShader

func (s *Shader) AddSubShader(key string, shader *Shader)

Shader.DelayedCreate

func (s *Shader) DelayedCreate(renderer Renderer, assetDatabase *assets.Database)

Shader.Destroy

func (s *Shader) Destroy(renderer Renderer)

Shader.IsComposite

func (s *Shader) IsComposite() bool

Shader.RemoveSubShader

func (s *Shader) RemoveSubShader(key string)

Shader.SubShader

func (s *Shader) SubShader(key string) *Shader

ShaderBuffer

struct

type ShaderBuffer struct {
    // Has unexported fields.
}

ShaderCache

struct

type ShaderCache struct {
    // Has unexported fields.
}

NewShaderCache

func NewShaderCache(renderer Renderer, assetDatabase *assets.Database) ShaderCache

ShaderCache.CreatePending

func (s *ShaderCache) CreatePending()

ShaderCache.Destroy

func (s *ShaderCache) Destroy()

ShaderCache.Shader

func (s *ShaderCache) Shader(vertPath, fragPath, geomPath, ctrlPath,

evalPath, key string, renderPass RenderPass) (shader Shader, isNew bool)

ShaderCache.ShaderFromDefinition

func (s *ShaderCache) ShaderFromDefinition(definitionKey string) *Shader

ShaderDataBase

struct

type ShaderDataBase struct {
    InitModel matrix.Mat4
    // Has unexported fields.
}

NewShaderDataBase

func NewShaderDataBase() ShaderDataBase

ShaderDataBase.Activate

func (s *ShaderDataBase) Activate()

ShaderDataBase.CancelDestroy

func (s *ShaderDataBase) CancelDestroy()

ShaderDataBase.DataPointer

func (s *ShaderDataBase) DataPointer() unsafe.Pointer

ShaderDataBase.Deactivate

func (s *ShaderDataBase) Deactivate()

ShaderDataBase.Destroy

func (s *ShaderDataBase) Destroy()

ShaderDataBase.IsActive

func (s *ShaderDataBase) IsActive() bool

ShaderDataBase.IsDestroyed

func (s *ShaderDataBase) IsDestroyed() bool

ShaderDataBase.Model

func (s *ShaderDataBase) Model() matrix.Mat4

ShaderDataBase.NamedDataInstanceSize

func (s *ShaderDataBase) NamedDataInstanceSize(name string) int

ShaderDataBase.NamedDataPointer

func (s *ShaderDataBase) NamedDataPointer(name string) unsafe.Pointer

ShaderDataBase.SetModel

func (s *ShaderDataBase) SetModel(model matrix.Mat4)

ShaderDataBase.Setup

func (s *ShaderDataBase) Setup()

ShaderDataBase.Size

func (s *ShaderDataBase) Size() int

ShaderDataBase.UpdateModel

func (s *ShaderDataBase) UpdateModel()

ShaderDataBase.UpdateNamedData

func (s *ShaderDataBase) UpdateNamedData(index, capacity int, name string) bool

ShaderDataBasic

struct

type ShaderDataBasic struct {
    ShaderDataBase
    Color matrix.Color
}

ShaderDataBasic.Size

func (t ShaderDataBasic) Size() int

ShaderDef

struct

type ShaderDef struct {
    CullMode   string
    DrawMode   string
    Vulkan     ShaderDefDriver
    Fields     []ShaderDefField
    Layouts    []ShaderDefLayout
    Canvas     string
    RenderPass string
    Pipeline   string
}

ShaderDefFromJson

func ShaderDefFromJson(jsonStr string) (ShaderDef, error)

ShaderDef.AddField

func (sd *ShaderDef) AddField(name, glslType string)

ShaderDef.Stride

func (sd ShaderDef) Stride() uint32

ShaderDef.ToAttributeDescription

func (sd ShaderDef) ToAttributeDescription(locationStart uint32) []vk.VertexInputAttributeDescription

ShaderDef.ToDescriptorSetLayoutStructure

func (sd ShaderDef) ToDescriptorSetLayoutStructure() DescriptorSetLayoutStructure

ShaderDefDriver

struct

type ShaderDefDriver struct {
    Vert string
    Frag string
    Geom string
    Tesc string
    Tese string
}

ShaderDefField

struct

type ShaderDefField struct {
    Name string
    Type string
}

ShaderDefField.Format

func (f ShaderDefField) Format() vk.Format

ShaderDefField.Vec4Size

func (f ShaderDefField) Vec4Size() uint32

ShaderDefLayout

struct

type ShaderDefLayout struct {
    Type    string
    Flags   []string
    Count   int
    Binding int
    Buffer  *LayoutBufferDescription
}

ShaderDefLayout.DescriptorFlags

func (l ShaderDefLayout) DescriptorFlags() vk.ShaderStageFlagBits

ShaderDefLayout.DescriptorType

func (l ShaderDefLayout) DescriptorType() vk.DescriptorType

ShaderDraw

struct

type ShaderDraw struct {
    // Has unexported fields.
}

NewShaderDraw

func NewShaderDraw(shader *Shader) ShaderDraw

ShaderDraw.AddInstanceGroup

func (s *ShaderDraw) AddInstanceGroup(group DrawInstanceGroup)

ShaderDraw.Destroy

func (s *ShaderDraw) Destroy(renderer Renderer)

ShaderDraw.Filter

func (s *ShaderDraw) Filter(filter func(*DrawInstanceGroup) bool) []*DrawInstanceGroup

ShaderDraw.SolidGroups

func (s *ShaderDraw) SolidGroups() []*DrawInstanceGroup

ShaderDraw.TransparentGroups

func (s *ShaderDraw) TransparentGroups() []*DrawInstanceGroup

ShaderDriverData

struct

type ShaderDriverData struct {
    DescriptorSetLayoutStructure
    CullMode              vk.CullModeFlagBits
    DrawMode              MeshDrawMode
    Stride                uint32
    AttributeDescriptions []vk.VertexInputAttributeDescription
    // Has unexported fields.
}

NewShaderDriverData

func NewShaderDriverData() ShaderDriverData

ShaderId

struct

type ShaderId struct {
    // Has unexported fields.
}

ShaderId.IsValid

func (s ShaderId) IsValid() bool

SkinnedShaderData

struct

type SkinnedShaderData struct {
    // Has unexported fields.
}

TextShaderData

struct

type TextShaderData struct {
    ShaderDataBase
    UVs     matrix.Vec4
    FgColor matrix.Color
    BgColor matrix.Color
    Scissor matrix.Vec4
    PxRange matrix.Vec2
}

TextShaderData.Size

func (s TextShaderData) Size() int

Texture

struct

type Texture struct {
    Key               string
    TexturePixelCache []byte
    RenderId          TextureId
    Channels          int
    Filter            int
    MipLevels         int
    Width             int
    Height            int
    CacheInvalid      bool
    // Has unexported fields.
}

NewTexture

func NewTexture(renderer Renderer, assetDb *assets.Database, textureKey string, filter TextureFilter) (*Texture, error)

NewTextureFromMemory

func NewTextureFromMemory(key string, data []byte, width, height int, filter TextureFilter) (*Texture, error)

Texture.DelayedCreate

func (t *Texture) DelayedCreate(renderer Renderer)

Texture.Destroy

func (t *Texture) Destroy(renderer Renderer)

Texture.ReadPixel

func (t *Texture) ReadPixel(renderer Renderer, x, y int) matrix.Color

Texture.Size

func (t Texture) Size() matrix.Vec2

Texture.WritePixels

func (t *Texture) WritePixels(renderer Renderer, x, y, width, height int, pixels []byte)

TextureCache

struct

type TextureCache struct {
    // Has unexported fields.
}

NewTextureCache

func NewTextureCache(renderer Renderer, assetDatabase *assets.Database) TextureCache

TextureCache.CreatePending

func (t *TextureCache) CreatePending()

TextureCache.Destroy

func (t *TextureCache) Destroy()

TextureCache.Texture

func (t *TextureCache) Texture(textureKey string, filter TextureFilter) (*Texture, error)

TextureColorFormat

int

type TextureColorFormat int

const ( TextureColorFormatRgbaUnorm TextureColorFormat = iota TextureColorFormatRgbUnorm TextureColorFormatRgbaSrgb TextureColorFormatRgbSrgb TextureColorFormatLuminance )

TextureData

struct

type TextureData struct {
    Mem            []byte
    InternalFormat TextureInputType
    Format         TextureColorFormat
    Type           TextureMemType
    Width          int
    Height         int
    InputType      TextureFileFormat
}

ReadRawTextureData

func ReadRawTextureData(mem []byte, inputType TextureFileFormat) TextureData

TexturePixelsFromAsset

func TexturePixelsFromAsset(assetDb *assets.Database, textureKey string) (TextureData, error)

TextureFileFormat

int

type TextureFileFormat = int

const ( TextureFileFormatAstc TextureFileFormat = iota TextureFileFormatPng TextureFileFormatRaw )

TextureFilter

int

type TextureFilter = int

const ( TextureFilterLinear TextureFilter = iota TextureFilterNearest TextureFilterMax )

TextureId

struct

type TextureId struct {
    Image      vk.Image
    Memory     vk.DeviceMemory
    View       vk.ImageView
    Sampler    vk.Sampler
    Format     vk.Format
    MipLevels  uint32
    Layout     vk.ImageLayout
    Access     vk.AccessFlags
    Samples    vk.SampleCountFlagBits
    Width      int
    Height     int
    LayerCount int
}

TextureId.IsValid

func (t TextureId) IsValid() bool

TextureInputType

int

type TextureInputType int

const ( TextureInputTypeCompressedRgbaAstc4x4 TextureInputType = iota TextureInputTypeCompressedRgbaAstc5x4 TextureInputTypeCompressedRgbaAstc5x5 TextureInputTypeCompressedRgbaAstc6x5 TextureInputTypeCompressedRgbaAstc6x6 TextureInputTypeCompressedRgbaAstc8x5 TextureInputTypeCompressedRgbaAstc8x6 TextureInputTypeCompressedRgbaAstc8x8 TextureInputTypeCompressedRgbaAstc10x5 TextureInputTypeCompressedRgbaAstc10x6 TextureInputTypeCompressedRgbaAstc10x8 TextureInputTypeCompressedRgbaAstc10x10 TextureInputTypeCompressedRgbaAstc12x10 TextureInputTypeCompressedRgbaAstc12x12 TextureInputTypeRgba8 TextureInputTypeRgb8 TextureInputTypeLuminance )

TextureMemType

int

type TextureMemType = int

const ( TextureMemTypeUnsignedByte TextureMemType = iota )

Vertex

struct

type Vertex struct {
    Position     matrix.Vec3
    Normal       matrix.Vec3
    Tangent      matrix.Vec4
    UV0          matrix.Vec2
    Color        matrix.Color
    JointIds     matrix.Vec4i
    JointWeights matrix.Vec4
    MorphTarget  matrix.Vec3
}

Vulkan

struct

type Vulkan struct {
    // Has unexported fields.
}

NewVKRenderer

func NewVKRenderer(window RenderingContainer, applicationName string) (*Vulkan, error)

Vulkan.AddPreRun

func (vr *Vulkan) AddPreRun(preRun func())

Vulkan.BlitTargets

func (vr *Vulkan) BlitTargets(targets ...RenderTargetDraw)

Vulkan.Canvas

func (vr *Vulkan) Canvas(name string) (Canvas, bool)

Vulkan.CopyBuffer

func (vr *Vulkan) CopyBuffer(srcBuffer vk.Buffer, dstBuffer vk.Buffer, size vk.DeviceSize)

Vulkan.CreateBuffer

func (vr *Vulkan) CreateBuffer(size vk.DeviceSize, usage vk.BufferUsageFlags, properties vk.MemoryPropertyFlags, buffer *vk.Buffer, bufferMemory *vk.DeviceMemory) bool

Vulkan.CreateFrameBuffer

func (vr *Vulkan) CreateFrameBuffer(renderPass *RenderPass, attachments []vk.ImageView, width, height uint32) (vk.Framebuffer, bool)

Vulkan.CreateImage

func (vr *Vulkan) CreateImage(width, height, mipLevels uint32, numSamples vk.SampleCountFlagBits, format vk.Format, tiling vk.ImageTiling, usage vk.ImageUsageFlags, properties vk.MemoryPropertyFlags, textureId *TextureId, layerCount int) bool

Vulkan.CreateMesh

func (vr *Vulkan) CreateMesh(mesh *Mesh, verts []Vertex, indices []uint32)

Vulkan.CreateShader

func (vr *Vulkan) CreateShader(shader *Shader, assetDB *assets.Database)

Vulkan.CreateTexture

func (vr *Vulkan) CreateTexture(texture *Texture, data *TextureData)

Vulkan.DefaultCanvas

func (vr *Vulkan) DefaultCanvas() Canvas

Vulkan.Destroy

func (vr *Vulkan) Destroy()

Vulkan.DestroyGroup

func (vr *Vulkan) DestroyGroup(group *DrawInstanceGroup)

Vulkan.DestroyMesh

func (vr *Vulkan) DestroyMesh(mesh *Mesh)

Vulkan.DestroyShader

func (vr *Vulkan) DestroyShader(shader *Shader)

Vulkan.DestroyTexture

func (vr *Vulkan) DestroyTexture(texture *Texture)

Vulkan.Draw

func (vr *Vulkan) Draw(drawings []RenderTargetDraw)

Vulkan.Initialize

func (vr *Vulkan) Initialize(caches RenderCaches, width, height int32) error

Vulkan.MeshIsReady

func (vr *Vulkan) MeshIsReady(mesh Mesh) bool

Vulkan.ReadyFrame

func (vr *Vulkan) ReadyFrame(camera cameras.Camera, uiCamera cameras.Camera, runtime float32) bool

Vulkan.RegisterCanvas

func (vr *Vulkan) RegisterCanvas(name string, canvas Canvas)

Vulkan.Resize

func (vr *Vulkan) Resize(width, height int)

Vulkan.SwapFrame

func (vr *Vulkan) SwapFrame(width, height int32) bool

Vulkan.TextureFromId

func (vr *Vulkan) TextureFromId(texture *Texture, other TextureId)

Vulkan.TextureReadPixel

func (vr *Vulkan) TextureReadPixel(texture *Texture, x, y int) matrix.Color

Vulkan.TextureWritePixels

func (vr *Vulkan) TextureWritePixels(texture *Texture, x, y, width, height int, pixels []uint8)

Vulkan.WaitForRender

func (vr *Vulkan) WaitForRender()