@hology/core 0.0.39 → 0.0.42
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +2 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -1
- package/dist/gameplay/initiate.js +1 -1
- package/dist/gameplay/services/physics/physics-system.js +1 -1
- package/dist/gameplay/services/world.d.ts +22 -1
- package/dist/gameplay/services/world.js +1 -1
- package/dist/rendering.d.ts +1 -0
- package/dist/rendering.js +1 -1
- package/dist/scene/asset-resource-loader.d.ts +2 -0
- package/dist/scene/asset-resource-loader.js +1 -1
- package/dist/scene/bootstrap.js +1 -1
- package/dist/scene/collision/collision-shape.d.ts +4 -6
- package/dist/scene/collision/collision-shape.js +1 -1
- package/dist/scene/materializer.d.ts +31 -8
- package/dist/scene/materializer.js +1 -1
- package/dist/scene/model.d.ts +7 -1
- package/dist/scene/runtime-backend-service.d.ts +2 -1
- package/dist/scene/runtime-backend-service.js +1 -1
- package/dist/scene/scene-data-service.d.ts +1 -1
- package/dist/scene/scene-data-service.js +1 -1
- package/dist/utils/three/traverse.d.ts +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/scene/model.d.ts
CHANGED
@@ -105,7 +105,13 @@ export interface SceneData {
|
|
105
105
|
name: string;
|
106
106
|
fileKey: string;
|
107
107
|
}
|
108
|
-
export
|
108
|
+
export type SceneBlob = {
|
109
|
+
id: string;
|
110
|
+
name: string;
|
111
|
+
data: SceneObject[];
|
112
|
+
sceneId: string;
|
113
|
+
} | SceneBlobV0;
|
114
|
+
export interface SceneBlobV0 {
|
109
115
|
id: string;
|
110
116
|
name: string;
|
111
117
|
data: string;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { SceneObject } from './materializer.js';
|
1
2
|
import { Asset, SceneData } from './model.js';
|
2
3
|
export declare class RuntimeBackendService {
|
3
4
|
private sceneStorage;
|
@@ -8,5 +9,5 @@ export declare class RuntimeBackendService {
|
|
8
9
|
getAsset(id: string): Promise<Asset>;
|
9
10
|
getScenes(): Promise<SceneData[]>;
|
10
11
|
getScene(idOrName: string): Promise<SceneData>;
|
11
|
-
getSceneData(sceneId: string): Promise<
|
12
|
+
getSceneData(sceneId: string): Promise<SceneObject[]>;
|
12
13
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{ObjectStorage as e}from"./storage/storage.js";export class RuntimeBackendService{constructor(t){this.sceneStorage=new e("scene"),this.sceneBlobStorage=new e("scene-blob"),this.assetStorage=new e("asset"),this.sceneStorage.setBasePath(t),this.sceneBlobStorage.setBasePath(t),this.assetStorage.setBasePath(t)}getAssets(){return this.assetStorage.getAll()}getAsset(e){return this.assetStorage.get(e)}getScenes(){return this.sceneStorage.getAll()}getScene(e){return this.sceneStorage.get(e)}async getSceneData(e){const t=await this.sceneBlobStorage.get(e);return t
|
1
|
+
import{ObjectStorage as e}from"./storage/storage.js";export class RuntimeBackendService{constructor(t){this.sceneStorage=new e("scene"),this.sceneBlobStorage=new e("scene-blob"),this.assetStorage=new e("asset"),this.sceneStorage.setBasePath(t),this.sceneBlobStorage.setBasePath(t),this.assetStorage.setBasePath(t)}getAssets(){return this.assetStorage.getAll()}getAsset(e){return this.assetStorage.get(e)}getScenes(){return this.sceneStorage.getAll()}getScene(e){return this.sceneStorage.get(e)}async getSceneData(e){const t=await this.sceneBlobStorage.get(e);return null==t?null:"string"==typeof t.data?JSON.parse(t.data):t.data}}
|
2
2
|
/*
|
3
3
|
* Copyright (©) 2023. All rights reserved.
|
4
4
|
* See the LICENSE.md file for details.
|
@@ -7,7 +7,7 @@ export declare class SceneDataService implements SceneDataProvider {
|
|
7
7
|
private removeCallbacks;
|
8
8
|
objectChange: BehaviorSubject<SceneObject[]>;
|
9
9
|
constructor();
|
10
|
-
initiate(data:
|
10
|
+
initiate(data: SceneObject[]): void;
|
11
11
|
private createDefaultObjects;
|
12
12
|
removeOnUpdateCallback(callback: (sceneObject: SceneObject) => void): void;
|
13
13
|
onUpdate(callback: (sceneObject: SceneObject) => void): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{BehaviorSubject as t}from"rxjs";import{Matrix4 as e,Vector3 as s,Quaternion as i,Euler as o}from"three";export class SceneDataService{constructor(){this.objects=[],this.callbacks=[],this.removeCallbacks=[],this.objectChange=new t([])}initiate(t){this.objects=t
|
1
|
+
import{BehaviorSubject as t}from"rxjs";import{Matrix4 as e,Vector3 as s,Quaternion as i,Euler as o}from"three";export class SceneDataService{constructor(){this.objects=[],this.callbacks=[],this.removeCallbacks=[],this.objectChange=new t([])}initiate(t){this.objects=t??[],this.objectChange.next(this.objects)}createDefaultObjects(){this.objects.some((t=>"global_fog"===t.type))||this.objects.unshift(createInitialFog());this.objects.some((t=>"sky"===t.type))||this.objects.unshift(createInitialSky())}removeOnUpdateCallback(t){this.callbacks.splice(this.callbacks.indexOf(t),1)}onUpdate(t){this.callbacks.push(t)}onRemove(t){this.removeCallbacks.push(t)}getObjects(){return this.objects}addObject(t){this.objects.push(t),this.callbacks.forEach((e=>e(t))),this.objectChange.next(this.objects)}updateObject(t){const e=this.findObjectById(t.id);e?(Object.assign(e,t),this.callbacks.forEach((e=>e(t)))):this.addObject(t),this.objectChange.next(this.objects)}findObjectById(t){const e=[...this.objects];for(;e.length>0;){const s=e.pop();if(s.id===t)return s;s.children&&e.push(...s.children)}}findAncestorsById(t){const e=this.findParentById(t);return null==e?[]:[e,...this.findAncestorsById(e.id)]}findParentById(t){return this._findParentById(t,this.objects)}_findParentById(t,e,s=null){return e.some((e=>e.id===t))?s:e.filter((t=>null!=t.children)).map((e=>this._findParentById(t,e.children,e))).find((t=>null!=t))}updateParent(t,n){const r=this.findParentById(t.id);{const c=null!=n?this.getMatrixWorld(n).invert():(new e).identity();null!=r&&c.multiply(this.getMatrixWorld(r));const a=this.getLocalMatrix(t),l=c.multiply(a),h=new s,d=new i,b=new s;l.decompose(h,d,b),t.position=h.toArray(),t.rotation=(new o).setFromQuaternion(d).toArray(),t.scale=b.toArray()}this.removeRecursive(t.id,r?.children??this.objects),null!=n?(n.children??=[],n.children.push(t)):this.objects.push(t),this.objectChange.next(this.objects),this.callbacks.forEach((e=>e(t)))}getMatrixWorld(t){const e=this.findAncestorsById(t.id).reverse();e.push(t);const s=this.getLocalMatrix(e.shift());for(const t of e){const e=this.getLocalMatrix(t);s.multiply(e)}return s}getLocalMatrix(t){const n=new e,r=(new s).fromArray(t.position),c=(new i).setFromEuler((new o).fromArray(t.rotation)),a=(new s).fromArray(t.scale);return n.compose(r,c,a),n}removeObject(t){this.removeRecursive(t.id,this.objects),this.removeCallbacks.forEach((e=>e(t))),this.objectChange.next([...this.objects])}removeRecursive(t,e){const s=e.findIndex((e=>e.id===t));if(s>-1)e.splice(s,1);else for(const s of e)this.removeRecursive(t,s.children??[])}save(){}serialize(){return JSON.stringify(this.objects)}}export function createInitialFog(){return{id:"auto-global-fog",name:"Global fog",type:"global_fog",fog:{type:"density",color:"#b8f8ff",density:.005,near:100,far:1e3}}}export function createInitialSky(){return{id:"auto-sky",name:"Sky",type:"sky",sky:{materialId:null}}}
|
2
2
|
/*
|
3
3
|
* Copyright (©) 2023. All rights reserved.
|
4
4
|
* See the LICENSE.md file for details.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Object3D, Vector3 } from 'three';
|
2
2
|
type ObjectPredicate<T> = (obj: T) => boolean;
|
3
|
-
export declare function filterScene(scene: Object3D, predicate: ObjectPredicate<Object3D>):
|
3
|
+
export declare function filterScene(scene: Object3D, predicate: ObjectPredicate<Object3D>): Object3D<import("three").Event>[];
|
4
4
|
export declare function findFirstVisibleObject(scene: Object3D, predicate: ObjectPredicate<Object3D>): Object3D;
|
5
5
|
/**
|
6
6
|
* Only continue traverse through children if it has not yet matched.
|