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