unreal.js
Version:
A pak reader for games like VALORANT & Fortnite written in Node.JS
53 lines (52 loc) • 2.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FDistanceFieldVolumeData = void 0;
const FVector2D_1 = require("../core/math/FVector2D");
const FBox_1 = require("../core/math/FBox");
const FIntVector_1 = require("../core/math/FIntVector");
const Game_1 = require("../../versions/Game");
const Versions_1 = require("../../versions/Versions");
class FDistanceFieldVolumeData {
constructor(Ar = null) {
if (Ar != null) {
if (Ar.game >= Game_1.Game.GAME_UE4(16)) {
this.compressedDistanceFieldVolume = Ar.read(Ar.readInt32());
this.size = new FIntVector_1.FIntVector(Ar);
this.localBoundingBox = new FBox_1.FBox(Ar);
this.distanceMinMax = new FVector2D_1.FVector2D(Ar);
this.meshWasClosed = Ar.readBoolean();
this.builtAsIfTwoSided = Ar.readBoolean();
this.meshWasPlane = Ar.readBoolean();
this.distanceFieldVolume = [];
}
else {
const distanceFieldVolumeNum = Ar.readInt32();
this.distanceFieldVolume = new Array(distanceFieldVolumeNum);
for (let i = 0; i < distanceFieldVolumeNum; ++i)
this.distanceFieldVolume[i] = Ar.readInt16();
this.size = new FIntVector_1.FIntVector(Ar);
this.localBoundingBox = new FBox_1.FBox(Ar);
this.meshWasClosed = Ar.readBoolean();
this.builtAsIfTwoSided = Ar.ver >= Versions_1.VER_UE4_RENAME_CROUCHMOVESCHARACTERDOWN ? Ar.readBoolean() : false;
this.meshWasPlane = Ar.ver >= Versions_1.VER_UE4_DEPRECATE_UMG_STYLE_ASSETS ? Ar.readBoolean() : false;
this.compressedDistanceFieldVolume = Buffer.alloc(0);
this.distanceMinMax = new FVector2D_1.FVector2D(0, 0);
}
}
}
serialize(Ar) {
}
static from(distanceFieldVolume, size, localBoundingBox, meshWasClosed, builtAsIfTwoSided, meshWasPlane, compressedDistanceFieldVolume, distanceMinMax) {
const volume = new FDistanceFieldVolumeData();
volume.distanceFieldVolume = distanceFieldVolume;
volume.size = size;
volume.localBoundingBox = localBoundingBox;
volume.meshWasClosed = meshWasClosed;
volume.builtAsIfTwoSided = builtAsIfTwoSided;
volume.meshWasPlane = meshWasPlane;
volume.compressedDistanceFieldVolume = compressedDistanceFieldVolume;
volume.distanceMinMax = distanceMinMax;
return volume;
}
}
exports.FDistanceFieldVolumeData = FDistanceFieldVolumeData;