model

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefinitionValid   = 3
	DefinitionVoid    = 1
	DefinitionWall    = 2
	DefinitionUnknown = 0
)
View Source
const (
	SegmentDataWall     = 0
	SegmentDataTexture  = iota
	SegmentDataNeighbor = iota
)

Variables

This section is empty.

Functions

func Hex128

func Hex128(uuid [24]byte) string

func NextUUId

func NextUUId() string

func ValidHex128

func ValidHex128(id string) bool

Types

type CHSegment

type CHSegment struct {
	Ref   string
	Start XY
	End   XY
	Data  interface{}
}

func NewCHSegment

func NewCHSegment(ref string, data interface{}, start XY, end XY) *CHSegment

type Compiler

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

func NewCompiler

func NewCompiler() *Compiler

func (*Compiler) Get

func (r *Compiler) Get(sectorId string) (*Sector, error)

func (*Compiler) GetMaxHeight

func (r *Compiler) GetMaxHeight() float64

func (*Compiler) GetSectors

func (r *Compiler) GetSectors() []*Sector

func (*Compiler) Setup

func (r *Compiler) Setup(cfg *Input, text *textures.Textures) error

type ConvexHull

type ConvexHull struct {
}

func NewConvexHull

func NewConvexHull() *ConvexHull

func (*ConvexHull) Create

func (ch *ConvexHull) Create(id string, inputSegments []*CHSegment) []*CHSegment

func (*ConvexHull) FromSector

func (ch *ConvexHull) FromSector(sector *Sector) []*Segment

type Element

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

type Generator

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

func MustNewGenerator

func MustNewGenerator() *Generator

func NewGenerator

func NewGenerator() (*Generator, error)

func (*Generator) Hex128

func (g *Generator) Hex128() string

func (*Generator) Next

func (g *Generator) Next() [24]byte

type GrahamScan

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

func (*GrahamScan) Compute

func (gs *GrahamScan) Compute(pl []XYId) ([]XYId, bool)

func (*GrahamScan) Partial

func (gs *GrahamScan) Partial(lowest XYId, a XYId, b XYId, pl []XYId) XYId

type Input

type Input struct {
	Sectors     []*InputSector `json:"sectors"`
	Lights      []*InputLight  `json:"lights"`
	Player      *InputPlayer   `json:"player"`
	ScaleFactor float64        `json:"scaleFactor"`
	DisableLoop bool           `json:"disableLoop"`
}

type InputLight

type InputLight struct {
	Where  XYZ    `json:"where"`
	Light  XYZ    `json:"light"`
	Sector string `json:"sector"`
}

type InputPlayer

type InputPlayer struct {
	Position XY      `json:"position"`
	Angle    float64 `json:"angle"`
	Sector   string  `json:"sector"`
}

type InputSector

type InputSector struct {
	Id           string          `json:"id"`
	Ceil         float64         `json:"ceil"`
	Floor        float64         `json:"floor"`
	Textures     bool            `json:"textures"`
	FloorTexture string          `json:"floorTexture"`
	CeilTexture  string          `json:"ceilTexture"`
	UpperTexture string          `json:"upperTexture"`
	LowerTexture string          `json:"lowerTexture"`
	WallTexture  string          `json:"wallTexture"`
	Segments     []*InputSegment `json:"segments"`
	Tag          string          `json:"tag"`
}

func NewInputSector

func NewInputSector(id string) *InputSector

func (*InputSector) Clone

func (is *InputSector) Clone(cloneSegments bool) *InputSector

type InputSegment

type InputSegment struct {
	Parent   string `json:"id"`
	Id       string `json:"id"`
	Start    XY     `json:"start"`
	End      XY     `json:"end"`
	Kind     int    `json:"kind"`
	Neighbor string `json:"neighbor"`
	Tag      string `json:"tag"`
	Upper    string `json:"upper"`
	Middle   string `json:"middle"`
	Lower    string `json:"lower"`
	// contains filtered or unexported fields
}

func NewInputSegment

func NewInputSegment(parent string, kind int, s XY, e XY) *InputSegment

func (*InputSegment) AddNeighbor

func (is *InputSegment) AddNeighbor(p0 XY, p1 XY, neighbor string)

func (*InputSegment) AddProperty

func (is *InputSegment) AddProperty(p0 XY, p1 XY, wall bool, upper string, middle string, lower string)

func (*InputSegment) AnyCoords

func (is *InputSegment) AnyCoords(tst *InputSegment) bool

func (*InputSegment) Build

func (is *InputSegment) Build() []*InputSegment

func (*InputSegment) Clone

func (is *InputSegment) Clone() *InputSegment

func (*InputSegment) EqualCoords

func (is *InputSegment) EqualCoords(tst *InputSegment) bool

func (*InputSegment) Prepare

func (is *InputSegment) Prepare()

func (*InputSegment) SameCoords

func (is *InputSegment) SameCoords(tst *InputSegment) bool

type Sector

type Sector struct {
	Id           string
	Floor        float64
	Ceil         float64
	Segments     []*Segment
	Textures     bool
	Tag          string
	FloorTexture *textures.Texture
	CeilTexture  *textures.Texture
	UpperTexture *textures.Texture
	LowerTexture *textures.Texture
	WallTexture  *textures.Texture
	// contains filtered or unexported fields
}

func NewSector

func NewSector(id string, segments []*Segment) *Sector

func (*Sector) Add

func (s *Sector) Add(id string)

func (*Sector) GetCompileId

func (s *Sector) GetCompileId() uint64

func (*Sector) GetUsage

func (s *Sector) GetUsage() int

func (*Sector) Has

func (s *Sector) Has(id string) bool

func (*Sector) Reference

func (s *Sector) Reference(compileId uint64)

type Segment

type Segment struct {
	Start  XY
	End    XY
	Ref    string
	Kind   int
	Sector *Sector
	Tag    string
}

func NewSegment

func NewSegment(ref string, sector *Sector, kind int, start XY, end XY, tag string) *Segment

func (*Segment) Copy

func (k *Segment) Copy() *Segment

func (*Segment) SetSector

func (k *Segment) SetSector(ref string, sector *Sector)

type Stack

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

func (*Stack) Len

func (s *Stack) Len() int

func (*Stack) Pop

func (s *Stack) Pop() (value interface{})

func (*Stack) Print

func (s *Stack) Print() string

func (*Stack) Push

func (s *Stack) Push(value interface{})

type XY

type XY struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

type XYId

type XYId struct {
	XY
	Id int
}

type XYZ

type XYZ struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"`
}

Jump to

Keyboard shortcuts

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