UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

47 lines (46 loc) 1.69 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify exports.__esModule = true; exports.Transform = void 0; var vec3_js_1 = require("./vec3.js"); var Transform = /** @class */ (function () { function Transform() { this.bb = null; this.bb_pos = 0; } Transform.prototype.__init = function (i, bb) { this.bb_pos = i; this.bb = bb; return this; }; Transform.prototype.position = function (obj) { return (obj || new vec3_js_1.Vec3()).__init(this.bb_pos, this.bb); }; Transform.prototype.rotation = function (obj) { return (obj || new vec3_js_1.Vec3()).__init(this.bb_pos + 12, this.bb); }; Transform.prototype.scale = function (obj) { return (obj || new vec3_js_1.Vec3()).__init(this.bb_pos + 24, this.bb); }; Transform.sizeOf = function () { return 36; }; Transform.createTransform = function (builder, position_x, position_y, position_z, rotation_x, rotation_y, rotation_z, scale_x, scale_y, scale_z) { builder.prep(4, 36); builder.prep(4, 12); builder.writeFloat32(scale_z); builder.writeFloat32(scale_y); builder.writeFloat32(scale_x); builder.prep(4, 12); builder.writeFloat32(rotation_z); builder.writeFloat32(rotation_y); builder.writeFloat32(rotation_x); builder.prep(4, 12); builder.writeFloat32(position_z); builder.writeFloat32(position_y); builder.writeFloat32(position_x); return builder.offset(); }; return Transform; }()); exports.Transform = Transform;