metadata

package
v0.0.0-...-224eed5 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidIDUint64 uint64 = 18446744073709551615
	InvalidID       uint32 = 4294967295
	InvalidIDUint16 uint16 = 65535
	InvalidIDUint8  uint8  = 255
)
View Source
const (
	/** @brief The default texture name. */
	DEFAULT_TEXTURE_NAME string = "default"
	/** @brief The default diffuse texture name. */
	DEFAULT_DIFFUSE_TEXTURE_NAME string = "default_DIFF"
	/** @brief The default specular texture name. */
	DEFAULT_SPECULAR_TEXTURE_NAME string = "default_SPEC"
	/** @brief The default normal texture name. */
	DEFAULT_NORMAL_TEXTURE_NAME string = "default_NORM"
)
View Source
const DefaultGeometryName string = "default"

* @brief The name of the default geometry.

View Source
const DefaultMaterialName string = "default"

* @brief The name of the default material.

View Source
const MAX_JOB_RESULTS int = 512

The max number of job results that can be stored at once.

View Source
const ResourceMagic int = 0xdaaaadd1

* @brief A magic number indicating the file as an anima binary file.

Variables

This section is empty.

Functions

func BytesToCodepoint

func BytesToCodepoint(bytes string, offset uint32) (int32, uint8, error)

func GenerateNewHash

func GenerateNewHash() string

Generate a fast FNV-1a hash as a string

func GetAligned

func GetAligned(operand, granularity uint64) uint64

Types

type BitmapFontConfig

type BitmapFontConfig struct {
	Name         string
	Size         uint16
	ResourceName string
}

type BitmapFontPage

type BitmapFontPage struct {
	ID   int8
	File string
}

type BitmapFontResourceData

type BitmapFontResourceData struct {
	Data  *FontData
	Pages []*BitmapFontPage
}

type DefaultTexture

type DefaultTexture struct {
	DefaultTexture         *Texture
	TexturePixels          []uint8
	DefaultDiffuseTexture  *Texture
	DiffuseTexturePixels   []uint8
	DefaultSpecularTexture *Texture
	SpecularTexturePixels  []uint8
	DefaultNormalTexture   *Texture
	NormalTexturePixels    []uint8
}

func NewDefaultTexture

func NewDefaultTexture() *DefaultTexture

func (*DefaultTexture) CreateSkeletonTextures

func (ts *DefaultTexture) CreateSkeletonTextures() bool

CreateSkeletonTexture misses the call to the actual renderer to properly generate the texture this method creates the shell of the objects that will hold the texture

type FaceCullMode

type FaceCullMode int

* @brief Determines face culling mode during rendering.

const (
	/** @brief No faces are culled. */
	FaceCullModeNone FaceCullMode = 0x0
	/** @brief Only front faces are culled. */
	FaceCullModeFront FaceCullMode = 0x1
	/** @brief Only back faces are culled. */
	FaceCullModeBack FaceCullMode = 0x2
	/** @brief Both front and back faces are culled. */
	FaceCullModeFrontAndBack FaceCullMode = 0x3
)

func CullModeFromString

func CullModeFromString(s string) (FaceCullMode, error)

type FontData

type FontData struct {
	FontType         FontType
	Face             string
	Size             uint32
	LineHeight       int32
	Baseline         int32
	AtlasSizeX       int32
	AtlasSizeY       int32
	Atlas            *TextureMap
	Glyphs           []*FontGlyph
	Kernings         []*FontKerning
	TabXAdvance      float32
	InternalDataSize uint32
	InternalData     interface{}
}

type FontGlyph

type FontGlyph struct {
	Codepoint int32
	X         uint16
	Y         uint16
	Width     uint16
	Height    uint16
	XOffset   int16
	YOffset   int16
	XAdvance  int16
	PageID    uint8
}

type FontKerning

type FontKerning struct {
	Codepoint0 int32
	Codepoint1 int32
	Amount     int16
}

type FontType

type FontType int
const (
	FONT_TYPE_BITMAP FontType = iota
	FONT_TYPE_SYSTEM
)

type Geometry

type Geometry struct {
	/** @brief The geometry identifier. */
	ID uint32
	/** @brief The internal geometry identifier, used by the renderer backend to map to internal resources. */
	InternalID uint32
	/** @brief The geometry generation. Incremented every time the geometry changes. */
	Generation uint16
	/** @brief The center of the geometry in local coordinates. */
	Center math.Vec3
	/** @brief The extents of the geometry in local coordinates. */
	Extents math.Extents3D
	/** @brief The geometry name. */
	Name string
	/** @brief A pointer to the material associated with this geometry.. */
	Material *Material
}

*

  • @brief Represents actual geometry in the world.
  • Typically (but not always, depending on use) paired with a material.

type GeometryConfig

type GeometryConfig struct {
	/** @brief The size of each vertex. */
	VertexSize uint32
	/** @brief The number of vertices. */
	VertexCount uint32
	/** @brief An array of Vertices. */
	Vertices []math.Vertex3D
	/** @brief The size of each index. */
	IndexSize uint32
	/** @brief The number of indices. */
	IndexCount uint32
	/** @brief An array of Indices. */
	Indices []uint32

	Center     math.Vec3
	MinExtents math.Vec3
	MaxExtents math.Vec3

	/** @brief The Name of the geometry. */
	Name string
	/** @brief The name of the material used by the geometry. */
	MaterialName string
}

*

  • @brief Represents the configuration for a geometry.

type GeometryDistance

type GeometryDistance struct {
	GeometryRenderData *GeometryRenderData
	Distance           float32
}

type GeometryReference

type GeometryReference struct {
	ReferenceCount uint64
	Geometry       *Geometry
	AutoRelease    bool
}

type GeometryRenderData

type GeometryRenderData struct {
	Model    math.Mat4
	Geometry *Geometry
	UniqueID uint32
}

type IRenderView

type IRenderView interface {
	/**
	 * @brief A pointer to a function to be called when this view is created.
	 *
	 * @param self A pointer to the view being created.
	 * @return True on success; otherwise false.
	 */
	OnCreate(uniforms map[string]uint16) error
	/**
	 * @brief A pointer to a function to be called when this view is destroyed.
	 *
	 * @param self A pointer to the view being destroyed.
	 */
	OnDestroy() error
	/**
	 * @brief A pointer to a function to be called when the owner of this view (such
	 * as the window) is resized.
	 *
	 * @param self A pointer to the view being resized.
	 * @param width The new width in pixels.
	 * @param width The new height in pixels.
	 */
	OnResize(width, height uint32)
	/**
	 * @brief Builds a render view packet using the provided view and meshes.
	 *
	 * @param self A pointer to the view to use.
	 * @param data Freeform data used to build the packet.
	 * @param out_packet A pointer to hold the generated packet.
	 * @return True on success; otherwise false.
	 */
	OnBuildPacket(data interface{}) (*RenderViewPacket, error)
	/**
	 * @brief Destroys the provided render view packet.
	 * @param self A pointer to the view to use.
	 * @param packet A pointer to the packet to be destroyed.
	 */
	OnDestroyPacket(packet *RenderViewPacket) error
	/**
	 * @brief Uses the given view and packet to render the contents therein.
	 *
	 * @param self A pointer to the view to use.
	 * @param packet A pointer to the packet whose data is to be rendered.
	 * @param frame_number The current renderer frame number, typically used for data synchronization.
	 * @param render_target_index The current render target index for renderers that use multiple render targets at once (i.e. Vulkan).
	 * @return True on success; otherwise false.
	 */
	OnRender(packet *RenderViewPacket, frame_number, render_target_index uint64) error
}

type ImageResourceData

type ImageResourceData struct {
	/** @brief The number of channels. */
	ChannelCount uint8
	/** @brief The width of the image. */
	Width uint32
	/** @brief The height of the image. */
	Height uint32
	/** @brief The pixel data of the image. */
	Pixels []uint8
}

*

  • @brief A structure to hold image resource data.

type ImageResourceParams

type ImageResourceParams struct {
	/** @brief Indicates if the image should be flipped on the y-axis when loaded. */
	FlipY bool
}

* @brief Parameters used when loading an image.

type JobPriority

type JobPriority int

*

  • @brief Determines which job queue a job uses. The high-priority queue is always
  • exhausted first before processing the normal-priority queue, which must also
  • be exhausted before processing the low-priority queue.
const (
	/** @brief The lowest-priority job, used for things that can wait to be done if need be, such as log flushing. */
	JOB_PRIORITY_LOW JobPriority = iota
	/** @brief A normal-priority job. Should be used for medium-priority tasks such as loading assets. */
	JOB_PRIORITY_NORMAL
	/** @brief The highest-priority job. Should be used sparingly, and only for time-critical operations.*/
	JOB_PRIORITY_HIGH
)

type JobTask

type JobTask struct {
	/** @brief The type of job. Used to determine which thread the job executes on. */
	JobType JobType
	/** @brief The priority of this job. Higher priority jobs obviously run sooner. */
	InputParams          interface{}
	Priority             JobPriority
	OnStart              func(params interface{}, output chan<- interface{}) error // Called when job starts
	OnComplete           func(paramsChan <-chan interface{})                       // Called when job completes successfully
	OnFailure            func(paramsChan <-chan interface{})                       // Called when job fails
	OnCompletionCallback func()                                                    // Optional callback after job completion
}

*

  • @brief Describes a job to be run.

type JobType

type JobType int

* @brief Describes a type of job

const (
	/**
	 * @brief A general job that does not have any specific thread requirements.
	 * This means it matters little which job thread this job runs on.
	 */
	JOB_TYPE_GENERAL JobType = 0x02
	/**
	 * @brief A resource loading job. Resources should always load on the same thread
	 * to avoid potential disk thrashing.
	 */
	JOB_TYPE_RESOURCE_LOAD JobType = 0x04
	/**
	 * @brief Jobs using GPU resources should be bound to a thread using this job type. Multithreaded
	 * renderers will use a specific job thread, and this type of job will run on that thread.
	 * For single-threaded renderers, this will be on the main thread.
	 */
	JOB_TYPE_GPU_RESOURCE JobType = 0x08
)

type Material

type Material struct {
	/** @brief The material id. */
	ID uint32
	/** @brief The material generation. Incremented every time the material is changed. */
	Generation uint32
	/** @brief The internal material id. Used by the renderer backend to map to internal resources. */
	InternalID uint32
	/** @brief The material name. */
	Name string
	/** @brief The diffuse colour. */
	DiffuseColour math.Vec4
	/** @brief The diffuse texture map. */
	DiffuseMap *TextureMap
	/** @brief The specular texture map. */
	SpecularMap *TextureMap
	/** @brief The normal texture map. */
	NormalMap *TextureMap
	/** @brief The material shininess, determines how concentrated the specular lighting is. */
	Shininess float32
	ShaderID  uint32
	/** @brief Synced to the renderer's current frame number when the material has been applied that frame. */
	RenderFrameNumber uint32
}

*

  • @brief A material, which represents various properties
  • of a surface in the world such as texture, colour,
  • bumpiness, shininess and more.

type MaterialConfig

type MaterialConfig struct {
	Version float32
	/** @brief The name of the material. */
	Name string
	/** @brief The material type. */
	ShaderName string
	/** @brief Indicates if the material should be automatically released when no references to it remain. */
	AutoRelease bool
	/** @brief The diffuse colour of the material. */
	DiffuseColour math.Vec4
	/** @brief The shininess of the material. */
	Shininess float32
	/** @brief The diffuse map name. */
	DiffuseMapName string
	/** @brief The specular map name. */
	SpecularMapName string
	/** @brief The normal map name. */
	NormalMapName string
}

*

  • @brief Material configuration typically loaded from
  • a file or created in code to load a material from.

type MaterialReference

type MaterialReference struct {
	ReferenceCount uint64
	Handle         uint32
	AutoRelease    bool
}

type MaterialShaderUniformLocations

type MaterialShaderUniformLocations struct {
	Projection      uint16
	View            uint16
	AmbientColour   uint16
	ViewPosition    uint16
	Shininess       uint16
	DiffuseColour   uint16
	DiffuseTexture  uint16
	SpecularTexture uint16
	NormalTexture   uint16
	Model           uint16
	RenderMode      uint16
}

type MemoryRange

type MemoryRange struct {
	/** @brief The Offset in bytes. */
	Offset uint64
	/** @brief The size in bytes. */
	Size uint64
}

* @brief A range, typically of memory

func GetAlignedRange

func GetAlignedRange(offset, size, granularity uint64) *MemoryRange

type Mesh

type Mesh struct {
	UniqueID      uint32
	Generation    uint8
	GeometryCount uint16
	Geometries    []*Geometry
	Transform     *math.Transform
}

type MeshLoadParams

type MeshLoadParams struct {
	ResourceName string
	OutMesh      *Mesh
	MeshResource *Resource
}

Also used as result_data from job.

type MeshPacketData

type MeshPacketData struct {
	MeshCount uint32
	Meshes    []*Mesh
}

type PickPacketData

type PickPacketData struct {
	WorldMeshData      *MeshPacketData
	WorldGeometryCount uint32
	UIMeshData         *MeshPacketData
	UIGeometryCount    uint32
	// TODO: temp
	TextCount uint32
	Texts     []*UIText

	// This is only neede for when we build the packet
	RequiredInstanceCount uint32
}

type PickShaderInfo

type PickShaderInfo struct {
	FOV        float32
	NearClip   float32
	FarClip    float32
	Projection math.Mat4
	View       math.Mat4

	IDColorLocation    uint16
	ModelLocation      uint16
	ProjectionLocation uint16
	ViewLocation       uint16

	Renderpass *RenderPass
	Shader     *Shader
}

type RenderBuffer

type RenderBuffer struct {
	/** @brief The type of buffer, which typically determines its use. */
	RenderBufferType RenderBufferType
	/** @brief The total size of the buffer in bytes. */
	TotalSize uint64
	/** @brief The buffer freelist, if used. */
	Buffer []interface{}
	/** @brief Contains internal data for the renderer-API-specific buffer. */
	InternalData interface{}
}

type RenderBufferType

type RenderBufferType int
const (
	/** @brief Buffer is use is unknown. Default, but usually invalid. */
	RENDERBUFFER_TYPE_UNKNOWN RenderBufferType = iota
	/** @brief Buffer is used for vertex data. */
	RENDERBUFFER_TYPE_VERTEX
	/** @brief Buffer is used for index data. */
	RENDERBUFFER_TYPE_INDEX
	/** @brief Buffer is used for uniform data. */
	RENDERBUFFER_TYPE_UNIFORM
	/** @brief Buffer is used for staging purposes (i.e. from host-visible to device-local memory) */
	RENDERBUFFER_TYPE_STAGING
	/** @brief Buffer is used for reading purposes (i.e copy to from device local, then read) */
	RENDERBUFFER_TYPE_READ
	/** @brief Buffer is used for data storage. */
	RENDERBUFFER_TYPE_STORAGE
)

type RenderPacket

type RenderPacket struct {
	DeltaTime float64
	/** The number of views to be rendered. */
	ViewCount uint16
	/** An array of ViewPackets to be rendered. */
	ViewPackets []*RenderViewPacket
}

*

  • @brief A structure which is generated by the application and sent once
  • to the renderer to render a given frame. Consists of any data required,
  • such as delta time and a collection of views to be rendered.

type RenderPass

type RenderPass struct {
	/** @brief The id of the renderpass */
	ID uint16
	/** @brief The current render area of the renderpass. */
	RenderArea math.Vec4
	/** @brief The clear colour used for this renderpass. */
	ClearColour math.Vec4
	/** @brief The clear flags for this renderpass. */
	ClearFlags uint8
	/** @brief The number of render targets for this renderpass. */
	RenderTargetCount uint8
	/** @brief An array of render Targets used by this renderpass. */
	Targets []*RenderTarget
	/** @brief Internal renderpass data */
	InternalData interface{}
}

*

  • @brief Represents a generic RenderPass.

type RenderPassConfig

type RenderPassConfig struct {
	/** @brief The Name of this renderpass. */
	Name string
	/** @brief The current render area of the renderpass. */
	RenderArea math.Vec4
	/** @brief The clear colour used for this renderpass. */
	ClearColour math.Vec4
	/** @brief The clear flags for this renderpass. */
	ClearFlags RenderpassClearFlag
	Depth      float32
	Stencil    uint32
	/** @brief The number of render targets created according to the render target config. */
	RenderTargetCount uint8
	/** @brief The render target configuration. */
	Target *RenderTargetConfig
}

type RenderTarget

type RenderTarget struct {
	/** @brief The number of attachments */
	AttachmentCount uint8
	/** @brief An array of Attachments (pointers to textures). */
	Attachments []*RenderTargetAttachment
	/** @brief The renderer API internal framebuffer object. */
	InternalFramebuffer vk.Framebuffer //interface{}
}

* @brief Represents a render target, which is used for rendering to a texture or set of textures.

type RenderTargetAttachment

type RenderTargetAttachment struct {
	RenderTargetAttachmentType RenderTargetAttachmentType
	Source                     RenderTargetAttachmentSource
	LoadOperation              RenderTargetAttachmentLoadOperation
	StoreOperation             RenderTargetAttachmentStoreOperation
	PresentAfter               bool
	Texture                    *Texture
}

type RenderTargetAttachmentConfig

type RenderTargetAttachmentConfig struct {
	RenderTargetAttachmentType RenderTargetAttachmentType
	Source                     RenderTargetAttachmentSource
	LoadOperation              RenderTargetAttachmentLoadOperation
	StoreOperation             RenderTargetAttachmentStoreOperation
	PresentAfter               bool
}

type RenderTargetAttachmentLoadOperation

type RenderTargetAttachmentLoadOperation uint32
const (
	RENDER_TARGET_ATTACHMENT_LOAD_OPERATION_DONT_CARE RenderTargetAttachmentLoadOperation = 0x0
	RENDER_TARGET_ATTACHMENT_LOAD_OPERATION_LOAD      RenderTargetAttachmentLoadOperation = 0x1
)

type RenderTargetAttachmentSource

type RenderTargetAttachmentSource uint32
const (
	RENDER_TARGET_ATTACHMENT_SOURCE_DEFAULT RenderTargetAttachmentSource = 0x1
	RENDER_TARGET_ATTACHMENT_SOURCE_VIEW    RenderTargetAttachmentSource = 0x2
)

type RenderTargetAttachmentStoreOperation

type RenderTargetAttachmentStoreOperation uint32
const (
	RENDER_TARGET_ATTACHMENT_STORE_OPERATION_DONT_CARE RenderTargetAttachmentStoreOperation = 0x0
	RENDER_TARGET_ATTACHMENT_STORE_OPERATION_STORE     RenderTargetAttachmentStoreOperation = 0x1
)

type RenderTargetAttachmentType

type RenderTargetAttachmentType uint32
const (
	RENDER_TARGET_ATTACHMENT_TYPE_COLOUR  RenderTargetAttachmentType = 0x1
	RENDER_TARGET_ATTACHMENT_TYPE_DEPTH   RenderTargetAttachmentType = 0x2
	RENDER_TARGET_ATTACHMENT_TYPE_STENCIL RenderTargetAttachmentType = 0x4
)

type RenderTargetConfig

type RenderTargetConfig struct {
	Attachments []*RenderTargetAttachmentConfig
}

type RenderView

type RenderView struct {
	/** @brief The unique identifier of this view. */
	ID uint16
	/** @brief The Name of the view. */
	Name string
	/** @brief The current Width of this view. */
	Width uint16
	/** @brief The current Height of this view. */
	Height uint16
	/** @brief The known type of this view. */
	RenderViewType RenderViewKnownType
	/** @brief The number of renderpasses used by this view. */
	RenderpassCount uint8
	/** @brief An array of pointers to renderpasses used by this view. */
	Passes []*RenderPass
	/** @brief The name of the custom shader used by this view, if there is one. */
	CustomShaderName string
	/** @brief The internal, view-specific data for this view. */
	InternalData interface{}
}

*

  • @brief A render view instance, responsible for the generation
  • of view packets based on internal logic and given config.

type RenderViewConfig

type RenderViewConfig struct {
	/** @brief The Name of the view. */
	Name string
	/**
	 * @brief The name of a custom shader to be used
	 * instead of the view's default. Must be 0 if
	 * not used.
	 */
	CustomShaderName string
	/** @brief The Width of the view. Set to 0 for 100% Width. */
	Width uint16
	/** @brief The Height of the view. Set to 0 for 100% Height. */
	Height uint16
	/** @brief The known type of the view. Used to associate with view logic. */
	RenderViewType RenderViewKnownType
	/** @brief The source of the view matrix. */
	ViewMatrixSource RenderViewViewMatrixSource
	/** @brief The source of the projection matrix. */
	ProjectionMatrixSource RenderViewProjectionMatrixSource
	/** @brief The number of renderpasses used in this view. */
	PassCount uint8
	/** @brief The configuration of renderpasses used in this view. */
	PassConfigs []*RenderPassConfig
}

*

  • @brief The configuration of a render view.
  • Used as a serialization target.

type RenderViewKnownType

type RenderViewKnownType int

* @brief Known render view types, which have logic associated with them.

const (
	/** @brief A view which only renders objects with *no* transparency. */
	RENDERER_VIEW_KNOWN_TYPE_WORLD RenderViewKnownType = 0x01
	/** @brief A view which only renders ui objects. */
	RENDERER_VIEW_KNOWN_TYPE_UI RenderViewKnownType = 0x02
	/** @brief A view which only renders skybox objects. */
	RENDERER_VIEW_KNOWN_TYPE_SKYBOX RenderViewKnownType = 0x03
	/** @brief A view which only renders ui and world objects to be picked. */
	RENDERER_VIEW_KNOWN_TYPE_PICK RenderViewKnownType = 0x04
)

type RenderViewPacket

type RenderViewPacket struct {
	/** @brief A constant pointer to the View this packet is associated with. */
	View *RenderView
	/** @brief The current view matrix. */
	ViewMatrix math.Mat4
	/** @brief The current projection matrix. */
	ProjectionMatrix math.Mat4
	/** @brief The current view position, if applicable. */
	ViewPosition math.Vec3
	/** @brief The current scene ambient colour, if applicable. */
	AmbientColour math.Vec4
	/** @brief The number of geometries to be drawn. */
	GeometryCount uint32
	/** @brief The Geometries to be drawn. */
	Geometries []*GeometryRenderData
	/** @brief The name of the custom shader to use, if applicable. Otherwise 0. */
	CustomShadername string
	/** @brief Holds a pointer to freeform data, typically understood both by the object and consuming view. */
	ExtendedData interface{}
}

*

  • @brief A packet for and generated by a render view, which contains
  • data about what is to be rendered.

type RenderViewPick

type RenderViewPick struct {
	UIShaderInfo    *PickShaderInfo
	WorldShaderInfo *PickShaderInfo

	// Used as the colour attachment for both renderpasses.
	ColourTargetAttachmentTexture *Texture
	// The depth attachment.
	DepthTargetAttachmentTexture *Texture

	InstanceCount   int32
	InstanceUpdated []bool

	MouseX int16
	MouseY int16

	WorldCamera *components.Camera
}

func (*RenderViewPick) OnMouseMoved

func (vp *RenderViewPick) OnMouseMoved(event_data core.EventContext)

type RenderViewProjectionMatrixSource

type RenderViewProjectionMatrixSource int

* @brief Known projection matrix sources.

const (
	RENDER_VIEW_PROJECTION_MATRIX_SOURCE_DEFAULT_PERSPECTIVE  RenderViewProjectionMatrixSource = 0x01
	RENDER_VIEW_PROJECTION_MATRIX_SOURCE_DEFAULT_ORTHOGRAPHIC RenderViewProjectionMatrixSource = 0x02
)

type RenderViewSkybox

type RenderViewSkybox struct {
	ShaderID         uint32
	FOV              float32
	NearClip         float32
	FarClip          float32
	ProjectionMatrix math.Mat4
	WorldCamera      *components.Camera
	// uniform locations
	ProjectionLocation uint16
	ViewLocation       uint16
	CubeMapLocation    uint16
	// Shader
	Shader *Shader
}

type RenderViewUI

type RenderViewUI struct {
	ShaderID              uint32
	FOV                   float32
	NearClip              float32
	FarClip               float32
	ProjectionMatrix      math.Mat4
	ViewMatrix            math.Mat4
	DiffuseMapLocation    uint16
	DiffuseColourLocation uint16
	ModelLocation         uint16
	Shader                *Shader
}

type RenderViewViewMatrixSource

type RenderViewViewMatrixSource int

* @brief Known view matrix sources.

const (
	RENDER_VIEW_VIEW_MATRIX_SOURCE_SCENE_CAMERA RenderViewViewMatrixSource = 0x01
	RENDER_VIEW_VIEW_MATRIX_SOURCE_UI_CAMERA    RenderViewViewMatrixSource = 0x02
	RENDER_VIEW_VIEW_MATRIX_SOURCE_LIGHT_CAMERA RenderViewViewMatrixSource = 0x03
)

type RenderViewWorld

type RenderViewWorld struct {
	ShaderID         uint32
	FOV              float32
	NearClip         float32
	FarClip          float32
	ProjectionMatrix math.Mat4
	WorldCamera      *components.Camera

	AmbientColour math.Vec4
	RenderMode    RendererDebugViewMode

	// Shader
	Shader *Shader
}

func (*RenderViewWorld) OnSetRenderMode

func (vw *RenderViewWorld) OnSetRenderMode(context core.EventContext)

type RendererBackendConfig

type RendererBackendConfig struct {
	/** @brief The name of the application */
	ApplicationName string
}

type RendererDebugViewMode

type RendererDebugViewMode uint32
const (
	RENDERER_VIEW_MODE_DEFAULT  RendererDebugViewMode = 0
	RENDERER_VIEW_MODE_LIGHTING RendererDebugViewMode = 1
	RENDERER_VIEW_MODE_NORMALS  RendererDebugViewMode = 2
)

type RenderpassClearFlag

type RenderpassClearFlag uint32

*

  • @brief The types of clearing to be done on a renderpass.
  • Can be combined together for multiple clearing functions.
const (
	/** @brief No clearing should be done. */
	RENDERPASS_CLEAR_NONE_FLAG RenderpassClearFlag = 0x0
	/** @brief Clear the colour buffer. */
	RENDERPASS_CLEAR_COLOUR_BUFFER_FLAG RenderpassClearFlag = 0x1
	/** @brief Clear the depth buffer. */
	RENDERPASS_CLEAR_DEPTH_BUFFER_FLAG RenderpassClearFlag = 0x2
	/** @brief Clear the stencil buffer. */
	RENDERPASS_CLEAR_STENCIL_BUFFER_FLAG RenderpassClearFlag = 0x3
)

type Resource

type Resource struct {
	/** @brief The identifier of the loader which handles this resource. */
	LoaderID uint32
	/** @brief The name of the resource. */
	Name string
	/** @brief The full file path of the resource. */
	FullPath string
	/** @brief The size of the resource data in bytes. */
	DataSize uint64
	/** @brief The resource data. */
	Data interface{}
}

*

  • @brief A generic structure for a resource. All resource loaders
  • load data into these.

type ResourceHeader

type ResourceHeader struct {
	/** @brief A magic number indicating the file as a kohi binary file. */
	MagicNumber uint32
	/** @brief The resource type. Maps to the enum resource_type. */
	ResourceType ResourceType
	/** @brief The format version this resource uses. */
	Version uint8
	/** @brief Reserved for future header data.. */
	Reserved uint16
}

*

  • @brief The header data for binary resource types.

type ResourceType

type ResourceType int
const (
	/** @brief Text resource type. */
	ResourceTypeText ResourceType = iota
	/** @brief Binary resource type. */
	ResourceTypeBinary
	/** @brief Image resource type. */
	ResourceTypeImage
	/** @brief Material resource type. */
	ResourceTypeMaterial
	/** @brief Shader resource type (or more accurately shader config). */
	ResourceTypeShader
	/** @brief Mesh resource type (collection of geometry configs). */
	ResourceTypeMesh
	/** @brief Model resource type */
	ResourceTypeModel
	/** @brief Bitmap font resource type. */
	ResourceTypeBitmapFont
	/** @brief System font resource type. */
	ResourceTypeSystemFont
	/** @brief Custom resource type. Used by loaders outside the core engine. */
	ResourceTypeCustom
	ResourceTypeNone
)

* @brief Pre-defined resource types.

type Shader

type Shader struct {
	/** @brief The shader identifier */
	ID uint32

	Name string

	/**
	 * @brief The amount of bytes that are required for UBO alignment.
	 *
	 * This is used along with the UBO size to determine the ultimate
	 * stride, which is how much the UBOs are spaced out in the buffer.
	 * For example, a required alignment of 256 means that the stride
	 * must be a multiple of 256 (true for some nVidia cards).
	 */
	RequiredUboAlignment uint64

	/** @brief The actual size of the global uniform buffer object. */
	GlobalUboSize uint64
	/** @brief The stride of the global uniform buffer object. */
	GlobalUboStride uint64
	/**
	 * @brief The offset in bytes for the global UBO from the beginning
	 * of the uniform buffer.
	 */
	GlobalUboOffset uint64

	/** @brief The actual size of the instance uniform buffer object. */
	UboSize uint64

	/** @brief The stride of the instance uniform buffer object. */
	UboStride uint64

	/** @brief The total size of all push constant ranges combined. */
	PushConstantSize uint64
	/** @brief The push constant stride, aligned to 4 bytes as required by Vulkan. */
	PushConstantStride uint64

	/** @brief An array of global texture map pointers */
	GlobalTextureMaps []*TextureMap

	/** @brief The number of instance textures. */
	InstanceTextureCount uint8

	BoundScope ShaderScope

	/** @brief The identifier of the currently bound instance. */
	BoundInstanceID uint32
	/** @brief The currently bound instance's ubo offset. */
	BoundUboOffset uint32

	/** @brief A hashtable to store uniform index/locations by name. */
	UniformLookup map[string]uint16

	/** @brief An array of Uniforms in this shader. */
	Uniforms []ShaderUniform

	/** @brief An array of Attributes. */
	Attributes []ShaderAttribute

	/** @brief The internal State of the shader. */
	State ShaderState

	/** @brief The number of push constant ranges. */
	PushConstantRangeCount uint8
	/** @brief An array of push constant ranges. */
	PushConstantRanges []*MemoryRange
	/** @brief The size of all attributes combined, a.k.a. the size of a vertex. */
	AttributeStride uint16

	/** @brief aUsed to ensure the shader's globals are only updated once per frame. */
	RenderFrameNumber uint64

	Flags ShaderFlagBits

	/** @brief An opaque pointer to hold renderer API specific data. Renderer is responsible for creation and destruction of this.  */
	InternalData interface{}
}

*

  • @brief Represents a shader on the frontend.

type ShaderAttribute

type ShaderAttribute struct {
	/** @brief The attribute Name. */
	Name string
	/** @brief The attribute type. */
	ShaderUniformAttributeType ShaderAttributeType
	/** @brief The attribute Size in bytes. */
	Size uint32
}

*

  • @brief Represents a single shader vertex attribute.

type ShaderAttributeConfig

type ShaderAttributeConfig struct {
	/** @brief The name of the attribute. */
	Name string
	/** @brief The size of the attribute. */
	Size uint8
	/** @brief The type of the attribute. */
	ShaderAttributeType ShaderAttributeType
}

* @brief Configuration for an attribute.

type ShaderAttributeType

type ShaderAttributeType uint

* @brief Available attribute types.

const (
	ShaderAttribTypeFloat32   ShaderAttributeType = 0
	ShaderAttribTypeFloat32_2 ShaderAttributeType = 1
	ShaderAttribTypeFloat32_3 ShaderAttributeType = 2
	ShaderAttribTypeFloat32_4 ShaderAttributeType = 3
	ShaderAttribTypeMatrix4   ShaderAttributeType = 4
	ShaderAttribTypeInt8      ShaderAttributeType = 5
	ShaderAttribTypeUint8     ShaderAttributeType = 6
	ShaderAttribTypeInt16     ShaderAttributeType = 7
	ShaderAttribTypeUint16    ShaderAttributeType = 8
	ShaderAttribTypeInt32     ShaderAttributeType = 9
	ShaderAttribTypeUint32    ShaderAttributeType = 10
)

func ShaderAttributeTypeFromString

func ShaderAttributeTypeFromString(s string) (ShaderAttributeType, uint8, error)

type ShaderConfig

type ShaderConfig struct {
	/** @brief The name of the shader to be created. */
	Name string
	/** @brief The face cull mode to be used. Default is BACK if not supplied. */
	CullMode FaceCullMode
	/** @brief The collection of attributes. */
	Attributes []*ShaderAttributeConfig
	/** @brief The collection of uniforms. */
	Uniforms []*ShaderUniformConfig
	/** @brief The name of the renderpass used by this shader. */
	RenderpassName string
	/** @brief The collection of stages. */
	Stages []ShaderStage
	/** @brief The collection of stage names. Must align with stages array. */
	StageNames []string
	/** @brief The collection of stage file names to be loaded (one per stage). Must align with stages array. */
	StageFilenames []string
	/** @brief Indicates if depth testing should be done. */
	DepthTest bool
	/**
	 * @brief Indicates if the results of depth testing should be written to the depth buffer.
	 * NOTE: This is ignored if depth_test is false.
	 */
	DepthWrite bool
}

*

  • @brief Configuration for a shader. Typically created and
  • destroyed by the shader resource loader, and set to the
  • properties found in a .shadercfg resource file.

type ShaderFlagBits

type ShaderFlagBits uint32

type ShaderFlags

type ShaderFlags uint32
const (
	SHADER_FLAG_NONE        ShaderFlags = 0x0
	SHADER_FLAG_DEPTH_TEST  ShaderFlags = 0x1
	SHADER_FLAG_DEPTH_WRITE ShaderFlags = 0x2
)

type ShaderScope

type ShaderScope int

*

  • @brief Defines shader scope, which indicates how
  • often it gets updated.
const (
	/** @brief Global shader scope, generally updated once per frame. */
	ShaderScopeGlobal ShaderScope = 0
	/** @brief Instance shader scope, generally updated "per-instance" of the shader. */
	ShaderScopeInstance ShaderScope = 1
	/** @brief Local shader scope, generally updated per-object */
	ShaderScopeLocal ShaderScope = 2
)

type ShaderStage

type ShaderStage int

* @brief Shader stages available in the system.

const (
	ShaderStageVertex   ShaderStage = 0x00000001
	ShaderStageGeometry ShaderStage = 0x00000002
	ShaderStageFragment ShaderStage = 0x00000004
	ShaderStageCompute  ShaderStage = 0x0000008
)

func ShaderStageFromString

func ShaderStageFromString(s string) (ShaderStage, error)

type ShaderState

type ShaderState int

*

  • @brief Represents the current state of a given shader.
const (
	/** @brief The shader has not yet gone through the creation process, and is unusable.*/
	SHADER_STATE_NOT_CREATED ShaderState = iota
	/** @brief The shader has gone through the creation process, but not initialization. It is unusable.*/
	SHADER_STATE_UNINITIALIZED
	/** @brief The shader is created and initialized, and is ready for use.*/
	SHADER_STATE_INITIALIZED
)

type ShaderUniform

type ShaderUniform struct {
	/** @brief The Offset in bytes from the beginning of the uniform set (global/instance/local) */
	Offset uint64
	/**
	 * @brief The Location to be used as a lookup. Typically the same as the index except for samplers,
	 * which is used to lookup texture index within the internal array at the given scope (global/instance).
	 */
	Location uint16
	/** @brief Index into the internal uniform array. */
	Index uint16
	/** @brief The Size of the uniform, or 0 for samplers. */
	Size uint16
	/** @brief The index of the descriptor set the uniform belongs to (0=global, 1=instance, INVALID_ID=local). */
	SetIndex uint8
	/** @brief The Scope of the uniform. */
	Scope ShaderScope
	/** @brief The type of uniform. */
	ShaderUniformType ShaderUniformType
}

*

  • @brief Represents a single entry in the internal uniform array.

type ShaderUniformConfig

type ShaderUniformConfig struct {
	/** @brief The name of the uniform. */
	Name string
	/** @brief The size of the uniform. */
	Size uint8
	/** @brief The location of the uniform. */
	Location uint32
	/** @brief The type of the uniform. */
	ShaderUniformType ShaderUniformType
	/** @brief The scope of the uniform. */
	Scope ShaderScope
}

* @brief Configuration for a uniform.

type ShaderUniformType

type ShaderUniformType uint

* @brief Available uniform types.

const (
	ShaderUniformTypeFloat32   ShaderUniformType = 0
	ShaderUniformTypeFloat32_2 ShaderUniformType = 1
	ShaderUniformTypeFloat32_3 ShaderUniformType = 2
	ShaderUniformTypeFloat32_4 ShaderUniformType = 3
	ShaderUniformTypeInt8      ShaderUniformType = 4
	ShaderUniformTypeUint8     ShaderUniformType = 5
	ShaderUniformTypeInt16     ShaderUniformType = 6
	ShaderUniformTypeUint16    ShaderUniformType = 7
	ShaderUniformTypeInt32     ShaderUniformType = 8
	ShaderUniformTypeUint32    ShaderUniformType = 9
	ShaderUniformTypeMatrix4   ShaderUniformType = 10
	ShaderUniformTypeSampler   ShaderUniformType = 11
	ShaderUniformTypeCustom    ShaderUniformType = 255
)

func ShaderUniformTypeFromString

func ShaderUniformTypeFromString(s string) (ShaderUniformType, uint8, error)

type Skybox

type Skybox struct {
	Cubemap    *TextureMap
	Geometry   *Geometry
	InstanceID uint32
	/** @brief Synced to the renderer's current frame number when the material has been applied that frame. */
	RenderFrameNumber uint64
}

type SkyboxPacketData

type SkyboxPacketData struct {
	Skybox *Skybox
}

type SystemFontConfig

type SystemFontConfig struct {
	Name         string
	DefaultSize  uint16
	ResourceName string
}

type SystemFontFace

type SystemFontFace struct {
	Name string
}

type SystemFontResourceData

type SystemFontResourceData struct {
	Fonts      []*SystemFontFace
	BinarySize uint64
	FontBinary interface{}
}

type Texture

type Texture struct {
	/** @brief The unique texture identifier. */
	ID uint32
	/** @brief The texture type. */
	TextureType TextureType
	/** @brief The texture Width. */
	Width uint32
	/** @brief The texture Height. */
	Height uint32
	/** @brief The number of channels in the texture. */
	ChannelCount uint8
	/** @brief Holds various Flags for this texture. */
	Flags TextureFlagBits
	/** @brief The texture Generation. Incremented every time the data is reloaded. */
	Generation uint32
	/** @brief The texture Name. */
	Name string
	/** @brief The raw texture data (pixels). */
	InternalData interface{}
}

*

  • @brief Represents a texture.

type TextureFilter

type TextureFilter int

* @brief Represents supported texture filtering modes.

const (
	/** @brief Nearest-neighbor filtering. */
	TextureFilterModeNearest TextureFilter = 0x0
	/** @brief Linear (i.e. bilinear) filtering.*/
	TextureFilterModeLinear TextureFilter = 0x1
)

type TextureFlag

type TextureFlag int
const (
	/** @brief Indicates if the texture has transparency. */
	TextureFlagHasTransparency TextureFlag = 0x1
	/** @brief Indicates if the texture can be written (rendered) to. */
	TextureFlagIsWriteable TextureFlag = 0x2
	/** @brief Indicates if the texture was created via wrapping vs traditional creation. */
	TextureFlagIsWrapped TextureFlag = 0x4
	/** @brief Indicates the texture is a depth texture. */
	TextureFlagDepth TextureFlag = 0x8
)

type TextureFlagBits

type TextureFlagBits uint8

* @brief Holds bit flags for textures..

type TextureLoadParams

type TextureLoadParams struct {
	ResourceName      string
	OutTexture        *Texture
	TempTexture       *Texture
	CurrentGeneration uint32
	ImageResource     *Resource
}

Also used as result_data from job.

type TextureMap

type TextureMap struct {
	/** @brief A pointer to a Texture. */
	Texture *Texture
	/** @brief The Use of the texture */
	Use TextureUse
	/** @brief Texture filtering mode for minification. */
	FilterMinify TextureFilter
	/** @brief Texture filtering mode for magnification. */
	FilterMagnify TextureFilter
	/** @brief The repeat mode on the U axis (or X, or S) */
	RepeatU TextureRepeat
	/** @brief The repeat mode on the V axis (or Y, or T) */
	RepeatV TextureRepeat
	/** @brief The repeat mode on the W axis (or Z, or U) */
	RepeatW TextureRepeat
	/** @brief A pointer to internal, render API-specific data. Typically the internal sampler. */
	InternalData interface{}
}

*

  • @brief A structure which maps a texture, use and
  • other properties.

type TextureReference

type TextureReference struct {
	ReferenceCount uint64
	Handle         uint32
	AutoRelease    bool
}

type TextureRepeat

type TextureRepeat int
const (
	TextureRepeatRepeat         TextureRepeat = 0x1
	TextureRepeatMirroredRepeat TextureRepeat = 0x2
	TextureRepeatClampToEdge    TextureRepeat = 0x3
	TextureRepeatClampToBorder  TextureRepeat = 0x4
)

type TextureType

type TextureType int

*

  • @brief Represents various types of textures.
const (
	/** @brief A standard two-dimensional texture. */
	TextureType2d TextureType = iota
	/** @brief A cube texture, used for cubemaps. */
	TextureTypeCube
)

type TextureUse

type TextureUse int

* @brief A collection of texture uses

const (
	/** @brief An unknown use. This is default, but should never actually be used. */
	TextureUseUnknown TextureUse = 0x00
	/** @brief The texture is used as a diffuse map. */
	TextureUseMapDiffuse TextureUse = 0x01
	/** @brief The texture is used as a specular map. */
	TextureUseMapSpecular TextureUse = 0x02
	/** @brief The texture is used as a normal map. */
	TextureUseMapNormal TextureUse = 0x03
	/** @brief The texture is used as a cube map. */
	TextureUseMapCubemap TextureUse = 0x04
)

type UIPacketData

type UIPacketData struct {
	MeshData *MeshPacketData
	Texts    []*UIText
}

type UIShaderUniformLocations

type UIShaderUniformLocations struct {
	Projection     uint16
	View           uint16
	DiffuseColour  uint16
	DiffuseTexture uint16
	Model          uint16
}

type UIText

type UIText struct {
	UniqueID          uint32
	InstanceID        uint32
	UITextType        UITextType
	Data              *FontData
	VertexBuffer      *RenderBuffer
	IndexBuffer       *RenderBuffer
	Text              string
	Transform         *math.Transform
	RenderFrameNumber uint64
}

type UITextType

type UITextType int
const (
	UI_TEXT_TYPE_BITMAP UITextType = iota
	UI_TEXT_TYPE_SYSTEM
)

Jump to

Keyboard shortcuts

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