studio

package
v0.0.0-...-3830b07 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STUDIO_NF_FLATSHADE  = 0x0001
	STUDIO_NF_CHROME     = 0x0002
	STUDIO_NF_FULLBRIGHT = 0x0004
	STUDIO_NF_NOMIPS     = 0x0008
	STUDIO_NF_ALPHA      = 0x0010
	STUDIO_NF_ADDITIVE   = 0x0020
	STUDIO_NF_MASKED     = 0x0040
)

lighting options (set Texture.Flags)

View Source
const (
	STUDIO_X     = 0x0001
	STUDIO_Y     = 0x0002
	STUDIO_Z     = 0x0004
	STUDIO_XR    = 0x0008
	STUDIO_YR    = 0x0010
	STUDIO_ZR    = 0x0020
	STUDIO_LX    = 0x0040
	STUDIO_LY    = 0x0080
	STUDIO_LZ    = 0x0100
	STUDIO_AX    = 0x0200
	STUDIO_AY    = 0x0400
	STUDIO_AZ    = 0x0800
	STUDIO_AXR   = 0x1000
	STUDIO_AYR   = 0x2000
	STUDIO_AZR   = 0x4000
	STUDIO_TYPES = 0x7FFF
	STUDIO_RLOOP = 0x8000 // controller that wraps shortest distance
)

motion flags (set SeqDesc.MotionType)

View Source
const (
	SIZEOF_ANIM      = 12
	SIZEOF_ANIMVALUE = 2
)

size of struct (Cannot use unsafe package on GAE)

Variables

This section is empty.

Functions

This section is empty.

Types

type Anim

type Anim struct {
	Offset [6]uint16
}

animations

func (*Anim) GetAnimValue

func (anm *Anim) GetAnimValue(idx int) *AnimValue

func (*Anim) GetAnimValue2

func (anm *Anim) GetAnimValue2(idx int) *AnimValue2

func (*Anim) GetNextAnim

func (anm *Anim) GetNextAnim(idx int) *Anim

type AnimValue

type AnimValue struct {
	Valid byte
	Total byte
}

animation frames

func (*AnimValue) GetAddedPointer

func (anv *AnimValue) GetAddedPointer(idx int) *AnimValue

func (*AnimValue) GetAnimValue2Pointer

func (anv *AnimValue) GetAnimValue2Pointer() *AnimValue2

type AnimValue2

type AnimValue2 struct {
	Value int16
}

type Attachment

type Attachment struct {
	Name    [32]byte
	Type    int32
	Bone    int32
	Org     Vec3 // attachment point
	Vectors [3]Vec3
}

attachment

type BBox

type BBox struct {
	Bone  int32
	Group int32 // intersection group
	BbMin Vec3  // bounding box
	BbMax Vec3
}

intersection boxes

type BodyPart

type BodyPart struct {
	Name       [64]byte
	NumModels  int32
	Base       int32
	ModelIndex int32 // index into models array
}

body part index

func (*BodyPart) GetModel

func (b *BodyPart) GetModel(basebuf *byte, idx int) *Model

type Bone

type Bone struct {
	Name           [32]byte   // bone name for symbolic links
	Parent         int32      // parent bone
	Flags          int32      // ??
	BoneController [6]int32   // bone controller index, -1 == none
	Value          [6]float32 // default DoF values
	Scale          [6]float32 // scale for delta DoF values
}

type BoneController

type BoneController struct {
	Bone  int32 // -1 == 0
	Type  int32 // X, Y, Z, XR, YR, ZR, M
	Start float32
	End   float32
	Rest  int32 // byte index value at rest
	Index int32 // 0-3 user set controller, 4 mouth
}

type Event

type Event struct {
	Frame   int32
	Event   int32
	Type    int32
	Options [64]byte
}

events

type Hdr

type Hdr struct {
	Id      int32
	Version int32
	Name    [64]byte
	Length  int32

	EyePosition Vec3 // ideal eye position
	Min         Vec3 // ideal movement hull size
	Max         Vec3

	BbMin Vec3 // clipping bounding box
	BbMax Vec3

	Flags int32

	NumBones  int32 // bones
	BoneIndex int32

	NumBoneControllers  int32 // bone controllers
	BoneControllerIndex int32

	NumHitBoxes int32 // complex bounding boxes
	HitBoxIndex int32

	NumSeq   int32 // animation sequences
	SeqIndex int32

	NumSeqGroups  int32 // demand loaded sequences
	SeqGroupIndex int32

	NumTextures      int32 // raw textures
	TextureIndex     int32
	TextureDataIndex int32

	NumSkinRef      int32 // replaceable textures
	NumSkinFamilies int32
	SkinIndex       int32

	NumBodyParts  int32
	BodyPartIndex int32

	NumAttachments  int32 // queryable attachable points
	AttachmentIndex int32

	SoundTable      int32
	SoundIndex      int32
	SoundGroups     int32
	SoundGroupIndex int32

	NumTransitions  int32 // animation node to animation node transition graph
	TransitionIndex int32
}

func NewHdr

func NewHdr(buf []byte) *Hdr

func (*Hdr) GetAttachmentsPtr

func (h *Hdr) GetAttachmentsPtr(buf []byte) *byte

func (*Hdr) GetBodyPartsPtr

func (h *Hdr) GetBodyPartsPtr(buf []byte) *byte

func (*Hdr) GetBoneControllersPtr

func (h *Hdr) GetBoneControllersPtr(buf []byte) *byte

func (*Hdr) GetBonesPtr

func (h *Hdr) GetBonesPtr(buf []byte) *byte

func (*Hdr) GetHitBoxesPtr

func (h *Hdr) GetHitBoxesPtr(buf []byte) *byte

func (*Hdr) GetSeqGroupsPtr

func (h *Hdr) GetSeqGroupsPtr(buf []byte) *byte

func (*Hdr) GetSeqsPtr

func (h *Hdr) GetSeqsPtr(buf []byte) *byte

func (*Hdr) GetSkinRefPtr

func (h *Hdr) GetSkinRefPtr(buf []byte) *byte

func (*Hdr) GetTextureDataPtr

func (h *Hdr) GetTextureDataPtr(buf []byte) *byte

func (*Hdr) GetTexturesPtr

func (h *Hdr) GetTexturesPtr(buf []byte) *byte

type Mat34

type Mat34 [3][4]float32

func (*Mat34) ConcatTransforms

func (in1 *Mat34) ConcatTransforms(in2 *Mat34, out *Mat34)

type Mesh

type Mesh struct {
	NumTris   int32
	TriIndex  int32
	SkinRef   int32
	NumNorms  int32 // per mesh normals (no use)
	NormIndex int32 // normal vec3_t (no use)
}

meshes

func (*Mesh) GetNextTricmd

func (me *Mesh) GetNextTricmd(tc *int16, idx int) *int16

func (*Mesh) GetTricmd

func (me *Mesh) GetTricmd(basebuf *byte, idx int) *int16

func (*Mesh) GetTricmdArray

func (me *Mesh) GetTricmdArray(tc *int16) *[4]int16

type Model

type Model struct {
	Name [64]byte

	Type int32

	BoundingRadius float32

	NumMesh   int32
	MeshIndex int32

	NumVerts      int32 // number of unique vertices
	VertInfoIndex int32 // vertex bone info
	VertIndex     int32 // vertex vec3_t
	NumNorms      int32 // number of unique surface normals
	NormInfoIndex int32 // normal bone info
	NormIndex     int32 // normal vec3_t

	NumGroups  int32 // deformation groups
	GroupIndex int32
}

studio models

func (*Model) GetMesh

func (md *Model) GetMesh(basebuf *byte, idx int) *Mesh

func (*Model) GetNormBone

func (md *Model) GetNormBone(basebuf *byte, idx int) byte

func (*Model) GetStudioNorm

func (md *Model) GetStudioNorm(basebuf *byte, idx int) *Vec3

func (*Model) GetStudioVert

func (md *Model) GetStudioVert(basebuf *byte, idx int) *Vec3

func (*Model) GetVertBone

func (md *Model) GetVertBone(basebuf *byte, idx int) byte

type Rgb

type Rgb struct {
	// contains filtered or unexported fields
}

type SeqDesc

type SeqDesc struct {
	Label [32]byte // sequence label

	Fps   float32 // frames per second
	Flags int32   // looping/non-looping flags

	Activity  int32
	ActWeight int32

	NumEvents  int32
	EventIndex int32

	NumFrames int32 // number of frames per sequence

	NumPivots  int32 // number of foot pivots
	PivotIndex int32

	MotionType         int32
	MotionBone         int32
	LinearMovement     Vec3
	AutoMovePosIndex   int32
	AutoMoveAngleIndex int32

	BbMin Vec3 // per sequence bounding box
	BbMax Vec3

	NumBlends int32
	AnimIndex int32 // mstudioanim_t pointer relative to start of sequence group data [blend][bone][X, Y, Z, XR, YR, ZR]

	BlendType   [2]int32   // X, Y, Z, XR, YR, ZR
	BlendStart  [2]float32 // starting value
	BlendEnd    [2]float32 // ending value
	BlendParent int32

	SeqGroup int32 // sequence group for demand loading

	EntryNode int32 // transition node at entry
	ExitNode  int32 // transition node at exit
	NodeFlags int32 // transition rules

	NextSeq int32 // auto advancing sequences
}

sequence descriptions

func (*SeqDesc) GetAnim

func (sd *SeqDesc) GetAnim(basebuf *byte, idx int) *Anim

type SeqGroup

type SeqGroup struct {
	Label   [32]byte // textual name
	Name    [64]byte // file name
	Unused1 int32    // was "cache"  - index pointer
	Unused2 int32    // was "data" -  hack for group 0
}

demand loaded sequence groups

type Texture

type Texture struct {
	Name   [64]byte
	Flags  int32
	Width  int32
	Height int32
	Index  int32
}

skin info

func (*Texture) GetPalBuf

func (tx *Texture) GetPalBuf(basebuf []byte) []byte

func (*Texture) GetPixelBuf

func (tx *Texture) GetPixelBuf(basebuf []byte) []byte

func (*Texture) GetRgb

func (tx *Texture) GetRgb(pixels []byte, pals []byte, pxidx int) *Rgb

func (*Texture) UploadTexture

func (tx *Texture) UploadTexture(basebuf []byte)

type Vec3

type Vec3 [3]float32

func (*Vec3) AngleQuaternion

func (angles *Vec3) AngleQuaternion(qt *Vec4)

func (*Vec3) CrossProduct

func (v1 *Vec3) CrossProduct(v2 *Vec3, cross *Vec3)

func (*Vec3) DotProduct

func (v1 *Vec3) DotProduct(v2 *Vec3) float32

func (*Vec3) DotProductV4

func (v1 *Vec3) DotProductV4(v2 [4]float32) float32

func (*Vec3) VectorCompare

func (v1 *Vec3) VectorCompare(v2 *Vec3) bool

func (*Vec3) VectorIRotate

func (in1 *Vec3) VectorIRotate(in2 *Mat34, out *Vec3)

rotate by the inverse of the matrix

func (*Vec3) VectorLength

func (v *Vec3) VectorLength() float32

func (*Vec3) VectorNormalize

func (v *Vec3) VectorNormalize() float32

func (*Vec3) VectorScale

func (in *Vec3) VectorScale(scale float32, out *Vec3)

func (*Vec3) VectorTransform

func (in1 *Vec3) VectorTransform(in2 *Mat34, out *Vec3)

type Vec4

type Vec4 [4]float32

func (*Vec4) QuaternionMatrix

func (qt *Vec4) QuaternionMatrix(mat *Mat34)

func (*Vec4) QuaternionSlerp

func (p *Vec4) QuaternionSlerp(q Vec4, t float32, qt *Vec4)

Jump to

Keyboard shortcuts

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