wld

package
v1.4.134 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

virtual is Virtual World file format, it is used to make binary world more human readable and editable

Index

Constants

This section is empty.

Variables

View Source
var AsciiVersion = "v0.0.1"

Functions

This section is empty.

Types

type ActorAction added in v1.4.113

type ActorAction struct {
	Unk1           uint32
	LevelOfDetails []ActorLevelOfDetail
}

ActorAction is a declaration of ACTION

type ActorDef added in v1.4.118

type ActorDef struct {
	Tag           string
	Callback      string
	BoundsRef     int32
	CurrentAction uint32
	Location      [6]float32
	Unk1          uint32
	Actions       []ActorAction
	Unk2          uint32
}

ActorDef is a declaration of ACTORDEF

func (*ActorDef) Definition added in v1.4.125

func (a *ActorDef) Definition() string

func (*ActorDef) Read added in v1.4.125

func (a *ActorDef) Read(r *AsciiReadToken) error

func (*ActorDef) Write added in v1.4.125

func (a *ActorDef) Write(w io.Writer) error

type ActorInst added in v1.4.118

type ActorInst struct {
	Tag              string
	Active           int
	SpriteVolumeOnly int
	SphereTag        string
	SoundTag         string
	DefinitionTag    string
	CurrentAction    uint32
	Location         [6]float32
	Unk1             uint32
	BoundingRadius   float32
	Scale            float32
	DMRGBTrackTag    string
	UserData         string
}

ActorInst is a declaration of ACTORINST

func (*ActorInst) Definition added in v1.4.125

func (a *ActorInst) Definition() string

func (*ActorInst) Read added in v1.4.125

func (a *ActorInst) Read(r *AsciiReadToken) error

func (*ActorInst) Write added in v1.4.125

func (a *ActorInst) Write(w io.Writer) error

type ActorLevelOfDetail added in v1.4.118

type ActorLevelOfDetail struct {
	Sprite3DTag           string
	HierarchicalSpriteTag string
	DMSpriteTag           string
	Sprite2DTag           string
	MinDistance           float32
}

ActorLevelOfDetail is a declaration of LEVELOFDETAIL

type AmbientLight added in v1.4.128

type AmbientLight struct {
	Tag      string
	LightTag string
	Regions  []uint32
}

func (*AmbientLight) Definition added in v1.4.128

func (a *AmbientLight) Definition() string

func (*AmbientLight) Read added in v1.4.128

func (a *AmbientLight) Read(r *AsciiReadToken) error

func (*AmbientLight) Write added in v1.4.128

func (a *AmbientLight) Write(w io.Writer) error

type AsciiReadToken added in v1.4.120

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

func LoadAsciiFile added in v1.4.121

func LoadAsciiFile(path string, wld *Wld) (*AsciiReadToken, error)

LoadAsciiFile returns a new AsciiReader that reads from r.

func (*AsciiReadToken) Close added in v1.4.121

func (a *AsciiReadToken) Close() error

func (*AsciiReadToken) Read added in v1.4.120

func (a *AsciiReadToken) Read(p []byte) (n int, err error)

Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.

func (*AsciiReadToken) ReadProperty added in v1.4.120

func (a *AsciiReadToken) ReadProperty(name string, minNumArgs int) ([]string, error)

func (*AsciiReadToken) TotalLineCountRead added in v1.4.124

func (a *AsciiReadToken) TotalLineCountRead() int

type AttachedSkin added in v1.4.123

type AttachedSkin struct {
	DMSpriteTag               string
	LinkSkinUpdatesToDagIndex uint32
}

type BSPNode added in v1.4.118

type BSPNode struct {
	Vertices           []uint32
	RenderMethod       string
	Flags              uint8
	Pen                uint32
	Brightness         float32
	ScaledAmbient      float32
	SpriteTag          string
	Origin             [3]float32
	UAxis              [3]float32
	VAxis              [3]float32
	RenderUVMapEntries []BspNodeUVInfo
	FrontTree          uint32
	BackTree           uint32
}

BSPNode is a declaration of BSPNODE

type BspNodeUVInfo added in v1.4.118

type BspNodeUVInfo struct {
	UvOrigin [3]float32 // UV %0.7f %0.7f %0.7f
	UAxis    [3]float32 // UAXIS %0.7f %0.7f %0.7f
	VAxis    [3]float32 // VAXIS %0.7f %0.7f %0.7f
}

BspNodeUVInfo is a declaration of UV

type DMSprite added in v1.4.130

type DMSprite struct {
	Tag           string
	DefinitionTag string
	Param         uint32
}

DMSprite is a declaration of DMSPRITEINSTANCE

func (*DMSprite) Definition added in v1.4.130

func (d *DMSprite) Definition() string

func (*DMSprite) Read added in v1.4.130

func (d *DMSprite) Read(r *AsciiReadToken) error

func (*DMSprite) Write added in v1.4.130

func (d *DMSprite) Write(w io.Writer) error

type DMSpriteDef added in v1.4.130

type DMSpriteDef struct {
	Tag            string
	Flags          uint32
	Fragment1Maybe int16
	Material       string
	Fragment3      uint32
	CenterPosition [3]float32
	Params2        uint32
	Something2     uint32
	Something3     uint32
	Verticies      [][3]float32
	TexCoords      [][3]float32
	Normals        [][3]float32
	Colors         []int32
	Polygons       []*DMSpriteDefSpritePolygon
	VertexPieces   []*DMSpriteDefVertexPiece
	PostVertexFlag uint32
	RenderGroups   []*DMSpriteDefRenderGroup
	VertexTex      [][2]float32
	Size6Pieces    []*DMSpriteDefSize6Entry
}

DMSpriteDef is a declaration of DMSPRITEDEF

type DMSpriteDef2 added in v1.4.116

type DMSpriteDef2 struct {
	Tag                  string
	Flags                uint32
	DmTrackTag           string
	Fragment3Ref         int32
	Fragment4Ref         int32
	Params2              [3]uint32
	MaxDistance          float32
	Min                  [3]float32
	Max                  [3]float32
	CenterOffset         [3]float32
	Vertices             [][3]float32
	UVs                  [][2]float32
	VertexNormals        [][3]float32
	SkinAssignmentGroups [][2]uint16
	MaterialPaletteTag   string
	Colors               [][4]uint8
	Faces                []*Face
	MeshOps              []*MeshOp
	FaceMaterialGroups   [][2]uint16
	VertexMaterialGroups [][2]int16
	BoundingRadius       float32
	FPScale              uint16
	PolyhedronTag        string
}

DMSpriteDef2 is a declaration of DMSpriteDef2

func (*DMSpriteDef2) Definition added in v1.4.120

func (d *DMSpriteDef2) Definition() string

func (*DMSpriteDef2) Read added in v1.4.120

func (d *DMSpriteDef2) Read(r *AsciiReadToken) error

func (*DMSpriteDef2) Write added in v1.4.120

func (d *DMSpriteDef2) Write(w io.Writer) error

type DMSpriteDefRenderGroup added in v1.4.130

type DMSpriteDefRenderGroup struct {
	PolygonCount int16
	MaterialId   int16
}

type DMSpriteDefSize6Entry added in v1.4.130

type DMSpriteDefSize6Entry struct {
	Unk1 uint32
	Unk2 uint32
	Unk3 uint32
	Unk4 uint32
	Unk5 uint32
}

type DMSpriteDefSpritePolygon added in v1.4.130

type DMSpriteDefSpritePolygon struct {
	Flag int16
	Unk1 int16
	Unk2 int16
	Unk3 int16
	Unk4 int16
	I1   int16
	I2   int16
	I3   int16
}

type DMSpriteDefVertexPiece added in v1.4.130

type DMSpriteDefVertexPiece struct {
	Count  int16
	Offset int16
}

type Dag added in v1.4.123

type Dag struct {
	Tag       string
	Track     string
	SubDags   []uint32
	SpriteTag string
}

type Face added in v1.4.116

type Face struct {
	Flags    uint16
	Triangle [3]uint16
}

type HierarchicalSpriteDef added in v1.4.123

type HierarchicalSpriteDef struct {
	Tag            string
	Dags           []Dag
	AttachedSkins  []AttachedSkin
	CenterOffset   [3]float32
	BoundingRadius float32
	DMSpriteTag    string
	DagCollision   int
}

func (*HierarchicalSpriteDef) Definition added in v1.4.123

func (h *HierarchicalSpriteDef) Definition() string

func (*HierarchicalSpriteDef) Read added in v1.4.123

func (*HierarchicalSpriteDef) Write added in v1.4.123

func (h *HierarchicalSpriteDef) Write(w io.Writer) error

type LightDef added in v1.4.118

type LightDef struct {
	Tag             string
	Flags           uint32
	FrameCurrentRef uint32
	Sleep           uint32
	LightLevels     []float32
	Colors          [][3]float32
}

LightDef is a declaration of LIGHTDEF

func (*LightDef) Definition added in v1.4.125

func (l *LightDef) Definition() string

func (*LightDef) Read added in v1.4.125

func (l *LightDef) Read(r *AsciiReadToken) error

func (*LightDef) Write added in v1.4.125

func (l *LightDef) Write(w io.Writer) error

type MaterialDef added in v1.4.116

type MaterialDef struct {
	Tag                  string   // TAG %s
	Flags                uint32   // FLAGS %d
	RenderMethod         string   // RENDERMETHOD %s
	RGBPen               [4]uint8 // RGBPEN %d %d %d
	Brightness           float32  // BRIGHTNESS %0.7f
	ScaledAmbient        float32  // SCALEDAMBIENT %0.7f
	SimpleSpriteInstTag  string   // SIMPLESPRITEINST
	SimpleSpriteInstFlag uint32   // FLAGS %d
	Pair1                uint32
	Pair2                float32
}

MaterialDef is an entry MATERIALDEFINITION

func (*MaterialDef) Definition added in v1.4.121

func (m *MaterialDef) Definition() string

func (*MaterialDef) Read added in v1.4.121

func (m *MaterialDef) Read(r *AsciiReadToken) error

func (*MaterialDef) Write added in v1.4.121

func (m *MaterialDef) Write(w io.Writer) error

type MaterialPalette added in v1.4.116

type MaterialPalette struct {
	Tag string

	Materials []string
	// contains filtered or unexported fields
}

MaterialPalette is a declaration of MATERIALPALETTE

func (*MaterialPalette) Definition added in v1.4.120

func (m *MaterialPalette) Definition() string

func (*MaterialPalette) Read added in v1.4.120

func (m *MaterialPalette) Read(r *AsciiReadToken) error

func (*MaterialPalette) Write added in v1.4.120

func (m *MaterialPalette) Write(w io.Writer) error

type MeshOp added in v1.4.116

type MeshOp struct {
	Index1    uint16
	Index2    uint16
	Offset    float32
	Param1    uint8
	TypeField uint8
}

type Obstacle added in v1.4.128

type Obstacle struct {
	Normal   [4]float32
	Vertices [][3]float32
}

type PointLight added in v1.4.118

type PointLight struct {
	Tag         string // TAG "%s"
	LightDefTag string // LIGHT "%s"
	Flags       uint32 // FLAGS %d
	Location    [3]float32
	Radius      float32 // RADIUSOFINFLUENCE %0.7f
}

PointLight is a declaration of POINTLIGHT

func (*PointLight) Definition added in v1.4.125

func (p *PointLight) Definition() string

func (*PointLight) Read added in v1.4.125

func (p *PointLight) Read(r *AsciiReadToken) error

func (*PointLight) Write added in v1.4.125

func (p *PointLight) Write(w io.Writer) error

type PolyhedronDefinition added in v1.4.120

type PolyhedronDefinition struct {
	Tag            string
	Flags          uint32
	BoundingRadius float32
	ScaleFactor    float32
	Vertices       [][3]float32
	Faces          []*PolyhedronDefinitionFace
}

func (*PolyhedronDefinition) Definition added in v1.4.120

func (p *PolyhedronDefinition) Definition() string

func (*PolyhedronDefinition) Read added in v1.4.120

func (*PolyhedronDefinition) Write added in v1.4.120

func (p *PolyhedronDefinition) Write(w io.Writer) error

type PolyhedronDefinitionFace added in v1.4.120

type PolyhedronDefinitionFace struct {
	Vertices []uint32
}

type PropOpt added in v1.4.129

type PropOpt struct {
	Name string
	Min  int
}

type RGBTrack added in v1.4.133

type RGBTrack struct {
	Tag           string
	DefinitionTag string
	Flags         uint32
}

RGBTrack is a track instance for RGB deformation tracks

func (*RGBTrack) Definition added in v1.4.133

func (r *RGBTrack) Definition() string

func (*RGBTrack) Read added in v1.4.133

func (r *RGBTrack) Read(token *AsciiReadToken) error

func (*RGBTrack) Write added in v1.4.133

func (r *RGBTrack) Write(w io.Writer) error

type RGBTrackDef added in v1.4.133

type RGBTrackDef struct {
	Tag   string
	Data1 uint32
	Data2 uint32
	Data4 uint32
	Sleep uint32
	RGBAs [][4]uint8
}

func (*RGBTrackDef) Definition added in v1.4.133

func (r *RGBTrackDef) Definition() string

func (*RGBTrackDef) Read added in v1.4.133

func (r *RGBTrackDef) Read(token *AsciiReadToken) error

func (*RGBTrackDef) Write added in v1.4.133

func (r *RGBTrackDef) Write(w io.Writer) error

type Region added in v1.4.113

type Region struct {
	RegionTag        string
	AmbientLightTag  string
	RegionVertices   [][3]float32
	RenderVertices   [][3]float32
	Walls            []*Wall
	Obstacles        []*Obstacle
	CuttingObstacles []*Obstacle
	VisTree          *VisTree
	Sphere           [4]float32
	UserData         string
}

func (*Region) Definition added in v1.4.128

func (r *Region) Definition() string

func (*Region) Read added in v1.4.128

func (r *Region) Read(token *AsciiReadToken) error

func (*Region) Write added in v1.4.128

func (r *Region) Write(w io.Writer) error

type SimpleSpriteDef added in v1.4.116

type SimpleSpriteDef struct {
	Tag                string
	SimpleSpriteFrames []SimpleSpriteFrame
}

SimpleSpriteDef is a declaration of SIMPLESPRITEDEF

func (*SimpleSpriteDef) Definition added in v1.4.121

func (s *SimpleSpriteDef) Definition() string

func (*SimpleSpriteDef) Read added in v1.4.121

func (s *SimpleSpriteDef) Read(r *AsciiReadToken) error

func (*SimpleSpriteDef) Write added in v1.4.121

func (s *SimpleSpriteDef) Write(w io.Writer) error

type SimpleSpriteFrame added in v1.4.129

type SimpleSpriteFrame struct {
	TextureFile string
	TextureTag  string
}

type Sprite3DDef added in v1.4.118

type Sprite3DDef struct {
	Tag            string
	CenterOffset   [3]float32
	BoundingRadius float32
	SphereListTag  string
	Vertices       [][3]float32
	BSPNodes       []*BSPNode
}

Sprite3DDef is a declaration of SPRITE3DDEF

func (*Sprite3DDef) Definition added in v1.4.125

func (s *Sprite3DDef) Definition() string

func (*Sprite3DDef) Read added in v1.4.125

func (s *Sprite3DDef) Read(r *AsciiReadToken) error

func (*Sprite3DDef) Write added in v1.4.125

func (s *Sprite3DDef) Write(w io.Writer) error

type TrackDef added in v1.4.120

type TrackDef struct {
	Tag             string
	Flags           uint32
	FrameTransforms []TrackFrameTransform
}

func (*TrackDef) Definition added in v1.4.120

func (t *TrackDef) Definition() string

func (*TrackDef) Read added in v1.4.120

func (t *TrackDef) Read(r *AsciiReadToken) error

func (*TrackDef) Write added in v1.4.120

func (t *TrackDef) Write(w io.Writer) error

type TrackFrameTransform added in v1.4.120

type TrackFrameTransform struct {
	PositionDenom float32
	Rotation      [3]int16
	Position      [3]float32
}

type TrackInstance added in v1.4.120

type TrackInstance struct {
	Tag           string
	DefinitionTag string
	Interpolate   int
	Reverse       int
	Sleep         uint32
}

func (*TrackInstance) Definition added in v1.4.120

func (t *TrackInstance) Definition() string

func (*TrackInstance) Read added in v1.4.120

func (t *TrackInstance) Read(r *AsciiReadToken) error

func (*TrackInstance) Write added in v1.4.120

func (t *TrackInstance) Write(w io.Writer) error

type VisList added in v1.4.128

type VisList struct {
	Range []uint32
}

type VisNode added in v1.4.128

type VisNode struct {
	Normal       [4]float32
	VisListIndex uint32
	FrontTree    uint32
	BackTree     uint32
}

type VisTree added in v1.4.128

type VisTree struct {
	VisNodes []*VisNode
	VisLists []*VisList
}

type Wall added in v1.4.128

type Wall struct {
	Normal   [4]float32
	Vertices [][3]float32
}

type Wld

type Wld struct {
	FileName               string
	GlobalAmbientLight     string
	Version                uint32
	SimpleSpriteDefs       []*SimpleSpriteDef
	MaterialDefs           []*MaterialDef
	MaterialPalettes       []*MaterialPalette
	DMSpriteDefs           []*DMSpriteDef
	DMSpriteInsts          []*DMSprite
	DMSpriteDef2s          []*DMSpriteDef2
	ActorDefs              []*ActorDef
	ActorInsts             []*ActorInst
	LightDefs              []*LightDef
	PointLights            []*PointLight
	Sprite3DDefs           []*Sprite3DDef
	TrackInstances         []*TrackInstance
	TrackDefs              []*TrackDef
	HierarchicalSpriteDefs []*HierarchicalSpriteDef
	PolyhedronDefs         []*PolyhedronDefinition
	WorldTrees             []*WorldTree
	Regions                []*Region
	AmbientLights          []*AmbientLight
	Zones                  []*Zone
	RGBTrackDefs           []*RGBTrackDef
	RGBTrackInsts          []*RGBTrack
}

Wld is a struct representing a Wld file

func (*Wld) ReadAscii added in v1.4.120

func (wld *Wld) ReadAscii(path string) error

ReadAscii reads the ascii file at path

func (*Wld) ReadRaw added in v1.4.130

func (wld *Wld) ReadRaw(src *raw.Wld) error

func (*Wld) WriteAscii added in v1.4.113

func (wld *Wld) WriteAscii(path string, isDir bool) error

func (*Wld) WriteRaw added in v1.4.131

func (wld *Wld) WriteRaw(w io.Writer) error

type WorldNode added in v1.4.128

type WorldNode struct {
	Normals        [4]float32
	WorldRegionTag string
	FrontTree      uint32
	BackTree       uint32
	Distance       float32
}

type WorldTree added in v1.4.128

type WorldTree struct {
	Tag        string
	WorldNodes []*WorldNode
}

func (*WorldTree) Definition added in v1.4.128

func (t *WorldTree) Definition() string

func (*WorldTree) Read added in v1.4.128

func (t *WorldTree) Read(r *AsciiReadToken) error

func (*WorldTree) Write added in v1.4.128

func (t *WorldTree) Write(w io.Writer) error

type Zone added in v1.4.128

type Zone struct {
	Tag      string
	Regions  []uint32
	UserData string
}

func (*Zone) Definition added in v1.4.128

func (z *Zone) Definition() string

func (*Zone) Read added in v1.4.128

func (z *Zone) Read(r *AsciiReadToken) error

func (*Zone) Write added in v1.4.128

func (z *Zone) Write(w io.Writer) error

Jump to

Keyboard shortcuts

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