Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TileLayer

Each tile in the wayward world is rendered as 4 subtiles (topleft, topright, bottomleft, bottomright). The world consists of 3 tile layers (terrain, doodad, doodadOver). Each subtile is a RGBA 32bit pixel representing a foreground and background tile. Red,Green make up the x,y coordinate in the tilesheet of the foreground tile. Blue,Alpha make up the x,y coordinate in the tilesheet of the background tile. If Red and Green are both 0, the subtile foreground is not rendered. If Blue and Alpha are both 0, the subtile background is not rendered.

Hierarchy

  • TileLayer

Index

Constructors

constructor

  • new TileLayer(width: number, height: number, gl: WebGLRenderingContext): TileLayer
  • Parameters

    • width: number
    • height: number
    • gl: WebGLRenderingContext

    Returns TileLayer

Properties

Private height

height: number

Private inverseTileDataTextureSize

inverseTileDataTextureSize: Vec2

Private singleTileData

singleTileData: ArrayBuffer

Private singleTileDataU32

singleTileDataU32: Uint32Array

Private singleTileDataU8

singleTileDataU8: Uint8Array

Private texTiles

texTiles: WebGLTexture

Private tileData

tileData: ArrayBuffer

Private tileDataU32

tileDataU32: Uint32Array

Private tileDataU8

tileDataU8: Uint8Array

Private width

width: number

Static Private inverseTileSpriteTextureSize

inverseTileSpriteTextureSize: Vec2

Static Private texTileSprites

texTileSprites: WebGLTexture

Static Private tileShaderProgram

tileShaderProgram: CompiledProgram

Methods

clear

  • clear(): void
  • Returns void

render

  • render(gl: WebGLRenderingContext, x: number, y: number, subTileSize: number, tileScale: number, viewWidth: number, viewHeight: number, fixedDepth?: boolean): void
  • Parameters

    • gl: WebGLRenderingContext
    • x: number
    • y: number
    • subTileSize: number
    • tileScale: number
    • viewWidth: number
    • viewHeight: number
    • Default value fixedDepth: boolean = false

    Returns void

sendTileToGPU

  • sendTileToGPU(x: number, y: number, gl: WebGLRenderingContext): void
  • Parameters

    • x: number
    • y: number
    • gl: WebGLRenderingContext

    Returns void

sendToGPU

  • sendToGPU(gl: WebGLRenderingContext): void
  • Parameters

    • gl: WebGLRenderingContext

    Returns void

setTileBLBG

  • setTileBLBG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileBLFG

  • setTileBLFG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileBRBG

  • setTileBRBG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileBRFG

  • setTileBRFG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileTLBG

  • setTileTLBG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileTLFG

  • setTileTLFG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileTRBG

  • setTileTRBG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

setTileTRFG

  • setTileTRFG(dataIndex: number, tileX: number, tileY: number): void
  • Parameters

    • dataIndex: number
    • tileX: number
    • tileY: number

    Returns void

Static compileShaders

  • compileShaders(gl: WebGLRenderingContext): void
  • Parameters

    • gl: WebGLRenderingContext

    Returns void

Static setTileTexture

  • setTileTexture(texture: WebGLTexture, textureSizeInversed: Vec2): any
  • Parameters

    • texture: WebGLTexture
    • textureSizeInversed: Vec2

    Returns any

Generated using TypeDoc