Documentation
¶
Index ¶
- Variables
- func GetCubeDef(id string) *t.Cube
- func GetCubeDefFromRef(r t.CubeRef) *t.Cube
- func GetCubeRef(id string) t.CubeRef
- func GetPartMesh(path string) *c3d.VoxelMesh
- func GetUITile(p string) t.FaceIndex
- func LoadMods(mods ...string) error
- func ReloadModInfo() error
- type AFQuat
- type Animation
- type AnimationFrame
- type Mod
- type Model
- type ModelDescriptor
- type ModelPartDescriptor
- type Vox
Constants ¶
This section is empty.
Variables ¶
var CubeDefs []*t.Cube
CubeDefs is the CubeRef to Cube lookup table.
var Faces *c3d.FaceAtlas = c3d.NewFaceAtlas()
Faces is the global face atlas.
var Mods = map[string]*Mod{}
Mods is the global map of all mods by ID
var UITiles *c3d.FaceAtlas = c3d.NewFaceAtlas()
UITiles is the face atlas for all UI tiles in all mods.
var VoxDefs = []*Vox{}
VoxDefs is the list of voxel definitions by internal ID.
Functions ¶
func GetCubeDefFromRef ¶
GetCubeDefFromRef returns the cube definition referenced by the cube reference.
func GetCubeRef ¶
GetCubeRef returns the CubeRef assigned to the given id.
func GetPartMesh ¶
GetPartMesh returns the part mesh by resource path.
func ReloadModInfo ¶
func ReloadModInfo() error
ReloadModInfo reloads all top-level info for all mods present.
Types ¶
type AFQuat ¶
type AFQuat [3]float32
AFQuat is the JSON structure used to hold X, Y, Z rotations to turn into quaternions.
func (*AFQuat) UnmarshalJSON ¶
type Animation ¶
type Animation []*AnimationFrame
Animation contains the information and functionality to play an animation loop on a model. Animations consist of rotations to joints only.
type AnimationFrame ¶
type AnimationFrame struct { Time float32 `json:"time"` // Time T for interpolation to Q Rotations map[string]AFQuat `json:"rotations"` // Map of part ID's to quaternions that describe that part's final rotation }
AnimationFrame describes a single frame of the animation.
type Mod ¶
type Mod struct { ID string `json:"-"` // Unique ID of the mod Name string `json:"name"` // Descriptive name of the mod Description string `json:"description"` // Description of the mod // contains filtered or unexported fields }
Mod manages a bundle of cubit engine content in separate external files.
type Model ¶
type Model struct { DrawDescriptor *c3d.ModelDrawDescriptor // The draw descriptor this model manages Bounds t.AABB // Model bounds in world coordinates // contains filtered or unexported fields }
Model describes a hierarchy of parts with defined animations.
func NewModel ¶
NewModel constructs a new model from the model descriptor at the resource path given.
func (*Model) StartAnimation ¶
StartAnimation starts the animation identified by the resource path on the model on the given animation layer.
type ModelDescriptor ¶
type ModelDescriptor struct { Bounds t.AABB `json:"bounds"` // Bounding box of the model Root *ModelPartDescriptor `json:"root"` // Root part }
ModelDescriptor describes how to initialize a model.
type ModelPartDescriptor ¶
type ModelPartDescriptor struct { ID string `json:"id"` // ID of the part for animations Mesh string `json:"mesh"` // Absolute path to the part mesh Origin mgl32.Vec3 `json:"origin"` // Center point / rotation point of the part Orientation t.Orientation `json:"orientation"` // T-pose orientation Children []ModelPartDescriptor `json:"children"` // Child parts }
ModelPartDescriptor describes how to initialize a part attached to a model.