UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

31 lines (24 loc) 1.05 kB
import { BinaryClassUpgrader } from "../../../../ecs/storage/binary/BinaryClassUpgrader.js"; import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js"; export class TopDownCameraControllerSerializationUpgrader_0_1 extends BinaryClassUpgrader { constructor() { super(); this.__startVersion = 0; this.__targetVersion = 1; } upgrade(source, target) { // read out target BinaryBuffer.copyFloat64(source, target); // x BinaryBuffer.copyFloat64(source, target); // y BinaryBuffer.copyFloat64(source, target); // z const pitch = source.readFloat64(); const yaw = source.readFloat64(); const roll = 0; target.writeFloat64(-pitch); target.writeFloat64(yaw - Math.PI); target.writeFloat64(roll); BinaryBuffer.copyFloat64(source, target); // distance BinaryBuffer.copyFloat64(source, target); // distanceMin BinaryBuffer.copyFloat64(source, target); // distanceMax } }