wld

package
v1.4.121 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 10 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

This section is empty.

Functions

This section is empty.

Types

type ActorAction added in v1.4.113

type ActorAction struct {
	//NUMLEVELSOFDETAIL %d
	LevelOfDetails []ActorLevelOfDetail // LEVELOFDETAIL
}

ActorAction is a declaration of ACTION

type ActorDef added in v1.4.118

type ActorDef struct {
	Tag           string     // ACTORTAG "%s"
	Callback      string     // CALLBACK "%s"
	BoundsRef     int32      // ?? BOUNDSTAG "%s"
	CurrentAction uint32     // ?? CURRENTACTION %d
	Location      [6]float32 // LOCATION %0.7f %0.7f %0.7f %d %d %d
	Unk1          uint32     // ?? UNK1 %d
	// NUMACTIONS %d
	Actions []ActorAction // ACTION
	// NUMFRAGMENTS %d
	FragmentRefs []uint32 // FRAGMENTREF %d
}

ActorDef is a declaration of ACTORDEF

func (*ActorDef) Ascii added in v1.4.118

func (a *ActorDef) Ascii() string

Ascii returns the ascii representation of an ActorDef

type ActorInst added in v1.4.118

type ActorInst struct {
	Tag            string     // ?? ACTORTAG "%s"
	Flags          uint32     // ?? FLAGS %d
	SphereTag      string     // ?? SPHERETAG "%s"
	CurrentAction  uint32     // ?? CURRENTACTION %d
	DefinitionTag  string     // DEFINITION "%s"
	Location       [6]float32 // LOCATION %0.7f %0.7f %0.7f %d %d %d
	Unk1           uint32     // ?? UNK1 %d
	BoundingRadius float32    // BOUNDINGRADIUS %0.7f
	Scale          float32    // SCALEFACTOR %0.7f
	Unk2           int32      // ?? UNK2 %d
}

ActorInst is a declaration of ACTORINST

func (*ActorInst) Ascii added in v1.4.118

func (a *ActorInst) Ascii() string

Ascii returns the ascii representation of an ActorInst

type ActorLevelOfDetail added in v1.4.118

type ActorLevelOfDetail struct {
	Unk1        uint32  // ?? HIERARCHIALSPRITE "%s"
	MinDistance float32 // MINDISTANCE %0.7f
}

ActorLevelOfDetail is a declaration of LEVELOFDETAIL

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(definition string) (string, error)

ReadProperty reads the property of the definition.

type AsciiReader added in v1.4.120

type AsciiReader interface {
	Read(p []byte) (n int, err error)
	ReadProperty(definition string) (string, error)
	ReadString() (string, error)
	ReadInt() (int, error)
}

type BSPNode added in v1.4.118

type BSPNode struct {
	// NUMVERTICES %d
	Vertices                    []uint32   // VERTEXLIST %d %d %d %d
	RenderMethod                string     // RENDERMETHOD %s
	RenderFlags                 uint8      // FLAGS %d
	RenderPen                   uint32     // PEN %d
	RenderBrightness            float32    // BRIGHTNESS %0.7f
	RenderScaledAmbient         float32    // SCALEDAMBIENT %0.7f
	RenderSimpleSpriteReference uint32     // SIMPLESPRITEINSTREF %d
	RenderUVInfoOrigin          [3]float32 // ORIGIN %0.7f %0.7f %0.7f
	RenderUVInfoUAxis           [3]float32 // UAXIS %0.7f %0.7f %0.7f
	RenderUVInfoVAxis           [3]float32 // VAXIS %0.7f %0.7f %0.7f
	RenderUVMapEntries          []BspNodeUVInfo
	FrontTree                   uint32 // FRONTTREE %d
	BackTree                    uint32 // BACKTREE %d
}

BSPNode is a declaration of BSPNODE

func (*BSPNode) Ascii added in v1.4.118

func (b *BSPNode) Ascii() string

Ascii returns the ascii representation of a 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 DMSpriteDef2 added in v1.4.116

type DMSpriteDef2 struct {
	Tag          string     // TAG "%s"
	Flags        uint32     // FLAGS %d
	DmTrackTag   string     // DMTRACK "%s"
	Fragment3Ref int32      // ?? FRAGMENT3REF %d
	Fragment4Ref int32      // ?? FRAGMENT4REF %d
	Params2      [3]uint32  // ?? PARAMS2 %d %d %d
	MaxDistance  float32    // ?? MAXDISTANCE %0.7f
	Min          [3]float32 // ?? MIN %0.7f %0.7f %0.7f
	Max          [3]float32 // ?? MAX %0.7f %0.7f %0.7f

	CenterOffset [3]float32 // CENTEROFFSET %0.7f %0.7f %0.7f
	// NUMVERTICES %d
	Vertices [][3]float32 // XYZ %0.7f %0.7f %0.7f
	// NUMUVS %d
	UVs [][2]float32 // UV %0.7f %0.7f
	// NUMVERTEXNORMALS %d
	VertexNormals        [][3]float32 // XYZ %0.7f %0.7f %0.7f
	SkinAssignmentGroups [][2]uint16  // SKINASSIGNMENTGROUPS %d %d
	MaterialPaletteTag   string       // MATERIALPALETTE "%s"
	// NUMCOLORS %d
	Colors [][4]uint8 // RGBA %d %d %d %d
	// NUMFACE2S %d
	Faces []*Face // DMFACE2S
	// NUMMESHOPS %d
	MeshOps              []*MeshOp   // MESHOP
	FaceMaterialGroups   [][2]uint16 // FACEMATERIALGROUPS %d %d
	VertexMaterialGroups [][2]int16  // VERTEXMATERIALGROUPS %d %d
	BoundingRadius       float32     // BOUNDINGRADIUS %0.7f
	FPScale              uint16      // FPScale %d
}

DMSpriteDef2 is a declaration of DMSpriteDef2

func (*DMSpriteDef2) Ascii added in v1.4.116

func (d *DMSpriteDef2) Ascii() string

Ascii returns the ascii representation of a 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 Face added in v1.4.116

type Face struct {
	Flags    uint16    // FLAGS %d
	Triangle [3]uint16 // TRIANGLE %d %d %d
}

type LightDef added in v1.4.118

type LightDef struct {
	Tag             string // TAG "%s"
	Flags           uint32 // ?? FLAGS %d
	FrameCurrentRef uint32 // ?? FRAMECURRENT "%d"
	Sleep           uint32 // SLEEP %d
	// NUMFRAMES %d
	LightLevels []float32 // LIGHTLEVELS %0.7f
	// NUMCOLORS %d
	Colors [][3]float32 // COLORS %0.7f %0.7f %0.7f
}

LightDef is a declaration of LIGHTDEF

func (*LightDef) Ascii added in v1.4.118

func (l *LightDef) Ascii() string

Ascii returns the ascii representation of a LightDef

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
}

MaterialDef is an entry MATERIALDEFINITION

func (*MaterialDef) Ascii added in v1.4.116

func (m *MaterialDef) Ascii() string

Ascii returns the ascii representation of a MaterialDef

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 // TAG "%s"

	Materials []string // MATERIAL "%s"
	// 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 PointLight added in v1.4.118

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

PointLight is a declaration of POINTLIGHT

func (*PointLight) Ascii added in v1.4.118

func (p *PointLight) Ascii() string

Ascii returns the ascii representation of a PointLight

type PolyhedronDefinition added in v1.4.120

type PolyhedronDefinition struct {
	Tag            string
	BoundingRadius float32
	ScaleFactor    float32

	Vertices [][3]float32

	Faces []*PolyhedronDefinitionFace
	// contains filtered or unexported fields
}

POLYHEDRONDEFINITION

TAG	"prepe_POLYHDEF"
BOUNDINGRADIUS	1.2431762e+002
SCALEFACTOR	1.0
NUMVERTICES	287
XYZ	-5.9604645e-008 1.9073486e-005 -3.8146973e-006
NUMFACES	280
FACE 1
	NUMVERTICES	3
	VERTEXLIST	3, 1, 2
ENDFACE 1
ENDPOLYHEDRONDEFINITION

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
	// contains filtered or unexported fields
}

type SimpleSpriteDef added in v1.4.116

type SimpleSpriteDef struct {
	Tag string // SIMPLESPRITETAG "%s"
	// NUMFRAMES %d
	BMInfos [][2]string // BMINFO "%s" "%s"
}

SimpleSpriteDef is a declaration of SIMPLESPRITEDEF

func (*SimpleSpriteDef) Ascii added in v1.4.116

func (s *SimpleSpriteDef) Ascii() string

Ascii returns the ascii representation of a 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 Sprite3DDef added in v1.4.118

type Sprite3DDef struct {
	Tag string // 3DSPRITETAG "%s"
	// NUMVERTICES %d
	Vertices [][3]float32 // XYZ %0.7f %0.7f %0.7f
	// NUMBSPNODES %d
	BSPNodes []*BSPNode // BSPNODE
}

Sprite3DDef is a declaration of SPRITE3DDEF

func (*Sprite3DDef) Ascii added in v1.4.118

func (s *Sprite3DDef) Ascii() string

Ascii returns the ascii representation of a Sprite3DDef

type TrackDef added in v1.4.120

type TrackDef struct {
	Tag string // TAG "%s"

	FrameTransform []TrackFrameTransform // FRAMETRANSFORM %0.7f %d %d %d %0.7f %0.7f %0.7f
	// contains filtered or unexported fields
}

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 {
}

type TrackInstance added in v1.4.120

type TrackInstance struct {
	Tag            string // TAG "%s"
	DefiniationTag string // DEFINITION "%s"

	Sleep uint32 // SLEEP %d
	// contains filtered or unexported fields
}

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 Wld

type Wld struct {
	FileName           string
	GlobalAmbientLight string
	Version            uint32
	SimpleSpriteDefs   []*SimpleSpriteDef
	MaterialDefs       []*MaterialDef
	MaterialPalettes   []*MaterialPalette
	DMSpriteDef2s      []*DMSpriteDef2
	ActorDefs          []*ActorDef
	ActorInsts         []*ActorInst
	LightDefs          []*LightDef
	PointLights        []*PointLight
	Sprite3DDefs       []*Sprite3DDef
	TrackInstances     []*TrackInstance
	TrackDefs          []*TrackDef
	// contains filtered or unexported fields
}

Wld is a struct representing a Wld file

func (*Wld) Read added in v1.4.113

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

func (*Wld) ReadAscii added in v1.4.120

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

ReadAscii reads the ascii file at path

func (*Wld) Write added in v1.4.113

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

func (*Wld) WriteAscii added in v1.4.113

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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