From 4e1dc70c9a282406fba025879d5d2b199cb6febc Mon Sep 17 00:00:00 2001 From: Lajos Meszaros Date: Wed, 22 May 2024 17:30:42 +0200 Subject: [PATCH] feat(utils): add isQuad and isTiled functions --- src/fts/helpers.ts | 8 ++++++-- src/utils.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fts/helpers.ts b/src/fts/helpers.ts index ac7bb9d..8ee15f6 100644 --- a/src/fts/helpers.ts +++ b/src/fts/helpers.ts @@ -4,8 +4,12 @@ import { ArxPolygon, ArxPolygonFlags } from '@fts/Polygon.js' import { ArxVertex } from '@fts/Vertex.js' import { COORDS_THAT_ROUND_UP } from '@fts/constants.js' -const isQuad = (polygon: ArxPolygon) => { - return (polygon.flags & ArxPolygonFlags.Quad) !== 0 +export const isQuad = ({ flags }: { flags: ArxPolygonFlags }) => { + return (flags & ArxPolygonFlags.Quad) !== 0 +} + +export const isTiled = ({ flags }: { flags: ArxPolygonFlags }) => { + return (flags & ArxPolygonFlags.Tiled) !== 0 } export const addLightIndex = (polygons: ArxPolygon[]) => { diff --git a/src/utils.ts b/src/utils.ts index d6346f9..b7828b3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -export { getCellCoords } from '@fts/helpers.js' +export { getCellCoords, isQuad, isTiled } from '@fts/helpers.js' export type { DoubleOf, TripleOf, QuadrupleOf, Optional, Expand, RecursiveExpand } from '@common/types.js'