UNPKG

arx-convert

Version:

Converts various Arx Fatalis formats to JSON or YAML and back

69 lines (68 loc) 1.94 kB
import { BinaryIO } from '../common/BinaryIO.js'; import type { ArxVector3, QuadrupleOf } from '../common/types.js'; import { type ArxVertex } from './Vertex.js'; /** * @see https://github.com/arx/ArxLibertatis/blob/1.2.1/src/graphics/GraphicsTypes.h#L88 */ export declare enum ArxPolygonFlags { None = 0, NoShadow = 1, DoubleSided = 2, Transparent = 4, Water = 8, Glow = 16, Ignore = 32, Quad = 64, /** unused by arx */ Tiled = 128, Metal = 256, Hide = 512, Stone = 1024, Wood = 2048, Gravel = 4096, Earth = 8192, NoCollision = 16384, Lava = 32768, Climbable = 65536, Falling = 131072, NoPath = 262144, NoDraw = 524288, PrecisePath = 1048576, LateMip = 134217728 } /** * @see https://github.com/arx/ArxLibertatis/blob/1.2.1/src/graphics/data/FastSceneFormat.h#L81 */ export type ArxPolygon = { vertices: QuadrupleOf<ArxVertex>; /** * reference to {@link ArxTextureContainer.id} */ textureContainerId: number; norm: ArxVector3; norm2: ArxVector3; normals?: QuadrupleOf<ArxVector3>; /** * Opacity type and amount when {@link ArxPolygon.flags} & {@link ArxPolygonFlags.Transparent}: * * - 2 or more = multiplicative * - 1 = additive * - 0 = normal * - -1 or less = subtractive * * @see https://github.com/arx/ArxLibertatis/blob/1.2.1/src/graphics/data/Mesh.cpp#L1102 */ transval: number; area: number; flags: ArxPolygonFlags; room: number; }; export declare class Polygon { static readFrom(binary: BinaryIO<ArrayBufferLike>): ArxPolygon; static accumulateFrom(polygon: ArxPolygon): ArrayBuffer; static sizeOf(): number; /** * A polygon is considered out of bounds when any of its vertices are not 0 <= x < 16000 or 0 <= z < 16000 */ static isOutOfBounds(polygon: ArxPolygon): boolean; }