dtcache

package
v0.0.0-...-9aee9df Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2018 License: MIT, Zlib Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DT_TILECACHE_MAGIC         int32  = 'D'<<24 | 'T'<<16 | 'L'<<8 | 'R' ///< 'DTLR';
	DT_TILECACHE_VERSION       int32  = 1
	DT_TILECACHE_NULL_AREA     uint8  = 0
	DT_TILECACHE_WALKABLE_AREA uint8  = 63
	DT_TILECACHE_NULL_IDX      uint16 = 0xffff
)
View Source
const (
	ShortSize                  = int(unsafe.Sizeof(uint16(1)))
	DtTileCacheLayerSize       = unsafe.Sizeof(DtTileCacheLayer{})
	DtTileCacheLayerHeaderSize = unsafe.Sizeof(DtTileCacheLayerHeader{})
)
View Source
const (
	MAX_VERTS_PER_POLY int32 = 6  // TODO: use the DT_VERTS_PER_POLYGON
	MAX_REM_EDGES      int32 = 48 // TODO: make this an expression.
)
View Source
const (
	DT_COMPRESSEDTILE_FREE_DATA = 0x01 ///< Navmesh owns the tile memory and should free it.
)

/ Flags for AddTile

View Source
const DT_LAYER_MAX_NEIS int32 = 16
View Source
const DT_MAX_TOUCHED_TILES int32 = 8
View Source
const MAX_REQUESTS int32 = 64
View Source
const MAX_UPDATE int32 = 64
View Source
const REQUEST_ADD int32 = 0
View Source
const REQUEST_REMOVE int32 = 1
View Source
const VERTEX_BUCKET_COUNT2 int32 = (1 << 8)

Variables

This section is empty.

Functions

func DtBuildTileCacheContours

func DtBuildTileCacheContours(layer *DtTileCacheLayer, walkableClimb int32, maxError float32, lcset *DtTileCacheContourSet) detour.DtStatus

TODO: move this somewhere else, once the layer meshing is done.

func DtBuildTileCacheLayer

func DtBuildTileCacheLayer(comp DtTileCacheCompressor,
	header *DtTileCacheLayerHeader,
	heights, areas, cons []uint8,
	outData *[]uint8, outDataSize *int32) detour.DtStatus

func DtBuildTileCachePolyMesh

func DtBuildTileCachePolyMesh(lcset *DtTileCacheContourSet, mesh *DtTileCachePolyMesh) detour.DtStatus

func DtBuildTileCacheRegions

func DtBuildTileCacheRegions(layer *DtTileCacheLayer, walkableClimb int32) detour.DtStatus

func DtDecompressTileCacheLayer

func DtDecompressTileCacheLayer(comp DtTileCacheCompressor,
	compressed []uint8, compressedSize int32,
	layerOut **DtTileCacheLayer) detour.DtStatus

func DtFreeTileCache

func DtFreeTileCache(tc *DtTileCache)

func DtFreeTileCacheContourSet

func DtFreeTileCacheContourSet(cset *DtTileCacheContourSet)

func DtFreeTileCacheLayer

func DtFreeTileCacheLayer(layer *DtTileCacheLayer)

func DtFreeTileCachePolyMesh

func DtFreeTileCachePolyMesh(lmesh *DtTileCachePolyMesh)

func DtMarkBoxArea1

func DtMarkBoxArea1(layer *DtTileCacheLayer, orig []float32, cs, ch float32,
	bmin, bmax []float32, areaId uint8) detour.DtStatus

func DtMarkBoxArea2

func DtMarkBoxArea2(layer *DtTileCacheLayer, orig []float32, cs, ch float32,
	center, halfExtents, rotAux []float32, areaId uint8) detour.DtStatus

func DtMarkCylinderArea

func DtMarkCylinderArea(layer *DtTileCacheLayer, orig []float32, cs, ch float32,
	pos []float32, radius, height float32, areaId uint8) detour.DtStatus

func DtTileCacheHeaderSwapEndian

func DtTileCacheHeaderSwapEndian(data []uint8, dataSize int32) bool

Types

type DtCompressedTile

type DtCompressedTile struct {
	Salt           uint32 ///< Counter describing modifications to the tile.
	Header         *DtTileCacheLayerHeader
	Compressed     []byte
	CompressedSize int32
	Data           []byte
	DataSize       int32
	Flags          uint32
	Next           *DtCompressedTile
}

type DtCompressedTileRef

type DtCompressedTileRef uint32

type DtObstacleBox

type DtObstacleBox struct {
	Bmin [3]float32
	Bmax [3]float32
}

type DtObstacleCylinder

type DtObstacleCylinder struct {
	Pos    [3]float32
	Radius float32
	Height float32
}

type DtObstacleOrientedBox

type DtObstacleOrientedBox struct {
	Center      [3]float32
	HalfExtents [3]float32
	RotAux      [2]float32 //{ cos(0.5f*angle)*sin(-0.5f*angle); cos(0.5f*angle)*cos(0.5f*angle) - 0.5 }
}

type DtObstacleRef

type DtObstacleRef uint32

type DtTileCache

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

func DtAllocTileCache

func DtAllocTileCache() *DtTileCache

func (*DtTileCache) AddBoxObstacle

func (this *DtTileCache) AddBoxObstacle(bmin, bmax []float32, result *DtObstacleRef) detour.DtStatus

func (*DtTileCache) AddBoxObstacle2

func (this *DtTileCache) AddBoxObstacle2(center, halfExtents []float32, yRadians float32, result *DtObstacleRef) detour.DtStatus

func (*DtTileCache) AddObstacle

func (this *DtTileCache) AddObstacle(pos []float32, radius, height float32, result *DtObstacleRef) detour.DtStatus

func (*DtTileCache) AddTile

func (this *DtTileCache) AddTile(data []byte, dataSize int32, flags uint8, result *DtCompressedTileRef) detour.DtStatus

func (*DtTileCache) BuildNavMeshTile

func (this *DtTileCache) BuildNavMeshTile(ref DtCompressedTileRef, navmesh *detour.DtNavMesh) detour.DtStatus

func (*DtTileCache) BuildNavMeshTilesAt

func (this *DtTileCache) BuildNavMeshTilesAt(tx, ty int32, navmesh *detour.DtNavMesh) detour.DtStatus

func (*DtTileCache) CalcTightTileBounds

func (this *DtTileCache) CalcTightTileBounds(header *DtTileCacheLayerHeader, bmin, bmax []float32)

func (*DtTileCache) DecodeObstacleIdObstacle

func (this *DtTileCache) DecodeObstacleIdObstacle(ref DtObstacleRef) uint32

/ Decodes an obstacle id.

func (*DtTileCache) DecodeObstacleIdSalt

func (this *DtTileCache) DecodeObstacleIdSalt(ref DtObstacleRef) uint32

/ Decodes an obstacle salt.

func (*DtTileCache) DecodeTileIdSalt

func (this *DtTileCache) DecodeTileIdSalt(ref DtCompressedTileRef) uint32

/ Decodes a tile salt.

func (*DtTileCache) DecodeTileIdTile

func (this *DtTileCache) DecodeTileIdTile(ref DtCompressedTileRef) uint32

/ Decodes a tile id.

func (*DtTileCache) EncodeObstacleId

func (this *DtTileCache) EncodeObstacleId(salt, it uint32) DtObstacleRef

/ Encodes an obstacle id.

func (*DtTileCache) EncodeTileId

func (this *DtTileCache) EncodeTileId(salt, it uint32) DtCompressedTileRef

/ Encodes a tile id.

func (*DtTileCache) GetCompressor

func (this *DtTileCache) GetCompressor() DtTileCacheCompressor

func (*DtTileCache) GetObstacle

func (this *DtTileCache) GetObstacle(i int) *DtTileCacheObstacle

func (*DtTileCache) GetObstacleBounds

func (this *DtTileCache) GetObstacleBounds(ob *DtTileCacheObstacle, bmin, bmax []float32)

func (*DtTileCache) GetObstacleByRef

func (this *DtTileCache) GetObstacleByRef(ref DtObstacleRef) *DtTileCacheObstacle

func (*DtTileCache) GetObstacleCount

func (this *DtTileCache) GetObstacleCount() int

func (*DtTileCache) GetObstacleRef

func (this *DtTileCache) GetObstacleRef(ob *DtTileCacheObstacle) DtObstacleRef

func (*DtTileCache) GetParams

func (this *DtTileCache) GetParams() *DtTileCacheParams

func (*DtTileCache) GetTile

func (this *DtTileCache) GetTile(i int) *DtCompressedTile

func (*DtTileCache) GetTileAt

func (this *DtTileCache) GetTileAt(tx, ty, tlayer int32) *DtCompressedTile

func (*DtTileCache) GetTileByRef

func (this *DtTileCache) GetTileByRef(ref DtCompressedTileRef) *DtCompressedTile

func (*DtTileCache) GetTileCount

func (this *DtTileCache) GetTileCount() int

func (*DtTileCache) GetTileRef

func (this *DtTileCache) GetTileRef(tile *DtCompressedTile) DtCompressedTileRef

func (*DtTileCache) GetTilesAt

func (this *DtTileCache) GetTilesAt(tx, ty int32, tiles []DtCompressedTileRef, maxTiles int32) int32

func (*DtTileCache) Init

func (this *DtTileCache) Init(params *DtTileCacheParams,
	tcomp DtTileCacheCompressor,
	tmproc DtTileCacheMeshProcess) detour.DtStatus

func (*DtTileCache) QueryTiles

func (this *DtTileCache) QueryTiles(bmin, bmax []float32,
	results []DtCompressedTileRef, resultCount *int32, maxResults int32) detour.DtStatus

func (*DtTileCache) RemoveObstacle

func (this *DtTileCache) RemoveObstacle(ref DtObstacleRef) detour.DtStatus

func (*DtTileCache) RemoveTile

func (this *DtTileCache) RemoveTile(ref DtCompressedTileRef, data *[]byte, dataSize *int32) detour.DtStatus

func (*DtTileCache) Update

func (this *DtTileCache) Update(dt float32, navmesh *detour.DtNavMesh,
	upToDate *bool) detour.DtStatus

type DtTileCacheCompressor

type DtTileCacheCompressor interface {
	MaxCompressedSize(bufferSize int32) int32
	Compress(buffer []byte, bufferSize int32, compressed []byte, maxCompressedSize int32, compressedSize *int32) detour.DtStatus
	Decompress(compressed []byte, compressedSize int32, buffer []byte, maxBufferSize int32, bufferSize *int32) detour.DtStatus
}

type DtTileCacheContour

type DtTileCacheContour struct {
	Nverts int32
	Verts  []uint8
	Reg    uint8
	Area   uint8
}

type DtTileCacheContourSet

type DtTileCacheContourSet struct {
	Nconts int32
	Conts  []DtTileCacheContour
}

func DtAllocTileCacheContourSet

func DtAllocTileCacheContourSet() *DtTileCacheContourSet

type DtTileCacheLayer

type DtTileCacheLayer struct {
	Header   *DtTileCacheLayerHeader
	RegCount uint8 ///< Region count.
	Heights  []uint8
	Areas    []uint8
	Cons     []uint8
	Regs     []uint8
}

type DtTileCacheLayerHeader

type DtTileCacheLayerHeader struct {
	Magic   int32 ///< Data magic
	Version int32 ///< Data version
	Tx      int32
	Ty      int32
	Tlayer  int32
	Bmin    [3]float32
	Bmax    [3]float32
	Hmin    uint16 ///< Height min/max range
	Hmax    uint16 ///< Height min/max range
	Width   uint8  ///< Dimension of the layer.
	Height  uint8  ///< Dimension of the layer.
	Minx    uint8  ///< Usable sub-region.
	Maxx    uint8  ///< Usable sub-region.
	Miny    uint8  ///< Usable sub-region.
	Maxy    uint8  ///< Usable sub-region.
}

type DtTileCacheMeshProcess

type DtTileCacheMeshProcess interface {
	Process(params *detour.DtNavMeshCreateParams, polyAreas []uint8, polyFlags []uint16)
}

type DtTileCacheParams

type DtTileCacheParams struct {
	Orig                   [3]float32
	Cs                     float32
	Ch                     float32
	Width                  int32
	Height                 int32
	WalkableHeight         float32
	WalkableRadius         float32
	WalkableClimb          float32
	MaxSimplificationError float32
	MaxTiles               int32
	MaxObstacles           int32
}

type DtTileCachePolyMesh

type DtTileCachePolyMesh struct {
	Nvp    int32
	Nverts int32    ///< Number of vertices.
	Npolys int32    ///< Number of polygons.
	Verts  []uint16 ///< Vertices of the mesh, 3 elements per vertex.
	Polys  []uint16 ///< Polygons of the mesh, nvp*2 elements per polygon.
	Flags  []uint16 ///< Per polygon flags.
	Areas  []uint8  ///< Area ID of polygons.
}

func DtAllocTileCachePolyMesh

func DtAllocTileCachePolyMesh() *DtTileCachePolyMesh
type NavMeshTileBuildContext struct {
	// contains filtered or unexported fields
}

type ObstacleRequest

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

type ObstacleState

type ObstacleState uint8
const (
	DT_OBSTACLE_EMPTY      ObstacleState = 0
	DT_OBSTACLE_PROCESSING ObstacleState = 1
	DT_OBSTACLE_PROCESSED  ObstacleState = 2
	DT_OBSTACLE_REMOVING   ObstacleState = 3
)

type ObstacleType

type ObstacleType uint8
const (
	DT_OBSTACLE_CYLINDER     ObstacleType = 0
	DT_OBSTACLE_BOX          ObstacleType = 1 // AABB
	DT_OBSTACLE_ORIENTED_BOX ObstacleType = 2 // OBB
)

Jump to

Keyboard shortcuts

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