UNPKG

arx-convert

Version:

Converts various Arx Fatalis formats to JSON or YAML and back

66 lines (65 loc) 1.81 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}: * * - greater or equal to 2 = multiplicative * - greater or equal to 1 = additive * - greater than 0 = normal * - less or equal to 0 = 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; paddy?: number; }; export declare class Polygon { static readFrom(binary: BinaryIO<ArrayBufferLike>): ArxPolygon; static accumulateFrom(polygon: ArxPolygon): ArrayBuffer; static sizeOf(): number; }