1// automatically generated by the FlatBuffers compiler, do not modify 2import { Color } from '../../my-game/example/color.js'; 3import { Test } from '../../my-game/example/test.js'; 4export class Vec3 { 5 constructor() { 6 this.bb = null; 7 this.bb_pos = 0; 8 } 9 __init(i, bb) { 10 this.bb_pos = i; 11 this.bb = bb; 12 return this; 13 } 14 x() { 15 return this.bb.readFloat32(this.bb_pos); 16 } 17 mutate_x(value) { 18 this.bb.writeFloat32(this.bb_pos + 0, value); 19 return true; 20 } 21 y() { 22 return this.bb.readFloat32(this.bb_pos + 4); 23 } 24 mutate_y(value) { 25 this.bb.writeFloat32(this.bb_pos + 4, value); 26 return true; 27 } 28 z() { 29 return this.bb.readFloat32(this.bb_pos + 8); 30 } 31 mutate_z(value) { 32 this.bb.writeFloat32(this.bb_pos + 8, value); 33 return true; 34 } 35 test1() { 36 return this.bb.readFloat64(this.bb_pos + 16); 37 } 38 mutate_test1(value) { 39 this.bb.writeFloat64(this.bb_pos + 16, value); 40 return true; 41 } 42 test2() { 43 return this.bb.readUint8(this.bb_pos + 24); 44 } 45 mutate_test2(value) { 46 this.bb.writeUint8(this.bb_pos + 24, value); 47 return true; 48 } 49 test3(obj) { 50 return (obj || new Test()).__init(this.bb_pos + 26, this.bb); 51 } 52 static getFullyQualifiedName() { 53 return 'MyGame.Example.Vec3'; 54 } 55 static sizeOf() { 56 return 32; 57 } 58 static createVec3(builder, x, y, z, test1, test2, test3_a, test3_b) { 59 builder.prep(8, 32); 60 builder.pad(2); 61 builder.prep(2, 4); 62 builder.pad(1); 63 builder.writeInt8(test3_b); 64 builder.writeInt16(test3_a); 65 builder.pad(1); 66 builder.writeInt8(test2); 67 builder.writeFloat64(test1); 68 builder.pad(4); 69 builder.writeFloat32(z); 70 builder.writeFloat32(y); 71 builder.writeFloat32(x); 72 return builder.offset(); 73 } 74 unpack() { 75 return new Vec3T(this.x(), this.y(), this.z(), this.test1(), this.test2(), (this.test3() !== null ? this.test3().unpack() : null)); 76 } 77 unpackTo(_o) { 78 _o.x = this.x(); 79 _o.y = this.y(); 80 _o.z = this.z(); 81 _o.test1 = this.test1(); 82 _o.test2 = this.test2(); 83 _o.test3 = (this.test3() !== null ? this.test3().unpack() : null); 84 } 85} 86export class Vec3T { 87 constructor(x = 0.0, y = 0.0, z = 0.0, test1 = 0.0, test2 = Color.Red, test3 = null) { 88 this.x = x; 89 this.y = y; 90 this.z = z; 91 this.test1 = test1; 92 this.test2 = test2; 93 this.test3 = test3; 94 } 95 pack(builder) { 96 return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, (this.test3?.a ?? 0), (this.test3?.b ?? 0)); 97 } 98} 99