@enable3d/common
Advanced tools
Comparing version 0.25.1 to 0.25.2
@@ -57,3 +57,14 @@ /** | ||
// default context config for phaser | ||
const contextCreationConfig = Object.assign({}, contextAttributes); | ||
const contextCreationConfig = { | ||
// alpha: false, | ||
// depth: false, | ||
// antialias: true, | ||
// premultipliedAlpha: true, | ||
// stencil: true, | ||
// preserveDrawingBuffer: false, | ||
// failIfMajorPerformanceCaveat: false, | ||
// powerPreference: 'default', | ||
// merge bots context attributes | ||
...contextAttributes | ||
}; | ||
const webgl = isWebGL2Available() ? 'webgl2' : 'webgl'; | ||
@@ -60,0 +71,0 @@ // create context |
@@ -6,13 +6,2 @@ /** | ||
*/ | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import { BoxBufferGeometry, ConeBufferGeometry, CylinderBufferGeometry, DoubleSide, ExtrudeBufferGeometry, Line, LineBasicMaterial, MeshBasicMaterial, MeshLambertMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, PlaneBufferGeometry, Points, PointsMaterial, SphereBufferGeometry, MathUtils as THREE_Math, TorusBufferGeometry } from 'three'; | ||
@@ -94,8 +83,6 @@ import { ExtendedMesh } from './extendedMesh'; | ||
makeExtrude(extrudeConfig, materialConfig) { | ||
const { x, y, z, name, shape, autoCenter = true, breakable = false } = extrudeConfig, rest = __rest(extrudeConfig | ||
const { x, y, z, name, shape, autoCenter = true, breakable = false, ...rest } = extrudeConfig; | ||
// @ts-expect-error ExtrudeGeometryOptions interface is missing since three.js r121. | ||
, ["x", "y", "z", "name", "shape", "autoCenter", "breakable"]); | ||
// @ts-expect-error ExtrudeGeometryOptions interface is missing since three.js r121. | ||
const { depth = 1, bevelEnabled = false } = rest; | ||
const geometry = new ExtrudeBufferGeometry(shape, Object.assign({ depth, bevelEnabled }, rest)); | ||
const geometry = new ExtrudeBufferGeometry(shape, { depth, bevelEnabled, ...rest }); | ||
const material = this.addMaterial(materialConfig); | ||
@@ -116,3 +103,3 @@ const mesh = this.createMesh(geometry, material, { x, y, z }); | ||
makePlane(planeConfig, materialConfig) { | ||
const { x, y, z, name, breakable = false } = planeConfig, rest = __rest(planeConfig, ["x", "y", "z", "name", "breakable"]); | ||
const { x, y, z, name, breakable = false, ...rest } = planeConfig; | ||
const geometry = new PlaneBufferGeometry(rest.width || 1, rest.height || 1, rest.widthSegments || 1, rest.heightSegments || 1); | ||
@@ -132,3 +119,3 @@ const material = this.addMaterial(materialConfig); | ||
makeSphere(sphereConfig, materialConfig) { | ||
const { x, y, z, name, breakable = false } = sphereConfig, rest = __rest(sphereConfig, ["x", "y", "z", "name", "breakable"]); | ||
const { x, y, z, name, breakable = false, ...rest } = sphereConfig; | ||
const geometry = new SphereBufferGeometry(rest.radius || 1, rest.widthSegments || 16, rest.heightSegments || 12, rest.phiStart || undefined, rest.phiLength || undefined, rest.thetaStart || undefined, rest.thetaLength || undefined); | ||
@@ -147,3 +134,3 @@ const material = this.addMaterial(materialConfig); | ||
makeBox(boxConfig, materialConfig) { | ||
const { x, y, z, name, breakable = false } = boxConfig, rest = __rest(boxConfig, ["x", "y", "z", "name", "breakable"]); | ||
const { x, y, z, name, breakable = false, ...rest } = boxConfig; | ||
const geometry = new BoxBufferGeometry(rest.width || 1, rest.height || 1, rest.depth || 1, rest.widthSegments || undefined, rest.heightSegments || undefined, rest.depthSegments || undefined); | ||
@@ -168,3 +155,3 @@ const material = this.addMaterial(materialConfig); | ||
makeCylinder(cylinderConfig = {}, materialConfig = {}) { | ||
const { x, y, z, name, breakable = false } = cylinderConfig, rest = __rest(cylinderConfig, ["x", "y", "z", "name", "breakable"]); | ||
const { x, y, z, name, breakable = false, ...rest } = cylinderConfig; | ||
const geometry = new 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); | ||
@@ -183,3 +170,3 @@ const material = this.addMaterial(materialConfig); | ||
makeCone(coneConfig = {}, materialConfig = {}) { | ||
const { x, y, z, name, breakable = false } = coneConfig, rest = __rest(coneConfig, ["x", "y", "z", "name", "breakable"]); | ||
const { x, y, z, name, breakable = false, ...rest } = coneConfig; | ||
const geometry = new ConeBufferGeometry(rest.radius || 1, rest.height || 1, rest.radiusSegments || 8, rest.heightSegments || 1, rest.openEnded || false, rest.thetaStart || 0, rest.thetaLength || 2 * Math.PI); | ||
@@ -199,3 +186,3 @@ const material = this.addMaterial(materialConfig); | ||
makeTorus(torusConfig = {}, materialConfig = {}) { | ||
const { x, y, z, name, breakable = false } = torusConfig, rest = __rest(torusConfig, ["x", "y", "z", "name", "breakable"]); | ||
const { x, y, z, name, breakable = false, ...rest } = torusConfig; | ||
const geometry = new TorusBufferGeometry(rest.radius || undefined, rest.tube || undefined, rest.radialSegments || undefined, rest.tubularSegments || undefined, rest.arc || undefined); | ||
@@ -202,0 +189,0 @@ const material = this.addMaterial(materialConfig); |
@@ -40,3 +40,3 @@ /** | ||
}; | ||
if (element === null || element === void 0 ? void 0 : element.domElement) { | ||
if (element?.domElement) { | ||
const { domElement } = element; | ||
@@ -79,3 +79,3 @@ if ('ontouchstart' in window) { | ||
}; | ||
if (element === null || element === void 0 ? void 0 : element.domElement) { | ||
if (element?.domElement) { | ||
this.click(element); | ||
@@ -82,0 +82,0 @@ } |
@@ -167,2 +167,3 @@ /** | ||
colorScale?: any; | ||
heightScale?: number; | ||
} | ||
@@ -169,0 +170,0 @@ export declare type CustomCompoundShape = { |
{ | ||
"name": "@enable3d/common", | ||
"version": "0.25.1", | ||
"version": "0.25.2", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"tsc": "tsc", | ||
"build": "tsc", | ||
"update": "npm update", | ||
@@ -15,3 +15,3 @@ "fix": "npm audit fix" | ||
"dependencies": { | ||
"@enable3d/three-wrapper": "^0.25.1", | ||
"@enable3d/three-wrapper": "^0.25.2", | ||
"@yandeu/events": "0.0.5" | ||
@@ -18,0 +18,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
249952
3352