Skip to content

package framework

import "kaiju/framework"

Functions

CreateDrawingFromMeshBasicLit

func CreateDrawingFromMeshBasicLit(host *engine.Host, mesh *rendering.Mesh, textures []*rendering.Texture) (rendering.Drawing, error)

CreateDrawingFromMeshBasicLitDynamic

func CreateDrawingFromMeshBasicLitDynamic(host *engine.Host, mesh *rendering.Mesh, textures []*rendering.Texture) (rendering.Drawing, error)

CreateDrawingFromMeshUnlit

func CreateDrawingFromMeshUnlit(host *engine.Host, mesh *rendering.Mesh, textures []*rendering.Texture) (rendering.Drawing, error)

CreateDrawingFromMeshUnlitTransparent

func CreateDrawingFromMeshUnlitTransparent(host *engine.Host, mesh *rendering.Mesh, textures []*rendering.Texture) (rendering.Drawing, error)

RegisterDrawingSpecification

func RegisterDrawingSpecification(spec DrawingSpecification)

SpawnTemplate

func SpawnTemplate(id string, host *engine.Host, parent *engine.Entity) (*engine.Entity, error)

SpawnTemplate loads an entity template asset identified by id from the host's asset database, deserializes it into a stages.EntityDescription (using JSON on desktop debug builds or the archive deserializer in other builds), and creates a new entity configured from that description. If parent is non-nil the new entity will be parented to it. The created entity is initialized via stages.SetupEntityFromDescription and returned, or an error is returned if the asset cannot be read or deserialized.

SpawnTemplateWithTransform

func SpawnTemplateWithTransform(id string, host *engine.Host, parent *engine.Entity, pos, rot, scale matrix.Vec3) (*engine.Entity, error)

SpawnTemplateWithTransform loads an entity template asset identified by id, creates a new entity from that template (optionally parented to parent), then sets the entity's transform to the provided position, rotation and scale. It is a thin wrapper around SpawnTemplate that applies the transform before returning the created entity or any encountered error.

Parameters: - id: template asset id to load from the host's asset database - host: the engine host used to create the entity and read assets - parent: optional parent entity to attach the new entity to - pos, rot, scale: transform components applied to the new entity

Returns the newly created entity or a non-nil error if the template could not be read or deserialized.

Types

DrawingSpecCreateInfo

struct

type DrawingSpecCreateInfo struct {
    LoadedMesh    load_result.Result
    Meshes        []*rendering.Mesh
    Textures      []*rendering.Texture
    SkipMatSearch bool
}

DrawingSpecification

struct

type DrawingSpecification struct {
    Name       string
    RenderInfo []DrawingSpecificationRenderInfo
}

FindDrawingSpecification

func FindDrawingSpecification(name string) DrawingSpecification

DrawingSpecification.CreateDrawings

func (s DrawingSpecification) CreateDrawings(host *engine.Host, info DrawingSpecCreateInfo) (ModelDrawingSlice, error)

DrawingSpecification.IsValid

func (s DrawingSpecification) IsValid() bool

DrawingSpecificationRenderInfo

struct

type DrawingSpecificationRenderInfo struct {
    Material    string
    DataFactory func() rendering.DrawInstance
}

EncryptedInt32

struct

type EncryptedInt32 struct {
    RawValue int32
    // Has unexported fields.
}

EncryptedInt32.Add

func (e *EncryptedInt32) Add(amount int32)

EncryptedInt32.Decrement

func (e *EncryptedInt32) Decrement()

EncryptedInt32.Decrypt

func (e *EncryptedInt32) Decrypt()

EncryptedInt32.Encrypt

func (e *EncryptedInt32) Encrypt()

EncryptedInt32.Increment

func (e *EncryptedInt32) Increment()

EncryptedInt32.SetValue

func (e *EncryptedInt32) SetValue(value int32)

EncryptedInt32.Subtract

func (e *EncryptedInt32) Subtract(amount int32)

EncryptedInt32.Value

func (e EncryptedInt32) Value() int32

ModelDrawing

struct

type ModelDrawing struct {
    Node     *load_result.Node
    MeshName string
    Drawing  rendering.Drawing
}

ModelDrawingSlice

[]ModelDrawing

type ModelDrawingSlice []ModelDrawing

CreateDrawingsBasic

func CreateDrawingsBasic(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

CreateDrawingsBasicLit

func CreateDrawingsBasicLit(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

CreateDrawingsBasicLitDynamic

func CreateDrawingsBasicLitDynamic(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

CreateDrawingsBasicLitStatic

func CreateDrawingsBasicLitStatic(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

CreateDrawingsPBR

func CreateDrawingsPBR(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

CreateDrawingsUnlit

func CreateDrawingsUnlit(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

CreateDrawingsUnlitTransparent

func CreateDrawingsUnlitTransparent(host *engine.Host, res load_result.Result) (ModelDrawingSlice, error)

ModelDrawingSlice.AllDrawings

func (s ModelDrawingSlice) AllDrawings() []rendering.Drawing

ModelDrawingSlice.AllForNode

func (s ModelDrawingSlice) AllForNode(node *load_result.Node) []ModelDrawing