diff --git a/README.md b/README.md index c7e99ef..48b90da 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # WallyFOV [![Dependencies](https://david-dm.org/sbj42/wally-fov.svg)](https://david-dm.org/sbj42/wally-fov) -[![CircleCI](https://img.shields.io/circleci/project/github/sbj42/wally-fov.svg)](https://circleci.com/gh/sbj42/wally-fov) +[![Node.js CI](https://github.com/sbj42/wally-fov/workflows/Node.js%20CI/badge.svg)](https://github.com/sbj42/wally-fov/actions?query=workflow%3A%22Node.js+CI%22) [![License](https://img.shields.io/github/license/sbj42/wally-fov.svg)](https://github.com/sbj42/wally-fov) -[![Coverage](https://coveralls.io/repos/github/sbj42/wally-fov/badge.svg?branch=master)](https://coveralls.io/github/sbj42/wally-fov?branch=master) #### Shadow-casting field-of-view algorithm with support for walls diff --git a/bin/wally-fov-1.0.2.js.map b/bin/wally-fov-1.0.2.js.map deleted file mode 100644 index 5f4d53f..0000000 --- a/bin/wally-fov-1.0.2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://WallyFov/webpack/bootstrap","webpack://WallyFov/./src/field-of-view.ts","webpack://WallyFov/./src/geom/direction-flags.ts","webpack://WallyFov/./src/geom/direction.ts","webpack://WallyFov/./src/geom/index.ts","webpack://WallyFov/./src/geom/mask-rect.ts","webpack://WallyFov/./src/geom/mask.ts","webpack://WallyFov/./src/geom/offset.ts","webpack://WallyFov/./src/geom/rectangle.ts","webpack://WallyFov/./src/geom/size.ts","webpack://WallyFov/./src/index.ts"],"names":[],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;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AE,CAAC;gBACd,QAAQ,CAAC,MAAM,CAAC,CAAC;aACpB;SACJ;IACL,CAAC;IACL,WAAC;AAAD,CAAC;AAhEY,oBAAI;;;;;;;;;;;;;;ACPjB;;;;;GAKG;;AAEH,2FAA+C;AAAvC,uDAAc;AACtB,sEAA2D;AAAnD,oCAAS;AAAE,8CAAc;AAAE,kCAAQ","file":"wally-fov-1.0.2.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/bin/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import * as geom from './geom';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\n/**\r\n * These flags determine whether a given tile has walls in any of the cardinal\r\n * directions, and whether there is a \"body\" in the tile.\r\n */\r\nenum TileFlag {\r\n WALL_NORTH = 1 << geom.Direction.NORTH,\r\n WALL_EAST = 1 << geom.Direction.EAST,\r\n WALL_WEST = 1 << geom.Direction.WEST,\r\n WALL_SOUTH = 1 << geom.Direction.SOUTH,\r\n BODY = 1 << geom.DIRECTIONS.length,\r\n}\r\n\r\n/**\r\n * In the shadowcasting algorithm, each shadow is represented by a \"wedge\",\r\n * running from a \"low\" angle to a \"high\" angle. The wedges are all stored in\r\n * a simple number array, with two numbers for each wedge. These constants\r\n * (WEDGE_LOW and WEDGE_HIGH) help to identify which number is which.\r\n * WEDGE_COUNT is just how many numbers per wedge.\r\n */\r\nconst WEDGE_LOW = 0;\r\nconst WEDGE_HIGH = 1;\r\nconst WEDGE_COUNT = 2;\r\n\r\n/**\r\n * Bodies in this algorithm do not entirely fill their tiles. This is\r\n * implemented by adjusting the angles of the shadows the bodies cast,\r\n * making the wedge very slightly narrower. BODY_EPSILON represents the\r\n * amount of reduction on either side of the wedge.\r\n */\r\nconst BODY_EPSILON = 0.00001;\r\n\r\n/**\r\n * Walls do fill the entire tile edge. With infinite precision, there would be\r\n * no need to adjust the shadow cast by a wall. But we're using floating point\r\n * math here, which means imprecision can creep in and cause angles not to line\r\n * up properly. To fix that, we widen the wedges of the shadows cast by walls.\r\n * We must make sure not to widen them as much as we narrow the body shadows,\r\n * or else they might close the gap we want between a body and a wall.\r\n */\r\nconst WALL_EPSILON = BODY_EPSILON / 10;\r\n\r\n/**\r\n * We avoid heap allocations during the core part of the algorithm by using this\r\n * preallocated offset object.\r\n */\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\n/**\r\n * The FieldOFViewMap represents the map over which the field of view will be\r\n * computed. It starts out empty. You can add walls and bodies to it, and then\r\n * use getFieldOfView() to compute the field of view from a given point.\r\n */\r\nexport class FieldOfViewMap {\r\n private readonly _size = new geom.Size();\r\n private readonly _tileFlags: number[];\r\n\r\n constructor(width: number, height: number) {\r\n this._size.set(width, height);\r\n this._tileFlags = new Array(this._size.area).fill(0);\r\n }\r\n\r\n private _addFlag(off: geom.OffsetLike, flag: TileFlag) {\r\n const index = this._size.index(off);\r\n this._tileFlags[index] |= flag;\r\n }\r\n\r\n private _removeFlag(off: geom.OffsetLike, flag: TileFlag) {\r\n const index = this._size.index(off);\r\n this._tileFlags[index] &= ~flag;\r\n }\r\n\r\n // setup and maintenance\r\n\r\n /**\r\n * Adds a wall at a particular edge. This automatically adds the\r\n * corresponding wall on the other side.\r\n */\r\n addWall(x: number, y: number, dir: geom.Direction) {\r\n LOCAL_OFF.set(x, y);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._addFlag(LOCAL_OFF, 1 << dir);\r\n LOCAL_OFF.addCardinalDirection(dir);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._addFlag(LOCAL_OFF, 1 << geom.directionOpposite(dir));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Removes a wall at a particular edge. This automatically removes the\r\n * corresponding wall on the other side.\r\n */\r\n removeWall(x: number, y: number, dir: geom.Direction) {\r\n LOCAL_OFF.set(x, y);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._removeFlag(LOCAL_OFF, 1 << dir);\r\n LOCAL_OFF.addCardinalDirection(dir);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._removeFlag(LOCAL_OFF, 1 << geom.directionOpposite(dir));\r\n }\r\n }\r\n }\r\n\r\n getWalls(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return this._tileFlags[index] & geom.DirectionFlags.ALL;\r\n }\r\n\r\n getWall(x: number, y: number, dir: geom.Direction) {\r\n return (this.getWalls(x, y) & (1 << dir)) !== 0;\r\n }\r\n\r\n addBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n this._addFlag(LOCAL_OFF, TileFlag.BODY);\r\n }\r\n\r\n removeBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n this._removeFlag(LOCAL_OFF, TileFlag.BODY);\r\n }\r\n\r\n getBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return (this._tileFlags[index] & TileFlag.BODY) !== 0;\r\n }\r\n\r\n // execution\r\n\r\n /**\r\n * Compute the field of view for a camera at the given tile.\r\n * chebyshevRadius is the vision radius. It uses chebyshev distance\r\n * (https://en.wikipedia.org/wiki/Chebyshev_distance), which just means\r\n * that the limit of vision in a large empty field will be square.\r\n *\r\n * This returns a MaskRect, which indicates which tiles are visible.\r\n * maskRect.get(x, y) will return true for visible tiles.\r\n */\r\n getFieldOfView(x: number, y: number, chebyshevRadius: number): geom.MaskRect {\r\n const origin = new geom.Offset(x, y);\r\n const boundRect = new geom.Rectangle(\r\n origin.x - chebyshevRadius, origin.y - chebyshevRadius,\r\n chebyshevRadius * 2 + 1, chebyshevRadius * 2 + 1,\r\n );\r\n const mask = new geom.MaskRect(boundRect);\r\n // the player can always see itself\r\n mask.set(origin, true);\r\n // the field is divided into quadrants\r\n this._quadrant(mask, origin, chebyshevRadius, -1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, -1, 1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, 1);\r\n return mask;\r\n }\r\n\r\n private _quadrant(mask: geom.MaskRect, origin: geom.OffsetLike, chebyshevRadius: number,\r\n xDir: number, yDir: number) {\r\n const {x: startX, y: startY} = origin;\r\n const endDX = (Math.min(Math.max(startX + xDir * (chebyshevRadius + 1),\r\n -1), this._size.width) - startX) * xDir;\r\n const endDY = (Math.min(Math.max(startY + yDir * (chebyshevRadius + 1),\r\n -1), this._size.height) - startY) * yDir;\r\n if (endDX < 0 || endDY < 0) {\r\n // the origin is outside of the map\r\n return;\r\n }\r\n const farYFlag = yDir === 1 ? TileFlag.WALL_SOUTH : TileFlag.WALL_NORTH;\r\n const farXFlag = xDir === 1 ? TileFlag.WALL_EAST : TileFlag.WALL_WEST;\r\n const startMapIndex = this._size.index(origin);\r\n const startMaskIndex = mask.index(origin);\r\n // Initial wedge is from slope zero to slope infinity (i.e. the whole quadrant)\r\n const wedges = [0, Number.POSITIVE_INFINITY];\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dy = 0, yMapIndex = startMapIndex, yMaskIndex = startMaskIndex;\r\n dy !== endDY && wedges.length > 0;\r\n dy ++, yMapIndex = yMapIndex + yDir * this._size.width, yMaskIndex = yMaskIndex + yDir * mask.width\r\n ) {\r\n const divYpos = 1 / (dy + 0.5);\r\n const divYneg = dy === 0 ? Number.POSITIVE_INFINITY : 1 / (dy - 0.5);\r\n let wedgeIndex = 0;\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dx = 0, mapIndex = yMapIndex, maskIndex = yMaskIndex,\r\n slopeY = -0.5 * divYpos, slopeX = 0.5 * divYneg;\r\n dx !== endDX && wedgeIndex !== wedges.length;\r\n dx ++, mapIndex = mapIndex + xDir, maskIndex = maskIndex + xDir,\r\n slopeY = slopeY + divYpos, slopeX = slopeX + divYneg\r\n ) {\r\n // the slopes of the four corners of this tile\r\n // these are named as follows:\r\n // slopeY is the slope closest to the Y axis\r\n // slopeFar is the slope to the farthest corner\r\n // slopeX is the slope closest to the X axis\r\n // this is always true:\r\n // slopeY < slopeFar < slopeX\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---X\r\n // | | | C |\r\n // +---+---Y---F\r\n\r\n // the walls of this tile\r\n // these are named as follows:\r\n // wallY is the farthest horizontal wall (slopeY to slopeFar)\r\n // wallX is the farthest vertical wall (slopeFar to slopeX)\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---+\r\n // | | | C X\r\n // +---+---+-Y-+\r\n\r\n // advance the wedge index until this tile is not after the current wedge\r\n while (slopeY >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n wedgeIndex = wedgeIndex + WEDGE_COUNT;\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n }\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n\r\n // if the current wedge is after this tile, move on\r\n if (slopeX <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n continue;\r\n }\r\n\r\n // we can see this tile\r\n mask.setAt(maskIndex, true);\r\n\r\n // const/let must be at the top of a block, in order not to trigger deoptimization due to\r\n // https://github.com/nodejs/node/issues/9729\r\n {\r\n const wallY = (this._tileFlags[mapIndex] & farYFlag) !== 0;\r\n const wallX = (this._tileFlags[mapIndex] & farXFlag) !== 0;\r\n if (wallX && wallY) {\r\n // this tile has both far walls\r\n // so we can't see beyond it and the whole range should be cut out of the wedge(s)\r\n wedgeIndex = cutWedge(wedges, wedgeIndex, slopeY - WALL_EPSILON, slopeX + WALL_EPSILON);\r\n } else {\r\n const body = (dx !== 0 || dy !== 0) && (this._tileFlags[mapIndex] & TileFlag.BODY) !== 0;\r\n if (body) {\r\n if (wallX) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX + WALL_EPSILON);\r\n } else if (wallY) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY - WALL_EPSILON, slopeX - BODY_EPSILON);\r\n } else {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX - BODY_EPSILON);\r\n }\r\n } else if (wallX) {\r\n const slopeFar = slopeY + divYpos;\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeFar - WALL_EPSILON, slopeX + WALL_EPSILON);\r\n } else if (wallY) {\r\n const slopeFar = slopeY + divYpos;\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY - WALL_EPSILON, slopeFar + WALL_EPSILON);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * This function cuts a range of angles out of the wedge array.\r\n */\r\nfunction cutWedge(wedges: number[], wedgeIndex: number, low: number, high: number): number {\r\n for (; ; ) {\r\n if (wedgeIndex === wedges.length) {\r\n return wedgeIndex;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n break;\r\n }\r\n // This next line is to cover a hypothetical edge case, where two slopes\r\n // are not the same, but are within the BODY_EPSILON distance. That\r\n // would be due to either floating point error or due to a very large\r\n // field radius. Either way I haven't been able to construct a test\r\n // case for it.\r\n wedgeIndex += WEDGE_COUNT;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // wedge is entirely occluded, remove it\r\n wedges.splice(wedgeIndex, WEDGE_COUNT);\r\n // now looking at the next wedge (or past the end)\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else if (high >= wedges[wedgeIndex + WEDGE_LOW]) {\r\n // low part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // still looking at the same wedge\r\n } else {\r\n // this cut doesn't reach the current wedge\r\n }\r\n } else if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // high part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_HIGH] = low;\r\n // move on to the next wedge\r\n wedgeIndex += WEDGE_COUNT;\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else {\r\n // middle part of wedge is occluded, split it\r\n wedges.splice(wedgeIndex, 0, wedges[wedgeIndex + WEDGE_LOW], low);\r\n wedgeIndex += WEDGE_COUNT;\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // now looking at the second wedge of the split\r\n }\r\n return wedgeIndex;\r\n}\r\n","import * as geom from '.';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\nexport enum DirectionFlags {\r\n NONE = 0,\r\n NORTH = 1,\r\n EAST = 2,\r\n SOUTH = 4,\r\n WEST = 8,\r\n ALL = 15,\r\n}\r\n\r\nexport function directionFlagsToString(flags: DirectionFlags) {\r\n let ret = '[';\r\n if ((flags & DirectionFlags.NORTH) !== 0) {\r\n ret += 'N';\r\n }\r\n if ((flags & DirectionFlags.EAST) !== 0) {\r\n ret += 'E';\r\n }\r\n if ((flags & DirectionFlags.SOUTH) !== 0) {\r\n ret += 'S';\r\n }\r\n if ((flags & DirectionFlags.WEST) !== 0) {\r\n ret += 'W';\r\n }\r\n return ret + ']';\r\n}\r\n\r\n// conversion\r\n\r\nexport function directionFlagsFromDirection(dir: geom.Direction) {\r\n return (1 << dir) as DirectionFlags;\r\n}\r\n","// tslint:disable:no-bitwise\r\n\r\nexport enum Direction {\r\n NORTH = 0,\r\n EAST = 1,\r\n SOUTH = 2,\r\n WEST = 3,\r\n}\r\n\r\nexport const DIRECTIONS = [\r\n Direction.NORTH,\r\n Direction.EAST,\r\n Direction.SOUTH,\r\n Direction.WEST,\r\n];\r\n\r\nexport function directionOpposite(dir: Direction) {\r\n return ((dir + 2) & 3) as Direction;\r\n}\r\n","export * from './direction';\r\nexport * from './direction-flags';\r\nexport * from './offset';\r\nexport * from './size';\r\nexport * from './rectangle';\r\nexport * from './mask';\r\nexport * from './mask-rect';\r\n","import * as geom from '.';\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class MaskRect implements geom.RectangleLike {\r\n private readonly _rectangle = new geom.Rectangle();\r\n private readonly _mask: geom.Mask;\r\n private readonly _outsideValue: boolean;\r\n\r\n constructor(rect: geom.RectangleLike, initialValue = false, outsideValue = false) {\r\n this._rectangle.copyFrom(rect);\r\n this._mask = new geom.Mask(rect, initialValue);\r\n this._outsideValue = outsideValue;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `${this._rectangle.northWest}/${this._outsideValue}\\n${this._mask}`;\r\n }\r\n\r\n get westX() {\r\n return this._rectangle.westX;\r\n }\r\n\r\n get northY() {\r\n return this._rectangle.northY;\r\n }\r\n\r\n get width() {\r\n return this._rectangle.width;\r\n }\r\n\r\n get height() {\r\n return this._rectangle.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._mask.index(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest));\r\n }\r\n\r\n getAt(index: number) {\r\n return this._mask.getAt(index);\r\n }\r\n\r\n get(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n if (!this._rectangle.containsOffset(LOCAL_OFF)) {\r\n return this._outsideValue;\r\n }\r\n return this._mask.get(LOCAL_OFF.subtractOffset(this._rectangle.northWest));\r\n }\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._mask.setAt(index, value);\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n this._mask.set(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest), value);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n this._mask.forEach(cursor, (off, value) => {\r\n callback(off.addOffset(this._rectangle.northWest), value);\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport class Mask implements geom.SizeLike {\r\n private readonly _size = new geom.Size();\r\n private readonly _bits: boolean[];\r\n // TODO consider Uint8Array for bits\r\n\r\n constructor(size: geom.SizeLike, initialValue = false) {\r\n this._size.copyFrom(size);\r\n this._bits = new Array(this._size.area).fill(initialValue);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n let ret = '';\r\n const off = new geom.Offset();\r\n for (let y = 0; y < this._size.height; y ++) {\r\n for (let x = 0; x < this._size.width; x ++) {\r\n off.set(x, y);\r\n ret += this.get(off.set(x, y)) ? '☑' : '☐';\r\n }\r\n ret += '\\n';\r\n }\r\n return ret;\r\n }\r\n\r\n get width() {\r\n return this._size.width;\r\n }\r\n\r\n get height() {\r\n return this._size.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._size.index(off);\r\n }\r\n\r\n getAt(index: number) {\r\n return this._bits[index];\r\n }\r\n\r\n get(off: geom.OffsetLike) {\r\n return this.getAt(this.index(off));\r\n }\r\n\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._bits[index] = value;\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n return this.setAt(this.index(off), value);\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n let index = 0;\r\n this._size.forEach(cursor, (off) => {\r\n callback(off, this._bits[index]);\r\n index ++;\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nconst X_FROM_CARDINAL_DIRECTION = [ 0, 1, 0, -1 ];\r\nconst Y_FROM_CARDINAL_DIRECTION = [ -1, 0, 1, 0 ];\r\n\r\nexport interface OffsetLike {\r\n readonly x: number;\r\n readonly y: number;\r\n}\r\n\r\nexport class Offset implements OffsetLike {\r\n x: number;\r\n y: number;\r\n\r\n constructor();\r\n constructor(x: number, y: number);\r\n constructor(x?: number, y?: number) {\r\n if (typeof x === 'undefined') {\r\n x = 0;\r\n }\r\n if (typeof y === 'undefined') {\r\n y = 0;\r\n }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n toString() {\r\n return `(${this.x},${this.y})`;\r\n }\r\n\r\n // mutators\r\n\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n copyFrom(other: OffsetLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n addOffset(off: OffsetLike) {\r\n this.x += off.x;\r\n this.y += off.y;\r\n return this;\r\n }\r\n\r\n addCardinalDirection(dir: geom.Direction) {\r\n this.x += X_FROM_CARDINAL_DIRECTION[dir];\r\n this.y += Y_FROM_CARDINAL_DIRECTION[dir];\r\n return this;\r\n }\r\n\r\n subtractOffset(off: OffsetLike) {\r\n this.x -= off.x;\r\n this.y -= off.y;\r\n return this;\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface RectangleLike extends geom.SizeLike {\r\n readonly westX: number;\r\n readonly northY: number;\r\n}\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class Rectangle implements RectangleLike, geom.SizeLike {\r\n northWest: geom.Offset;\r\n size: geom.Size;\r\n\r\n constructor();\r\n constructor(westX: number, northY: number, width: number, height: number);\r\n constructor(westX?: number, northY?: number, width?: number, height?: number) {\r\n if (typeof westX === 'undefined') {\r\n westX = 0;\r\n }\r\n if (typeof northY === 'undefined') {\r\n northY = 0;\r\n }\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.northWest = new geom.Offset(westX, northY);\r\n this.size = new geom.Size(width, height);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.westX},${this.northY} ${this.width}x${this.height})`;\r\n }\r\n\r\n get northY() {\r\n return this.northWest.y;\r\n }\r\n\r\n get southY() {\r\n return this.northWest.y + this.size.height - 1;\r\n }\r\n\r\n get westX() {\r\n return this.northWest.x;\r\n }\r\n\r\n get eastX() {\r\n return this.northWest.x + this.size.width - 1;\r\n }\r\n\r\n get width() {\r\n return this.size.width;\r\n }\r\n\r\n get height() {\r\n return this.size.height;\r\n }\r\n\r\n get empty() {\r\n return this.size.empty;\r\n }\r\n\r\n get area() {\r\n return this.size.area;\r\n }\r\n\r\n // mutators\r\n\r\n copyFrom(other: RectangleLike) {\r\n this.northWest.set(other.westX, other.northY);\r\n this.size.set(other.width, other.height);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return this.size.containsOffset(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this.size.index(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface SizeLike {\r\n readonly width: number;\r\n readonly height: number;\r\n}\r\n\r\nexport class Size implements SizeLike {\r\n width: number;\r\n height: number;\r\n\r\n constructor();\r\n constructor(width: number, height: number);\r\n constructor(width?: number, height?: number) {\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.width}x${this.height})`;\r\n }\r\n\r\n get empty() {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n get area() {\r\n return this.width * this.height;\r\n }\r\n\r\n // mutators\r\n\r\n set(width: number, height: number) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n }\r\n\r\n copyFrom(other: SizeLike) {\r\n this.width = other.width;\r\n this.height = other.height;\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return off.x >= 0 && off.y >= 0 && off.x < this.width && off.y < this.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return off.y * this.width + off.x;\r\n }\r\n\r\n forEach(cursor: geom.Offset, callback: (offset: geom.Offset) => void) {\r\n for (let dy = 0; dy < this.height; dy ++) {\r\n for (let dx = 0; dx < this.width; dx ++) {\r\n cursor.x = dx;\r\n cursor.y = dy;\r\n callback(cursor);\r\n }\r\n }\r\n }\r\n}\r\n","/*\r\n * WallyFOV\r\n * github.com/sbj42/wally-fov\r\n * James Clark\r\n * Licensed under the MIT license.\r\n */\r\n\r\nexport {FieldOfViewMap} from './field-of-view';\r\nexport {Direction, DirectionFlags, MaskRect} from './geom';\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/bin/wally-fov-1.0.2.min.js b/bin/wally-fov-1.0.2.min.js deleted file mode 100644 index 0c34266..0000000 --- a/bin/wally-fov-1.0.2.min.js +++ /dev/null @@ -1,2 +0,0 @@ -var WallyFov=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/bin/",i(i.s=9)}([function(t,e,i){"use strict";function n(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),n(i(7)),n(i(6)),n(i(5)),n(i(4)),n(i(3)),n(i(2)),n(i(1))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(0),r=new n.Offset,o=function(){function t(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1),this._rectangle=new n.Rectangle,this._rectangle.copyFrom(t),this._mask=new n.Mask(t,e),this._outsideValue=i}return t.prototype.toString=function(){return this._rectangle.northWest+"/"+this._outsideValue+"\n"+this._mask},Object.defineProperty(t.prototype,"westX",{get:function(){return this._rectangle.westX},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"northY",{get:function(){return this._rectangle.northY},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._rectangle.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._rectangle.height},enumerable:!0,configurable:!0}),t.prototype.index=function(t){return this._mask.index(r.copyFrom(t).subtractOffset(this._rectangle.northWest))},t.prototype.getAt=function(t){return this._mask.getAt(t)},t.prototype.get=function(t,e){return r.set(t,e),this._rectangle.containsOffset(r)?this._mask.get(r.subtractOffset(this._rectangle.northWest)):this._outsideValue},t.prototype.setAt=function(t,e){return this._mask.setAt(t,e),this},t.prototype.set=function(t,e){return this._mask.set(r.copyFrom(t).subtractOffset(this._rectangle.northWest),e),this},t.prototype.forEach=function(t,e){var i=this;this._mask.forEach(t,function(t,n){e(t.addOffset(i._rectangle.northWest),n)})},t}();e.MaskRect=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(0),r=function(){function t(t,e){void 0===e&&(e=!1),this._size=new n.Size,this._size.copyFrom(t),this._bits=new Array(this._size.area).fill(e)}return t.prototype.toString=function(){for(var t="",e=new n.Offset,i=0;i=0&&t.y>=0&&t.x0;b++,v+=h*this._size.width,m+=h*t.width)for(var w=1/(b+.5),S=0===b?Number.POSITIVE_INFINITY:1/(b-.5),T=0,x=0,W=v,F=m,z=-.5*w,A=.5*S;x!==p&&T!==O.length;x++,W+=r,F+=r,z+=w,A+=S){for(;z>=O[T+s]&&!((T+=u)>=O.length););if(T>=O.length)break;if(!(A<=O[T+o])){t.setAt(F,!0);var P=0!=(this._tileFlags[W]&d),j=0!=(this._tileFlags[W]&y);if(j&&P)T=c(O,T,z-1e-5/10,A+1e-5/10);else if((0!==x||0!==b)&&0!=(this._tileFlags[W]&n.BODY))T=j?c(O,T,z+1e-5,A+1e-5/10):c(O,T,P?z-1e-5/10:z+1e-5,A-1e-5);else if(j){T=c(O,T,z+w-1e-5/10,A+1e-5/10)}else if(P){T=c(O,T,z-1e-5/10,z+w+1e-5/10)}}}},t}();function c(t,e,i,n){for(;;){if(e===t.length)return e;if(i<=t[e+s])break;e+=u}if(i<=t[e+o]){if(n>=t[e+s])return t.splice(e,u),c(t,e,i,n);n>=t[e+o]&&(t[e+o]=n)}else{if(n>=t[e+s])return t[e+s]=i,c(t,e+=u,i,n);t.splice(e,0,t[e+o],i),t[(e+=u)+o]=n}return e}e.FieldOfViewMap=f},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(8);e.FieldOfViewMap=n.FieldOfViewMap;var r=i(0);e.Direction=r.Direction,e.DirectionFlags=r.DirectionFlags,e.MaskRect=r.MaskRect}]); -//# sourceMappingURL=wally-fov-1.0.2.min.js.map \ No newline at end of file diff --git a/bin/wally-fov-1.0.2.min.js.map b/bin/wally-fov-1.0.2.min.js.map deleted file mode 100644 index 8ca8716..0000000 --- a/bin/wally-fov-1.0.2.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://WallyFov/webpack/bootstrap","webpack://WallyFov/./src/geom/index.ts","webpack://WallyFov/./src/geom/mask-rect.ts","webpack://WallyFov/./src/geom/mask.ts","webpack://WallyFov/./src/geom/rectangle.ts","webpack://WallyFov/./src/geom/size.ts","webpack://WallyFov/./src/geom/offset.ts","webpack://WallyFov/./src/geom/direction-flags.ts","webpack://WallyFov/./src/geom/direction.ts","webpack://WallyFov/./src/field-of-view.ts","webpack://WallyFov/./src/index.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__export","geom","LOCAL_OFF","Offset","MaskRect","rect","initialValue","outsideValue","this","_rectangle","Rectangle","copyFrom","_mask","Mask","_outsideValue","toString","northWest","westX","northY","width","height","index","off","subtractOffset","getAt","x","y","set","containsOffset","setAt","forEach","cursor","callback","_this","addOffset","size","_size","Size","_bits","Array","area","fill","ret","empty","other","dy","dx","X_FROM_CARDINAL_DIRECTION","Y_FROM_CARDINAL_DIRECTION","addCardinalDirection","dir","DirectionFlags","directionFlagsToString","flags","NORTH","EAST","SOUTH","WEST","directionFlagsFromDirection","Direction","DIRECTIONS","directionOpposite","TileFlag","length","WEDGE_LOW","WEDGE_HIGH","WEDGE_COUNT","FieldOfViewMap","_tileFlags","_addFlag","flag","_removeFlag","addWall","removeWall","getWalls","ALL","getWall","addBody","BODY","removeBody","getBody","getFieldOfView","chebyshevRadius","origin","boundRect","mask","_quadrant","xDir","yDir","startX","startY","endDX","Math","min","max","endDY","farYFlag","WALL_SOUTH","WALL_NORTH","farXFlag","WALL_EAST","WALL_WEST","startMapIndex","startMaskIndex","wedges","Number","POSITIVE_INFINITY","yMapIndex","yMaskIndex","divYpos","divYneg","wedgeIndex","mapIndex","maskIndex","slopeY","slopeX","wallY","wallX","cutWedge","low","high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,GACMF,GAAawD,EAGrC,OAAOT,EA7QEjJ,EAAAqG,gGCjDb,IAAAuD,EAAA9J,EAAA,GAAQE,EAAAqG,eAAAuD,EAAAvD,eACR,IAAAwD,EAAA/J,EAAA,GAAQE,EAAA6F,UAAAgE,EAAAhE,UAAW7F,EAAAqF,eAAAwE,EAAAxE,eAAgBrF,EAAAsC,SAAAuH,EAAAvH","file":"wally-fov-1.0.2.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/bin/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n","export * from './direction';\r\nexport * from './direction-flags';\r\nexport * from './offset';\r\nexport * from './size';\r\nexport * from './rectangle';\r\nexport * from './mask';\r\nexport * from './mask-rect';\r\n","import * as geom from '.';\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class MaskRect implements geom.RectangleLike {\r\n private readonly _rectangle = new geom.Rectangle();\r\n private readonly _mask: geom.Mask;\r\n private readonly _outsideValue: boolean;\r\n\r\n constructor(rect: geom.RectangleLike, initialValue = false, outsideValue = false) {\r\n this._rectangle.copyFrom(rect);\r\n this._mask = new geom.Mask(rect, initialValue);\r\n this._outsideValue = outsideValue;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `${this._rectangle.northWest}/${this._outsideValue}\\n${this._mask}`;\r\n }\r\n\r\n get westX() {\r\n return this._rectangle.westX;\r\n }\r\n\r\n get northY() {\r\n return this._rectangle.northY;\r\n }\r\n\r\n get width() {\r\n return this._rectangle.width;\r\n }\r\n\r\n get height() {\r\n return this._rectangle.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._mask.index(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest));\r\n }\r\n\r\n getAt(index: number) {\r\n return this._mask.getAt(index);\r\n }\r\n\r\n get(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n if (!this._rectangle.containsOffset(LOCAL_OFF)) {\r\n return this._outsideValue;\r\n }\r\n return this._mask.get(LOCAL_OFF.subtractOffset(this._rectangle.northWest));\r\n }\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._mask.setAt(index, value);\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n this._mask.set(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest), value);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n this._mask.forEach(cursor, (off, value) => {\r\n callback(off.addOffset(this._rectangle.northWest), value);\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport class Mask implements geom.SizeLike {\r\n private readonly _size = new geom.Size();\r\n private readonly _bits: boolean[];\r\n // TODO consider Uint8Array for bits\r\n\r\n constructor(size: geom.SizeLike, initialValue = false) {\r\n this._size.copyFrom(size);\r\n this._bits = new Array(this._size.area).fill(initialValue);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n let ret = '';\r\n const off = new geom.Offset();\r\n for (let y = 0; y < this._size.height; y ++) {\r\n for (let x = 0; x < this._size.width; x ++) {\r\n off.set(x, y);\r\n ret += this.get(off.set(x, y)) ? '☑' : '☐';\r\n }\r\n ret += '\\n';\r\n }\r\n return ret;\r\n }\r\n\r\n get width() {\r\n return this._size.width;\r\n }\r\n\r\n get height() {\r\n return this._size.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._size.index(off);\r\n }\r\n\r\n getAt(index: number) {\r\n return this._bits[index];\r\n }\r\n\r\n get(off: geom.OffsetLike) {\r\n return this.getAt(this.index(off));\r\n }\r\n\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._bits[index] = value;\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n return this.setAt(this.index(off), value);\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n let index = 0;\r\n this._size.forEach(cursor, (off) => {\r\n callback(off, this._bits[index]);\r\n index ++;\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface RectangleLike extends geom.SizeLike {\r\n readonly westX: number;\r\n readonly northY: number;\r\n}\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class Rectangle implements RectangleLike, geom.SizeLike {\r\n northWest: geom.Offset;\r\n size: geom.Size;\r\n\r\n constructor();\r\n constructor(westX: number, northY: number, width: number, height: number);\r\n constructor(westX?: number, northY?: number, width?: number, height?: number) {\r\n if (typeof westX === 'undefined') {\r\n westX = 0;\r\n }\r\n if (typeof northY === 'undefined') {\r\n northY = 0;\r\n }\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.northWest = new geom.Offset(westX, northY);\r\n this.size = new geom.Size(width, height);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.westX},${this.northY} ${this.width}x${this.height})`;\r\n }\r\n\r\n get northY() {\r\n return this.northWest.y;\r\n }\r\n\r\n get southY() {\r\n return this.northWest.y + this.size.height - 1;\r\n }\r\n\r\n get westX() {\r\n return this.northWest.x;\r\n }\r\n\r\n get eastX() {\r\n return this.northWest.x + this.size.width - 1;\r\n }\r\n\r\n get width() {\r\n return this.size.width;\r\n }\r\n\r\n get height() {\r\n return this.size.height;\r\n }\r\n\r\n get empty() {\r\n return this.size.empty;\r\n }\r\n\r\n get area() {\r\n return this.size.area;\r\n }\r\n\r\n // mutators\r\n\r\n copyFrom(other: RectangleLike) {\r\n this.northWest.set(other.westX, other.northY);\r\n this.size.set(other.width, other.height);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return this.size.containsOffset(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this.size.index(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface SizeLike {\r\n readonly width: number;\r\n readonly height: number;\r\n}\r\n\r\nexport class Size implements SizeLike {\r\n width: number;\r\n height: number;\r\n\r\n constructor();\r\n constructor(width: number, height: number);\r\n constructor(width?: number, height?: number) {\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.width}x${this.height})`;\r\n }\r\n\r\n get empty() {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n get area() {\r\n return this.width * this.height;\r\n }\r\n\r\n // mutators\r\n\r\n set(width: number, height: number) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n }\r\n\r\n copyFrom(other: SizeLike) {\r\n this.width = other.width;\r\n this.height = other.height;\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return off.x >= 0 && off.y >= 0 && off.x < this.width && off.y < this.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return off.y * this.width + off.x;\r\n }\r\n\r\n forEach(cursor: geom.Offset, callback: (offset: geom.Offset) => void) {\r\n for (let dy = 0; dy < this.height; dy ++) {\r\n for (let dx = 0; dx < this.width; dx ++) {\r\n cursor.x = dx;\r\n cursor.y = dy;\r\n callback(cursor);\r\n }\r\n }\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nconst X_FROM_CARDINAL_DIRECTION = [ 0, 1, 0, -1 ];\r\nconst Y_FROM_CARDINAL_DIRECTION = [ -1, 0, 1, 0 ];\r\n\r\nexport interface OffsetLike {\r\n readonly x: number;\r\n readonly y: number;\r\n}\r\n\r\nexport class Offset implements OffsetLike {\r\n x: number;\r\n y: number;\r\n\r\n constructor();\r\n constructor(x: number, y: number);\r\n constructor(x?: number, y?: number) {\r\n if (typeof x === 'undefined') {\r\n x = 0;\r\n }\r\n if (typeof y === 'undefined') {\r\n y = 0;\r\n }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n toString() {\r\n return `(${this.x},${this.y})`;\r\n }\r\n\r\n // mutators\r\n\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n copyFrom(other: OffsetLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n addOffset(off: OffsetLike) {\r\n this.x += off.x;\r\n this.y += off.y;\r\n return this;\r\n }\r\n\r\n addCardinalDirection(dir: geom.Direction) {\r\n this.x += X_FROM_CARDINAL_DIRECTION[dir];\r\n this.y += Y_FROM_CARDINAL_DIRECTION[dir];\r\n return this;\r\n }\r\n\r\n subtractOffset(off: OffsetLike) {\r\n this.x -= off.x;\r\n this.y -= off.y;\r\n return this;\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\nexport enum DirectionFlags {\r\n NONE = 0,\r\n NORTH = 1,\r\n EAST = 2,\r\n SOUTH = 4,\r\n WEST = 8,\r\n ALL = 15,\r\n}\r\n\r\nexport function directionFlagsToString(flags: DirectionFlags) {\r\n let ret = '[';\r\n if ((flags & DirectionFlags.NORTH) !== 0) {\r\n ret += 'N';\r\n }\r\n if ((flags & DirectionFlags.EAST) !== 0) {\r\n ret += 'E';\r\n }\r\n if ((flags & DirectionFlags.SOUTH) !== 0) {\r\n ret += 'S';\r\n }\r\n if ((flags & DirectionFlags.WEST) !== 0) {\r\n ret += 'W';\r\n }\r\n return ret + ']';\r\n}\r\n\r\n// conversion\r\n\r\nexport function directionFlagsFromDirection(dir: geom.Direction) {\r\n return (1 << dir) as DirectionFlags;\r\n}\r\n","// tslint:disable:no-bitwise\r\n\r\nexport enum Direction {\r\n NORTH = 0,\r\n EAST = 1,\r\n SOUTH = 2,\r\n WEST = 3,\r\n}\r\n\r\nexport const DIRECTIONS = [\r\n Direction.NORTH,\r\n Direction.EAST,\r\n Direction.SOUTH,\r\n Direction.WEST,\r\n];\r\n\r\nexport function directionOpposite(dir: Direction) {\r\n return ((dir + 2) & 3) as Direction;\r\n}\r\n","import * as geom from './geom';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\n/**\r\n * These flags determine whether a given tile has walls in any of the cardinal\r\n * directions, and whether there is a \"body\" in the tile.\r\n */\r\nenum TileFlag {\r\n WALL_NORTH = 1 << geom.Direction.NORTH,\r\n WALL_EAST = 1 << geom.Direction.EAST,\r\n WALL_WEST = 1 << geom.Direction.WEST,\r\n WALL_SOUTH = 1 << geom.Direction.SOUTH,\r\n BODY = 1 << geom.DIRECTIONS.length,\r\n}\r\n\r\n/**\r\n * In the shadowcasting algorithm, each shadow is represented by a \"wedge\",\r\n * running from a \"low\" angle to a \"high\" angle. The wedges are all stored in\r\n * a simple number array, with two numbers for each wedge. These constants\r\n * (WEDGE_LOW and WEDGE_HIGH) help to identify which number is which.\r\n * WEDGE_COUNT is just how many numbers per wedge.\r\n */\r\nconst WEDGE_LOW = 0;\r\nconst WEDGE_HIGH = 1;\r\nconst WEDGE_COUNT = 2;\r\n\r\n/**\r\n * Bodies in this algorithm do not entirely fill their tiles. This is\r\n * implemented by adjusting the angles of the shadows the bodies cast,\r\n * making the wedge very slightly narrower. BODY_EPSILON represents the\r\n * amount of reduction on either side of the wedge.\r\n */\r\nconst BODY_EPSILON = 0.00001;\r\n\r\n/**\r\n * Walls do fill the entire tile edge. With infinite precision, there would be\r\n * no need to adjust the shadow cast by a wall. But we're using floating point\r\n * math here, which means imprecision can creep in and cause angles not to line\r\n * up properly. To fix that, we widen the wedges of the shadows cast by walls.\r\n * We must make sure not to widen them as much as we narrow the body shadows,\r\n * or else they might close the gap we want between a body and a wall.\r\n */\r\nconst WALL_EPSILON = BODY_EPSILON / 10;\r\n\r\n/**\r\n * We avoid heap allocations during the core part of the algorithm by using this\r\n * preallocated offset object.\r\n */\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\n/**\r\n * The FieldOFViewMap represents the map over which the field of view will be\r\n * computed. It starts out empty. You can add walls and bodies to it, and then\r\n * use getFieldOfView() to compute the field of view from a given point.\r\n */\r\nexport class FieldOfViewMap {\r\n private readonly _size = new geom.Size();\r\n private readonly _tileFlags: number[];\r\n\r\n constructor(width: number, height: number) {\r\n this._size.set(width, height);\r\n this._tileFlags = new Array(this._size.area).fill(0);\r\n }\r\n\r\n private _addFlag(off: geom.OffsetLike, flag: TileFlag) {\r\n const index = this._size.index(off);\r\n this._tileFlags[index] |= flag;\r\n }\r\n\r\n private _removeFlag(off: geom.OffsetLike, flag: TileFlag) {\r\n const index = this._size.index(off);\r\n this._tileFlags[index] &= ~flag;\r\n }\r\n\r\n // setup and maintenance\r\n\r\n /**\r\n * Adds a wall at a particular edge. This automatically adds the\r\n * corresponding wall on the other side.\r\n */\r\n addWall(x: number, y: number, dir: geom.Direction) {\r\n LOCAL_OFF.set(x, y);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._addFlag(LOCAL_OFF, 1 << dir);\r\n LOCAL_OFF.addCardinalDirection(dir);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._addFlag(LOCAL_OFF, 1 << geom.directionOpposite(dir));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Removes a wall at a particular edge. This automatically removes the\r\n * corresponding wall on the other side.\r\n */\r\n removeWall(x: number, y: number, dir: geom.Direction) {\r\n LOCAL_OFF.set(x, y);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._removeFlag(LOCAL_OFF, 1 << dir);\r\n LOCAL_OFF.addCardinalDirection(dir);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._removeFlag(LOCAL_OFF, 1 << geom.directionOpposite(dir));\r\n }\r\n }\r\n }\r\n\r\n getWalls(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return this._tileFlags[index] & geom.DirectionFlags.ALL;\r\n }\r\n\r\n getWall(x: number, y: number, dir: geom.Direction) {\r\n return (this.getWalls(x, y) & (1 << dir)) !== 0;\r\n }\r\n\r\n addBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n this._addFlag(LOCAL_OFF, TileFlag.BODY);\r\n }\r\n\r\n removeBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n this._removeFlag(LOCAL_OFF, TileFlag.BODY);\r\n }\r\n\r\n getBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return (this._tileFlags[index] & TileFlag.BODY) !== 0;\r\n }\r\n\r\n // execution\r\n\r\n /**\r\n * Compute the field of view for a camera at the given tile.\r\n * chebyshevRadius is the vision radius. It uses chebyshev distance\r\n * (https://en.wikipedia.org/wiki/Chebyshev_distance), which just means\r\n * that the limit of vision in a large empty field will be square.\r\n *\r\n * This returns a MaskRect, which indicates which tiles are visible.\r\n * maskRect.get(x, y) will return true for visible tiles.\r\n */\r\n getFieldOfView(x: number, y: number, chebyshevRadius: number): geom.MaskRect {\r\n const origin = new geom.Offset(x, y);\r\n const boundRect = new geom.Rectangle(\r\n origin.x - chebyshevRadius, origin.y - chebyshevRadius,\r\n chebyshevRadius * 2 + 1, chebyshevRadius * 2 + 1,\r\n );\r\n const mask = new geom.MaskRect(boundRect);\r\n // the player can always see itself\r\n mask.set(origin, true);\r\n // the field is divided into quadrants\r\n this._quadrant(mask, origin, chebyshevRadius, -1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, -1, 1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, 1);\r\n return mask;\r\n }\r\n\r\n private _quadrant(mask: geom.MaskRect, origin: geom.OffsetLike, chebyshevRadius: number,\r\n xDir: number, yDir: number) {\r\n const {x: startX, y: startY} = origin;\r\n const endDX = (Math.min(Math.max(startX + xDir * (chebyshevRadius + 1),\r\n -1), this._size.width) - startX) * xDir;\r\n const endDY = (Math.min(Math.max(startY + yDir * (chebyshevRadius + 1),\r\n -1), this._size.height) - startY) * yDir;\r\n if (endDX < 0 || endDY < 0) {\r\n // the origin is outside of the map\r\n return;\r\n }\r\n const farYFlag = yDir === 1 ? TileFlag.WALL_SOUTH : TileFlag.WALL_NORTH;\r\n const farXFlag = xDir === 1 ? TileFlag.WALL_EAST : TileFlag.WALL_WEST;\r\n const startMapIndex = this._size.index(origin);\r\n const startMaskIndex = mask.index(origin);\r\n // Initial wedge is from slope zero to slope infinity (i.e. the whole quadrant)\r\n const wedges = [0, Number.POSITIVE_INFINITY];\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dy = 0, yMapIndex = startMapIndex, yMaskIndex = startMaskIndex;\r\n dy !== endDY && wedges.length > 0;\r\n dy ++, yMapIndex = yMapIndex + yDir * this._size.width, yMaskIndex = yMaskIndex + yDir * mask.width\r\n ) {\r\n const divYpos = 1 / (dy + 0.5);\r\n const divYneg = dy === 0 ? Number.POSITIVE_INFINITY : 1 / (dy - 0.5);\r\n let wedgeIndex = 0;\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dx = 0, mapIndex = yMapIndex, maskIndex = yMaskIndex,\r\n slopeY = -0.5 * divYpos, slopeX = 0.5 * divYneg;\r\n dx !== endDX && wedgeIndex !== wedges.length;\r\n dx ++, mapIndex = mapIndex + xDir, maskIndex = maskIndex + xDir,\r\n slopeY = slopeY + divYpos, slopeX = slopeX + divYneg\r\n ) {\r\n // the slopes of the four corners of this tile\r\n // these are named as follows:\r\n // slopeY is the slope closest to the Y axis\r\n // slopeFar is the slope to the farthest corner\r\n // slopeX is the slope closest to the X axis\r\n // this is always true:\r\n // slopeY < slopeFar < slopeX\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---X\r\n // | | | C |\r\n // +---+---Y---F\r\n\r\n // the walls of this tile\r\n // these are named as follows:\r\n // wallY is the farthest horizontal wall (slopeY to slopeFar)\r\n // wallX is the farthest vertical wall (slopeFar to slopeX)\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---+\r\n // | | | C X\r\n // +---+---+-Y-+\r\n\r\n // advance the wedge index until this tile is not after the current wedge\r\n while (slopeY >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n wedgeIndex = wedgeIndex + WEDGE_COUNT;\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n }\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n\r\n // if the current wedge is after this tile, move on\r\n if (slopeX <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n continue;\r\n }\r\n\r\n // we can see this tile\r\n mask.setAt(maskIndex, true);\r\n\r\n // const/let must be at the top of a block, in order not to trigger deoptimization due to\r\n // https://github.com/nodejs/node/issues/9729\r\n {\r\n const wallY = (this._tileFlags[mapIndex] & farYFlag) !== 0;\r\n const wallX = (this._tileFlags[mapIndex] & farXFlag) !== 0;\r\n if (wallX && wallY) {\r\n // this tile has both far walls\r\n // so we can't see beyond it and the whole range should be cut out of the wedge(s)\r\n wedgeIndex = cutWedge(wedges, wedgeIndex, slopeY - WALL_EPSILON, slopeX + WALL_EPSILON);\r\n } else {\r\n const body = (dx !== 0 || dy !== 0) && (this._tileFlags[mapIndex] & TileFlag.BODY) !== 0;\r\n if (body) {\r\n if (wallX) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX + WALL_EPSILON);\r\n } else if (wallY) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY - WALL_EPSILON, slopeX - BODY_EPSILON);\r\n } else {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX - BODY_EPSILON);\r\n }\r\n } else if (wallX) {\r\n const slopeFar = slopeY + divYpos;\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeFar - WALL_EPSILON, slopeX + WALL_EPSILON);\r\n } else if (wallY) {\r\n const slopeFar = slopeY + divYpos;\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY - WALL_EPSILON, slopeFar + WALL_EPSILON);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * This function cuts a range of angles out of the wedge array.\r\n */\r\nfunction cutWedge(wedges: number[], wedgeIndex: number, low: number, high: number): number {\r\n for (; ; ) {\r\n if (wedgeIndex === wedges.length) {\r\n return wedgeIndex;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n break;\r\n }\r\n // This next line is to cover a hypothetical edge case, where two slopes\r\n // are not the same, but are within the BODY_EPSILON distance. That\r\n // would be due to either floating point error or due to a very large\r\n // field radius. Either way I haven't been able to construct a test\r\n // case for it.\r\n wedgeIndex += WEDGE_COUNT;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // wedge is entirely occluded, remove it\r\n wedges.splice(wedgeIndex, WEDGE_COUNT);\r\n // now looking at the next wedge (or past the end)\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else if (high >= wedges[wedgeIndex + WEDGE_LOW]) {\r\n // low part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // still looking at the same wedge\r\n } else {\r\n // this cut doesn't reach the current wedge\r\n }\r\n } else if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // high part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_HIGH] = low;\r\n // move on to the next wedge\r\n wedgeIndex += WEDGE_COUNT;\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else {\r\n // middle part of wedge is occluded, split it\r\n wedges.splice(wedgeIndex, 0, wedges[wedgeIndex + WEDGE_LOW], low);\r\n wedgeIndex += WEDGE_COUNT;\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // now looking at the second wedge of the split\r\n }\r\n return wedgeIndex;\r\n}\r\n","/*\r\n * WallyFOV\r\n * github.com/sbj42/wally-fov\r\n * James Clark\r\n * Licensed under the MIT license.\r\n */\r\n\r\nexport {FieldOfViewMap} from './field-of-view';\r\nexport {Direction, DirectionFlags, MaskRect} from './geom';\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/bin/wally-fov-1.0.2.js b/bin/wally-fov-1.0.4.js similarity index 99% rename from bin/wally-fov-1.0.2.js rename to bin/wally-fov-1.0.4.js index cfd27b2..e38f100 100644 --- a/bin/wally-fov-1.0.2.js +++ b/bin/wally-fov-1.0.4.js @@ -932,4 +932,4 @@ exports.MaskRect = geom_1.MaskRect; /***/ }) /******/ }); -//# sourceMappingURL=wally-fov-1.0.2.js.map \ No newline at end of file +//# sourceMappingURL=wally-fov-1.0.4.js.map \ No newline at end of file diff --git a/bin/wally-fov-1.0.4.js.map b/bin/wally-fov-1.0.4.js.map new file mode 100644 index 0000000..4a00b3a --- /dev/null +++ b/bin/wally-fov-1.0.4.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://WallyFov/webpack/bootstrap","webpack://WallyFov/./src/field-of-view.ts","webpack://WallyFov/./src/geom/direction-flags.ts","webpack://WallyFov/./src/geom/direction.ts","webpack://WallyFov/./src/geom/index.ts","webpack://WallyFov/./src/geom/mask-rect.ts","webpack://WallyFov/./src/geom/mask.ts","webpack://WallyFov/./src/geom/offset.ts","webpack://WallyFov/./src/geom/rectangle.ts","webpack://WallyFov/./src/geom/size.ts","webpack://WallyFov/./src/index.ts"],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;AClFA,oEAA+B;AAE/B,4BAA4B;AAE5B;;;GAGG;AACH,IAAK,QAMJ;AAND,WAAK,QAAQ;IACT,mDAAsC;IACtC,iDAAqC;IACrC,iDAAqC;IACrC,mDAAsC;IACtC,4BAAa,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM;AAC5C,CAAC,EANI,QAAQ,KAAR,QAAQ,QAMZ;AAED;;;;;;GAMG;AACH,IAAM,SAAS,GAAG,CAAC,CAAC;AACpB,IAAM,UAAU,GAAG,CAAC,CAAC;AACrB,IAAM,WAAW,GAAG,CAAC,CAAC;AAEtB;;;;;GAKG;AACH,IAAM,YAAY,GAAG,OAAO,CAAC;AAE7B;;;;;;;GAOG;AACH,IAAM,YAAY,GAAG,YAAY,GAAG,EA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IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACjF,CAAC;IAED,oBAAK,GAAL,UAAM,GAAoB;QACtB,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,sBAAO,GAAP,UAAQ,MAAmB,EAAE,QAAuC;QAChE,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAG,EAAE;YACtC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,EAAG,EAAE;gBACrC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;gBACd,QAAQ,CAAC,MAAM,CAAC,CAAC;aACpB;SACJ;IACL,CAAC;IACL,WAAC;AAAD,CAAC;AAhEY,oBAAI;;;;;;;;;;;;;;ACPjB;;;;;GAKG;;AAEH,2FAA+C;AAAvC,uDAAc;AACtB,sEAA2D;AAAnD,oCAAS;AAAE,8CAAc;AAAE,kCAAQ","file":"wally-fov-1.0.4.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/bin/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import * as geom from './geom';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\n/**\r\n * These flags determine whether a given tile has walls in any of the cardinal\r\n * directions, and whether there is a \"body\" in the tile.\r\n */\r\nenum TileFlag {\r\n WALL_NORTH = 1 << geom.Direction.NORTH,\r\n WALL_EAST = 1 << geom.Direction.EAST,\r\n WALL_WEST = 1 << geom.Direction.WEST,\r\n WALL_SOUTH = 1 << geom.Direction.SOUTH,\r\n BODY = 1 << geom.DIRECTIONS.length,\r\n}\r\n\r\n/**\r\n * In the shadowcasting algorithm, each shadow is represented by a \"wedge\",\r\n * running from a \"low\" angle to a \"high\" angle. The wedges are all stored in\r\n * a simple number array, with two numbers for each wedge. These constants\r\n * (WEDGE_LOW and WEDGE_HIGH) help to identify which number is which.\r\n * WEDGE_COUNT is just how many numbers per wedge.\r\n */\r\nconst WEDGE_LOW = 0;\r\nconst WEDGE_HIGH = 1;\r\nconst WEDGE_COUNT = 2;\r\n\r\n/**\r\n * Bodies in this algorithm do not entirely fill their tiles. This is\r\n * implemented by adjusting the angles of the shadows the bodies cast,\r\n * making the wedge very slightly narrower. BODY_EPSILON represents the\r\n * amount of reduction on either side of the wedge.\r\n */\r\nconst BODY_EPSILON = 0.00001;\r\n\r\n/**\r\n * Walls do fill the entire tile edge. With infinite precision, there would be\r\n * no need to adjust the shadow cast by a wall. But we're using floating point\r\n * math here, which means imprecision can creep in and cause angles not to line\r\n * up properly. To fix that, we widen the wedges of the shadows cast by walls.\r\n * We must make sure not to widen them as much as we narrow the body shadows,\r\n * or else they might close the gap we want between a body and a wall.\r\n */\r\nconst WALL_EPSILON = BODY_EPSILON / 10;\r\n\r\n/**\r\n * We avoid heap allocations during the core part of the algorithm by using this\r\n * preallocated offset object.\r\n */\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\n/**\r\n * The FieldOFViewMap represents the map over which the field of view will be\r\n * computed. It starts out empty. You can add walls and bodies to it, and then\r\n * use getFieldOfView() to compute the field of view from a given point.\r\n */\r\nexport class FieldOfViewMap {\r\n private readonly _size = new geom.Size();\r\n private readonly _tileFlags: number[];\r\n\r\n constructor(width: number, height: number) {\r\n this._size.set(width, height);\r\n this._tileFlags = new Array(this._size.area).fill(0);\r\n }\r\n\r\n private _addFlag(off: geom.OffsetLike, flag: TileFlag) {\r\n const index = this._size.index(off);\r\n this._tileFlags[index] |= flag;\r\n }\r\n\r\n private _removeFlag(off: geom.OffsetLike, flag: TileFlag) {\r\n const index = this._size.index(off);\r\n this._tileFlags[index] &= ~flag;\r\n }\r\n\r\n // setup and maintenance\r\n\r\n /**\r\n * Adds a wall at a particular edge. This automatically adds the\r\n * corresponding wall on the other side.\r\n */\r\n addWall(x: number, y: number, dir: geom.Direction) {\r\n LOCAL_OFF.set(x, y);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._addFlag(LOCAL_OFF, 1 << dir);\r\n LOCAL_OFF.addCardinalDirection(dir);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._addFlag(LOCAL_OFF, 1 << geom.directionOpposite(dir));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Removes a wall at a particular edge. This automatically removes the\r\n * corresponding wall on the other side.\r\n */\r\n removeWall(x: number, y: number, dir: geom.Direction) {\r\n LOCAL_OFF.set(x, y);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._removeFlag(LOCAL_OFF, 1 << dir);\r\n LOCAL_OFF.addCardinalDirection(dir);\r\n if (this._size.containsOffset(LOCAL_OFF)) {\r\n this._removeFlag(LOCAL_OFF, 1 << geom.directionOpposite(dir));\r\n }\r\n }\r\n }\r\n\r\n getWalls(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return this._tileFlags[index] & geom.DirectionFlags.ALL;\r\n }\r\n\r\n getWall(x: number, y: number, dir: geom.Direction) {\r\n return (this.getWalls(x, y) & (1 << dir)) !== 0;\r\n }\r\n\r\n addBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n this._addFlag(LOCAL_OFF, TileFlag.BODY);\r\n }\r\n\r\n removeBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n this._removeFlag(LOCAL_OFF, TileFlag.BODY);\r\n }\r\n\r\n getBody(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n const index = this._size.index(LOCAL_OFF);\r\n return (this._tileFlags[index] & TileFlag.BODY) !== 0;\r\n }\r\n\r\n // execution\r\n\r\n /**\r\n * Compute the field of view for a camera at the given tile.\r\n * chebyshevRadius is the vision radius. It uses chebyshev distance\r\n * (https://en.wikipedia.org/wiki/Chebyshev_distance), which just means\r\n * that the limit of vision in a large empty field will be square.\r\n *\r\n * This returns a MaskRect, which indicates which tiles are visible.\r\n * maskRect.get(x, y) will return true for visible tiles.\r\n */\r\n getFieldOfView(x: number, y: number, chebyshevRadius: number): geom.MaskRect {\r\n const origin = new geom.Offset(x, y);\r\n const boundRect = new geom.Rectangle(\r\n origin.x - chebyshevRadius, origin.y - chebyshevRadius,\r\n chebyshevRadius * 2 + 1, chebyshevRadius * 2 + 1,\r\n );\r\n const mask = new geom.MaskRect(boundRect);\r\n // the player can always see itself\r\n mask.set(origin, true);\r\n // the field is divided into quadrants\r\n this._quadrant(mask, origin, chebyshevRadius, -1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, -1);\r\n this._quadrant(mask, origin, chebyshevRadius, -1, 1);\r\n this._quadrant(mask, origin, chebyshevRadius, 1, 1);\r\n return mask;\r\n }\r\n\r\n private _quadrant(mask: geom.MaskRect, origin: geom.OffsetLike, chebyshevRadius: number,\r\n xDir: number, yDir: number) {\r\n const {x: startX, y: startY} = origin;\r\n const endDX = (Math.min(Math.max(startX + xDir * (chebyshevRadius + 1),\r\n -1), this._size.width) - startX) * xDir;\r\n const endDY = (Math.min(Math.max(startY + yDir * (chebyshevRadius + 1),\r\n -1), this._size.height) - startY) * yDir;\r\n if (endDX < 0 || endDY < 0) {\r\n // the origin is outside of the map\r\n return;\r\n }\r\n const farYFlag = yDir === 1 ? TileFlag.WALL_SOUTH : TileFlag.WALL_NORTH;\r\n const farXFlag = xDir === 1 ? TileFlag.WALL_EAST : TileFlag.WALL_WEST;\r\n const startMapIndex = this._size.index(origin);\r\n const startMaskIndex = mask.index(origin);\r\n // Initial wedge is from slope zero to slope infinity (i.e. the whole quadrant)\r\n const wedges = [0, Number.POSITIVE_INFINITY];\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dy = 0, yMapIndex = startMapIndex, yMaskIndex = startMaskIndex;\r\n dy !== endDY && wedges.length > 0;\r\n dy ++, yMapIndex = yMapIndex + yDir * this._size.width, yMaskIndex = yMaskIndex + yDir * mask.width\r\n ) {\r\n const divYpos = 1 / (dy + 0.5);\r\n const divYneg = dy === 0 ? Number.POSITIVE_INFINITY : 1 / (dy - 0.5);\r\n let wedgeIndex = 0;\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n for (let dx = 0, mapIndex = yMapIndex, maskIndex = yMaskIndex,\r\n slopeY = -0.5 * divYpos, slopeX = 0.5 * divYneg;\r\n dx !== endDX && wedgeIndex !== wedges.length;\r\n dx ++, mapIndex = mapIndex + xDir, maskIndex = maskIndex + xDir,\r\n slopeY = slopeY + divYpos, slopeX = slopeX + divYneg\r\n ) {\r\n // the slopes of the four corners of this tile\r\n // these are named as follows:\r\n // slopeY is the slope closest to the Y axis\r\n // slopeFar is the slope to the farthest corner\r\n // slopeX is the slope closest to the X axis\r\n // this is always true:\r\n // slopeY < slopeFar < slopeX\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---X\r\n // | | | C |\r\n // +---+---Y---F\r\n\r\n // the walls of this tile\r\n // these are named as follows:\r\n // wallY is the farthest horizontal wall (slopeY to slopeFar)\r\n // wallX is the farthest vertical wall (slopeFar to slopeX)\r\n //\r\n // O = origin, C = current\r\n // +---+---+---+\r\n // | O | | |\r\n // +---+---+---+\r\n // | | | C X\r\n // +---+---+-Y-+\r\n\r\n // advance the wedge index until this tile is not after the current wedge\r\n while (slopeY >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // X += Y must be written as X = X + Y, in order not to trigger deoptimization due to\r\n // http://stackoverflow.com/questions/34595356/what-does-compound-let-const-assignment-mean\r\n wedgeIndex = wedgeIndex + WEDGE_COUNT;\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n }\r\n if (wedgeIndex >= wedges.length) {\r\n break;\r\n }\r\n\r\n // if the current wedge is after this tile, move on\r\n if (slopeX <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n continue;\r\n }\r\n\r\n // we can see this tile\r\n mask.setAt(maskIndex, true);\r\n\r\n // const/let must be at the top of a block, in order not to trigger deoptimization due to\r\n // https://github.com/nodejs/node/issues/9729\r\n {\r\n const wallY = (this._tileFlags[mapIndex] & farYFlag) !== 0;\r\n const wallX = (this._tileFlags[mapIndex] & farXFlag) !== 0;\r\n if (wallX && wallY) {\r\n // this tile has both far walls\r\n // so we can't see beyond it and the whole range should be cut out of the wedge(s)\r\n wedgeIndex = cutWedge(wedges, wedgeIndex, slopeY - WALL_EPSILON, slopeX + WALL_EPSILON);\r\n } else {\r\n const body = (dx !== 0 || dy !== 0) && (this._tileFlags[mapIndex] & TileFlag.BODY) !== 0;\r\n if (body) {\r\n if (wallX) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX + WALL_EPSILON);\r\n } else if (wallY) {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY - WALL_EPSILON, slopeX - BODY_EPSILON);\r\n } else {\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY + BODY_EPSILON, slopeX - BODY_EPSILON);\r\n }\r\n } else if (wallX) {\r\n const slopeFar = slopeY + divYpos;\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeFar - WALL_EPSILON, slopeX + WALL_EPSILON);\r\n } else if (wallY) {\r\n const slopeFar = slopeY + divYpos;\r\n wedgeIndex = cutWedge(wedges, wedgeIndex,\r\n slopeY - WALL_EPSILON, slopeFar + WALL_EPSILON);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * This function cuts a range of angles out of the wedge array.\r\n */\r\nfunction cutWedge(wedges: number[], wedgeIndex: number, low: number, high: number): number {\r\n for (; ; ) {\r\n if (wedgeIndex === wedges.length) {\r\n return wedgeIndex;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n break;\r\n }\r\n // This next line is to cover a hypothetical edge case, where two slopes\r\n // are not the same, but are within the BODY_EPSILON distance. That\r\n // would be due to either floating point error or due to a very large\r\n // field radius. Either way I haven't been able to construct a test\r\n // case for it.\r\n wedgeIndex += WEDGE_COUNT;\r\n }\r\n if (low <= wedges[wedgeIndex + WEDGE_LOW]) {\r\n if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // wedge is entirely occluded, remove it\r\n wedges.splice(wedgeIndex, WEDGE_COUNT);\r\n // now looking at the next wedge (or past the end)\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else if (high >= wedges[wedgeIndex + WEDGE_LOW]) {\r\n // low part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // still looking at the same wedge\r\n } else {\r\n // this cut doesn't reach the current wedge\r\n }\r\n } else if (high >= wedges[wedgeIndex + WEDGE_HIGH]) {\r\n // high part of wedge is occluded, trim it\r\n wedges[wedgeIndex + WEDGE_HIGH] = low;\r\n // move on to the next wedge\r\n wedgeIndex += WEDGE_COUNT;\r\n return cutWedge(wedges, wedgeIndex, low, high);\r\n } else {\r\n // middle part of wedge is occluded, split it\r\n wedges.splice(wedgeIndex, 0, wedges[wedgeIndex + WEDGE_LOW], low);\r\n wedgeIndex += WEDGE_COUNT;\r\n wedges[wedgeIndex + WEDGE_LOW] = high;\r\n // now looking at the second wedge of the split\r\n }\r\n return wedgeIndex;\r\n}\r\n","import * as geom from '.';\r\n\r\n// tslint:disable:no-bitwise\r\n\r\nexport enum DirectionFlags {\r\n NONE = 0,\r\n NORTH = 1,\r\n EAST = 2,\r\n SOUTH = 4,\r\n WEST = 8,\r\n ALL = 15,\r\n}\r\n\r\nexport function directionFlagsToString(flags: DirectionFlags) {\r\n let ret = '[';\r\n if ((flags & DirectionFlags.NORTH) !== 0) {\r\n ret += 'N';\r\n }\r\n if ((flags & DirectionFlags.EAST) !== 0) {\r\n ret += 'E';\r\n }\r\n if ((flags & DirectionFlags.SOUTH) !== 0) {\r\n ret += 'S';\r\n }\r\n if ((flags & DirectionFlags.WEST) !== 0) {\r\n ret += 'W';\r\n }\r\n return ret + ']';\r\n}\r\n\r\n// conversion\r\n\r\nexport function directionFlagsFromDirection(dir: geom.Direction) {\r\n return (1 << dir) as DirectionFlags;\r\n}\r\n","// tslint:disable:no-bitwise\r\n\r\nexport enum Direction {\r\n NORTH = 0,\r\n EAST = 1,\r\n SOUTH = 2,\r\n WEST = 3,\r\n}\r\n\r\nexport const DIRECTIONS = [\r\n Direction.NORTH,\r\n Direction.EAST,\r\n Direction.SOUTH,\r\n Direction.WEST,\r\n];\r\n\r\nexport function directionOpposite(dir: Direction) {\r\n return ((dir + 2) & 3) as Direction;\r\n}\r\n","export * from './direction';\r\nexport * from './direction-flags';\r\nexport * from './offset';\r\nexport * from './size';\r\nexport * from './rectangle';\r\nexport * from './mask';\r\nexport * from './mask-rect';\r\n","import * as geom from '.';\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class MaskRect implements geom.RectangleLike {\r\n private readonly _rectangle = new geom.Rectangle();\r\n private readonly _mask: geom.Mask;\r\n private readonly _outsideValue: boolean;\r\n\r\n constructor(rect: geom.RectangleLike, initialValue = false, outsideValue = false) {\r\n this._rectangle.copyFrom(rect);\r\n this._mask = new geom.Mask(rect, initialValue);\r\n this._outsideValue = outsideValue;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `${this._rectangle.northWest}/${this._outsideValue}\\n${this._mask}`;\r\n }\r\n\r\n get westX() {\r\n return this._rectangle.westX;\r\n }\r\n\r\n get northY() {\r\n return this._rectangle.northY;\r\n }\r\n\r\n get width() {\r\n return this._rectangle.width;\r\n }\r\n\r\n get height() {\r\n return this._rectangle.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._mask.index(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest));\r\n }\r\n\r\n getAt(index: number) {\r\n return this._mask.getAt(index);\r\n }\r\n\r\n get(x: number, y: number) {\r\n LOCAL_OFF.set(x, y);\r\n if (!this._rectangle.containsOffset(LOCAL_OFF)) {\r\n return this._outsideValue;\r\n }\r\n return this._mask.get(LOCAL_OFF.subtractOffset(this._rectangle.northWest));\r\n }\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._mask.setAt(index, value);\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n this._mask.set(LOCAL_OFF.copyFrom(off).subtractOffset(this._rectangle.northWest), value);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n this._mask.forEach(cursor, (off, value) => {\r\n callback(off.addOffset(this._rectangle.northWest), value);\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport class Mask implements geom.SizeLike {\r\n private readonly _size = new geom.Size();\r\n private readonly _bits: boolean[];\r\n // TODO consider Uint8Array for bits\r\n\r\n constructor(size: geom.SizeLike, initialValue = false) {\r\n this._size.copyFrom(size);\r\n this._bits = new Array(this._size.area).fill(initialValue);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n let ret = '';\r\n const off = new geom.Offset();\r\n for (let y = 0; y < this._size.height; y ++) {\r\n for (let x = 0; x < this._size.width; x ++) {\r\n off.set(x, y);\r\n ret += this.get(off.set(x, y)) ? '☑' : '☐';\r\n }\r\n ret += '\\n';\r\n }\r\n return ret;\r\n }\r\n\r\n get width() {\r\n return this._size.width;\r\n }\r\n\r\n get height() {\r\n return this._size.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this._size.index(off);\r\n }\r\n\r\n getAt(index: number) {\r\n return this._bits[index];\r\n }\r\n\r\n get(off: geom.OffsetLike) {\r\n return this.getAt(this.index(off));\r\n }\r\n\r\n // mutators\r\n\r\n setAt(index: number, value: boolean) {\r\n this._bits[index] = value;\r\n return this;\r\n }\r\n\r\n set(off: geom.OffsetLike, value: boolean) {\r\n return this.setAt(this.index(off), value);\r\n }\r\n\r\n // utilities\r\n\r\n forEach(cursor: geom.Offset, callback: (cursor: geom.Offset, value: boolean) => void) {\r\n let index = 0;\r\n this._size.forEach(cursor, (off) => {\r\n callback(off, this._bits[index]);\r\n index ++;\r\n });\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nconst X_FROM_CARDINAL_DIRECTION = [ 0, 1, 0, -1 ];\r\nconst Y_FROM_CARDINAL_DIRECTION = [ -1, 0, 1, 0 ];\r\n\r\nexport interface OffsetLike {\r\n readonly x: number;\r\n readonly y: number;\r\n}\r\n\r\nexport class Offset implements OffsetLike {\r\n x: number;\r\n y: number;\r\n\r\n constructor();\r\n constructor(x: number, y: number);\r\n constructor(x?: number, y?: number) {\r\n if (typeof x === 'undefined') {\r\n x = 0;\r\n }\r\n if (typeof y === 'undefined') {\r\n y = 0;\r\n }\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n toString() {\r\n return `(${this.x},${this.y})`;\r\n }\r\n\r\n // mutators\r\n\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n copyFrom(other: OffsetLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n addOffset(off: OffsetLike) {\r\n this.x += off.x;\r\n this.y += off.y;\r\n return this;\r\n }\r\n\r\n addCardinalDirection(dir: geom.Direction) {\r\n this.x += X_FROM_CARDINAL_DIRECTION[dir];\r\n this.y += Y_FROM_CARDINAL_DIRECTION[dir];\r\n return this;\r\n }\r\n\r\n subtractOffset(off: OffsetLike) {\r\n this.x -= off.x;\r\n this.y -= off.y;\r\n return this;\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface RectangleLike extends geom.SizeLike {\r\n readonly westX: number;\r\n readonly northY: number;\r\n}\r\n\r\nconst LOCAL_OFF = new geom.Offset();\r\n\r\nexport class Rectangle implements RectangleLike, geom.SizeLike {\r\n northWest: geom.Offset;\r\n size: geom.Size;\r\n\r\n constructor();\r\n constructor(westX: number, northY: number, width: number, height: number);\r\n constructor(westX?: number, northY?: number, width?: number, height?: number) {\r\n if (typeof westX === 'undefined') {\r\n westX = 0;\r\n }\r\n if (typeof northY === 'undefined') {\r\n northY = 0;\r\n }\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.northWest = new geom.Offset(westX, northY);\r\n this.size = new geom.Size(width, height);\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.westX},${this.northY} ${this.width}x${this.height})`;\r\n }\r\n\r\n get northY() {\r\n return this.northWest.y;\r\n }\r\n\r\n get southY() {\r\n return this.northWest.y + this.size.height - 1;\r\n }\r\n\r\n get westX() {\r\n return this.northWest.x;\r\n }\r\n\r\n get eastX() {\r\n return this.northWest.x + this.size.width - 1;\r\n }\r\n\r\n get width() {\r\n return this.size.width;\r\n }\r\n\r\n get height() {\r\n return this.size.height;\r\n }\r\n\r\n get empty() {\r\n return this.size.empty;\r\n }\r\n\r\n get area() {\r\n return this.size.area;\r\n }\r\n\r\n // mutators\r\n\r\n copyFrom(other: RectangleLike) {\r\n this.northWest.set(other.westX, other.northY);\r\n this.size.set(other.width, other.height);\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return this.size.containsOffset(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return this.size.index(LOCAL_OFF.copyFrom(off).subtractOffset(this.northWest));\r\n }\r\n}\r\n","import * as geom from '.';\r\n\r\nexport interface SizeLike {\r\n readonly width: number;\r\n readonly height: number;\r\n}\r\n\r\nexport class Size implements SizeLike {\r\n width: number;\r\n height: number;\r\n\r\n constructor();\r\n constructor(width: number, height: number);\r\n constructor(width?: number, height?: number) {\r\n if (typeof width === 'undefined') {\r\n width = 0;\r\n }\r\n if (typeof height === 'undefined') {\r\n height = 0;\r\n }\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n // accessors\r\n\r\n toString() {\r\n return `(${this.width}x${this.height})`;\r\n }\r\n\r\n get empty() {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n get area() {\r\n return this.width * this.height;\r\n }\r\n\r\n // mutators\r\n\r\n set(width: number, height: number) {\r\n this.width = width;\r\n this.height = height;\r\n return this;\r\n }\r\n\r\n copyFrom(other: SizeLike) {\r\n this.width = other.width;\r\n this.height = other.height;\r\n return this;\r\n }\r\n\r\n // utilities\r\n\r\n containsOffset(off: geom.OffsetLike) {\r\n return off.x >= 0 && off.y >= 0 && off.x < this.width && off.y < this.height;\r\n }\r\n\r\n index(off: geom.OffsetLike) {\r\n return off.y * this.width + off.x;\r\n }\r\n\r\n forEach(cursor: geom.Offset, callback: (offset: geom.Offset) => void) {\r\n for (let dy = 0; dy < this.height; dy ++) {\r\n for (let dx = 0; dx < this.width; dx ++) {\r\n cursor.x = dx;\r\n cursor.y = dy;\r\n callback(cursor);\r\n }\r\n }\r\n }\r\n}\r\n","/*\r\n * WallyFOV\r\n * github.com/sbj42/wally-fov\r\n * James Clark\r\n * Licensed under the MIT license.\r\n */\r\n\r\nexport {FieldOfViewMap} from './field-of-view';\r\nexport {Direction, DirectionFlags, MaskRect} from './geom';\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/bin/wally-fov-1.0.4.min.js b/bin/wally-fov-1.0.4.min.js new file mode 100644 index 0000000..17c28dd --- /dev/null +++ b/bin/wally-fov-1.0.4.min.js @@ -0,0 +1,2 @@ +var WallyFov=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/bin/",i(i.s=1)}([function(t,e,i){"use strict";function n(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),n(i(3)),n(i(4)),n(i(5)),n(i(6)),n(i(7)),n(i(8)),n(i(9))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(2);e.FieldOfViewMap=n.FieldOfViewMap;var r=i(0);e.Direction=r.Direction,e.DirectionFlags=r.DirectionFlags,e.MaskRect=r.MaskRect},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,r=i(0);!function(t){t[t.WALL_NORTH=1]="WALL_NORTH",t[t.WALL_EAST=2]="WALL_EAST",t[t.WALL_WEST=8]="WALL_WEST",t[t.WALL_SOUTH=4]="WALL_SOUTH",t[t.BODY=1<0;g++,_+=o*this._size.width,O+=o*t.width)for(var b=1/(g+.5),v=0===g?Number.POSITIVE_INFINITY:1/(g-.5),m=0,w=0,S=_,T=O,x=-.5*b,W=.5*v;w!==f&&m!==y.length;w++,S+=r,T+=r,x+=b,W+=v){for(;x>=y[m+1]&&!((m+=2)>=y.length););if(m>=y.length)break;if(!(W<=y[m+0])){t.setAt(T,!0);var F=0!=(this._tileFlags[S]&a),z=0!=(this._tileFlags[S]&p);if(z&&F)m=u(y,m,x-1e-5/10,W+1e-5/10);else if((0!==w||0!==g)&&0!=(this._tileFlags[S]&n.BODY))m=z?u(y,m,x+1e-5,W+1e-5/10):u(y,m,F?x-1e-5/10:x+1e-5,W-1e-5);else if(z){m=u(y,m,x+b-1e-5/10,W+1e-5/10)}else if(F){m=u(y,m,x-1e-5/10,x+b+1e-5/10)}}}},t}();function u(t,e,i,n){for(;;){if(e===t.length)return e;if(i<=t[e+1])break;e+=2}if(i<=t[e+0]){if(n>=t[e+1])return t.splice(e,2),u(t,e,i,n);n>=t[e+0]&&(t[e+0]=n)}else{if(n>=t[e+1])return t[e+1]=i,u(t,e+=2,i,n);t.splice(e,0,t[e+0],i),t[(e+=2)+0]=n}return e}e.FieldOfViewMap=s},function(t,e,i){"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.NORTH=0]="NORTH",t[t.EAST=1]="EAST",t[t.SOUTH=2]="SOUTH",t[t.WEST=3]="WEST"}(n=e.Direction||(e.Direction={})),e.DIRECTIONS=[n.NORTH,n.EAST,n.SOUTH,n.WEST],e.directionOpposite=function(t){return t+2&3}},function(t,e,i){"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.NONE=0]="NONE",t[t.NORTH=1]="NORTH",t[t.EAST=2]="EAST",t[t.SOUTH=4]="SOUTH",t[t.WEST=8]="WEST",t[t.ALL=15]="ALL"}(n=e.DirectionFlags||(e.DirectionFlags={})),e.directionFlagsToString=function(t){var e="[";return 0!=(t&n.NORTH)&&(e+="N"),0!=(t&n.EAST)&&(e+="E"),0!=(t&n.SOUTH)&&(e+="S"),0!=(t&n.WEST)&&(e+="W"),e+"]"},e.directionFlagsFromDirection=function(t){return 1<=0&&t.y>=0&&t.x