ecsy-babylon
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -6,16 +6,71 @@ 'use strict'; | ||
var ecsy = require('ecsy'); | ||
var core = require('@babylonjs/core'); | ||
var math_vector = require('@babylonjs/core/Maths/math.vector'); | ||
var mesh = require('@babylonjs/core/Meshes/mesh'); | ||
var math_color = require('@babylonjs/core/Maths/math.color'); | ||
var pbrMaterial = require('@babylonjs/core/Materials/PBR/pbrMaterial'); | ||
var constants = require('@babylonjs/core/Engines/constants'); | ||
var scene = require('@babylonjs/core/scene'); | ||
var engine = require('@babylonjs/core/Engines/engine'); | ||
var freeCamera = require('@babylonjs/core/Cameras/freeCamera'); | ||
var arcRotateCamera = require('@babylonjs/core/Cameras/arcRotateCamera'); | ||
var transformNode = require('@babylonjs/core/Meshes/transformNode'); | ||
var planeBuilder = require('@babylonjs/core/Meshes/Builders/planeBuilder'); | ||
var boxBuilder = require('@babylonjs/core/Meshes/Builders/boxBuilder'); | ||
var sphereBuilder = require('@babylonjs/core/Meshes/Builders/sphereBuilder'); | ||
var backgroundMaterial = require('@babylonjs/core/Materials/Background/backgroundMaterial'); | ||
var standardMaterial = require('@babylonjs/core/Materials/standardMaterial'); | ||
var materials = require('@babylonjs/materials'); | ||
var hemisphericLight = require('@babylonjs/core/Lights/hemisphericLight'); | ||
var directionalLight = require('@babylonjs/core/Lights/directionalLight'); | ||
var pointLight = require('@babylonjs/core/Lights/pointLight'); | ||
var instancedMesh = require('@babylonjs/core/Meshes/instancedMesh'); | ||
var shadowGenerator = require('@babylonjs/core/Lights/Shadows/shadowGenerator'); | ||
var actionManager = require('@babylonjs/core/Actions/actionManager'); | ||
var directActions = require('@babylonjs/core/Actions/directActions'); | ||
var BabylonCore = ecsy.createComponentClass({ | ||
world: { default: null }, | ||
canvas: { default: null }, | ||
defaultCamera: { default: null }, | ||
engine: { default: null }, | ||
scene: { default: null }, | ||
shadowGenerators: { default: new Set() }, | ||
beforeRender: { default: undefined }, | ||
afterRender: { default: undefined }, | ||
}, 'BabylonCore'); | ||
class BabylonCore extends ecsy.Component { | ||
constructor() { | ||
super(...arguments); | ||
this.shadowGenerators = new Set(); | ||
} | ||
} | ||
Object.defineProperty(BabylonCore, 'name', { value: 'BabylonCore' }); | ||
class ArcRotateCamera extends ecsy.Component { | ||
constructor() { | ||
super(...arguments); | ||
this.value = null; | ||
this.alpha = 0; | ||
this.beta = 0; | ||
this.radius = 10; | ||
this.target = new math_vector.Vector3(0, 0, 0); | ||
this.lowerAlphaLimit = null; | ||
this.lowerBetaLimit = null; | ||
this.lowerRadiusLimit = null; | ||
this.upperAlphaLimit = null; | ||
this.upperBetaLimit = null; | ||
this.upperRadiusLimit = null; | ||
} | ||
reset() { | ||
this.value = null; | ||
this.alpha = 0; | ||
this.beta = 0; | ||
this.radius = 10; | ||
this.target.set(0, 0, 0); | ||
this.lowerAlphaLimit = null; | ||
this.lowerBetaLimit = null; | ||
this.lowerRadiusLimit = null; | ||
this.upperAlphaLimit = null; | ||
this.upperBetaLimit = null; | ||
this.upperRadiusLimit = null; | ||
} | ||
} | ||
Object.defineProperty(ArcRotateCamera, 'name', { value: 'ArcRotateCamera' }); | ||
var Mesh = ecsy.createComponentClass({ | ||
value: { default: null }, | ||
instance: { default: null }, | ||
dispose: { default: false }, | ||
}, 'Mesh'); | ||
// TODO: copy seems to be necessary for Vector/Color to work properly, but it is only used | ||
@@ -41,5 +96,5 @@ // when initially adding the component, not on subsequent updates. Requires more research. | ||
Vector2: ecsy.createType({ | ||
baseType: core.Vector2, | ||
baseType: math_vector.Vector2, | ||
create: (defaultValue) => { | ||
const v = new core.Vector2(0, 0); | ||
const v = new math_vector.Vector2(0, 0); | ||
if (typeof defaultValue !== 'undefined') { | ||
@@ -64,5 +119,5 @@ v.copyFrom(defaultValue); | ||
Vector3: ecsy.createType({ | ||
baseType: core.Vector3, | ||
baseType: math_vector.Vector3, | ||
create: (defaultValue) => { | ||
const v = new core.Vector3(0, 0, 0); | ||
const v = new math_vector.Vector3(0, 0, 0); | ||
if (typeof defaultValue !== 'undefined') { | ||
@@ -87,5 +142,5 @@ v.copyFrom(defaultValue); | ||
Vector4: ecsy.createType({ | ||
baseType: core.Vector4, | ||
baseType: math_vector.Vector4, | ||
create: (defaultValue) => { | ||
const v = new core.Vector4(0, 0, 0, 0); | ||
const v = new math_vector.Vector4(0, 0, 0, 0); | ||
if (typeof defaultValue !== 'undefined') { | ||
@@ -110,5 +165,5 @@ v.copyFrom(defaultValue); | ||
Color3: ecsy.createType({ | ||
baseType: core.Color3, | ||
baseType: math_color.Color3, | ||
create: (defaultValue) => { | ||
const c = new core.Color3(0, 0, 0); | ||
const c = new math_color.Color3(0, 0, 0); | ||
if (typeof defaultValue !== 'undefined') { | ||
@@ -133,5 +188,5 @@ c.copyFrom(defaultValue); | ||
Color4: ecsy.createType({ | ||
baseType: core.Color4, | ||
baseType: math_color.Color4, | ||
create: (defaultValue) => { | ||
const c = new core.Color4(0, 0, 0); | ||
const c = new math_color.Color4(0, 0, 0); | ||
if (typeof defaultValue !== 'undefined') { | ||
@@ -157,23 +212,2 @@ c.copyFrom(defaultValue); | ||
var ArcRotateCamera = ecsy.createComponentClass({ | ||
value: { default: null }, | ||
alpha: { default: 0 }, | ||
beta: { default: 0 }, | ||
radius: { default: 10 }, | ||
// target: { default: null, type: Types.Vector3 }, | ||
lowerAlphaLimit: { default: null, type: Types.OptionalNumber }, | ||
lowerBetaLimit: { default: null, type: Types.OptionalNumber }, | ||
lowerRadiusLimit: { default: null, type: Types.OptionalNumber }, | ||
upperAlphaLimit: { default: null, type: Types.OptionalNumber }, | ||
upperBetaLimit: { default: null, type: Types.OptionalNumber }, | ||
upperRadiusLimit: { default: null, type: Types.OptionalNumber }, | ||
panningSensibility: { default: 0 }, | ||
}, 'ArcRotateCamera'); | ||
var Mesh = ecsy.createComponentClass({ | ||
value: { default: null }, | ||
instance: { default: null }, | ||
dispose: { default: false }, | ||
}, 'Mesh'); | ||
var Plane = ecsy.createComponentClass({ | ||
@@ -184,3 +218,3 @@ size: { default: 1 }, | ||
updatable: { default: false }, | ||
sideOrientation: { default: core.Mesh.DEFAULTSIDE }, | ||
sideOrientation: { default: mesh.Mesh.DEFAULTSIDE }, | ||
}, 'Plane'); | ||
@@ -194,3 +228,3 @@ | ||
updatable: { default: false }, | ||
sideOrientation: { default: core.Mesh.DEFAULTSIDE }, | ||
sideOrientation: { default: mesh.Mesh.DEFAULTSIDE }, | ||
}, 'Box'); | ||
@@ -207,3 +241,3 @@ | ||
updatable: { default: false }, | ||
sideOrientation: { default: core.Mesh.DEFAULTSIDE }, | ||
sideOrientation: { default: mesh.Mesh.DEFAULTSIDE }, | ||
}, 'Sphere'); | ||
@@ -216,5 +250,5 @@ | ||
var StandardMaterial = ecsy.createComponentClass({ | ||
ambientColor: { default: new core.Color3(0, 0, 0), type: Types.Color3 }, | ||
diffuseColor: { default: new core.Color3(1, 1, 1), type: Types.Color3 }, | ||
emissiveColor: { default: new core.Color3(0, 0, 0), type: Types.Color3 }, | ||
ambientColor: { default: new math_color.Color3(0, 0, 0), type: Types.Color3 }, | ||
diffuseColor: { default: new math_color.Color3(1, 1, 1), type: Types.Color3 }, | ||
emissiveColor: { default: new math_color.Color3(0, 0, 0), type: Types.Color3 }, | ||
disableLighting: { default: false }, | ||
@@ -234,3 +268,3 @@ alpha: { default: 1.0 }, | ||
this.ambientTextureStrength = 1; | ||
this.ambientTextureImpactOnAnalyticalLights = core.PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS; | ||
this.ambientTextureImpactOnAnalyticalLights = pbrMaterial.PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS; | ||
this.opacityTexture = null; | ||
@@ -248,7 +282,7 @@ this.reflectionTexture = null; | ||
this.lightmapTexture = null; | ||
this.ambientColor = new core.Color3(0, 0, 0); | ||
this.albedoColor = new core.Color3(1, 1, 1); | ||
this.reflectivityColor = new core.Color3(1, 1, 1); | ||
this.reflectionColor = new core.Color3(1, 1, 1); | ||
this.emissiveColor = new core.Color3(0, 0, 0); | ||
this.ambientColor = new math_color.Color3(0, 0, 0); | ||
this.albedoColor = new math_color.Color3(1, 1, 1); | ||
this.reflectivityColor = new math_color.Color3(1, 1, 1); | ||
this.reflectionColor = new math_color.Color3(1, 1, 1); | ||
this.emissiveColor = new math_color.Color3(0, 0, 0); | ||
this.microSurface = 1.0; | ||
@@ -295,3 +329,3 @@ this.useLightmapAsShadowmap = false; | ||
this.ambientTextureStrength = 1; | ||
this.ambientTextureImpactOnAnalyticalLights = core.PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS; | ||
this.ambientTextureImpactOnAnalyticalLights = pbrMaterial.PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS; | ||
this.opacityTexture = null; | ||
@@ -353,5 +387,5 @@ this.reflectionTexture = null; | ||
alpha: { default: 1.0 }, | ||
alphaMode: { default: core.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF }, | ||
alphaMode: { default: constants.Constants.ALPHA_PREMULTIPLIED_PORTERDUFF }, | ||
shadowLevel: { default: 0.5 }, | ||
primaryColor: { default: new core.Color3(0, 0, 0), type: Types.Color3 }, | ||
primaryColor: { default: new math_color.Color3(0, 0, 0), type: Types.Color3 }, | ||
useRGBColor: { default: false }, | ||
@@ -370,7 +404,7 @@ enableNoise: { default: true }, | ||
var HemisphericLight = ecsy.createComponentClass(Object.assign(Object.assign({}, schema), { direction: { default: new core.Vector3(0, 1, 0), type: Types.Vector3 } }), 'HemisphericLight'); | ||
var HemisphericLight = ecsy.createComponentClass(Object.assign(Object.assign({}, schema), { direction: { default: new math_vector.Vector3(0, 1, 0), type: Types.Vector3 } }), 'HemisphericLight'); | ||
var DirectionalLight = ecsy.createComponentClass(Object.assign(Object.assign({}, schema), { direction: { default: new core.Vector3(0, -1, 0), type: Types.Vector3 } }), 'DirectionalLight'); | ||
var DirectionalLight = ecsy.createComponentClass(Object.assign(Object.assign({}, schema), { direction: { default: new math_vector.Vector3(0, -1, 0), type: Types.Vector3 } }), 'DirectionalLight'); | ||
var PointLight = ecsy.createComponentClass(Object.assign(Object.assign({}, schema), { position: { default: new core.Vector3(0, 1, 0), type: Types.Vector3 } }), 'PointLight'); | ||
var PointLight = ecsy.createComponentClass(Object.assign(Object.assign({}, schema), { position: { default: new math_vector.Vector3(0, 1, 0), type: Types.Vector3 } }), 'PointLight'); | ||
@@ -388,32 +422,38 @@ var ShadowGenerator = ecsy.createComponentClass({ | ||
var Position = ecsy.createComponentClass({ | ||
value: { default: new core.Vector3(0, 0, 0), type: Types.Vector3 }, | ||
value: { default: new math_vector.Vector3(0, 0, 0), type: Types.Vector3 }, | ||
}, 'Position'); | ||
var Rotation = ecsy.createComponentClass({ | ||
value: { default: new core.Vector3(0, 0, 0), type: Types.Vector3 }, | ||
value: { default: new math_vector.Vector3(0, 0, 0), type: Types.Vector3 }, | ||
}, 'Rotation'); | ||
var Scale = ecsy.createComponentClass({ | ||
value: { default: new core.Vector3(1, 1, 1), type: Types.Vector3 }, | ||
value: { default: new math_vector.Vector3(1, 1, 1), type: Types.Vector3 }, | ||
}, 'Scale'); | ||
var Action = ecsy.createComponentClass({ | ||
pick: { default: null }, | ||
doublePick: { default: null }, | ||
centerPick: { default: null }, | ||
everyFrame: { default: null }, | ||
intersectionEnter: { default: null }, | ||
intersectionExit: { default: null }, | ||
keyDown: { default: null }, | ||
keyUp: { default: null }, | ||
leftPick: { default: null }, | ||
longPress: { default: null }, | ||
pickDown: { default: null }, | ||
pickOut: { default: null }, | ||
pickUp: { default: null }, | ||
pointerOut: { default: null }, | ||
pointerOver: { default: null }, | ||
rightPick: { default: null }, | ||
_actions: { default: {} }, | ||
}, 'Action'); | ||
class Action extends ecsy.Component { | ||
constructor() { | ||
super(...arguments); | ||
this._actions = {}; | ||
} | ||
reset() { | ||
this.pick = undefined; | ||
this.doublePick = undefined; | ||
this.centerPick = undefined; | ||
this.everyFrame = undefined; | ||
this.intersectionEnter = undefined; | ||
this.intersectionExit = undefined; | ||
this.keyDown = undefined; | ||
this.keyUp = undefined; | ||
this.leftPick = undefined; | ||
this.longPress = undefined; | ||
this.pickDown = undefined; | ||
this.pickOut = undefined; | ||
this.pickUp = undefined; | ||
this.pointerOut = undefined; | ||
this.pointerOver = undefined; | ||
this.rightPick = undefined; | ||
} | ||
} | ||
Object.defineProperty(Action, 'name', { value: 'Action' }); | ||
@@ -449,32 +489,33 @@ var Parent = ecsy.createComponentClass({ | ||
execute() { | ||
this.queries.core.added.forEach((e) => this.setup(e)); | ||
this.queries.core.removed.forEach((e) => this.remove(e)); | ||
var _a, _b; | ||
(_a = this.queries.core.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.core.removed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.remove(e)); | ||
} | ||
setup(entity) { | ||
const core$1 = entity.getMutableComponent(BabylonCore); | ||
core$1.engine = core$1.engine || new core.Engine(core$1.canvas, true, {}, false); | ||
core$1.scene = new core.Scene(core$1.engine); | ||
core$1.defaultCamera = new core.FreeCamera('defaultCamera', new core.Vector3(0, 0, -10), core$1.scene); | ||
core$1.defaultCamera.attachControl(core$1.canvas, false); | ||
const core = entity.getMutableComponent(BabylonCore); | ||
core.engine = core.engine || new engine.Engine(core.canvas, true, {}, false); | ||
core.scene = new scene.Scene(core.engine); | ||
core.defaultCamera = new freeCamera.FreeCamera('defaultCamera', new math_vector.Vector3(0, 0, -10), core.scene); | ||
core.defaultCamera.attachControl(core.canvas, false); | ||
this.listener = function () { | ||
this.engine.resize(); | ||
}.bind({ engine: core$1.engine }); | ||
}.bind({ engine: core.engine }); | ||
window.addEventListener('resize', this.listener); | ||
const startTime = window.performance.now(); | ||
core$1.engine.runRenderLoop(() => { | ||
if (!core$1.engine || !core$1.scene) { | ||
core.engine.runRenderLoop(() => { | ||
if (!core.engine || !core.scene) { | ||
throw new Error('Engine and/or Scene not found'); | ||
} | ||
const delta = core$1.engine.getDeltaTime(); | ||
const delta = core.engine.getDeltaTime(); | ||
const time = window.performance.now() - startTime; | ||
if (core$1.beforeRender) { | ||
core$1.beforeRender(delta, time); | ||
if (core.beforeRender) { | ||
core.beforeRender(delta, time); | ||
} | ||
core$1.world.execute(delta, time); | ||
core.world.execute(delta, time); | ||
// only render if there is an active camera | ||
if (core$1.scene.activeCamera) { | ||
core$1.scene.render(); | ||
if (core.scene.activeCamera) { | ||
core.scene.render(); | ||
} | ||
if (core$1.afterRender) { | ||
core$1.afterRender(delta, time); | ||
if (core.afterRender) { | ||
core.afterRender(delta, time); | ||
} | ||
@@ -532,3 +573,4 @@ }); | ||
execute() { | ||
if (this.queries.core.added.length) { | ||
var _a; | ||
if ((_a = this.queries.core.added) === null || _a === void 0 ? void 0 : _a.length) { | ||
if (this.queries.core.added.length > 1) { | ||
@@ -542,3 +584,4 @@ throw new Error('More than 1 core has been added.'); | ||
afterExecute() { | ||
if (this.queries.core.removed.length) { | ||
var _a; | ||
if ((_a = this.queries.core.removed) === null || _a === void 0 ? void 0 : _a.length) { | ||
this.core = undefined; | ||
@@ -567,6 +610,7 @@ } | ||
execute() { | ||
var _a, _b, _c; | ||
super.execute(); | ||
this.queries.arcRotateCamera.added.forEach((e) => this.setupArcRotateCamera(e)); | ||
this.queries.arcRotateCamera.changed.forEach((e) => this.update(e, ArcRotateCamera)); | ||
this.queries.arcRotateCamera.removed.forEach((e) => this.remove(e, ArcRotateCamera)); | ||
(_a = this.queries.arcRotateCamera.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setupArcRotateCamera(e)); | ||
(_b = this.queries.arcRotateCamera.changed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.update(e, ArcRotateCamera)); | ||
(_c = this.queries.arcRotateCamera.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.remove(e, ArcRotateCamera)); | ||
super.afterExecute(); | ||
@@ -580,3 +624,3 @@ } | ||
const { alpha, beta, radius, target } = args; | ||
const instance = value || new core.ArcRotateCamera(cameraComponent.name, alpha, beta, radius, target, scene, false); | ||
const instance = value || new arcRotateCamera.ArcRotateCamera(ArcRotateCamera.name, alpha, beta, radius, target, scene, false); | ||
Object.assign(instance, args); | ||
@@ -626,16 +670,17 @@ cameraComponent.value = instance; | ||
execute() { | ||
this.queries.parent.added.forEach((e) => this.setup(e)); | ||
this.queries.transformNode.added.forEach((e) => this.setupTransformNode(e)); | ||
this.queries.position.added.forEach((e) => this.position(e)); | ||
this.queries.position.changed.forEach((e) => this.position(e)); | ||
this.queries.position.removed.forEach((e) => this.removePosition(e)); | ||
this.queries.rotation.added.forEach((e) => this.rotation(e)); | ||
this.queries.rotation.changed.forEach((e) => this.rotation(e)); | ||
this.queries.rotation.removed.forEach((e) => this.removeRotation(e)); | ||
this.queries.scale.added.forEach((e) => this.scale(e)); | ||
this.queries.scale.changed.forEach((e) => this.scale(e)); | ||
this.queries.scale.removed.forEach((e) => this.removeScale(e)); | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; | ||
(_a = this.queries.parent.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.transformNode.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setupTransformNode(e)); | ||
(_c = this.queries.position.added) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.position(e)); | ||
(_d = this.queries.position.changed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.position(e)); | ||
(_e = this.queries.position.removed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.removePosition(e)); | ||
(_f = this.queries.rotation.added) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.rotation(e)); | ||
(_g = this.queries.rotation.changed) === null || _g === void 0 ? void 0 : _g.forEach((e) => this.rotation(e)); | ||
(_h = this.queries.rotation.removed) === null || _h === void 0 ? void 0 : _h.forEach((e) => this.removeRotation(e)); | ||
(_j = this.queries.scale.added) === null || _j === void 0 ? void 0 : _j.forEach((e) => this.scale(e)); | ||
(_k = this.queries.scale.changed) === null || _k === void 0 ? void 0 : _k.forEach((e) => this.scale(e)); | ||
(_l = this.queries.scale.removed) === null || _l === void 0 ? void 0 : _l.forEach((e) => this.removeScale(e)); | ||
// entity might remove TransformNode, so it needs to run before | ||
this.queries.parent.removed.forEach((e) => this.remove(e)); | ||
this.queries.transformNode.removed.forEach((e) => this.removeTransformNode(e)); | ||
(_m = this.queries.parent.removed) === null || _m === void 0 ? void 0 : _m.forEach((e) => this.remove(e)); | ||
(_o = this.queries.transformNode.removed) === null || _o === void 0 ? void 0 : _o.forEach((e) => this.removeTransformNode(e)); | ||
} | ||
@@ -646,4 +691,4 @@ setup(entity) { | ||
} | ||
const transformNode = new core.TransformNode(`${guidFor(entity)}__TransformNode`); | ||
entity.addComponent(TransformNode, { value: transformNode }); | ||
const transformNode$1 = new transformNode.TransformNode(`${guidFor(entity)}__TransformNode`); | ||
entity.addComponent(TransformNode, { value: transformNode$1 }); | ||
} | ||
@@ -697,3 +742,3 @@ remove(entity) { | ||
const tn = this.getTransformNode(entity, true); | ||
tn.position = new core.Vector3(0, 0, 0); | ||
tn.position = new math_vector.Vector3(0, 0, 0); | ||
} | ||
@@ -766,8 +811,9 @@ rotation(entity) { | ||
execute() { | ||
this.queries.planes.added.forEach((e) => this.setup(e, Plane, core.PlaneBuilder.CreatePlane)); // eslint-disable-line @typescript-eslint/unbound-method | ||
this.queries.boxes.added.forEach((e) => this.setup(e, Box, core.BoxBuilder.CreateBox)); // eslint-disable-line @typescript-eslint/unbound-method | ||
this.queries.spheres.added.forEach((e) => this.setup(e, Sphere, core.SphereBuilder.CreateSphere)); // eslint-disable-line @typescript-eslint/unbound-method | ||
this.queries.planes.removed.forEach((e) => this.remove(e)); | ||
this.queries.boxes.removed.forEach((e) => this.remove(e)); | ||
this.queries.spheres.removed.forEach((e) => this.remove(e)); | ||
var _a, _b, _c, _d, _e, _f; | ||
(_a = this.queries.planes.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e, Plane, planeBuilder.PlaneBuilder.CreatePlane)); // eslint-disable-line @typescript-eslint/unbound-method | ||
(_b = this.queries.boxes.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setup(e, Box, boxBuilder.BoxBuilder.CreateBox)); // eslint-disable-line @typescript-eslint/unbound-method | ||
(_c = this.queries.spheres.added) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.setup(e, Sphere, sphereBuilder.SphereBuilder.CreateSphere)); // eslint-disable-line @typescript-eslint/unbound-method | ||
(_d = this.queries.planes.removed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.remove(e)); | ||
(_e = this.queries.boxes.removed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.remove(e)); | ||
(_f = this.queries.spheres.removed) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.remove(e)); | ||
} | ||
@@ -815,5 +861,6 @@ setup(entity, Component, createPrimitive) { | ||
execute() { | ||
var _a, _b; | ||
super.execute(); | ||
this.queries.meshes.added.forEach((e) => this.setup(e)); | ||
this.queries.meshes.removed.forEach((e) => this.remove(e)); | ||
(_a = this.queries.meshes.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.meshes.removed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.remove(e)); | ||
super.afterExecute(); | ||
@@ -862,18 +909,19 @@ } | ||
execute() { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; | ||
super.execute(); | ||
this.queries.StandardMaterial.added.forEach((e) => this.setupMaterial(e, StandardMaterial, core.StandardMaterial)); | ||
this.queries.StandardMaterial.changed.forEach((e) => this.updateMaterial(e, StandardMaterial)); | ||
this.queries.StandardMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.ShadowOnlyMaterial.added.forEach((e) => this.setupMaterial(e, ShadowOnlyMaterial, materials.ShadowOnlyMaterial)); | ||
this.queries.ShadowOnlyMaterial.changed.forEach((e) => this.updateMaterial(e, ShadowOnlyMaterial)); | ||
this.queries.ShadowOnlyMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.BackgroundMaterial.added.forEach((e) => this.setupMaterial(e, BackgroundMaterial, core.BackgroundMaterial)); | ||
this.queries.BackgroundMaterial.changed.forEach((e) => this.updateMaterial(e, BackgroundMaterial)); | ||
this.queries.BackgroundMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.PBRMaterial.added.forEach((e) => this.setupMaterial(e, PbrMaterial, core.PBRMaterial)); | ||
this.queries.PBRMaterial.changed.forEach((e) => this.updateMaterial(e, PbrMaterial)); | ||
this.queries.PBRMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.Material.removed.forEach((e) => this.remove(e)); | ||
this.queries.Material.added.forEach((e) => this.setup(e)); | ||
this.queries.Material.changed.forEach((e) => this.setup(e)); | ||
(_a = this.queries.StandardMaterial.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setupMaterial(e, StandardMaterial, standardMaterial.StandardMaterial)); | ||
(_b = this.queries.StandardMaterial.changed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.updateMaterial(e, StandardMaterial)); | ||
(_c = this.queries.StandardMaterial.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.removeMaterial(e)); | ||
(_d = this.queries.ShadowOnlyMaterial.added) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.setupMaterial(e, ShadowOnlyMaterial, materials.ShadowOnlyMaterial)); | ||
(_e = this.queries.ShadowOnlyMaterial.changed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.updateMaterial(e, ShadowOnlyMaterial)); | ||
(_f = this.queries.ShadowOnlyMaterial.removed) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.removeMaterial(e)); | ||
(_g = this.queries.BackgroundMaterial.added) === null || _g === void 0 ? void 0 : _g.forEach((e) => this.setupMaterial(e, BackgroundMaterial, backgroundMaterial.BackgroundMaterial)); | ||
(_h = this.queries.BackgroundMaterial.changed) === null || _h === void 0 ? void 0 : _h.forEach((e) => this.updateMaterial(e, BackgroundMaterial)); | ||
(_j = this.queries.BackgroundMaterial.removed) === null || _j === void 0 ? void 0 : _j.forEach((e) => this.removeMaterial(e)); | ||
(_k = this.queries.PBRMaterial.added) === null || _k === void 0 ? void 0 : _k.forEach((e) => this.setupMaterial(e, PbrMaterial, pbrMaterial.PBRMaterial)); | ||
(_l = this.queries.PBRMaterial.changed) === null || _l === void 0 ? void 0 : _l.forEach((e) => this.updateMaterial(e, PbrMaterial)); | ||
(_m = this.queries.PBRMaterial.removed) === null || _m === void 0 ? void 0 : _m.forEach((e) => this.removeMaterial(e)); | ||
(_o = this.queries.Material.removed) === null || _o === void 0 ? void 0 : _o.forEach((e) => this.remove(e)); | ||
(_p = this.queries.Material.added) === null || _p === void 0 ? void 0 : _p.forEach((e) => this.setup(e)); | ||
(_q = this.queries.Material.changed) === null || _q === void 0 ? void 0 : _q.forEach((e) => this.setup(e)); | ||
super.afterExecute(); | ||
@@ -983,8 +1031,9 @@ } | ||
execute() { | ||
this.queries.hemisphericLight.added.forEach((e) => this.setupHemisphericLight(e, HemisphericLight)); | ||
this.queries.directionalLight.added.forEach((e) => this.setupDirectionalLight(e, DirectionalLight)); | ||
this.queries.pointLight.added.forEach((e) => this.setupPointLight(e, PointLight)); | ||
this.queries.hemisphericLight.removed.forEach((e) => this.remove(e, HemisphericLight)); | ||
this.queries.directionalLight.removed.forEach((e) => this.remove(e, DirectionalLight)); | ||
this.queries.pointLight.removed.forEach((e) => this.remove(e, PointLight)); | ||
var _a, _b, _c, _d, _e, _f; | ||
(_a = this.queries.hemisphericLight.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setupHemisphericLight(e, HemisphericLight)); | ||
(_b = this.queries.directionalLight.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setupDirectionalLight(e, DirectionalLight)); | ||
(_c = this.queries.pointLight.added) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.setupPointLight(e, PointLight)); | ||
(_d = this.queries.hemisphericLight.removed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.remove(e, HemisphericLight)); | ||
(_e = this.queries.directionalLight.removed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.remove(e, DirectionalLight)); | ||
(_f = this.queries.pointLight.removed) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.remove(e, PointLight)); | ||
} | ||
@@ -996,3 +1045,3 @@ setupHemisphericLight(entity, Component) { | ||
const { light, direction } = component, options = __rest(component, ["light", "direction"]); | ||
component.light = new core.HemisphericLight((_a = component.name) !== null && _a !== void 0 ? _a : 'Hemispheric Light', direction, null // passing null is actually possible, but the typings require a Scene | ||
component.light = new hemisphericLight.HemisphericLight((_a = component.name) !== null && _a !== void 0 ? _a : 'Hemispheric Light', direction, null // passing null is actually possible, but the typings require a Scene | ||
); | ||
@@ -1008,3 +1057,3 @@ Object.assign(component.light, options); | ||
const { light, position } = component, options = __rest(component, ["light", "position"]); | ||
component.light = new core.PointLight((_a = component.name) !== null && _a !== void 0 ? _a : 'Hemispheric Light', position, null // passing null is actually possible, but the typings require a Scene | ||
component.light = new pointLight.PointLight((_a = component.name) !== null && _a !== void 0 ? _a : 'Hemispheric Light', position, null // passing null is actually possible, but the typings require a Scene | ||
); | ||
@@ -1019,3 +1068,3 @@ Object.assign(component.light, options); | ||
const { light, direction } = component, options = __rest(component, ["light", "direction"]); | ||
component.light = new core.DirectionalLight(component.name, direction, null // passing null is actually possible, but the typings require a Scene | ||
component.light = new directionalLight.DirectionalLight(component.name, direction, null // passing null is actually possible, but the typings require a Scene | ||
); | ||
@@ -1059,7 +1108,8 @@ Object.assign(component.light, options); | ||
execute() { | ||
var _a, _b, _c, _d; | ||
super.execute(); | ||
this.queries.shadowGenerator.added.forEach((e) => this.setup(e)); | ||
this.queries.mesh.added.forEach((e) => this.addMesh(e)); | ||
this.queries.mesh.removed.forEach((e) => this.removeMesh(e)); | ||
this.queries.shadowGenerator.removed.forEach((e) => this.remove(e)); | ||
(_a = this.queries.shadowGenerator.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.mesh.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.addMesh(e)); | ||
(_c = this.queries.mesh.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.removeMesh(e)); | ||
(_d = this.queries.shadowGenerator.removed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.remove(e)); | ||
super.afterExecute(); | ||
@@ -1080,4 +1130,4 @@ } | ||
const options = __rest(component, ["value"]); | ||
const shadowGenerator = new core.ShadowGenerator(options.size, light); | ||
Object.assign(shadowGenerator, options); | ||
const shadowGenerator$1 = new shadowGenerator.ShadowGenerator(options.size, light); | ||
Object.assign(shadowGenerator$1, options); | ||
// disable continuous shadow calculation | ||
@@ -1088,8 +1138,8 @@ // light.autoUpdateExtends = false; | ||
// TODO: remove, pass this option to the mesh or primitive directly | ||
const mesh = m instanceof core.InstancedMesh ? m.sourceMesh : m; | ||
const mesh = m instanceof instancedMesh.InstancedMesh ? m.sourceMesh : m; | ||
mesh.receiveShadows = true; | ||
shadowGenerator.addShadowCaster(m, false); | ||
shadowGenerator$1.addShadowCaster(m, false); | ||
}); | ||
component.value = shadowGenerator; | ||
this.core.shadowGenerators.add(shadowGenerator); | ||
component.value = shadowGenerator$1; | ||
this.core.shadowGenerators.add(shadowGenerator$1); | ||
} | ||
@@ -1143,25 +1193,26 @@ addMesh(entity) { | ||
const TRIGGER = { | ||
pick: core.ActionManager.OnPickTrigger, | ||
doublePick: core.ActionManager.OnDoublePickTrigger, | ||
centerPick: core.ActionManager.OnCenterPickTrigger, | ||
everyFrame: core.ActionManager.OnEveryFrameTrigger, | ||
intersectionEnter: core.ActionManager.OnIntersectionEnterTrigger, | ||
intersectionExit: core.ActionManager.OnIntersectionExitTrigger, | ||
keyDown: core.ActionManager.OnKeyDownTrigger, | ||
keyUp: core.ActionManager.OnKeyUpTrigger, | ||
leftPick: core.ActionManager.OnLeftPickTrigger, | ||
longPress: core.ActionManager.OnLongPressTrigger, | ||
pickDown: core.ActionManager.OnPickDownTrigger, | ||
pickOut: core.ActionManager.OnPickOutTrigger, | ||
pickUp: core.ActionManager.OnPickUpTrigger, | ||
pointerOut: core.ActionManager.OnPointerOutTrigger, | ||
pointerOver: core.ActionManager.OnPointerOverTrigger, | ||
rightPick: core.ActionManager.OnRightPickTrigger, | ||
pick: actionManager.ActionManager.OnPickTrigger, | ||
doublePick: actionManager.ActionManager.OnDoublePickTrigger, | ||
centerPick: actionManager.ActionManager.OnCenterPickTrigger, | ||
everyFrame: actionManager.ActionManager.OnEveryFrameTrigger, | ||
intersectionEnter: actionManager.ActionManager.OnIntersectionEnterTrigger, | ||
intersectionExit: actionManager.ActionManager.OnIntersectionExitTrigger, | ||
keyDown: actionManager.ActionManager.OnKeyDownTrigger, | ||
keyUp: actionManager.ActionManager.OnKeyUpTrigger, | ||
leftPick: actionManager.ActionManager.OnLeftPickTrigger, | ||
longPress: actionManager.ActionManager.OnLongPressTrigger, | ||
pickDown: actionManager.ActionManager.OnPickDownTrigger, | ||
pickOut: actionManager.ActionManager.OnPickOutTrigger, | ||
pickUp: actionManager.ActionManager.OnPickUpTrigger, | ||
pointerOut: actionManager.ActionManager.OnPointerOutTrigger, | ||
pointerOver: actionManager.ActionManager.OnPointerOverTrigger, | ||
rightPick: actionManager.ActionManager.OnRightPickTrigger, | ||
}; | ||
class ActionSystem extends SystemWithCore { | ||
execute() { | ||
var _a, _b, _c; | ||
super.execute(); | ||
this.queries.action.added.forEach((e) => this.setup(e)); | ||
this.queries.action.changed.forEach((e) => this.setup(e)); | ||
this.queries.action.removed.forEach((e) => this.remove(e)); | ||
(_a = this.queries.action.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.action.changed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setup(e)); | ||
(_c = this.queries.action.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.remove(e)); | ||
super.afterExecute(); | ||
@@ -1172,4 +1223,4 @@ } | ||
const actionComponent = entity.getMutableComponent(Action); | ||
let actionManager = this.getActionManager(entity); | ||
if (actionManager === null) { | ||
let actionManager$1 = this.getActionManager(entity); | ||
if (actionManager$1 === null) { | ||
const meshComponent = entity.getComponent(Mesh); | ||
@@ -1179,9 +1230,9 @@ if (!(meshComponent === null || meshComponent === void 0 ? void 0 : meshComponent.value)) { | ||
} | ||
actionManager = new core.ActionManager(this.core.scene); | ||
actionManager$1 = new actionManager.ActionManager(this.core.scene); | ||
const mesh = meshComponent.value; | ||
mesh.actionManager = actionManager; | ||
mesh.actionManager = actionManager$1; | ||
} | ||
Object.keys(TRIGGER).forEach((triggerName) => { | ||
if (actionComponent._actions[triggerName]) { | ||
actionManager.unregisterAction(actionComponent._actions[triggerName]); | ||
actionManager$1.unregisterAction(actionComponent._actions[triggerName]); | ||
delete actionComponent._actions[triggerName]; | ||
@@ -1194,3 +1245,3 @@ } | ||
const trigger = TRIGGER[triggerName]; | ||
const action = actionManager.registerAction(new core.ExecuteCodeAction(trigger, fn)); | ||
const action = actionManager$1.registerAction(new directActions.ExecuteCodeAction(trigger, fn)); | ||
if (action) { | ||
@@ -1197,0 +1248,0 @@ actionComponent._actions[triggerName] = action; |
@@ -1,21 +0,27 @@ | ||
import { createComponentClass } from 'ecsy'; | ||
export default createComponentClass({ | ||
pick: { default: null }, | ||
doublePick: { default: null }, | ||
centerPick: { default: null }, | ||
everyFrame: { default: null }, | ||
intersectionEnter: { default: null }, | ||
intersectionExit: { default: null }, | ||
keyDown: { default: null }, | ||
keyUp: { default: null }, | ||
leftPick: { default: null }, | ||
longPress: { default: null }, | ||
pickDown: { default: null }, | ||
pickOut: { default: null }, | ||
pickUp: { default: null }, | ||
pointerOut: { default: null }, | ||
pointerOver: { default: null }, | ||
rightPick: { default: null }, | ||
_actions: { default: {} }, | ||
}, 'Action'); | ||
import { Component } from 'ecsy'; | ||
export default class Action extends Component { | ||
constructor() { | ||
super(...arguments); | ||
this._actions = {}; | ||
} | ||
reset() { | ||
this.pick = undefined; | ||
this.doublePick = undefined; | ||
this.centerPick = undefined; | ||
this.everyFrame = undefined; | ||
this.intersectionEnter = undefined; | ||
this.intersectionExit = undefined; | ||
this.keyDown = undefined; | ||
this.keyUp = undefined; | ||
this.leftPick = undefined; | ||
this.longPress = undefined; | ||
this.pickDown = undefined; | ||
this.pickOut = undefined; | ||
this.pickUp = undefined; | ||
this.pointerOut = undefined; | ||
this.pointerOver = undefined; | ||
this.rightPick = undefined; | ||
} | ||
} | ||
Object.defineProperty(Action, 'name', { value: 'Action' }); | ||
//# sourceMappingURL=action.js.map |
@@ -1,17 +0,33 @@ | ||
import { createComponentClass } from 'ecsy'; | ||
import Types from '../types'; | ||
export default createComponentClass({ | ||
value: { default: null }, | ||
alpha: { default: 0 }, | ||
beta: { default: 0 }, | ||
radius: { default: 10 }, | ||
// target: { default: null, type: Types.Vector3 }, | ||
lowerAlphaLimit: { default: null, type: Types.OptionalNumber }, | ||
lowerBetaLimit: { default: null, type: Types.OptionalNumber }, | ||
lowerRadiusLimit: { default: null, type: Types.OptionalNumber }, | ||
upperAlphaLimit: { default: null, type: Types.OptionalNumber }, | ||
upperBetaLimit: { default: null, type: Types.OptionalNumber }, | ||
upperRadiusLimit: { default: null, type: Types.OptionalNumber }, | ||
panningSensibility: { default: 0 }, | ||
}, 'ArcRotateCamera'); | ||
import { Component } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export default class ArcRotateCamera extends Component { | ||
constructor() { | ||
super(...arguments); | ||
this.value = null; | ||
this.alpha = 0; | ||
this.beta = 0; | ||
this.radius = 10; | ||
this.target = new Vector3(0, 0, 0); | ||
this.lowerAlphaLimit = null; | ||
this.lowerBetaLimit = null; | ||
this.lowerRadiusLimit = null; | ||
this.upperAlphaLimit = null; | ||
this.upperBetaLimit = null; | ||
this.upperRadiusLimit = null; | ||
} | ||
reset() { | ||
this.value = null; | ||
this.alpha = 0; | ||
this.beta = 0; | ||
this.radius = 10; | ||
this.target.set(0, 0, 0); | ||
this.lowerAlphaLimit = null; | ||
this.lowerBetaLimit = null; | ||
this.lowerRadiusLimit = null; | ||
this.upperAlphaLimit = null; | ||
this.upperBetaLimit = null; | ||
this.upperRadiusLimit = null; | ||
} | ||
} | ||
Object.defineProperty(ArcRotateCamera, 'name', { value: 'ArcRotateCamera' }); | ||
//# sourceMappingURL=arc-rotate-camera.js.map |
@@ -1,12 +0,9 @@ | ||
import { createComponentClass } from 'ecsy'; | ||
export default createComponentClass({ | ||
world: { default: null }, | ||
canvas: { default: null }, | ||
defaultCamera: { default: null }, | ||
engine: { default: null }, | ||
scene: { default: null }, | ||
shadowGenerators: { default: new Set() }, | ||
beforeRender: { default: undefined }, | ||
afterRender: { default: undefined }, | ||
}, 'BabylonCore'); | ||
import { Component } from 'ecsy'; | ||
export default class BabylonCore extends Component { | ||
constructor() { | ||
super(...arguments); | ||
this.shadowGenerators = new Set(); | ||
} | ||
} | ||
Object.defineProperty(BabylonCore, 'name', { value: 'BabylonCore' }); | ||
//# sourceMappingURL=babylon-core.js.map |
import { createComponentClass } from 'ecsy'; | ||
import { Color3, Constants } from '@babylonjs/core'; | ||
import Types from '../types'; | ||
import { Color3 } from '@babylonjs/core/Maths/math.color'; | ||
import { Constants } from '@babylonjs/core/Engines/constants'; | ||
export default createComponentClass({ | ||
@@ -5,0 +6,0 @@ diffuseTexture: { default: null }, |
import { createComponentClass } from 'ecsy'; | ||
import { Mesh } from '@babylonjs/core'; | ||
import { Mesh } from '@babylonjs/core/Meshes/mesh'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
import { schema } from './-private/light-component'; | ||
import { createComponentClass } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import Types from '../types'; | ||
export default createComponentClass(Object.assign(Object.assign({}, schema), { direction: { default: new Vector3(0, -1, 0), type: Types.Vector3 } }), 'DirectionalLight'); | ||
//# sourceMappingURL=directional-light.js.map |
import { schema } from './-private/light-component'; | ||
import { createComponentClass } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import Types from '../types'; | ||
export default createComponentClass(Object.assign(Object.assign({}, schema), { direction: { default: new Vector3(0, 1, 0), type: Types.Vector3 } }), 'HemisphericLight'); | ||
//# sourceMappingURL=hemispheric-light.js.map |
import { Component } from 'ecsy'; | ||
import { Color3, PBRMaterial as BabylonPBRMaterial } from '@babylonjs/core'; | ||
import { PBRMaterial as BabylonPBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial'; | ||
import { Color3 } from '@babylonjs/core/Maths/math.color'; | ||
export default class PbrMaterial extends Component { | ||
@@ -4,0 +5,0 @@ constructor() { |
import { createComponentClass } from 'ecsy'; | ||
import { Mesh } from '@babylonjs/core'; | ||
import { Mesh } from '@babylonjs/core/Meshes/mesh'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
import { schema } from './-private/light-component'; | ||
import { createComponentClass } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import Types from '../types'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export default createComponentClass(Object.assign(Object.assign({}, schema), { position: { default: new Vector3(0, 1, 0), type: Types.Vector3 } }), 'PointLight'); | ||
//# sourceMappingURL=point-light.js.map |
import { createComponentClass } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
import { createComponentClass } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
import { createComponentClass } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
import { createComponentClass } from 'ecsy'; | ||
import { Mesh } from '@babylonjs/core'; | ||
import { Mesh } from '@babylonjs/core/Meshes/mesh'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
import { createComponentClass } from 'ecsy'; | ||
import { Color3 } from '@babylonjs/core'; | ||
import { Color3 } from '@babylonjs/core/Maths/math.color'; | ||
import Types from '../types'; | ||
@@ -4,0 +4,0 @@ export default createComponentClass({ |
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
import { Action, Mesh } from '../components'; | ||
import { ActionManager, ExecuteCodeAction } from '@babylonjs/core'; | ||
import SystemWithCore, { queries } from '../SystemWithCore'; | ||
import assert from '../utils/assert'; | ||
import { ActionManager } from '@babylonjs/core/Actions/actionManager'; | ||
import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions'; | ||
const TRIGGER = { | ||
@@ -26,6 +27,7 @@ pick: ActionManager.OnPickTrigger, | ||
execute() { | ||
var _a, _b, _c; | ||
super.execute(); | ||
this.queries.action.added.forEach((e) => this.setup(e)); | ||
this.queries.action.changed.forEach((e) => this.setup(e)); | ||
this.queries.action.removed.forEach((e) => this.remove(e)); | ||
(_a = this.queries.action.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.action.changed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setup(e)); | ||
(_c = this.queries.action.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.remove(e)); | ||
super.afterExecute(); | ||
@@ -32,0 +34,0 @@ } |
import { System } from 'ecsy'; | ||
import { BabylonCore } from '../components'; | ||
import { Engine, FreeCamera, Scene, Vector3 } from '@babylonjs/core'; | ||
import { Scene } from '@babylonjs/core/scene'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import { Engine } from '@babylonjs/core/Engines/engine'; | ||
import { FreeCamera } from '@babylonjs/core/Cameras/freeCamera'; | ||
export default class BabylonSystem extends System { | ||
execute() { | ||
this.queries.core.added.forEach((e) => this.setup(e)); | ||
this.queries.core.removed.forEach((e) => this.remove(e)); | ||
var _a, _b; | ||
(_a = this.queries.core.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.core.removed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.remove(e)); | ||
} | ||
@@ -9,0 +13,0 @@ setup(entity) { |
@@ -13,3 +13,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { ArcRotateCamera, TransformNode } from '../components'; | ||
import { ArcRotateCamera as BabylonArcRotateCamera } from '@babylonjs/core'; | ||
import { ArcRotateCamera as BabylonArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera'; | ||
import SystemWithCore, { queries } from '../SystemWithCore'; | ||
@@ -19,6 +19,7 @@ import assert from '../utils/assert'; | ||
execute() { | ||
var _a, _b, _c; | ||
super.execute(); | ||
this.queries.arcRotateCamera.added.forEach((e) => this.setupArcRotateCamera(e)); | ||
this.queries.arcRotateCamera.changed.forEach((e) => this.update(e, ArcRotateCamera)); | ||
this.queries.arcRotateCamera.removed.forEach((e) => this.remove(e, ArcRotateCamera)); | ||
(_a = this.queries.arcRotateCamera.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setupArcRotateCamera(e)); | ||
(_b = this.queries.arcRotateCamera.changed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.update(e, ArcRotateCamera)); | ||
(_c = this.queries.arcRotateCamera.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.remove(e, ArcRotateCamera)); | ||
super.afterExecute(); | ||
@@ -32,3 +33,3 @@ } | ||
const { alpha, beta, radius, target } = args; | ||
const instance = value || new BabylonArcRotateCamera(cameraComponent.name, alpha, beta, radius, target, scene, false); | ||
const instance = value || new BabylonArcRotateCamera(ArcRotateCamera.name, alpha, beta, radius, target, scene, false); | ||
Object.assign(instance, args); | ||
@@ -35,0 +36,0 @@ cameraComponent.value = instance; |
@@ -14,11 +14,14 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { DirectionalLight, HemisphericLight, PointLight, TransformNode } from '../components'; | ||
import { HemisphericLight as _HemisphericLight, DirectionalLight as _DirectionalLight, PointLight as _PointLight, } from '@babylonjs/core'; | ||
import { HemisphericLight as _HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight'; | ||
import { DirectionalLight as _DirectionalLight } from '@babylonjs/core/Lights/directionalLight'; | ||
import { PointLight as _PointLight } from '@babylonjs/core/Lights/pointLight'; | ||
export default class LightSystem extends System { | ||
execute() { | ||
this.queries.hemisphericLight.added.forEach((e) => this.setupHemisphericLight(e, HemisphericLight)); | ||
this.queries.directionalLight.added.forEach((e) => this.setupDirectionalLight(e, DirectionalLight)); | ||
this.queries.pointLight.added.forEach((e) => this.setupPointLight(e, PointLight)); | ||
this.queries.hemisphericLight.removed.forEach((e) => this.remove(e, HemisphericLight)); | ||
this.queries.directionalLight.removed.forEach((e) => this.remove(e, DirectionalLight)); | ||
this.queries.pointLight.removed.forEach((e) => this.remove(e, PointLight)); | ||
var _a, _b, _c, _d, _e, _f; | ||
(_a = this.queries.hemisphericLight.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setupHemisphericLight(e, HemisphericLight)); | ||
(_b = this.queries.directionalLight.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setupDirectionalLight(e, DirectionalLight)); | ||
(_c = this.queries.pointLight.added) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.setupPointLight(e, PointLight)); | ||
(_d = this.queries.hemisphericLight.removed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.remove(e, HemisphericLight)); | ||
(_e = this.queries.directionalLight.removed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.remove(e, DirectionalLight)); | ||
(_f = this.queries.pointLight.removed) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.remove(e, PointLight)); | ||
} | ||
@@ -25,0 +28,0 @@ setupHemisphericLight(entity, Component) { |
@@ -13,3 +13,5 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { Mesh, PBRMaterial, Material, ShadowOnlyMaterial, BackgroundMaterial, StandardMaterial } from '../components'; | ||
import { PBRMaterial as BabylonPBRMaterial, BackgroundMaterial as BabylonBackgroundMaterial, StandardMaterial as BabylonStandardMaterial, } from '@babylonjs/core'; | ||
import { PBRMaterial as BabylonPBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial'; | ||
import { BackgroundMaterial as BabylonBackgroundMaterial } from '@babylonjs/core/Materials/Background/backgroundMaterial'; | ||
import { StandardMaterial as BabylonStandardMaterial } from '@babylonjs/core/Materials/standardMaterial'; | ||
import { ShadowOnlyMaterial as BabylonShadowOnlyMaterial } from '@babylonjs/materials'; | ||
@@ -20,18 +22,19 @@ import assert from '../utils/assert'; | ||
execute() { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; | ||
super.execute(); | ||
this.queries.StandardMaterial.added.forEach((e) => this.setupMaterial(e, StandardMaterial, BabylonStandardMaterial)); | ||
this.queries.StandardMaterial.changed.forEach((e) => this.updateMaterial(e, StandardMaterial)); | ||
this.queries.StandardMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.ShadowOnlyMaterial.added.forEach((e) => this.setupMaterial(e, ShadowOnlyMaterial, BabylonShadowOnlyMaterial)); | ||
this.queries.ShadowOnlyMaterial.changed.forEach((e) => this.updateMaterial(e, ShadowOnlyMaterial)); | ||
this.queries.ShadowOnlyMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.BackgroundMaterial.added.forEach((e) => this.setupMaterial(e, BackgroundMaterial, BabylonBackgroundMaterial)); | ||
this.queries.BackgroundMaterial.changed.forEach((e) => this.updateMaterial(e, BackgroundMaterial)); | ||
this.queries.BackgroundMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.PBRMaterial.added.forEach((e) => this.setupMaterial(e, PBRMaterial, BabylonPBRMaterial)); | ||
this.queries.PBRMaterial.changed.forEach((e) => this.updateMaterial(e, PBRMaterial)); | ||
this.queries.PBRMaterial.removed.forEach((e) => this.removeMaterial(e)); | ||
this.queries.Material.removed.forEach((e) => this.remove(e)); | ||
this.queries.Material.added.forEach((e) => this.setup(e)); | ||
this.queries.Material.changed.forEach((e) => this.setup(e)); | ||
(_a = this.queries.StandardMaterial.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setupMaterial(e, StandardMaterial, BabylonStandardMaterial)); | ||
(_b = this.queries.StandardMaterial.changed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.updateMaterial(e, StandardMaterial)); | ||
(_c = this.queries.StandardMaterial.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.removeMaterial(e)); | ||
(_d = this.queries.ShadowOnlyMaterial.added) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.setupMaterial(e, ShadowOnlyMaterial, BabylonShadowOnlyMaterial)); | ||
(_e = this.queries.ShadowOnlyMaterial.changed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.updateMaterial(e, ShadowOnlyMaterial)); | ||
(_f = this.queries.ShadowOnlyMaterial.removed) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.removeMaterial(e)); | ||
(_g = this.queries.BackgroundMaterial.added) === null || _g === void 0 ? void 0 : _g.forEach((e) => this.setupMaterial(e, BackgroundMaterial, BabylonBackgroundMaterial)); | ||
(_h = this.queries.BackgroundMaterial.changed) === null || _h === void 0 ? void 0 : _h.forEach((e) => this.updateMaterial(e, BackgroundMaterial)); | ||
(_j = this.queries.BackgroundMaterial.removed) === null || _j === void 0 ? void 0 : _j.forEach((e) => this.removeMaterial(e)); | ||
(_k = this.queries.PBRMaterial.added) === null || _k === void 0 ? void 0 : _k.forEach((e) => this.setupMaterial(e, PBRMaterial, BabylonPBRMaterial)); | ||
(_l = this.queries.PBRMaterial.changed) === null || _l === void 0 ? void 0 : _l.forEach((e) => this.updateMaterial(e, PBRMaterial)); | ||
(_m = this.queries.PBRMaterial.removed) === null || _m === void 0 ? void 0 : _m.forEach((e) => this.removeMaterial(e)); | ||
(_o = this.queries.Material.removed) === null || _o === void 0 ? void 0 : _o.forEach((e) => this.remove(e)); | ||
(_p = this.queries.Material.added) === null || _p === void 0 ? void 0 : _p.forEach((e) => this.setup(e)); | ||
(_q = this.queries.Material.changed) === null || _q === void 0 ? void 0 : _q.forEach((e) => this.setup(e)); | ||
super.afterExecute(); | ||
@@ -38,0 +41,0 @@ } |
@@ -17,5 +17,6 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
execute() { | ||
var _a, _b; | ||
super.execute(); | ||
this.queries.meshes.added.forEach((e) => this.setup(e)); | ||
this.queries.meshes.removed.forEach((e) => this.remove(e)); | ||
(_a = this.queries.meshes.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.meshes.removed) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.remove(e)); | ||
super.afterExecute(); | ||
@@ -22,0 +23,0 @@ } |
import { System } from 'ecsy'; | ||
import { Plane, Box, Mesh, Sphere } from '../components'; | ||
import { PlaneBuilder, BoxBuilder, SphereBuilder } from '@babylonjs/core'; | ||
import { PlaneBuilder } from '@babylonjs/core/Meshes/Builders/planeBuilder'; | ||
import { BoxBuilder } from '@babylonjs/core/Meshes/Builders/boxBuilder'; | ||
import { SphereBuilder } from '@babylonjs/core/Meshes/Builders/sphereBuilder'; | ||
export default class PrimitiveSystem extends System { | ||
execute() { | ||
this.queries.planes.added.forEach((e) => this.setup(e, Plane, PlaneBuilder.CreatePlane)); // eslint-disable-line @typescript-eslint/unbound-method | ||
this.queries.boxes.added.forEach((e) => this.setup(e, Box, BoxBuilder.CreateBox)); // eslint-disable-line @typescript-eslint/unbound-method | ||
this.queries.spheres.added.forEach((e) => this.setup(e, Sphere, SphereBuilder.CreateSphere)); // eslint-disable-line @typescript-eslint/unbound-method | ||
this.queries.planes.removed.forEach((e) => this.remove(e)); | ||
this.queries.boxes.removed.forEach((e) => this.remove(e)); | ||
this.queries.spheres.removed.forEach((e) => this.remove(e)); | ||
var _a, _b, _c, _d, _e, _f; | ||
(_a = this.queries.planes.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e, Plane, PlaneBuilder.CreatePlane)); // eslint-disable-line @typescript-eslint/unbound-method | ||
(_b = this.queries.boxes.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setup(e, Box, BoxBuilder.CreateBox)); // eslint-disable-line @typescript-eslint/unbound-method | ||
(_c = this.queries.spheres.added) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.setup(e, Sphere, SphereBuilder.CreateSphere)); // eslint-disable-line @typescript-eslint/unbound-method | ||
(_d = this.queries.planes.removed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.remove(e)); | ||
(_e = this.queries.boxes.removed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.remove(e)); | ||
(_f = this.queries.spheres.removed) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.remove(e)); | ||
} | ||
@@ -13,0 +16,0 @@ setup(entity, Component, createPrimitive) { |
@@ -13,12 +13,14 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
import { ShadowGenerator, DirectionalLight, PointLight, Mesh } from '../components'; | ||
import { InstancedMesh, ShadowGenerator as _ShadowGenerator } from '@babylonjs/core'; | ||
import SystemWithCore, { queries } from '../SystemWithCore'; | ||
import assert from '../utils/assert'; | ||
import { InstancedMesh } from '@babylonjs/core/Meshes/instancedMesh'; | ||
import { ShadowGenerator as _ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator'; | ||
export default class ShadowSystem extends SystemWithCore { | ||
execute() { | ||
var _a, _b, _c, _d; | ||
super.execute(); | ||
this.queries.shadowGenerator.added.forEach((e) => this.setup(e)); | ||
this.queries.mesh.added.forEach((e) => this.addMesh(e)); | ||
this.queries.mesh.removed.forEach((e) => this.removeMesh(e)); | ||
this.queries.shadowGenerator.removed.forEach((e) => this.remove(e)); | ||
(_a = this.queries.shadowGenerator.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.mesh.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.addMesh(e)); | ||
(_c = this.queries.mesh.removed) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.removeMesh(e)); | ||
(_d = this.queries.shadowGenerator.removed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.remove(e)); | ||
super.afterExecute(); | ||
@@ -25,0 +27,0 @@ } |
import { System } from 'ecsy'; | ||
import { Position, Rotation, Scale, TransformNode, Parent } from '../components'; | ||
import { TransformNode as BabylonTransformNode, Vector3 } from '@babylonjs/core'; | ||
import guidFor from '../utils/guid'; | ||
import assert from '../utils/assert'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import { TransformNode as BabylonTransformNode } from '@babylonjs/core/Meshes/transformNode'; | ||
export default class TransformSystem extends System { | ||
execute() { | ||
this.queries.parent.added.forEach((e) => this.setup(e)); | ||
this.queries.transformNode.added.forEach((e) => this.setupTransformNode(e)); | ||
this.queries.position.added.forEach((e) => this.position(e)); | ||
this.queries.position.changed.forEach((e) => this.position(e)); | ||
this.queries.position.removed.forEach((e) => this.removePosition(e)); | ||
this.queries.rotation.added.forEach((e) => this.rotation(e)); | ||
this.queries.rotation.changed.forEach((e) => this.rotation(e)); | ||
this.queries.rotation.removed.forEach((e) => this.removeRotation(e)); | ||
this.queries.scale.added.forEach((e) => this.scale(e)); | ||
this.queries.scale.changed.forEach((e) => this.scale(e)); | ||
this.queries.scale.removed.forEach((e) => this.removeScale(e)); | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; | ||
(_a = this.queries.parent.added) === null || _a === void 0 ? void 0 : _a.forEach((e) => this.setup(e)); | ||
(_b = this.queries.transformNode.added) === null || _b === void 0 ? void 0 : _b.forEach((e) => this.setupTransformNode(e)); | ||
(_c = this.queries.position.added) === null || _c === void 0 ? void 0 : _c.forEach((e) => this.position(e)); | ||
(_d = this.queries.position.changed) === null || _d === void 0 ? void 0 : _d.forEach((e) => this.position(e)); | ||
(_e = this.queries.position.removed) === null || _e === void 0 ? void 0 : _e.forEach((e) => this.removePosition(e)); | ||
(_f = this.queries.rotation.added) === null || _f === void 0 ? void 0 : _f.forEach((e) => this.rotation(e)); | ||
(_g = this.queries.rotation.changed) === null || _g === void 0 ? void 0 : _g.forEach((e) => this.rotation(e)); | ||
(_h = this.queries.rotation.removed) === null || _h === void 0 ? void 0 : _h.forEach((e) => this.removeRotation(e)); | ||
(_j = this.queries.scale.added) === null || _j === void 0 ? void 0 : _j.forEach((e) => this.scale(e)); | ||
(_k = this.queries.scale.changed) === null || _k === void 0 ? void 0 : _k.forEach((e) => this.scale(e)); | ||
(_l = this.queries.scale.removed) === null || _l === void 0 ? void 0 : _l.forEach((e) => this.removeScale(e)); | ||
// entity might remove TransformNode, so it needs to run before | ||
this.queries.parent.removed.forEach((e) => this.remove(e)); | ||
this.queries.transformNode.removed.forEach((e) => this.removeTransformNode(e)); | ||
(_m = this.queries.parent.removed) === null || _m === void 0 ? void 0 : _m.forEach((e) => this.remove(e)); | ||
(_o = this.queries.transformNode.removed) === null || _o === void 0 ? void 0 : _o.forEach((e) => this.removeTransformNode(e)); | ||
} | ||
@@ -23,0 +25,0 @@ setup(entity) { |
import { System } from 'ecsy'; | ||
import BabylonCore from './components/babylon-core'; | ||
import { BabylonCore } from './components'; | ||
export default class SystemWithCore extends System { | ||
execute() { | ||
if (this.queries.core.added.length) { | ||
var _a; | ||
if ((_a = this.queries.core.added) === null || _a === void 0 ? void 0 : _a.length) { | ||
if (this.queries.core.added.length > 1) { | ||
@@ -14,3 +15,4 @@ throw new Error('More than 1 core has been added.'); | ||
afterExecute() { | ||
if (this.queries.core.removed.length) { | ||
var _a; | ||
if ((_a = this.queries.core.removed) === null || _a === void 0 ? void 0 : _a.length) { | ||
this.core = undefined; | ||
@@ -17,0 +19,0 @@ } |
import { createType } from 'ecsy'; | ||
import { Vector2, Vector3, Vector4, Color3, Color4 } from '@babylonjs/core'; | ||
import { Vector2, Vector3, Vector4 } from '@babylonjs/core/Maths/math.vector'; | ||
import { Color3, Color4 } from '@babylonjs/core/Maths/math.color'; | ||
// TODO: copy seems to be necessary for Vector/Color to work properly, but it is only used | ||
@@ -4,0 +5,0 @@ // when initially adding the component, not on subsequent updates. Requires more research. |
import { Component } from 'ecsy'; | ||
import { Light } from '@babylonjs/core'; | ||
import { Light } from '@babylonjs/core/Lights/light'; | ||
export interface LightComponent extends Component { | ||
@@ -4,0 +4,0 @@ name: string; |
import { Component } from 'ecsy'; | ||
import { ActionEvent, IAction } from '@babylonjs/core'; | ||
import { ActionEvent } from '@babylonjs/core/Actions/actionEvent'; | ||
import { IAction } from '@babylonjs/core/Actions/action'; | ||
declare type ActionCallback = (evt: ActionEvent) => void; | ||
export interface ActionComponent extends Component { | ||
export default class Action extends Component { | ||
pick?: ActionCallback; | ||
@@ -24,4 +25,4 @@ doublePick?: ActionCallback; | ||
}; | ||
reset(): void; | ||
} | ||
declare const _default: import("ecsy").ComponentConstructor<ActionComponent>; | ||
export default _default; | ||
export {}; |
import { Component } from 'ecsy'; | ||
import { ArcRotateCamera, Vector3 } from '@babylonjs/core'; | ||
export interface ArcRotateComponent extends Component { | ||
name: string; | ||
value: ArcRotateCamera | null; | ||
import { ArcRotateCamera as BabylonArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export default class ArcRotateCamera extends Component { | ||
value: BabylonArcRotateCamera | null; | ||
alpha: number; | ||
@@ -16,4 +16,3 @@ beta: number; | ||
upperRadiusLimit: number | null; | ||
reset(): void; | ||
} | ||
declare const _default: import("ecsy").ComponentConstructor<ArcRotateComponent>; | ||
export default _default; |
@@ -1,4 +0,7 @@ | ||
import { Camera, Engine, Scene, ShadowGenerator } from '@babylonjs/core'; | ||
import { Scene } from '@babylonjs/core/scene'; | ||
import { Engine } from '@babylonjs/core/Engines/engine'; | ||
import { Component, World } from 'ecsy'; | ||
export interface BabylonCoreComponent extends Component { | ||
import { Camera } from '@babylonjs/core/Cameras/camera'; | ||
import { ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator'; | ||
export default class BabylonCore extends Component { | ||
world: World; | ||
@@ -13,3 +16,1 @@ canvas: HTMLCanvasElement; | ||
} | ||
declare const _default: import("ecsy").ComponentConstructor<BabylonCoreComponent>; | ||
export default _default; |
import { Component } from 'ecsy'; | ||
import { Color3, Texture } from '@babylonjs/core'; | ||
import { Texture } from '@babylonjs/core/Materials/Textures/texture'; | ||
import { Color3 } from '@babylonjs/core/Maths/math.color'; | ||
export interface BackgroundMaterialComponent extends Component { | ||
@@ -4,0 +5,0 @@ name: string; |
import { LightComponent } from './-private/light-component'; | ||
import { DirectionalLight, Vector3 } from '@babylonjs/core'; | ||
import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export interface DirectionalLightComponent extends LightComponent { | ||
@@ -4,0 +5,0 @@ direction: Vector3; |
import { LightComponent } from './-private/light-component'; | ||
import { HemisphericLight, Vector3 } from '@babylonjs/core'; | ||
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export interface HemisphericLightComponent extends LightComponent { | ||
@@ -4,0 +5,0 @@ direction: Vector3; |
@@ -23,3 +23,3 @@ import BabylonCore from './babylon-core'; | ||
export { BabylonCore, ArcRotateCamera, Mesh, Plane, Box, Sphere, Material, StandardMaterial, PBRMaterial, BackgroundMaterial, ShadowOnlyMaterial, HemisphericLight, DirectionalLight, PointLight, ShadowGenerator, TransformNode, Position, Rotation, Scale, Action, Parent, }; | ||
declare const _default: (import("ecsy").ComponentConstructor<import("./babylon-core").BabylonCoreComponent> | import("ecsy").ComponentConstructor<import("./arc-rotate-camera").ArcRotateComponent> | import("ecsy").ComponentConstructor<import("./mesh").MeshComponent> | import("ecsy").ComponentConstructor<import("./plane").PlaneComponent> | import("ecsy").ComponentConstructor<import("./box").BoxComponent> | import("ecsy").ComponentConstructor<import("./sphere").SphereComponent> | import("ecsy").ComponentConstructor<import("./material").MaterialComponent> | import("ecsy").ComponentConstructor<import("./standard-material").StandardMaterialComponent> | typeof PBRMaterial | import("ecsy").ComponentConstructor<import("./background-material").BackgroundMaterialComponent> | import("ecsy").ComponentConstructor<import("./shadow-only-material").ShadowOnlyMaterialComponent> | import("ecsy").ComponentConstructor<import("./hemispheric-light").HemisphericLightComponent> | import("ecsy").ComponentConstructor<import("./directional-light").DirectionalLightComponent> | import("ecsy").ComponentConstructor<import("./point-light").PointLightComponent> | import("ecsy").ComponentConstructor<import("./shadow-generator").ShadowGeneratorComponent> | import("ecsy").ComponentConstructor<import("./transform-node").TransformNodeComponent> | import("ecsy").ComponentConstructor<import("./position").PositionComponent> | import("ecsy").ComponentConstructor<import("./action").ActionComponent>)[]; | ||
declare const _default: (typeof BabylonCore | typeof ArcRotateCamera | import("ecsy").ComponentConstructor<import("./mesh").MeshComponent> | import("ecsy").ComponentConstructor<import("./plane").PlaneComponent> | import("ecsy").ComponentConstructor<import("./box").BoxComponent> | import("ecsy").ComponentConstructor<import("./sphere").SphereComponent> | import("ecsy").ComponentConstructor<import("./material").MaterialComponent> | import("ecsy").ComponentConstructor<import("./standard-material").StandardMaterialComponent> | typeof PBRMaterial | import("ecsy").ComponentConstructor<import("./background-material").BackgroundMaterialComponent> | import("ecsy").ComponentConstructor<import("./shadow-only-material").ShadowOnlyMaterialComponent> | import("ecsy").ComponentConstructor<import("./hemispheric-light").HemisphericLightComponent> | import("ecsy").ComponentConstructor<import("./directional-light").DirectionalLightComponent> | import("ecsy").ComponentConstructor<import("./point-light").PointLightComponent> | import("ecsy").ComponentConstructor<import("./shadow-generator").ShadowGeneratorComponent> | import("ecsy").ComponentConstructor<import("./transform-node").TransformNodeComponent> | import("ecsy").ComponentConstructor<import("./position").PositionComponent> | typeof Action)[]; | ||
export default _default; |
import { Component } from 'ecsy'; | ||
import { Material } from '@babylonjs/core'; | ||
import { Material } from '@babylonjs/core/Materials/material'; | ||
export interface MaterialComponent extends Component { | ||
@@ -4,0 +4,0 @@ name: string; |
import { Component } from 'ecsy'; | ||
import { InstancedMesh, Mesh } from '@babylonjs/core'; | ||
import { Mesh } from '@babylonjs/core/Meshes/mesh'; | ||
import { InstancedMesh } from '@babylonjs/core/Meshes/instancedMesh'; | ||
export interface MeshComponent extends Component { | ||
@@ -4,0 +5,0 @@ value: Mesh | null; |
import { Component } from 'ecsy'; | ||
import { BaseTexture, Color3 } from '@babylonjs/core'; | ||
import { BaseTexture } from '@babylonjs/core/Materials/Textures/baseTexture'; | ||
import { Color3 } from '@babylonjs/core/Maths/math.color'; | ||
export default class PbrMaterial extends Component { | ||
@@ -4,0 +5,0 @@ directIntensity: number; |
import { LightComponent } from './-private/light-component'; | ||
import { PointLight, Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
import { PointLight } from '@babylonjs/core/Lights/pointLight'; | ||
export interface PointLightComponent extends LightComponent { | ||
@@ -4,0 +5,0 @@ position: Vector3; |
import { Component } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export interface PositionComponent extends Component { | ||
@@ -4,0 +4,0 @@ value: Vector3; |
import { Component } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export interface RotationComponent extends Component { | ||
@@ -4,0 +4,0 @@ value: Vector3; |
import { Component } from 'ecsy'; | ||
import { Vector3 } from '@babylonjs/core'; | ||
import { Vector3 } from '@babylonjs/core/Maths/math.vector'; | ||
export interface ScaleComponent extends Component { | ||
@@ -4,0 +4,0 @@ value: Vector3; |
import { Component } from 'ecsy'; | ||
import { ShadowGenerator } from '@babylonjs/core'; | ||
import { ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator'; | ||
export interface ShadowGeneratorComponent extends Component { | ||
@@ -4,0 +4,0 @@ size: number; |
import { Component } from 'ecsy'; | ||
import { Light } from '@babylonjs/core'; | ||
import { Light } from '@babylonjs/core/Lights/light'; | ||
export interface ShadowOnlyMaterialComponent extends Component { | ||
@@ -4,0 +4,0 @@ name: string; |
import { Component } from 'ecsy'; | ||
import { Color3 } from '@babylonjs/core'; | ||
import { Color3 } from '@babylonjs/core/Maths/math.color'; | ||
export interface StandardMaterialComponent extends Component { | ||
@@ -4,0 +4,0 @@ name: string; |
import { Component } from 'ecsy'; | ||
import { TransformNode } from '@babylonjs/core'; | ||
import { TransformNode } from '@babylonjs/core/Meshes/transformNode'; | ||
export interface TransformNodeComponent extends Component { | ||
@@ -4,0 +4,0 @@ value: TransformNode | null; |
import { Entity } from 'ecsy'; | ||
import { Action } from '../components'; | ||
import SystemWithCore from '../SystemWithCore'; | ||
@@ -10,3 +11,3 @@ export default class ActionSystem extends SystemWithCore { | ||
action: { | ||
components: (import("ecsy").ComponentConstructor<import("../components/mesh").MeshComponent> | import("ecsy").ComponentConstructor<import("../components/action").ActionComponent>)[]; | ||
components: (import("ecsy").ComponentConstructor<import("../components/mesh").MeshComponent> | typeof Action)[]; | ||
listen: { | ||
@@ -19,3 +20,3 @@ added: boolean; | ||
core: { | ||
components: import("ecsy").ComponentConstructor<import("../components/babylon-core").BabylonCoreComponent>[]; | ||
components: typeof import("../components").BabylonCore[]; | ||
listen: { | ||
@@ -22,0 +23,0 @@ added: boolean; |
import { Entity, System } from 'ecsy'; | ||
import { BabylonCore } from '../components'; | ||
export default class BabylonSystem extends System { | ||
@@ -9,3 +10,3 @@ listener?: EventListener; | ||
core: { | ||
components: import("ecsy").ComponentConstructor<import("../components/babylon-core").BabylonCoreComponent>[]; | ||
components: (typeof BabylonCore)[]; | ||
listen: { | ||
@@ -12,0 +13,0 @@ added: boolean; |
import { ComponentConstructor, Entity } from 'ecsy'; | ||
import { ArcRotateCamera } from '../components'; | ||
import SystemWithCore from '../SystemWithCore'; | ||
import { ArcRotateComponent } from '../components/arc-rotate-camera'; | ||
export default class CameraSystem extends SystemWithCore { | ||
execute(): void; | ||
setupArcRotateCamera(entity: Entity): void; | ||
update(entity: Entity, component: ComponentConstructor<ArcRotateComponent>): void; | ||
remove(entity: Entity, component: ComponentConstructor<ArcRotateComponent>): void; | ||
update(entity: Entity, component: ComponentConstructor<ArcRotateCamera>): void; | ||
remove(entity: Entity, component: ComponentConstructor<ArcRotateCamera>): void; | ||
static queries: { | ||
arcRotateCamera: { | ||
components: ComponentConstructor<ArcRotateComponent>[]; | ||
components: (typeof ArcRotateCamera)[]; | ||
listen: { | ||
@@ -19,3 +19,3 @@ added: boolean; | ||
core: { | ||
components: ComponentConstructor<import("../components/babylon-core").BabylonCoreComponent>[]; | ||
components: typeof import("../components").BabylonCore[]; | ||
listen: { | ||
@@ -22,0 +22,0 @@ added: boolean; |
import { ComponentConstructor, Entity } from 'ecsy'; | ||
import { PBRMaterial } from '../components'; | ||
import { Mesh as BabylonMesh, Material as BabylonMaterial, Scene } from '@babylonjs/core'; | ||
import { Material as BabylonMaterial } from '@babylonjs/core/Materials/material'; | ||
import { Mesh as BabylonMesh } from '@babylonjs/core/Meshes/mesh'; | ||
import { Scene } from '@babylonjs/core/scene'; | ||
import SystemWithCore from '../SystemWithCore'; | ||
@@ -62,3 +64,3 @@ import { StandardMaterialComponent } from '../components/standard-material'; | ||
core: { | ||
components: ComponentConstructor<import("../components/babylon-core").BabylonCoreComponent>[]; | ||
components: typeof import("../components").BabylonCore[]; | ||
listen: { | ||
@@ -65,0 +67,0 @@ added: boolean; |
@@ -16,3 +16,3 @@ import { Entity } from 'ecsy'; | ||
core: { | ||
components: import("ecsy").ComponentConstructor<import("../components/babylon-core").BabylonCoreComponent>[]; | ||
components: typeof import("../components").BabylonCore[]; | ||
listen: { | ||
@@ -19,0 +19,0 @@ added: boolean; |
import { ComponentConstructor, Entity, System } from 'ecsy'; | ||
import { Mesh as BabylonMesh, Scene } from '@babylonjs/core'; | ||
import { Mesh as BabylonMesh } from '@babylonjs/core/Meshes/mesh'; | ||
import { Scene } from '@babylonjs/core/scene'; | ||
import { PlaneComponent } from '../components/plane'; | ||
@@ -4,0 +5,0 @@ import { BoxComponent } from '../components/box'; |
@@ -28,3 +28,3 @@ import { Entity } from 'ecsy'; | ||
core: { | ||
components: import("ecsy").ComponentConstructor<import("../components/babylon-core").BabylonCoreComponent>[]; | ||
components: typeof import("../components").BabylonCore[]; | ||
listen: { | ||
@@ -31,0 +31,0 @@ added: boolean; |
import { Entity, System } from 'ecsy'; | ||
import { TransformNode as BabylonTransformNode } from '@babylonjs/core'; | ||
import { TransformNode as BabylonTransformNode } from '@babylonjs/core/Meshes/transformNode'; | ||
export default class TransformSystem extends System { | ||
@@ -4,0 +4,0 @@ execute(): void; |
import { System } from 'ecsy'; | ||
import { BabylonCoreComponent } from './components/babylon-core'; | ||
import { BabylonCore } from './components'; | ||
export default class SystemWithCore extends System { | ||
core?: BabylonCoreComponent; | ||
core?: BabylonCore; | ||
execute(): void; | ||
@@ -10,3 +10,3 @@ afterExecute(): void; | ||
core: { | ||
components: import("ecsy").ComponentConstructor<BabylonCoreComponent>[]; | ||
components: (typeof BabylonCore)[]; | ||
listen: { | ||
@@ -13,0 +13,0 @@ added: boolean; |
{ | ||
"name": "ecsy-babylon", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "", | ||
@@ -41,4 +41,3 @@ "keywords": [], | ||
"{src,test}/**/*.ts": [ | ||
"yarn lint:eslint --fix", | ||
"git add" | ||
"yarn lint:eslint --fix" | ||
] | ||
@@ -72,11 +71,11 @@ }, | ||
"@babylonjs/materials": "^4.1.0", | ||
"ecsy": "^0.2.1" | ||
"ecsy": "^0.2.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.7", | ||
"@babel/preset-env": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.9.0", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"@rollup/plugin-typescript": "^3.0.0", | ||
"@rollup/plugin-typescript": "^4.0.0", | ||
"@types/jest": "^25.1.4", | ||
@@ -86,13 +85,13 @@ "@types/lodash-es": "^4.17.3", | ||
"@types/rollup-plugin-sourcemaps": "^0.4.2", | ||
"@typescript-eslint/eslint-plugin": "^2.22.0", | ||
"@typescript-eslint/parser": "^2.20.0", | ||
"@typescript-eslint/eslint-plugin": "^2.25.0", | ||
"@typescript-eslint/parser": "^2.25.0", | ||
"babel-jest": "^25.1.0", | ||
"colors": "^1.3.2", | ||
"commitizen": "^4.0.3", | ||
"coveralls": "^3.0.2", | ||
"coveralls": "^3.0.11", | ||
"cross-env": "^7.0.2", | ||
"cz-conventional-changelog": "^3.1.0", | ||
"eslint": "^6.7.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-import-resolver-typescript": "^2.0.0", | ||
@@ -107,5 +106,5 @@ "eslint-plugin-import": "^2.20.1", | ||
"jest": "^24.9.0", | ||
"jest-config": "^25.1.0", | ||
"jest-config": "^25.2.4", | ||
"jest-extended": "^0.11.5", | ||
"lint-staged": "^9.5.0", | ||
"lint-staged": "^10.0.10", | ||
"prettier": "^1.14.3", | ||
@@ -115,6 +114,6 @@ "rollup": "^1.31.1", | ||
"rollup-plugin-sourcemaps": "^0.5.0", | ||
"semantic-release": "^17.0.2", | ||
"semantic-release": "^17.0.4", | ||
"ts-jest": "^24.2.0", | ||
"ts-node": "^8.6.2", | ||
"typedoc": "^0.16.11", | ||
"ts-node": "^8.8.1", | ||
"typedoc": "^0.17.3", | ||
"typescript": "^3.8.2" | ||
@@ -121,0 +120,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
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
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
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
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
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
250947
118
3281
1
Updatedecsy@^0.2.3