Documentation
¶
Index ¶
- Constants
- Variables
- func CountChildTextures(cubes []*maps.Cube, target map[int32]int)
- func CountTextures(cube *maps.Cube, target map[int32]int)
- func FileExists(path string) bool
- func Find[T any](handler func(x T) bool) func(list []T) opt.Option[T]
- func GetChildTextures(state worldio.MapState, vslots []*maps.VSlot) map[int32]int
- func NormalizeTexture(texture string) string
- type Index
- type IndexAsset
- type Mapping
- type Model
- type Processor
- func (processor *Processor) AddFile(ref *Reference)
- func (processor *Processor) AddModel(name string)
- func (p *Processor) AddModelFile(name string)
- func (processor *Processor) AddSlot() *maps.Slot
- func (processor *Processor) AddSound(ref *Reference)
- func (p *Processor) AutoGrass(name string)
- func (p *Processor) DoNothing()
- func (processor *Processor) EmptyVSlot(owner *maps.Slot) *maps.VSlot
- func (p *Processor) Exec(name string)
- func (processor *Processor) FindCubemap(ctx context.Context, cubemap string) []*Reference
- func (processor *Processor) FindTexture(ctx context.Context, texture string) *Reference
- func (processor *Processor) ListVSlots()
- func (p *Processor) LoadSky(name string)
- func (p *Processor) LoadSkyOverlay(name string)
- func (p *Processor) MModel(name string)
- func (p *Processor) MapModelCompat(rad int, h int, tex int, name string, shadow string)
- func (p *Processor) MapSound(name string, vol int, maxUses int)
- func (p *Processor) MdlEnvMap(envMapMax float32, envMapMin float32, envMap string)
- func (p *Processor) MdlName() string
- func (p *Processor) NormalizeModelPath(modelDir string, path string) string
- func (processor *Processor) ProcessFile(ctx context.Context, ref *Reference) error
- func (p *Processor) ProcessModel(ctx context.Context, path string) error
- func (p *Processor) ProcessModelFile(ctx context.Context, modelDir string, modelType string, ref *Reference) ([]*Reference, error)
- func (processor *Processor) ReassignVSlot(owner *maps.Slot, vslot *maps.VSlot) *maps.VSlot
- func (p *Processor) RegisterSound(name string, vol int)
- func (processor *Processor) ResetMaterials()
- func (processor *Processor) ResetModels(limit int)
- func (processor *Processor) ResetSounds()
- func (processor *Processor) ResetTextures(n int32)
- func (p *Processor) ResolveRelative(ctx context.Context, modelDir string, file string) *Reference
- func (processor *Processor) SaveTextureIndex(path string) error
- func (processor *Processor) SearchFile(ctx context.Context, path string) *Reference
- func (p *Processor) SetBumpMap(meshname string, normalMapFile string)
- func (processor *Processor) SetMaterial(material string)
- func (p *Processor) SetModelDir(name string)
- func (p *Processor) SetSkin(meshname string, tex string, masks string, envMapMax float32, ...)
- func (p *Processor) SkelLoadPart(model string, other string)
- func (p *Processor) SkelSetAnim(anim string, animFile string)
- func (p *Processor) Texture(type_ string, name string, rot int, xOffset int, yOffset int, scale float32)
- func (p *Processor) TextureReset(limit int)
- func (p *Processor) VertLoadPart(model string)
- func (p *Processor) VertSetAnim(anim string)
- type Reference
- type RootFlags
- type Texture
- type TextureChange
- type TextureChangeType
- type TextureIndex
- type TextureReset
Constants ¶
View Source
const ( TEXTURE_CHANGE_ADD = iota TEXTURE_CHANGE_RESET )
Variables ¶
View Source
var ( SKEL_MODEL_TYPES = []string{"md5", "iqm", "smd"} VERT_MODEL_TYPES = []string{"md3", "md2", "obj"} )
View Source
var ( // All of the valid material slots MATERIALS = []string{ "air", "water", "water1", "water2", "water3", "water4", "glass", "glass1", "glass2", "glass3", "glass4", "lava", "lava1", "lava2", "lava3", "lava4", "clip", "noclip", "gameclip", "death", "alpha", "sky", } CUBEMAPSIDES = []string{ "lf", "rt", "ft", "bk", "dn", "up", } MODELTYPES = []string{ "md2", "md3", "md5", "obj", "smd", "iqm", } // The valid parameters to texture slots PARAMS = []string{ "c", "u", "d", "n", "g", "s", "z", "a", "e", "1", } )
View Source
var ( // Textures can have some additional stuff to modify them but they // should refer to the same file // ex: <mix:1,1,1><mad:2/2/2> TEXTURE_REGEX = regexp.MustCompile(`((<[^>]*>)*)([^<]+)`) TEXTURE_COMMAND_REGEX = regexp.MustCompile(`<([^>]*)>`) )
View Source
var (
COMMAND_REGEX = regexp.MustCompile(`(("[^"]*")|([^\s]+))`)
)
View Source
var EMPTY_COMMANDS = []string{
"adaptivesample",
"ambient",
"blurlms",
"blurskylight",
"causticmillis",
"causticscale",
"cloudalpha",
"cloudboxalpha",
"cloudboxcolour",
"cloudcolour",
"cloudfade",
"cloudheight",
"cloudscale",
"cloudscrollx",
"cloudscrolly",
"edgetolerance",
"elevcontag",
"fog",
"fogcolour",
"fogdomecap",
"fogdomeclip",
"fogdomeclouds",
"fogdomecolour",
"fogdomeheight",
"fogdomemax",
"fogdomemin",
"grassalpha",
"grasscolour",
"lightlod",
"lightprecision",
"lmshadows",
"mapmsg",
"maptitle",
"maxmerge",
"mdlalphablend",
"mdlalphadepth",
"mdlalphatest",
"mdlambient",
"mdlbb",
"mdlcollide",
"mdlcullface",
"mdldepthoffset",
"mdlellipsecollide",
"mdlextendbb",
"mdlfullbright",
"mdlglare",
"mdlglow",
"mdlpitch",
"mdlscale",
"mdlshader",
"mdlshadow",
"mdlspec",
"mdlspin",
"mdltrans",
"mdlyaw",
"minimapclip",
"minimapcolour",
"minimapheight",
"noclip",
"panelset",
"rdeye",
"rdjoint",
"rdlimitdist",
"rdlimitrot",
"rdtri",
"rdvert",
"setshader",
"setshaderparam",
"shadowmapambient",
"shadowmapangle",
"skill",
"skyboxcolour",
"skylight",
"skytexture",
"skytexturelight",
"smoothangle",
"spinclouds",
"spinsky",
"sunlight",
"sunlightpitch",
"sunlightscale",
"sunlightyaw",
"texalpha",
"texcolor",
"texlayer",
"texoffset",
"texrotate",
"texscale",
"texscroll",
"texsmooth",
"water2colour",
"water2fog",
"watercolour",
"waterfallcolour",
"waterfog",
"waterspec",
"yawsky",
}
View Source
var EMPTY_MODEL_COMMANDS = []string{
"adjust",
"alphablend",
"alphatest",
"ambient",
"animpart",
"cullface",
"envmap",
"fullbright",
"glare",
"glow",
"link",
"noclip",
"pitch",
"pitchcorrect",
"pitchtarget",
"scroll",
"shader",
"spec",
"tag",
}
Functions ¶
func FileExists ¶
func GetChildTextures ¶
func NormalizeTexture ¶
Types ¶
type Index ¶
type Index struct { Assets []string Refs []IndexAsset }
type IndexAsset ¶
type Mapping ¶
type Mapping struct { // The absolute path of the asset on the filesystem // Example: /home/blah/sauerbraten/packages/base/blah.cfg From *Reference // The path of the asset relative to the game's "root" // Example: packages/base/blah.cfg To string }
func CrunchReferences ¶
Ensure each source file only appears in the destination once.
type Processor ¶
type Processor struct { Roots []assets.Root LastMaterial *maps.Slot VSlots []*maps.VSlot Slots []*maps.Slot Textures TextureIndex Models []Model Sounds []*Reference Materials map[string]*maps.Slot // File references are guaranteed to be included and do not have a slot Files []*Reference ModelFiles []*Reference // contains filtered or unexported fields }
func (*Processor) AddModelFile ¶
func (*Processor) FindCubemap ¶
func (*Processor) FindTexture ¶
func (*Processor) ListVSlots ¶
func (processor *Processor) ListVSlots()
func (*Processor) LoadSkyOverlay ¶
func (*Processor) MapModelCompat ¶
func (*Processor) NormalizeModelPath ¶
This is slightly different from the other Normalize because models specifically use relative paths for some stuff
func (*Processor) ProcessFile ¶
func (*Processor) ProcessModel ¶
func (*Processor) ProcessModelFile ¶
func (*Processor) ReassignVSlot ¶
func (*Processor) RegisterSound ¶
func (*Processor) ResetMaterials ¶
func (processor *Processor) ResetMaterials()
func (*Processor) ResetModels ¶
func (*Processor) ResetSounds ¶
func (processor *Processor) ResetSounds()
func (*Processor) ResetTextures ¶
func (*Processor) ResolveRelative ¶
func (*Processor) SaveTextureIndex ¶
func (*Processor) SearchFile ¶
Search for a file in the roots, one at a time
func (*Processor) SetBumpMap ¶
func (*Processor) SetMaterial ¶
func (*Processor) SetModelDir ¶
func (*Processor) SkelLoadPart ¶
func (*Processor) SkelSetAnim ¶
func (*Processor) TextureReset ¶
func (*Processor) VertLoadPart ¶
func (*Processor) VertSetAnim ¶
type Texture ¶
type Texture struct { Ref *Reference Line int Type string Name string Rotation int Xoffset int Yoffset int Scale float32 }
func (Texture) Op ¶
func (t Texture) Op() TextureChangeType
type TextureChange ¶
type TextureChange interface {
Op() TextureChangeType
}
type TextureChangeType ¶
type TextureChangeType byte
type TextureIndex ¶
type TextureIndex []TextureChange
type TextureReset ¶
type TextureReset struct {
Limit int
}
func (TextureReset) Op ¶
func (t TextureReset) Op() TextureChangeType
Click to show internal directories.
Click to hide internal directories.