LightingModel

   
Type LightingModel
Library wattageTileEngine.*
Keywords Wattage, LightingModel, Tile Engine
See also  

Overview

The lighting model tracks lighting of the tiles.

Syntax

local TileEngine = require "plugin.wattageTileEngine"

-- Callback to indicate whether light can pass through a tile
local function isTransparentForLight(column, row)
    -- Make an opaque wall along column 5
    return column ~= 5
end

-- Callback to indicate whether a tile is affected by ambient lighting.
local function isTileAffectedByAmbient(row, column)
    -- Make all tiles affected by ambient lighting
    return true
end

local lightingModel = TileEngine.LightingModel.new({
    isTransparent = isTransparentForLight,
    isTileAffectedByAmbient = isTileAffectedByAmbient,
    useTransitioners = true,
    compensateLightingForViewingPosition = false
})

Constructor

LightingModel.new()

Functions

LightingModel.setAmbientLight()
LightingModel.getAmbientLight()
LightingModel.update()
LightingModel.resetDirtyFlags()
LightingModel.addLight()
LightingModel.updateLight()
LightingModel.removeLight()
LightingModel.getLightProperties()
LightingModel.markLightAsDirtyIfAffectedAreaContainsTile()
LightingModel.markChangeInTransparency()
LightingModel.getAggregateLightIfRowColumnOpaque()
LightingModel.getAggregateLight()
LightingModel.getDirtyAggregateRows()
LightingModel.getDirtyAggregateColumns()
LightingModel.getDirtyAggregateCount()
LightingModel.hasDirtyAggregateTile()
LightingModel.hasAmbientLightChanged()
LightingModel.setIsTransparentCallback()
LightingModel.setIsTileAffectedByAmbientCallback()
LightingModel.setUseTransitioners()