UNPKG

unreal.js

Version:

A pak reader for games like VALORANT & Fortnite written in Node.JS

31 lines (30 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FPositionVertexBuffer = void 0; const FVector_1 = require("../../../objects/core/math/FVector"); const FArchive_1 = require("../../../reader/FArchive"); const Exceptions_1 = require("../../../../exceptions/Exceptions"); class FPositionVertexBuffer { constructor(...args) { const arg = args[0]; if (arg instanceof FArchive_1.FArchive) { this.stride = arg.readInt32(); this.numVertices = arg.readInt32(); const elemSize = arg.readInt32(); const elemCount = arg.readInt32(); const savePos = arg.pos; const array = new Array(elemCount); for (let i = 0; i < elemCount; ++i) array[i] = new FVector_1.FVector(arg); if (arg.pos != savePos + array.length * elemSize) throw new Exceptions_1.ParserException(`RawArray item size mismatch: expected ${elemSize}, serialized ${(arg.pos - savePos) / array.length}`); this.verts = array; } else { this.verts = arg; this.stride = args[1]; this.numVertices = args[2]; } } } exports.FPositionVertexBuffer = FPositionVertexBuffer;