@hology/core 0.0.64 → 0.0.65
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/gameplay/actors/builtin/navmesh-actor.d.ts +1 -4
- package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -1
- package/dist/gameplay/actors/factory.d.ts +1 -1
- package/dist/gameplay/ai/dynamic-tiled-navmesh.js +1 -1
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts +1 -1
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.js +1 -1
- package/dist/gameplay/index.d.ts +1 -1
- package/dist/gameplay/services/asset-loader.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/scene/asset-resource-loader.js +1 -1
- package/dist/worker/index.d.ts +4 -0
- package/dist/worker/index.js +5 -0
- package/package.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
@@ -9,12 +9,9 @@ declare class NavMeshActor extends BaseActor {
|
|
9
9
|
private world;
|
10
10
|
debug: boolean;
|
11
11
|
refreshMs: number;
|
12
|
-
tileSize
|
13
|
-
cellSize: number;
|
12
|
+
private tileSize;
|
14
13
|
walkableClimb: number;
|
15
14
|
walkableSlopeAngle: number;
|
16
|
-
walkableRadius: number;
|
17
|
-
walkableHeight: number;
|
18
15
|
navMesh: NavMesh;
|
19
16
|
onInit(): Promise<void>;
|
20
17
|
private init;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{__decorate as e,__metadata as t}from"tslib";import{Ball as o,Capsule as
|
1
|
+
import{__decorate as e,__metadata as t}from"tslib";import{Ball as o,Capsule as n,Cone as s,ConvexPolyhedron as r,Cuboid as i,Cylinder as a,Heightfield as l,ShapeType as c,TriMesh as h}from"@dimforge/rapier3d-compat";import{Actor as p,BaseActor as u,Parameter as d,PhysicsSystem as f,ViewController as m,World as w,inject as g}from"../../";import{init as b}from"@recast-navigation/core";import{DebugDrawer as y,getPositionsAndIndices as x}from"@recast-navigation/three";import*as v from"three";import{DynamicTiledNavMesh as B}from"../../ai/dynamic-tiled-navmesh";import{BufferGeometryUtils as M,ConvexHull as S}from"three/examples/jsm/Addons.js";import{debounceTime as A,takeUntil as C}from"rxjs";const k=new v.Box3(new v.Vector3(-1e3,-200,-1e3),new v.Vector3(1e3,200,1e3)),z=navigator.hardwareConcurrency??1;let F=!1,G=class extends u{constructor(){super(...arguments),this.physics=g(f),this.view=g(m),this.world=g(w),this.debug=!0,this.refreshMs=2e3,this.tileSize=400,this.walkableClimb=5,this.walkableSlopeAngle=45}async onInit(){F||(await b(),F=!0),this.init()}init(){const e={tileSize:400,walkableClimb:.2*this.walkableClimb,walkableSlopeAngle:this.walkableSlopeAngle,walkableRadius:2,walkableHeight:5,detailSampleDist:1,minRegionArea:6,mergeRegionArea:400,cs:.2,ch:.2,maxSimplificationError:1.3,maxEdgeLen:200},t=(new v.Box3,new B({navMeshBounds:k,recastConfig:e,maxTiles:16384,workers:z,cacheId:"nav"+this.object.userData?.src?.id}));this.navMesh=t.navMesh,this.object.position.set(0,0,0);const o=this.tileSize*e.cs*2,n=performance.now(),s=new Map,r=new y;let i=t.navMesh;const a=()=>{const e=this.view.getCamera().getWorldPosition(new v.Vector3),t=new v.Box3((new v.Vector3).copy(e).subScalar(o),(new v.Vector3).copy(e).addScalar(o)),n=[],r=this.physics.world.bodies,i=new v.Box3;for(const e of r.getAll())for(let o=0,r=e.numColliders();o<r;o++){const r=e.collider(o);if(r.isSensor()||null!=r.parent().userData&&!0===r.parent().userData.ignoreForNavMesh)continue;const a=(e.userData??e.handle)+","+o,l=s.get(a)?.mesh,c=l??j(r);if(V(r,c),null!=c){i.copy(c.geometry.boundingBox),i.min.add(c.position),i.max.add(c.position);const e=i.intersectsBox(t)||!0;s.set(a,{pos:r.translation(),mesh:c}),e&&n.push(c)}}return n},l=new v.Box3,c=new Map,h=new Map;let p=!0;const u=setInterval((()=>{const e=new v.Box3,o=a();for(const t of o){const o=c.get(t);!0!==o?.equals(t.position)&&(null!=o&&e.expandByPoint(o),e.expandByObject(t),c.set(t,t.position.clone()))}const n=t.getTilesForBounds(e);if(0!=n.length){const s=[];for(const t of o)l.setFromObject(t),l.intersect(e)&&s.push(t);console.log("tiles to update ",n),console.log("intersecting meshes",s.length);const[r,i]=x(s),a=p;p=!1,Promise.all(n.map((e=>t.buildTile(r,i,e,a).then((()=>{const t=e[0]+","+e[1];h.set(t,(h.get(t)??0)+1),this.debug}))))).then((()=>{this.debug}))}}),this.refreshMs??1e4);this.disposed.subscribe((()=>clearInterval(u))),t.onNavMeshUpdate.pipe(C(this.disposed),A(200)).subscribe((()=>{r.clear(),r.drawNavMesh(t.navMesh)})),console.log("Create navmesh with debug",this.debug),this.debug&&this.object.parent.add(r),this.disposed.subscribe((()=>{i?.destroy(),t?.destroy(),r.removeFromParent(),r.dispose()}));const d=performance.now()-n;d>1e3&&console.warn(`NavMesh update took ${d} ms. Consider changing tileSize or other parameter that may affect performance`)}};e([d(),t("design:type",Boolean)],G.prototype,"debug",void 0),e([d(),t("design:type",Number)],G.prototype,"walkableClimb",void 0),e([d({range:[0,89]}),t("design:type",Number)],G.prototype,"walkableSlopeAngle",void 0),G=e([p()],G);export default G;function P(e){if(e.shape instanceof l)return function(e){const t=e.shape;if(t.type!==c.HeightField)throw new Error("The provided collider is not a height field.");let o=!1;const n=t,s=n.heights,r=n.nrows,i=n.ncols,a=n.scale.x,l=n.scale.z,h=n.scale.y,p=r+1,u=new v.PlaneGeometry(l,a,i,r);u.rotateX(-Math.PI/2);const d=u.attributes.position.array;let f=0;for(let e=0;e<p;e++)for(let t=0;t<p;t++)d[f+1]=s[t*p+e]*h,f+=3,0!=d[f+1]&&(o=!0);if(!o){const e=new v.PlaneGeometry(a,l,2,2);return e.rotateX(-Math.PI/2),e}return u}(e);if(e.shape instanceof o)return new v.SphereGeometry(e.shape.radius);if(e.shape instanceof i){const t=e.shape.halfExtents;return new v.BoxGeometry(2*t.x,2*t.y,2*t.z)}if(e.shape instanceof r)return function(e){const t=[];for(let o=0;o<e.length;o+=3)t.push(new v.Vector3(e[o],e[o+1],e[o+2]));const o=(new S).setFromPoints(t),n=[];o.faces.forEach((e=>{const t=e.edge.head().point,o=e.edge.next.head().point,s=e.edge.next.next.head().point;n.push(t.x,t.y,t.z),n.push(o.x,o.y,o.z),n.push(s.x,s.y,s.z)}));const s=new v.BufferGeometry;return s.setAttribute("position",new v.Float32BufferAttribute(n,3)),s}(e.shape.vertices);if(e.shape instanceof h){const t=e.shape.vertices,o=e.shape.indices;let n=new v.BufferGeometry;return n.setAttribute("position",new v.Float32BufferAttribute(t,3)),null!=o?n.setIndex(new v.Uint16BufferAttribute(o,1)):n=M.mergeVertices(n),n.computeVertexNormals(),n}if(e.shape instanceof a){const t=e.shape.halfHeight,o=e.shape.radius;return new v.CylinderGeometry(o,o,2*t)}if(e.shape instanceof s){const t=e.shape.halfHeight,o=e.shape.radius;return new v.ConeGeometry(o,2*t)}if(e.shape instanceof n){const t=e.shape.halfHeight,o=e.shape.radius;return new v.CapsuleGeometry(o,2*t)}return console.warn("Unsupported shape",e.shape.type,e),null}function j(e){const t=P(e);if(null==t)return null;const o=new v.MeshBasicMaterial({wireframe:!1,color:16711680,side:v.FrontSide}),n=new v.Mesh(t,o);return n.geometry.computeBoundingBox(),n.geometry.scale(1.01,1.01,1.01),n}function V(e,t){const o=e.translation(),n=e.rotation();t.position.set(o.x,o.y,o.z),t.quaternion.set(n.x,n.y,n.z,n.w)}
|
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 { Constructable, ContainerInstance } from "typedi";
|
2
2
|
import { BaseActor } from './actor.js';
|
3
|
-
import { EngineEnvironment } from '../env.js';
|
3
|
+
import { type EngineEnvironment } from '../env.js';
|
4
4
|
import { ActorProvider } from '../../scene/materializer.js';
|
5
5
|
import { Vector3, Euler } from "three";
|
6
6
|
export declare class ActorFactory implements ActorProvider<BaseActor> {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{NavMesh as t,NavMeshParams as s,Raw as e,UnsignedCharArray as i,recastConfigDefaults as
|
1
|
+
import{NavMesh as t,NavMeshParams as s,Raw as e,UnsignedCharArray as i,recastConfigDefaults as o,statusToReadableString as n}from"recast-navigation";import{buildConfig as r,buildTile as a}from"./build-tile.js";import{Subject as h}from"rxjs";import{hasWorkerBuilder as l,createWorker as d}from"../../worker/index.js";export class DynamicTiledNavMesh{constructor(e){this.navMeshVersion=0,this.onNavMeshUpdate=new h,this.workerRoundRobin=0;const i=e.navMeshBounds.min,n=e.navMeshBounds.max,a=[i.toArray(),n.toArray()],u=e.navMeshBounds.min;this.navMeshBoundsMin=i,this.navMeshBoundsMax=n,this.navMeshBounds=a,this.navMeshOrigin=u,this.cacheId=e.cacheId;const c={...o,...e.recastConfig};this.recastConfig=c;const M=new t,{tileWidth:v,tileHeight:f,tcs:m,maxPolysPerTile:g}=r({recastConfig:c,navMeshBounds:a});this.tileWidth=v,this.tileHeight=f,this.tcs=m;const x=s.create({orig:u,tileWidth:c.tileSize*c.cs,tileHeight:c.tileSize*c.ch,maxTiles:e.maxTiles,maxPolys:g});if(M.initTiled(x),this.navMesh=M,this.workers=[],l())for(let t=0;t<e.workers;t++){const t=d();t.onmessage=t=>{this.onResult(t)},this.workers.push(t)}}onResult(t){const{tileX:s,tileY:o,navMeshData:r}=t.data,a=new i;a.copy(r),this.navMesh.removeTile(this.navMesh.getTileRefAt(s,o,0));const h=this.navMesh.addTile(a,e.Module.DT_TILE_FREE_DATA,0);e.Detour.statusFailed(h.status)&&(console.error(e.Module.RC_LOG_WARNING,`Failed to add tile to nav mesh\n\ttx: ${s}, ty: ${o},status: ${n(h.status)} (${h.status})`),a.destroy()),this.navMeshVersion++,this.onNavMeshUpdate.next([this.navMeshVersion,[s,o]])}buildTile(t,s,[e,i],o=!0){const n=new Float32Array(t),r=new Uint32Array(s),h={tileX:e,tileY:i,tileBoundsMin:[this.navMeshBoundsMin.x+e*this.tcs,this.navMeshBoundsMin.y,this.navMeshBoundsMin.z+i*this.tcs],tileBoundsMax:[this.navMeshBoundsMax.x+(e+1)*this.tcs,this.navMeshBoundsMax.y,this.navMeshBoundsMax.z+(i+1)*this.tcs],recastConfig:this.recastConfig,navMeshBounds:this.navMeshBounds,keepIntermediates:!1,positions:n,indices:r};if(this.workers.length>0){this.workerRoundRobin=++this.workerRoundRobin%this.workers.length;return this.workers[this.workerRoundRobin].postMessage(h,[n.buffer,r.buffer]),Promise.resolve()}return new Promise((t=>{requestIdleCallback((()=>{const s=this.cacheId+JSON.stringify({tileX:h.tileX,tileY:h.tileY});if(o){const e=localStorage.getItem(s);if(null!=e){const s=c(e);return this.onResult({data:{tileX:h.tileX,tileY:h.tileY,navMeshData:s}}),void t({})}}else localStorage.removeItem(s);const e=a(h);if(!e.success||!e.data)return;const i=e.data.toTypedArray();localStorage.setItem(s,u(i)),this.onResult({data:{tileX:h.tileX,tileY:h.tileY,navMeshData:i}}),t(e)}))}))}buildAllTiles(t,s){const{tileWidth:e,tileHeight:i}=this;for(let o=0;o<i;o++)for(let i=0;i<e;i++)this.buildTile(t,s,[i,o])}getTileForWorldPosition(t){return[Math.floor((t.x-this.navMeshBoundsMin.x)/this.tcs),Math.floor((t.z-this.navMeshBoundsMin.z)/this.tcs)]}getTilesForBounds(t){const s=this.getTileForWorldPosition(t.min),e=this.getTileForWorldPosition(t.max),i=[];for(let t=s[1];t<=e[1];t++)for(let o=s[0];o<=e[0];o++)i.push([o,t]);return i}destroy(){this.navMesh.destroy();for(const t of this.workers)t.terminate()}}const u=function(t){return btoa(String.fromCharCode(...t))},c=function(t){if(!t)return null;const s=atob(t),e=s.length,i=new Uint8Array(e);for(let t=0;t<e;t++)i[t]=s.charCodeAt(t);return i};
|
2
2
|
/*
|
3
3
|
* Copyright (©) 2023. All rights reserved.
|
4
4
|
* See the LICENSE.md file for details.
|
@@ -1 +1 @@
|
|
1
|
-
export
|
1
|
+
export declare function setupNavMeshWorker(): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{init as t}from"recast-navigation";import{buildTile as e}from"./build-tile.js";let s=!1;const a=[];self.onmessage=t=>{s?o(t.data):a.push(t.data)}
|
1
|
+
import{init as t}from"recast-navigation";import{buildTile as e}from"./build-tile.js";let s=!1;const a=[];export function setupNavMeshWorker(){t().then((()=>{s=!0;for(const t of a)o(t)})),self.onmessage=t=>{s?o(t.data):a.push(t.data)}}const o=t=>{const s=e(t);if(!s.success||!s.data)return;const a=s.data.toTypedArray();s.data.destroy(),self.postMessage({tileX:t.tileX,tileY:t.tileY,navMeshData:a},[a.buffer])};
|
2
2
|
/*
|
3
3
|
* Copyright (©) 2023. All rights reserved.
|
4
4
|
* See the LICENSE.md file for details.
|
package/dist/gameplay/index.d.ts
CHANGED
@@ -5,7 +5,7 @@ export * from './inject.js';
|
|
5
5
|
export { Service, Inject } from 'typedi';
|
6
6
|
export { ActorFactory } from './actors/factory.js';
|
7
7
|
export { Actor, BaseActor } from './actors/actor.js';
|
8
|
-
export { Component, ActorComponent, ComponentOptions, attach, Attach } from './actors/component.js';
|
8
|
+
export { Component, ActorComponent, type ComponentOptions, attach, Attach } from './actors/component.js';
|
9
9
|
export * from './services/world.js';
|
10
10
|
export * from './services/render.js';
|
11
11
|
export * from './services/physics/physics-system.js';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AssetResourceLoader, LoadedMesh } from '../../scene/asset-resource-loader.js';
|
2
|
-
import { AssetsProvider } from '../../scene/assets-provider.js';
|
2
|
+
import { type AssetsProvider } from '../../scene/assets-provider.js';
|
3
3
|
import { AssetId } from '../../scene/model.js';
|
4
4
|
import { GLTF } from "three-stdlib";
|
5
5
|
import { Material } from "three";
|
package/dist/index.d.ts
CHANGED
@@ -2,3 +2,4 @@ export { loadScene } from './scene/bootstrap.js';
|
|
2
2
|
export { BaseGameController } from './controllers/base-game-controller.js';
|
3
3
|
export * from './scene/collision/collision-shape.js';
|
4
4
|
export { AssetMeshInstance } from './scene/asset-resource-loader.js';
|
5
|
+
export { registerWorker, initWorker } from './worker';
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export{loadScene}from"./scene/bootstrap.js";export{BaseGameController}from"./controllers/base-game-controller.js";export*from"./scene/collision/collision-shape.js";export{AssetMeshInstance}from"./scene/asset-resource-loader.js";
|
1
|
+
export{loadScene}from"./scene/bootstrap.js";export{BaseGameController}from"./controllers/base-game-controller.js";export*from"./scene/collision/collision-shape.js";export{AssetMeshInstance}from"./scene/asset-resource-loader.js";export{registerWorker,initWorker}from"./worker";
|
2
2
|
/*
|
3
3
|
* Copyright (©) 2023. All rights reserved.
|
4
4
|
* See the LICENSE.md file for details.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{AudioLoader as e,BufferGeometry as t,Group as s,LoadingManager as a,Mesh as i,Object3D as r,TextureLoader as o}from"three";import{GLTFLoader as n,MTLLoader as h,OBJLoader as c}from"three-stdlib";import{FBXLoader as l}from"three-stdlib";import{cloneMesh as d}from"../utils/mesh.js";import{pathJoin as m}from"../utils/files.js";import{Subject as p,firstValueFrom as
|
1
|
+
import{AudioLoader as e,BufferGeometry as t,Group as s,LoadingManager as a,Mesh as i,Object3D as r,TextureLoader as o}from"three";import{GLTFLoader as n,MTLLoader as h,OBJLoader as c}from"three-stdlib";import{FBXLoader as l}from"three-stdlib";import{cloneMesh as d}from"../utils/mesh.js";import{pathJoin as m}from"../utils/files.js";import{Subject as p,firstValueFrom as u}from"rxjs";import{importCollisionShapes as f,isCollisionMesh as g}from"./collision/collision-shape-import.js";import*as w from"three";import{iterateMaterials as y}from"../utils/materials.js";import{BufferGeometryUtils as x,KTX2Loader as L,TGALoader as M}from"three/examples/jsm/Addons.js";const b=["glb","gltf","fbx","obj"];export class AssetResourceLoader{onError(e){console.error(e)}constructor(){this.cache=new Map,this.textureCache=new Map,this.loadingManager=new a,this.glbLoader=new n(this.loadingManager),this.fbxLoader=new l(this.loadingManager),this.objLoader=new c(this.loadingManager),this.textureLoader=new o(this.loadingManager),this.tgaLoader=new M(this.loadingManager),this.ktx2Loader=new L(this.loadingManager),this._textureLoader=new w.ImageBitmapLoader(this.loadingManager),this.audioLoader=new e(this.loadingManager),this.makeReady=new p,this.ready=u(this.makeReady),this.collisionShapeCache=new Map,this.optimizedMeshes=new Set}setDataDir(e){this.basePath=m(e,"asset-resources"),this.makeReady.next(!0)}getUri(e){return m(this.basePath,e)+`?windowId=${getElectronArg("windowId")}`}async getTexture(e){return null==e?null:(await this.ready,this.textureCache.has(e.id)||await this._getTextureLoader(e.fileKey).loadAsync(this.getUri(e.fileKey)).then((t=>(t.wrapS=S(e.texture?.wrapS),t.wrapT=S(e.texture?.wrapT),t.flipY=e.texture?.flipY??!0,this.textureCache.set(e.id,t),t))),this.textureCache.get(e.id))}_getTextureLoader(e){return e.toLowerCase().endsWith(".tga")?this.tgaLoader:e.toLowerCase().endsWith(".ktx2")?this.ktx2Loader:this.textureLoader}async getMesh(e,t){if(await this.ready,!b.includes(e.fileFormat?.toLowerCase()))return console.error("Unsupported mesh file format "+e.fileFormat,e),{scene:new s,animations:[]};const a=e.fileKey+(!0===t?.mergeGeomtries?"1":"0");if(!this.cache.has(a))try{this.cache.set(a,await this.loadMesh(e))}catch(e){return this.onError(e),{scene:new s,animations:[]}}const r=this.cache.get(a).scene,o=this.computeCollisionShapes(e,r);!0===t?.mergeGeomtries&&this.optimizeDrawGroups(r);const n=d(r),h=this.cache.get(a).animations;n.traverse((e=>{e instanceof i&&e.material instanceof Array&&(e.material=e.material.slice())}));const c=new AssetMeshInstance;c.add(n),c.collisionShapes=o,c.animations=h;const l=e.receiveShadow??!0,m=e.castShadow??!1;return n.traverse((e=>{e.castShadow=m,e.receiveShadow=l})),{scene:c,animations:h}}async getAudio(e){return await this.ready,this.audioLoader.loadAsync(this.getUri(e.fileKey))}computeCollisionShapes(e,t){const s=e.id+e.mesh?.collisions?.shapeType;return this.collisionShapeCache.has(s)||this.collisionShapeCache.set(s,f(t,e)),this.collisionShapeCache.get(s)}async loadMesh(e){return await this.ready,await this.loadByAsset(e).then((e=>(e.scene=function(e,t){let s=!1;if(t.traverseVisible((e=>{C.test(e.name)&&(s=!0)})),!s)return t;const a=new w.LOD,i=[t];for(;i.length>0;){const e=i.shift(),t=e.name.match(C);if(null!=t){const s=parseInt(t[1]);0===s?a.addLevel(e,0):console.warn(`Skipping LOD level ${s} for now as LOD is not fully supported`)}else i.push(...e.children)}return a}(0,e.scene),e)))}optimizeDrawGroups(e){if(this.optimizedMeshes.has(e.uuid))return;this.optimizedMeshes.add(e.uuid);let s=!0,a=0;if(e.traverse((e=>{e instanceof i&&e.geometry instanceof t&&!g(e)?a++:(e instanceof w.SkinnedMesh||e instanceof w.Bone)&&(s=!1)})),a>1&&s){const s=[],a=[],r=[];e.updateWorldMatrix(!0,!0),e.traverse((e=>{e instanceof i&&e.geometry instanceof t&&!g(e)&&!Array.isArray(e.material)&&(e.updateWorldMatrix(!0,!0),e.geometry.applyMatrix4(e.matrixWorld),s.push(e.geometry),a.push(e.material),r.push(e))}));for(const e of r)e.removeFromParent();const o=x.mergeGeometries(s,!0),n=[];let h=0;e:for(const e of a){for(const t of n)if(t.m.id===e.id){t.indices.push(h),h++;continue e}n.push({m:e,indices:[h]}),h++}let c=0;for(const e of n){for(const t of e.indices)o.groups[t].materialIndex=c;c++}e.add(new i(o,n.map((e=>e.m))))}e.traverse((e=>{if(e instanceof i&&e.geometry instanceof t){const t=e.geometry;Array.isArray(e.material)&&t.groups.length>1&&t.groups.length>e.material.length&&x.mergeGroups(t)}}))}async loadByAsset(e){const t=this.getUri(e.fileKey);switch(e.fileFormat){case"glb":case"gltf":return this.glbLoader.loadAsync(t).then((e=>({scene:e.scene,animations:e.animations})));case"fbx":return this.fbxLoader.loadAsync(t).then((e=>({scene:e,animations:e.animations})));case"obj":if(null!=e.materialLib){const t=new h;t.materialOptions={normalizeRGB:!1};const s=await t.loadAsync(this.getUri(e.materialLib));this.objLoader.setMaterials(s)}return this.objLoader.loadAsync(t).then((e=>(A(e),e))).then((e=>({scene:e,animations:e.animations})))}}}function A(e){if(e instanceof i)for(const t of y(e.material))t instanceof w.MeshPhongMaterial&&!t.color.isLinear&&(t.color.isLinear=!0);e.children?.forEach(A)}export class AssetMeshInstance extends r{}export function getElectronArg(e){const t=`--${e}=`,s=window.process?.argv.find((e=>e.startsWith(t)));return s?.substring(t.length)}function S(e){switch(e){case"clamp":return w.ClampToEdgeWrapping;case"repeat":return w.RepeatWrapping;case"mirror":return w.MirroredRepeatWrapping}return w.RepeatWrapping}const C=/_LOD(\d+)$/;
|
2
2
|
/*
|
3
3
|
* Copyright (©) 2023. All rights reserved.
|
4
4
|
* See the LICENSE.md file for details.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import{setupNavMeshWorker as r}from"../gameplay/ai/dynamic-tiled-navmesh.worker";let e;export function registerWorker(r){e=r}export function hasWorkerBuilder(){return null!=e}export function createWorker(){return e()}export function initWorker(){r()}
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hology/core",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.65",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"type": "module",
|
@@ -28,7 +28,8 @@
|
|
28
28
|
"./shader-nodes": "./dist/shader-nodes/index.js",
|
29
29
|
"./gameplay": "./dist/gameplay/index.js",
|
30
30
|
"./gameplay/actors": "./dist/gameplay/actors/index.js",
|
31
|
-
"./gameplay/input": "./dist/gameplay/input/index.js"
|
31
|
+
"./gameplay/input": "./dist/gameplay/input/index.js",
|
32
|
+
"./worker": "./dist/worker/index.js"
|
32
33
|
},
|
33
34
|
"types": "./dist/index.d.ts",
|
34
35
|
"typesVersions": {
|
@@ -77,6 +78,9 @@
|
|
77
78
|
],
|
78
79
|
"gameplay/input": [
|
79
80
|
"./dist/gameplay/input/index.d.ts"
|
81
|
+
],
|
82
|
+
"worker": [
|
83
|
+
"./dist/worker/index.d.ts"
|
80
84
|
]
|
81
85
|
}
|
82
86
|
},
|