Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@enable3d/common

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enable3d/common - npm Package Compare versions

Comparing version 0.0.16-alpha.2 to 0.0.16

dist/serverClock.d.ts

4

dist/customCanvas.d.ts
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@ interface CustomCanvasConfig {

"use strict";
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -7,0 +7,0 @@ var __assign = (this && this.__assign) || function () {

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@ import { AnimationClip, AnimationMixer, Mesh, Geometry, BufferGeometry, Material } from '@enable3d/three-wrapper/dist/index';

"use strict";
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -7,0 +7,0 @@ var __extends = (this && this.__extends) || (function () {

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@ import { AnimationClip, AnimationMixer, Mesh, Line, Points, Object3D } from '@enable3d/three-wrapper/dist/index';

"use strict";
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -7,0 +7,0 @@ var __extends = (this && this.__extends) || (function () {

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -13,3 +13,4 @@ import { MaterialConfig, TorusConfig, BoxObject, GroundObject, SphereObject, CylinderObject, ExtrudeObject, AddMaterial, PlaneObject, ConeObject } from './types';

protected defaultMaterial: DefaultMaterial;
constructor(scene: Scene);
isHeadless: boolean;
constructor(scene: Scene | 'headless');
get make(): {

@@ -16,0 +17,0 @@ extrude: ExtrudeObject;

"use strict";
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -40,2 +40,3 @@ var __assign = (this && this.__assign) || function () {

this.scene = scene;
this.isHeadless = scene === 'headless' ? true : false;
this.defaultMaterial = new defaultMaterial_1.default();

@@ -144,4 +145,11 @@ }

});
Factories.prototype.addExisting = function (object) {
this.scene.add(object);
Factories.prototype.addExisting = function () {
var _a;
var object = [];
for (var _i = 0; _i < arguments.length; _i++) {
object[_i] = arguments[_i];
}
if (this.scene === 'headless')
return;
(_a = this.scene).add.apply(_a, object);
};

@@ -151,7 +159,7 @@ Factories.prototype.addMesh = function (mesh) {

for (var i = 0; i < mesh.length; i++) {
this.scene.add(mesh[i]);
this.addExisting(mesh[i]);
}
}
else {
this.scene.add(mesh);
this.addExisting(mesh);
}

@@ -181,3 +189,3 @@ return this;

var _d = rest.depth, depth = _d === void 0 ? 1 : _d, _e = rest.bevelEnabled, bevelEnabled = _e === void 0 ? false : _e;
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.ExtrudeBufferGeometry(shape, __assign({ depth: depth, bevelEnabled: bevelEnabled }, rest))

@@ -197,3 +205,3 @@ : new index_1.ExtrudeGeometry(shape, __assign({ depth: depth, bevelEnabled: bevelEnabled }, rest));

var obj = this.makeExtrude(extrudeConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -203,3 +211,3 @@ };

var x = planeConfig.x, y = planeConfig.y, z = planeConfig.z, name = planeConfig.name, _a = planeConfig.breakable, breakable = _a === void 0 ? false : _a, _b = planeConfig.bufferGeometry, bufferGeometry = _b === void 0 ? true : _b, rest = __rest(planeConfig, ["x", "y", "z", "name", "breakable", "bufferGeometry"]);
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.PlaneBufferGeometry(rest.width || 1, rest.height || 1, rest.widthSegments || 1, rest.heightSegments || 1)

@@ -216,3 +224,3 @@ : new index_1.PlaneGeometry(rest.width || 1, rest.height || 1, rest.widthSegments || 1, rest.heightSegments || 1);

var obj = this.makePlane(planeConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -222,3 +230,3 @@ };

var x = sphereConfig.x, y = sphereConfig.y, z = sphereConfig.z, name = sphereConfig.name, _a = sphereConfig.breakable, breakable = _a === void 0 ? false : _a, _b = sphereConfig.bufferGeometry, bufferGeometry = _b === void 0 ? true : _b, rest = __rest(sphereConfig, ["x", "y", "z", "name", "breakable", "bufferGeometry"]);
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.SphereBufferGeometry(rest.radius || 1, rest.widthSegments || 16, rest.heightSegments || 12, rest.phiStart || undefined, rest.phiLength || undefined, rest.thetaStart || undefined, rest.thetaLength || undefined)

@@ -236,3 +244,3 @@ : new index_1.SphereGeometry(rest.radius || 1, rest.widthSegments || 16, rest.heightSegments || 12, rest.phiStart || undefined, rest.phiLength || undefined, rest.thetaStart || undefined, rest.thetaLength || undefined);

var obj = this.makeSphere(sphereConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -242,3 +250,3 @@ };

var x = boxConfig.x, y = boxConfig.y, z = boxConfig.z, name = boxConfig.name, _a = boxConfig.breakable, breakable = _a === void 0 ? false : _a, _b = boxConfig.bufferGeometry, bufferGeometry = _b === void 0 ? true : _b, rest = __rest(boxConfig, ["x", "y", "z", "name", "breakable", "bufferGeometry"]);
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.BoxBufferGeometry(rest.width || 1, rest.height || 1, rest.depth || 1, rest.widthSegments || undefined, rest.heightSegments || undefined, rest.depthSegments || undefined)

@@ -256,3 +264,3 @@ : new index_1.BoxGeometry(rest.width || 1, rest.height || 1, rest.depth || 1, rest.widthSegments || undefined, rest.heightSegments || undefined, rest.depthSegments || undefined);

var obj = this.makeBox(boxConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -264,3 +272,3 @@ };

obj.rotateX(index_1.MathUtils.degToRad(90));
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -272,3 +280,3 @@ };

var x = cylinderConfig.x, y = cylinderConfig.y, z = cylinderConfig.z, name = cylinderConfig.name, _a = cylinderConfig.breakable, breakable = _a === void 0 ? false : _a, _b = cylinderConfig.bufferGeometry, bufferGeometry = _b === void 0 ? true : _b, rest = __rest(cylinderConfig, ["x", "y", "z", "name", "breakable", "bufferGeometry"]);
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.CylinderBufferGeometry(rest.radiusTop || 1, rest.radiusBottom || 1, rest.height || 1, rest.radiusSegments || undefined, rest.heightSegments || undefined, rest.openEnded || undefined, rest.thetaStart || undefined, rest.thetaLength || undefined)

@@ -286,3 +294,3 @@ : new index_1.CylinderGeometry(rest.radiusTop || 1, rest.radiusBottom || 1, rest.height || 1, rest.radiusSegments || undefined, rest.heightSegments || undefined, rest.openEnded || undefined, rest.thetaStart || undefined, rest.thetaLength || undefined);

var obj = this.makeCylinder(cylinderConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -294,3 +302,3 @@ };

var x = coneConfig.x, y = coneConfig.y, z = coneConfig.z, name = coneConfig.name, _a = coneConfig.breakable, breakable = _a === void 0 ? false : _a, _b = coneConfig.bufferGeometry, bufferGeometry = _b === void 0 ? true : _b, rest = __rest(coneConfig, ["x", "y", "z", "name", "breakable", "bufferGeometry"]);
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.ConeBufferGeometry(rest.radius || 1, rest.height || 1, rest.radiusSegments || 8, rest.heightSegments || 1, rest.openEnded || false, rest.thetaStart || 0, rest.thetaLength || 2 * Math.PI)

@@ -308,3 +316,3 @@ : new index_1.ConeBufferGeometry(rest.radius || 1, rest.height || 1, rest.radiusSegments || 8, rest.heightSegments || 1, rest.openEnded || false, rest.thetaStart || 0, rest.thetaLength || 2 * Math.PI);

var obj = this.makeCone(coneConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -317,3 +325,3 @@ };

var x = torusConfig.x, y = torusConfig.y, z = torusConfig.z, name = torusConfig.name, _a = torusConfig.breakable, breakable = _a === void 0 ? false : _a, _b = torusConfig.bufferGeometry, bufferGeometry = _b === void 0 ? true : _b, rest = __rest(torusConfig, ["x", "y", "z", "name", "breakable", "bufferGeometry"]);
var geometry = bufferGeometry || breakable
var geometry = bufferGeometry || breakable || this.isHeadless
? new index_1.TorusBufferGeometry(rest.radius || undefined, rest.tube || undefined, rest.radialSegments || undefined, rest.tubularSegments || undefined, rest.arc || undefined)

@@ -331,3 +339,3 @@ : new index_1.TorusGeometry(rest.radius || undefined, rest.tube || undefined, rest.radialSegments || undefined, rest.tubularSegments || undefined, rest.arc || undefined);

var obj = this.makeTorus(torusConfig, materialConfig);
this.scene.add(obj);
this.addExisting(obj);
return obj;

@@ -343,2 +351,5 @@ };

// }
// always share the same material in headless mode to save memory
if (this.scene === 'headless')
return this.defaultMaterial.get();
switch (type) {

@@ -345,0 +356,0 @@ case 'basic':

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@ import { MeshStandardMaterialParameters, MeshBasicMaterialParameters, MeshPhongMaterialParameters, LineBasicMaterialParameters, PointsMaterialParameters, MeshNormalMaterialParameters, PerspectiveCamera as THREE_PerspectiveCamera, OrthographicCamera as THREE_OrthographicCamera, Shape, ExtrudeGeometryOptions, MeshLambertMaterialParameters, Texture, MeshToonMaterialParameters, MeshPhysicalMaterialParameters, Material, WebGLRenderer } from '@enable3d/three-wrapper/dist/index';

"use strict";
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -7,0 +7,0 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

{
"name": "@enable3d/common",
"version": "0.0.16-alpha.2",
"version": "0.0.16",
"description": "",

@@ -15,5 +15,5 @@ "main": "dist/index.js",

"dependencies": {
"@enable3d/three-wrapper": "^0.0.16-alpha.2",
"@enable3d/three-wrapper": "^0.0.16",
"chroma-js": "^2.1.0"
}
}
/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -66,4 +66,6 @@

protected defaultMaterial: DefaultMaterial
public isHeadless: boolean
constructor(private scene: Scene) {
constructor(private scene: Scene | 'headless') {
this.isHeadless = scene === 'headless' ? true : false
this.defaultMaterial = new DefaultMaterial()

@@ -140,4 +142,5 @@ }

private addExisting(object: ExtendedObject3D | Mesh | Line | Points) {
this.scene.add(object)
private addExisting(...object: Object3D[] | ExtendedObject3D[] | Mesh[] | Line[] | Points[]) {
if (this.scene === 'headless') return
this.scene.add(...object)
}

@@ -148,6 +151,6 @@

for (let i = 0; i < mesh.length; i++) {
this.scene.add(mesh[i])
this.addExisting(mesh[i])
}
} else {
this.scene.add(mesh)
this.addExisting(mesh)
}

@@ -182,3 +185,3 @@ return this

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new ExtrudeBufferGeometry(shape, { depth, bevelEnabled, ...rest })

@@ -197,3 +200,3 @@ : new ExtrudeGeometry(shape, { depth, bevelEnabled, ...rest })

const obj = this.makeExtrude(extrudeConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -205,3 +208,3 @@ }

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new PlaneBufferGeometry(rest.width || 1, rest.height || 1, rest.widthSegments || 1, rest.heightSegments || 1)

@@ -219,3 +222,3 @@ : new PlaneGeometry(rest.width || 1, rest.height || 1, rest.widthSegments || 1, rest.heightSegments || 1)

const obj = this.makePlane(planeConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -227,3 +230,3 @@ }

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new SphereBufferGeometry(

@@ -256,3 +259,3 @@ rest.radius || 1,

const obj = this.makeSphere(sphereConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -264,3 +267,3 @@ }

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new BoxBufferGeometry(

@@ -291,3 +294,3 @@ rest.width || 1,

const obj = this.makeBox(boxConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -299,3 +302,3 @@ }

obj.rotateX(THREE_Math.degToRad(90))
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -307,3 +310,3 @@ }

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new CylinderBufferGeometry(

@@ -338,3 +341,3 @@ rest.radiusTop || 1,

const obj = this.makeCylinder(cylinderConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -346,3 +349,3 @@ }

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new ConeBufferGeometry(

@@ -375,3 +378,3 @@ rest.radius || 1,

const obj = this.makeCone(coneConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -384,3 +387,3 @@ }

const geometry =
bufferGeometry || breakable
bufferGeometry || breakable || this.isHeadless
? new TorusBufferGeometry(

@@ -409,3 +412,3 @@ rest.radius || undefined,

const obj = this.makeTorus(torusConfig, materialConfig)
this.scene.add(obj)
this.addExisting(obj)
return obj

@@ -423,2 +426,5 @@ }

// always share the same material in headless mode to save memory
if (this.scene === 'headless') return this.defaultMaterial.get()
switch (type) {

@@ -425,0 +431,0 @@ case 'basic':

/**
* @author Yannick Deubel (https://github.com/yandeu)
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/yandeu/enable3d
* @license {@link https://github.com/yandeu/enable3d/blob/master/LICENSE|GNU GPLv3}
* @copyright Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
* @license {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
*/

@@ -6,0 +6,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc