arx-level-generator
Version:
A tool for creating Arx Fatalis maps
66 lines • 2.05 kB
JavaScript
import { Vector3 } from './Vector3.js';
export class Portal {
min;
max;
norm;
norm2;
vertices;
center;
room1;
room2;
useportal;
paddy;
constructor(props) {
this.min = props.min;
this.max = props.max;
this.norm = props.norm;
this.norm2 = props.norm2;
this.vertices = props.vertices;
this.center = props.center;
this.room1 = props.room1;
this.room2 = props.room2;
this.useportal = props.useportal;
this.paddy = props.paddy;
}
static fromArxPortal(portal) {
return new Portal({
min: Vector3.fromArxVector3(portal.polygon.min),
max: Vector3.fromArxVector3(portal.polygon.max),
norm: Vector3.fromArxVector3(portal.polygon.norm),
norm2: Vector3.fromArxVector3(portal.polygon.norm2),
vertices: portal.polygon.vertices.map((vertex) => {
return {
position: Vector3.fromArxVector3(vertex.pos),
rhw: vertex.rhw,
};
}),
center: Vector3.fromArxVector3(portal.polygon.center),
room1: portal.room1,
room2: portal.room2,
useportal: portal.useportal,
paddy: portal.paddy,
});
}
toArxPortal() {
return {
polygon: {
min: this.min.toArxVector3(),
max: this.max.toArxVector3(),
norm: this.norm.toArxVector3(),
norm2: this.norm2.toArxVector3(),
vertices: this.vertices.map((vertex) => {
return {
pos: vertex.position.toArxVector3(),
rhw: vertex.rhw,
};
}),
center: this.center.toArxVector3(),
},
room1: this.room1,
room2: this.room2,
useportal: this.useportal,
paddy: this.paddy,
};
}
}
//# sourceMappingURL=Portal.js.map