package 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
MaxJoints
50
MaxSkinInstances
50
QuaternionSize
[int(unsafe](../int(unsafe).[Sizeof(matrix](../int(unsafe#Sizeof(matrix)
CubeMapSides
6
BytesInPixel
4
MaxCommandBuffers
15
Functions
TextureKeys
VertexFaceNormal
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
CombineCanvas.Color
CombineCanvas.Create
CombineCanvas.Destroy
CombineCanvas.Draw
CombineCanvas.Pass
CombineCanvas.ShaderPipeline
DescriptorSetLayoutStructure
struct
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.
}
ReflectDuplicateDrawInstance
DrawInstanceGroup
struct
type DrawInstanceGroup struct {
Mesh *Mesh
InstanceDriverData
Textures []*Texture
Instances []DrawInstance
// Has unexported fields.
}
NewDrawInstanceGroup
DrawInstanceGroup.AddInstance
DrawInstanceGroup.AlterPadding
DrawInstanceGroup.AnyVisible
DrawInstanceGroup.Destroy
DrawInstanceGroup.IsEmpty
DrawInstanceGroup.IsReady
DrawInstanceGroup.TotalSize
DrawInstanceGroup.UpdateData
DrawInstanceGroup.VisibleCount
DrawInstanceGroup.VisibleSize
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
Drawings
struct
NewDrawings
Drawings.AddDrawing
Drawings.AddDrawings
Drawings.Destroy
Drawings.HasDrawings
Drawings.PreparePending
Drawings.Render
FontBaseline
FontCache
struct
NewFontCache
FontCache.Destroy
FontCache.EMSize
FontCache.Init
FontCache.LineCountWithin
FontCache.MeasureCharacter
FontCache.MeasureString
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
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
FontFace.IsBold
FontFace.IsExtraBold
FontFace.IsItalic
FontJustify
FuncPipeline
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
InstanceCopyDataNew
InstanceDriverData
struct
InstanceGroupSkinningData
struct
LayoutBufferDescription
struct
LayoutBufferDescription.TotalByteCapacity
LayoutBufferDescription.TypeSize
Mesh
struct
NewMesh
NewMeshCube
NewMeshCubeInverse
NewMeshFrustum
NewMeshGrid
NewMeshLine
NewMeshOffsetQuad
NewMeshPlane
NewMeshPoint
NewMeshQuad
NewMeshScreenQuad
NewMeshSkyboxCube
NewMeshTexturableCube
NewMeshTriangle
NewMeshUnitQuad
NewMeshWireCube
NewMeshWireQuad
Mesh.DelayedCreate
Mesh.Destroy
Mesh.IsReady
Mesh.Key
Mesh.SetKey
MeshCache
struct
NewMeshCache
MeshCache.AddMesh
Try to add the mesh to the cache, if it already exists, return the existing mesh
MeshCache.CreatePending
MeshCache.Destroy
MeshCache.FindMesh
MeshCache.Mesh
MeshCullMode
const ( MeshCullModeBack MeshCullMode = iota MeshCullModeFront MeshCullModeNone )
MeshDrawMode
const ( MeshDrawModePoints MeshDrawMode = iota MeshDrawModeLines MeshDrawModeTriangles MeshDrawModePatches )
MeshId
struct
MeshId.IsValid
OITCanvas
struct
OITCanvas.Color
OITCanvas.Create
OITCanvas.Destroy
OITCanvas.Draw
OITCanvas.Initialize
OITCanvas.Pass
OITCanvas.ShaderPipeline
OutlineCanvas
struct
OutlineCanvas.Color
OutlineCanvas.Create
OutlineCanvas.Destroy
OutlineCanvas.Draw
OutlineCanvas.Pass
OutlineCanvas.ShaderPipeline
RenderCaches
interface
type RenderCaches interface {
ShaderCache() *ShaderCache
TextureCache() *TextureCache
MeshCache() *MeshCache
FontCache() *FontCache
}
RenderPass
struct
NewRenderPass
func NewRenderPass(device vk.Device, dbg *debugVulkan, attachments []vk.AttachmentDescription, subPasses []vk.SubpassDescription, dependencies []vk.SubpassDependency) (RenderPass, error)
RenderPass.CreateFrameBuffer
imageViews []vk.ImageView, width, height int) error
RenderPass.Destroy
RenderTargetDraw
struct
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
key string, renderPass RenderPass) Shader
Shader.AddSubShader
Shader.DelayedCreate
Shader.Destroy
Shader.IsComposite
Shader.RemoveSubShader
Shader.SubShader
ShaderBuffer
struct
ShaderCache
struct
NewShaderCache
ShaderCache.CreatePending
ShaderCache.Destroy
ShaderCache.Shader
evalPath, key string, renderPass RenderPass) (shader Shader, isNew bool)
ShaderCache.ShaderFromDefinition
ShaderDataBase
struct
NewShaderDataBase
ShaderDataBase.Activate
ShaderDataBase.CancelDestroy
ShaderDataBase.DataPointer
ShaderDataBase.Deactivate
ShaderDataBase.Destroy
ShaderDataBase.IsActive
ShaderDataBase.IsDestroyed
ShaderDataBase.Model
ShaderDataBase.NamedDataInstanceSize
ShaderDataBase.NamedDataPointer
ShaderDataBase.SetModel
ShaderDataBase.Setup
ShaderDataBase.Size
ShaderDataBase.UpdateModel
ShaderDataBase.UpdateNamedData
ShaderDataBasic
struct
ShaderDataBasic.Size
ShaderDef
struct
type ShaderDef struct {
CullMode string
DrawMode string
Vulkan ShaderDefDriver
Canvas string
RenderPass string
Pipeline string
LayoutGroups []ShaderLayoutGroup
}
ShaderDefFromJson
ShaderDef.SelectLayout
ShaderDef.Stride
ShaderDef.ToAttributeDescription
func (sd ShaderDef) ToAttributeDescription(locationStart uint32) []vk.VertexInputAttributeDescription
ShaderDef.ToDescriptorSetLayoutStructure
ShaderDefDriver
struct
ShaderDefField
struct
ShaderDefField.Format
ShaderDefField.Vec4Size
ShaderDefLayout
struct
type ShaderDefLayout struct {
Type string
Flags []string
Count int
Binding int
Buffer *LayoutBufferDescription
}
ShaderDefLayout.DescriptorFlags
ShaderDefLayout.DescriptorType
ShaderDraw
struct
NewShaderDraw
ShaderDraw.AddInstanceGroup
ShaderDraw.Destroy
ShaderDraw.Filter
ShaderDraw.SolidGroups
ShaderDraw.TransparentGroups
ShaderDriverData
struct
type ShaderDriverData struct {
DescriptorSetLayoutStructure
CullMode vk.CullModeFlagBits
DrawMode MeshDrawMode
Stride uint32
AttributeDescriptions []vk.VertexInputAttributeDescription
// Has unexported fields.
}
NewShaderDriverData
ShaderId
struct
ShaderId.IsValid
ShaderLayout
struct
type ShaderLayout struct {
Location int // -1 if not set
Binding int // -1 if not set
Set int // -1 if not set
InputAttachment int // -1 if not set
Type string // float, vec3, mat4, etc.
Name string
Source string // in, out, uniform
Fields []ShaderLayoutStructField
}
ShaderLayout.Capacity
ShaderLayout.DescriptorType
ShaderLayout.FullName
ShaderLayout.IsBuffer
ShaderLayout.Stride
ShaderLayoutGroup
struct
ShaderLayoutGroup.DescriptorFlag
ShaderLayoutStructField
struct
SkinnedShaderData
struct
TextShaderData
struct
type TextShaderData struct {
ShaderDataBase
UVs matrix.Vec4
FgColor matrix.Color
BgColor matrix.Color
Scissor matrix.Vec4
PxRange matrix.Vec2
}
TextShaderData.Size
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
Texture.Destroy
Texture.ReadPixel
Texture.Size
Texture.WritePixels
TextureCache
struct
NewTextureCache
TextureCache.CreatePending
TextureCache.Destroy
TextureCache.Texture
TextureColorFormat
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
TexturePixelsFromAsset
TextureFileFormat
const ( TextureFileFormatAstc TextureFileFormat = iota TextureFileFormatPng TextureFileFormatRaw )
TextureFilter
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
TextureInputType
const ( TextureInputTypeCompressedRgbaAstc4x4 TextureInputType = iota TextureInputTypeCompressedRgbaAstc5x4 TextureInputTypeCompressedRgbaAstc5x5 TextureInputTypeCompressedRgbaAstc6x5 TextureInputTypeCompressedRgbaAstc6x6 TextureInputTypeCompressedRgbaAstc8x5 TextureInputTypeCompressedRgbaAstc8x6 TextureInputTypeCompressedRgbaAstc8x8 TextureInputTypeCompressedRgbaAstc10x5 TextureInputTypeCompressedRgbaAstc10x6 TextureInputTypeCompressedRgbaAstc10x8 TextureInputTypeCompressedRgbaAstc10x10 TextureInputTypeCompressedRgbaAstc12x10 TextureInputTypeCompressedRgbaAstc12x12 TextureInputTypeRgba8 TextureInputTypeRgb8 TextureInputTypeLuminance )
TextureMemType
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
NewVKRenderer
Vulkan.AddPreRun
Vulkan.BlitTargets
Vulkan.Canvas
Vulkan.CopyBuffer
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