lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
45 lines • 1.49 kB
JavaScript
import { deg2Rad } from "@lincode/math";
import { PI2 } from "../../globals";
import { torusDefaults, torusSchema } from "../../interface/ITorus";
import { releaseTorusGeometry, requestTorusGeometry } from "../../pools/torusGeometryPool";
import PooledPrimitve from "../core/PooledPrimitive";
import toFixed from "../../api/serializer/toFixed";
import { refreshPooledPrimitiveSystem } from "../../systems/configSystems/refreshPooledPrimitiveSystem";
const geometry = requestTorusGeometry([0.5, 0.1, 16, 32, PI2]);
class Torus extends PooledPrimitve {
static componentName = "torus";
static defaults = torusDefaults;
static schema = torusSchema;
constructor() {
super(geometry, releaseTorusGeometry, requestTorusGeometry);
}
$getParams() {
return [0.5, this.thickness, 16, this.segments, this.theta * deg2Rad];
}
_segments;
get segments() {
return this._segments ?? 32;
}
set segments(val) {
this._segments = toFixed(val);
refreshPooledPrimitiveSystem.add(this);
}
_thickness;
get thickness() {
return this._thickness ?? 0.1;
}
set thickness(val) {
this._thickness = toFixed(val);
refreshPooledPrimitiveSystem.add(this);
}
_theta;
get theta() {
return this._theta ?? 360;
}
set theta(val) {
this._theta = toFixed(val);
refreshPooledPrimitiveSystem.add(this);
}
}
export default Torus;
//# sourceMappingURL=Torus.js.map