@hology/core 0.0.169 → 0.0.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/effects/vfx/vfx-actor.js +1 -1
- package/dist/effects/vfx/vfx-materializer.d.ts +2 -1
- package/dist/effects/vfx/vfx-param.d.ts +1 -1
- package/dist/effects/vfx/vfx-param.js +1 -1
- package/dist/effects/vfx/vfx-service.d.ts +3 -2
- package/dist/effects/vfx/vfx-service.js +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import*as s from"three";import{Rate as e}from"@hology/nebula";import{Actor as i,BaseActor as r}from"../../gameplay/actors/actor.js";import{inject as o}from"../../gameplay/inject.js";import{AssetLoader as a}from"../../gameplay/services/asset-loader.js";import{ViewController as h}from"../../gameplay/services/render.js";import{World as m}from"../../gameplay/services/world.js";import{DelayRate as l}from"./rates.js";import{materializeVfx as d}from"./vfx-materializer.js";import{PhysicsSystem as
|
|
1
|
+
import{__decorate as t}from"tslib";import*as s from"three";import{Rate as e}from"@hology/nebula";import{Actor as i,BaseActor as r}from"../../gameplay/actors/actor.js";import{inject as o}from"../../gameplay/inject.js";import{AssetLoader as a}from"../../gameplay/services/asset-loader.js";import{ViewController as h}from"../../gameplay/services/render.js";import{World as m}from"../../gameplay/services/world.js";import{DelayRate as l}from"./rates.js";import{materializeVfx as d}from"./vfx-materializer.js";import{PhysicsSystem as p}from"../../gameplay/services/physics/physics-system.js";import{ShaderProvider as n}from"../../gameplay/services/shader-provider.js";let c=class extends r{constructor(){super(...arguments),this.timescale=1,this.paused=!0,this.assetLoader=o(a),this.world=o(m),this.view=o(h),this.physics=o(p),this.shaderProvider=o(n),this._worldPos=new s.Vector3,this._worldRot=new s.Quaternion,this._worldEul=new s.Euler,this.max=0}async fromAsset(t){if("vfx"!==t.type)throw"Asset must be a VFX asset but is "+t.type;null!=this.system&&(this.system.destroy(),this.system.emitters.forEach(t=>t.reset())),this.sourceAsset=t,this.disposeSystem&&this.disposeSystem(),this.world.scene.add(this.object);const{system:s,dispose:e,container:i}=await d(this.sourceAsset,this.object,{getAsset:t=>this.assetLoader.getAsset(t),getMaterial:t=>this.assetLoader.getMaterialByAssetId(t),getTexture:t=>this.assetLoader.getTextureByAssetId(t),getMesh:t=>this.assetLoader.getModelByAssetId(t).then(t=>t.scene)},this.view,this.physics,this.shaderProvider);this.system=s,this.disposeSystem=e,this.particleSystemContainer=i,this.object.visible=!1,this.object.matrixAutoUpdate=!1,this.object.matrixWorldAutoUpdate=!1,this.particleSystemContainer.matrixAutoUpdate=!1,this.particleSystemContainer.matrixWorldAutoUpdate=!1}play(){null==this.particleSystemContainer.parent&&this.world.scene.add(this.particleSystemContainer),this.object.matrixAutoUpdate=!0,this.object.matrixWorldAutoUpdate=!0,this.particleSystemContainer.matrixAutoUpdate=!0,this.particleSystemContainer.matrixWorldAutoUpdate=!0,this.object.visible=!0,this.paused=!1;this.system.emitters.every(t=>t.dead)&&this.restart()}pause(){this.paused=!0}stop(){this.system.emitters.forEach(t=>{const s=t.rate;s instanceof e&&(s.nextTime=1/0)})}restart(){if(null!=this.system&&null!=this.system.emitters)for(const t of this.system.emitters){const s=t.rate;s instanceof l?s.restart():s.nextTime=0,t.removeAllParticles()}}onUpdate(t){this.paused||(this.object.getWorldPosition(this._worldPos),this.object.getWorldQuaternion(this._worldRot),this._worldEul.setFromQuaternion(this._worldRot),this.system?.emitters.forEach(t=>{"world"===t._space&&(t.setPosition(this._worldPos),t.setRotation(this._worldEul))}),this.system?.update(t*this.timescale))}getParticleCount(){return this.system?.getCount()??0}onEndPlay(){this.stop(),null!=this.disposeSystem&&this.disposeSystem()}};c=t([i()],c);export{c as VfxActor};/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import System from "@hology/nebula";
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import { Object3D } from "three";
|
|
4
|
-
import { PhysicsSystem
|
|
4
|
+
import { PhysicsSystem } from '../../gameplay/services/physics/physics-system.js';
|
|
5
|
+
import { ViewController } from '../../gameplay/services/render.js';
|
|
5
6
|
import { Asset, VfxAsset } from '../../scene/model.js';
|
|
6
7
|
import { ShaderProvider } from "../../gameplay/services/shader-provider.js";
|
|
7
8
|
export type VfxAssetProvider = {
|
|
@@ -2,7 +2,7 @@ import { VfxActor } from './vfx-actor.js';
|
|
|
2
2
|
import { ActorProvider } from "../../scene/materializer.js";
|
|
3
3
|
import { VfxAsset } from "../../scene/model.js";
|
|
4
4
|
import { Object3D } from 'three';
|
|
5
|
-
import { BaseActor } from '../../gameplay/
|
|
5
|
+
import { BaseActor } from '../../gameplay/actors/actor.js';
|
|
6
6
|
export declare class VisualEffect {
|
|
7
7
|
private actorProvider;
|
|
8
8
|
private asset;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{VfxActor as t}from"./vfx-actor.js";import{BaseActor as s}from"../../gameplay/
|
|
1
|
+
import{VfxActor as t}from"./vfx-actor.js";import{BaseActor as s}from"../../gameplay/actors/actor.js";export class VisualEffect{constructor(t,s){this.actorProvider=t,this.asset=s}async create(e){const a=await this.actorProvider.create(t);return e instanceof s?e.object.add(a.object):e.add(a.object),await a.fromAsset(this.asset),a}createPool(t){return new VfxPool(()=>this.create(t))}}export class VfxPool{constructor(t){this.creator=t,this.instances=[]}async get(){0==this.instances.length&&this.instances.push(await this.creator());const t=this.instances.shift();return t.restart(),t}release(t){t.stop(),this.instances.push(t)}dispose(){this.instances.length=0}}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Object3D } from 'three';
|
|
2
|
-
import { BaseActor
|
|
3
|
-
import {
|
|
2
|
+
import { BaseActor } from '../../gameplay/actors/actor.js';
|
|
3
|
+
import { VfxActor } from './vfx-actor.js';
|
|
4
|
+
import { Asset, AssetId } from '../../scene/model.js';
|
|
4
5
|
import { VfxPool } from './vfx-param';
|
|
5
6
|
export declare class VfxService {
|
|
6
7
|
private pools;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import{ActorFactory as s
|
|
1
|
+
import{__decorate as t}from"tslib";import{ActorFactory as s}from"../../gameplay/actors/factory.js";import{AssetLoader as e}from"../../gameplay/services/asset-loader.js";import{BaseActor as r}from"../../gameplay/actors/actor.js";import{inject as o}from"../../gameplay/inject.js";import{Service as a}from"typedi";import{World as c}from"../../gameplay/services/world.js";import{VfxActor as i}from"./vfx-actor.js";import{VfxPool as m}from"./vfx-param";let l=class{constructor(){this.pools=new Map,this.actorFactory=o(s),this.assetService=o(e),this.world=o(c)}async createFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createFromAsset(e,s)}async createFromAsset(t,s=this.world.scene){const e=await this.actorFactory.create(i);return s instanceof r?s.object.add(e.object):s.add(e.object),await e.fromAsset(t),e}async createPoolFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createPoolFromAsset(e,s)}async createPoolFromAsset(t,s=this.world.scene){let e;return this.pools.has(t.id)||(e=new m(()=>this.createFromAsset(t,s)),this.pools.set(t.id,e)),e}};l=t([a()],l);export{l as VfxService};/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|