@hology/core 0.0.27 → 0.0.30

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.
Files changed (62) hide show
  1. package/dist/effects/vfx/behaviours.d.ts +26 -0
  2. package/dist/effects/vfx/behaviours.js +5 -0
  3. package/dist/effects/vfx/index.d.ts +2 -0
  4. package/dist/effects/vfx/index.js +5 -0
  5. package/dist/effects/vfx/initializsers.d.ts +44 -0
  6. package/dist/effects/vfx/initializsers.js +5 -0
  7. package/dist/effects/vfx/rates.d.ts +6 -0
  8. package/dist/effects/vfx/rates.js +5 -0
  9. package/dist/effects/vfx/vfx-actor.d.ts +27 -0
  10. package/dist/effects/vfx/vfx-actor.js +5 -0
  11. package/dist/effects/vfx/vfx-asset.d.ts +99 -0
  12. package/dist/effects/vfx/vfx-asset.js +5 -0
  13. package/dist/effects/vfx/vfx-defs.d.ts +207 -0
  14. package/dist/effects/vfx/vfx-defs.js +5 -0
  15. package/dist/effects/vfx/vfx-materializer.d.ts +19 -0
  16. package/dist/effects/vfx/vfx-materializer.js +5 -0
  17. package/dist/effects/vfx/vfx-param.d.ts +13 -0
  18. package/dist/effects/vfx/vfx-param.js +5 -0
  19. package/dist/effects/vfx/zones.d.ts +74 -0
  20. package/dist/effects/vfx/zones.js +5 -0
  21. package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +5 -1
  22. package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -1
  23. package/dist/gameplay/actors/camera/third-party-camera-component.js +1 -1
  24. package/dist/gameplay/index.d.ts +1 -0
  25. package/dist/gameplay/index.js +1 -1
  26. package/dist/gameplay/initiate.d.ts +3 -0
  27. package/dist/gameplay/initiate.js +1 -1
  28. package/dist/gameplay/input/input-service.d.ts +4 -0
  29. package/dist/gameplay/input/input-service.js +1 -1
  30. package/dist/gameplay/polyfill.d.ts +1 -0
  31. package/dist/gameplay/polyfill.js +5 -0
  32. package/dist/gameplay/services/asset-loader.d.ts +9 -4
  33. package/dist/gameplay/services/asset-loader.js +1 -1
  34. package/dist/gameplay/services/render.d.ts +3 -2
  35. package/dist/rendering.d.ts +1 -0
  36. package/dist/rendering.js +1 -1
  37. package/dist/scene/materializer.d.ts +20 -3
  38. package/dist/scene/materializer.js +1 -1
  39. package/dist/scene/model.d.ts +8 -2
  40. package/dist/scene/model.js +1 -1
  41. package/dist/scene/objects/shapes.d.ts +4 -2
  42. package/dist/scene/scene-data-service.js +1 -1
  43. package/dist/scene/sky.d.ts +3 -0
  44. package/dist/scene/sky.js +1 -1
  45. package/dist/shader/parameter.d.ts +2 -1
  46. package/dist/shader-nodes/effects.d.ts +8 -0
  47. package/dist/shader-nodes/effects.js +5 -0
  48. package/dist/shader-nodes/glsl-node.d.ts +16 -0
  49. package/dist/shader-nodes/glsl-node.js +5 -0
  50. package/dist/shader-nodes/index.d.ts +4 -0
  51. package/dist/shader-nodes/index.js +1 -1
  52. package/dist/shader-nodes/math.d.ts +2 -0
  53. package/dist/shader-nodes/math.js +5 -0
  54. package/dist/shader-nodes/particle.d.ts +6 -0
  55. package/dist/shader-nodes/particle.js +5 -0
  56. package/dist/shader-nodes/shapes.d.ts +3 -0
  57. package/dist/shader-nodes/shapes.js +5 -0
  58. package/dist/shader-nodes/voronoi.d.ts +5 -0
  59. package/dist/shader-nodes/voronoi.js +5 -0
  60. package/dist/utils/math.js +1 -1
  61. package/package.json +3 -2
  62. package/tsconfig.tsbuildinfo +1 -1
@@ -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,e=!1){var s;this.objects=t&&null!==(s=JSON.parse(t))&&void 0!==s?s:[];!this.objects.some((t=>"global_fog"===t.type))&&e&&this.objects.unshift({id:"auto-global-fog",name:"Global fog",type:"global_fog",position:[0,0,0],scale:[1,1,1],rotation:[0,0,0],collisionDetection:!1,fog:{type:"density",color:"#b8f8ff",density:.005,near:100,far:1e3}}),this.objectChange.next(this.objects)}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){var r,c;const l=this.findParentById(t.id);{const r=null!=n?this.getMatrixWorld(n).invert():(new e).identity();null!=l&&r.multiply(this.getMatrixWorld(l));const c=this.getLocalMatrix(t),a=r.multiply(c),h=new s,d=new i,b=new s;a.decompose(h,d,b),t.position=h.toArray(),t.rotation=(new o).setFromQuaternion(d).toArray(),t.scale=b.toArray()}this.removeRecursive(t.id,null!==(r=null==l?void 0:l.children)&&void 0!==r?r:this.objects),null!=n?(null!==(c=n.children)&&void 0!==c||(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)),l=(new s).fromArray(t.scale);return n.compose(r,c,l),n}removeObject(t){this.removeRecursive(t.id,this.objects),this.removeCallbacks.forEach((e=>e(t))),this.objectChange.next(this.objects)}removeRecursive(t,e){var s;const i=e.findIndex((e=>e.id===t));if(i>-1)e.splice(i,1);else for(const i of e)this.removeRecursive(t,null!==(s=i.children)&&void 0!==s?s:[])}save(){}serialize(){return JSON.stringify(this.objects)}}
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,e=!1){var s;this.objects=t&&null!==(s=JSON.parse(t))&&void 0!==s?s:[];!this.objects.some((t=>"global_fog"===t.type))&&e&&this.objects.unshift({id:"auto-global-fog",name:"Global fog",type:"global_fog",position:[0,0,0],scale:[1,1,1],rotation:[0,0,0],collisionDetection:!1,fog:{type:"density",color:"#b8f8ff",density:.005,near:100,far:1e3}});this.objects.some((t=>"sky"===t.type))||this.objects.unshift({id:"auto-sky",name:"Sky",type:"sky",position:[0,0,0],scale:[1,1,1],rotation:[0,0,0],collisionDetection:!1,sky:{materialId:null}}),this.objectChange.next(this.objects)}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){var r,c;const l=this.findParentById(t.id);{const r=null!=n?this.getMatrixWorld(n).invert():(new e).identity();null!=l&&r.multiply(this.getMatrixWorld(l));const c=this.getLocalMatrix(t),a=r.multiply(c),h=new s,d=new i,b=new s;a.decompose(h,d,b),t.position=h.toArray(),t.rotation=(new o).setFromQuaternion(d).toArray(),t.scale=b.toArray()}this.removeRecursive(t.id,null!==(r=null==l?void 0:l.children)&&void 0!==r?r:this.objects),null!=n?(null!==(c=n.children)&&void 0!==c||(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)),l=(new s).fromArray(t.scale);return n.compose(r,c,l),n}removeObject(t){this.removeRecursive(t.id,this.objects),this.removeCallbacks.forEach((e=>e(t))),this.objectChange.next(this.objects)}removeRecursive(t,e){var s;const i=e.findIndex((e=>e.id===t));if(i>-1)e.splice(i,1);else for(const i of e)this.removeRecursive(t,null!==(s=i.children)&&void 0!==s?s:[])}save(){}serialize(){return JSON.stringify(this.objects)}}
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -1,3 +1,6 @@
1
1
  import * as THREE from "three";
2
+ import { NodeShaderMaterial } from 'three-shader-graph';
2
3
  export declare function basicSceneSetup(scene: THREE.Scene): void;
3
4
  export declare const ambientLightName = "default_ambient";
5
+ export declare const defaultSkyMaterial: NodeShaderMaterial;
6
+ export declare function createSky(): THREE.Mesh<THREE.SphereGeometry, NodeShaderMaterial>;
package/dist/scene/sky.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as e from"three";import{AmbientLight as a,FogExp2 as o}from"three";import{attributes as r,NodeShaderMaterial as t,uniforms as i,vec4 as n,varyingVec3 as s,float as h,normalize as c,rgb as d,mix as m,max as w,pow as p}from"three-shader-graph";export function basicSceneSetup(g){!function(o){new a(16777215,.5);var l=new e.HemisphereLight(16777215,273,.5);l.name=ambientLightName,l.position.set(0,100,0),o.add(l);new e.HemisphereLightHelper(l,10);var f=new e.DirectionalLight(16777215,.7);f.position.set(-30,50,30),f.castShadow=!0,f.shadow.mapSize.width=2048,f.shadow.mapSize.height=2048;var g=250;f.shadow.normalBias=.3,f.shadow.camera.left=-g,f.shadow.camera.right=g,f.shadow.camera.top=g,f.shadow.camera.bottom=-g,f.shadow.camera.far=500,f.shadow.bias=-5e-4;new e.DirectionalLightHelper(f,10);var S=new e.PointLight(16777215,1,50);S.castShadow=!0,S.position.set(0,40,0),S.shadow.camera.near=1,S.shadow.camera.far=60,S.shadow.bias=-.005;const L=h(5),b=h(.6),v=l.color.clone().convertSRGBToLinear(),u=new e.Color(13431551).convertSRGBToLinear();var y=new e.SphereGeometry(300,10,15);const B=s(i.modelMatrix.multiplyVec(n(r.position,1)).xyz()),x=c(B.addScalar(L)).y(),H=w(p(w(x,h(0)),h(b)),h(0)),R=n(m(d(u),d(v),H),h(1)),z=new t({color:R.rgba()});z.side=e.BackSide,z.depthTest=!1;var G=new e.Mesh(y,z);o.add(G),G.renderOrder=-999;const T=o.onBeforeRender;o.onBeforeRender=(e,a,o,r,t,i)=>{G.position.copy(o.position),T(e,a,o,r,t,i)},G.raycast=()=>{}}(g),function(e){e.fog=new o(l,f)}(g)}export const ambientLightName="default_ambient";const l=157554,f=.005;
1
+ import*as e from"three";import{AmbientLight as a,FogExp2 as t}from"three";import{attributes as r,NodeShaderMaterial as o,uniforms as i,vec4 as n,varyingVec3 as s,float as h,normalize as c,rgb as d,mix as m,max as w,pow as p}from"three-shader-graph";export function basicSceneSetup(r){!function(t){new a(16777215,.5);var r=new e.HemisphereLight(16777215,273,.5);r.name=ambientLightName,r.position.set(0,100,0),t.add(r);new e.HemisphereLightHelper(r,10);var o=new e.DirectionalLight(16777215,.7);o.position.set(-30,50,30),o.castShadow=!0,o.shadow.mapSize.width=2048,o.shadow.mapSize.height=2048;var i=250;o.shadow.normalBias=.3,o.shadow.camera.left=-i,o.shadow.camera.right=i,o.shadow.camera.top=i,o.shadow.camera.bottom=-i,o.shadow.camera.far=500,o.shadow.bias=-5e-4;new e.DirectionalLightHelper(o,10);var n=new e.PointLight(16777215,1,50);n.castShadow=!0,n.position.set(0,40,0),n.shadow.camera.near=1,n.shadow.camera.far=60,n.shadow.bias=-.005}(r),function(e){e.fog=new t(l,f)}(r)}export const ambientLightName="default_ambient";const l=157554,f=.005;export const defaultSkyMaterial=function(){const a=h(5),t=h(.6),l=new e.Color(16777215).convertSRGBToLinear(),f=new e.Color(13431551).convertSRGBToLinear(),S=s(i.modelMatrix.multiplyVec(n(r.position,1)).xyz()),g=c(S.addScalar(a)).y(),u=w(p(w(g,h(0)),h(t)),h(0)),L=n(m(d(f),d(l),u),h(1)),b=new o({color:L.rgba()});return b.side=e.BackSide,b.depthTest=!1,b}();export function createSky(){var a=new e.SphereGeometry(300,10,15),t=new e.Mesh(a,defaultSkyMaterial);return t.renderOrder=-999,t.raycast=()=>{},t}
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -3,7 +3,8 @@ import { Type } from '../utils/type';
3
3
  import { BaseActor } from '../gameplay/actors/actor';
4
4
  import { Color, Euler, Material, Object3D, Texture, Vector2, Vector3, Vector4 } from 'three';
5
5
  import { BooleanNode, FloatNode, RgbNode, Sampler2DNode, Vec2Node, Vec3Node, Vec4Node } from '../shader-nodes';
6
- export type ParameterType = Type<FloatNode | Number | Texture | Sampler2DNode | Boolean | BooleanNode | Vector2 | Vec2Node | Vector3 | Vec3Node | Vector4 | Vec4Node | Color | RgbNode | String | BaseActor | Euler | Object3D | Material>;
6
+ import { VisualEffect } from '../effects/vfx/vfx-param';
7
+ export type ParameterType = Type<FloatNode | Number | Texture | Sampler2DNode | Boolean | BooleanNode | Vector2 | Vec2Node | Vector3 | Vec3Node | Vector4 | Vec4Node | Color | RgbNode | String | BaseActor | Euler | Object3D | Material | VisualEffect>;
7
8
  export type ParameterOption<T> = {
8
9
  name: string;
9
10
  value: T;
@@ -0,0 +1,8 @@
1
+ import { FloatNode } from "three-shader-graph";
2
+ export declare function fresnelEffect(power?: number | FloatNode): FloatNode;
3
+ /**
4
+ * Gives a factor for how shallow the depth is where 1 is the most shallow.
5
+ * This can be useful to for example create a highlight where an object intersects
6
+ * with another or to increase the transparency of water where it meets a shore.
7
+ */
8
+ export declare function edgeDepthEffect(power?: number | FloatNode): FloatNode;
@@ -0,0 +1,5 @@
1
+ import{Vec3ExpressionNode as t,attributes as r,dot as e,float as o,normalize as n,pow as c,saturate as i,uniforms as s,varyingAttributes as a,varyingVec3 as f,vec4 as p}from"three-shader-graph";import{fragmentLinearEyeDepth as u,linearEyeDepth as m}from"./depth";const d=s.modelMatrix.multiplyVec(p(r.position,1));export function fresnelEffect(s=1){const a=r.normal,f=new t("cameraPosition"),p=n(f.subtract(d.xyz())),u=o(1);return c(i(u.subtract(e(a,p))),o(s))}const h=o(1).subtract(m.subtract(u).divide(m));export function edgeDepthEffect(t=1){return c(h,o(t))}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -0,0 +1,16 @@
1
+ import { FloatNode, BooleanNode, IntNode, Vec2Node, Vec3Node, Vec4Node, Mat2Node, Mat3Node, Mat4Node, RgbNode, RgbaNode, Sampler2DNode } from "shader-nodes";
2
+ type AbstractType<T> = abstract new (...args: unknown[]) => T;
3
+ type ShaderNode = FloatNode | BooleanNode | IntNode | Vec2Node | Vec3Node | Vec4Node | Mat2Node | Mat3Node | Mat4Node | RgbNode | RgbaNode | Sampler2DNode;
4
+ /**
5
+ * Create reusable functions out of GLSL code.
6
+ * Just specify the return type, an object with the arguments and the glsl function body
7
+ * as a string.
8
+ *
9
+ * function example(uv: Vec2Node) {
10
+ * return glslFunction(Vec2Node, {uv}, `
11
+ * return uv * 1.;
12
+ * `)
13
+ * }
14
+ */
15
+ export declare function glslFunction<TReturn extends ShaderNode>(returnType: AbstractType<TReturn>, args: Record<string, ShaderNode>, body: string): TReturn;
16
+ export {};
@@ -0,0 +1,5 @@
1
+ export function glslFunction(t,e,n){const o=t.typeName;return new class extends t{compile(t){const c=`customFunction_${t.variable()}`,s=Object.entries(e).map((([t,e])=>`${e.constructor.typeName} ${t}`)).join(", "),r=Object.values(e).map((e=>t.get(e))).join(", ");return{pars:`${o} ${c}(${s}) {\n ${n}\n }`,out:`${c}(${r})`}}}}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -3,3 +3,7 @@ export { linearEyeDepth, fragmentLinearEyeDepth, depthSampler } from './depth';
3
3
  export { timeUniforms } from './time';
4
4
  export * from './layers';
5
5
  export * from './landscape';
6
+ export * from './shapes';
7
+ export * from './voronoi';
8
+ export * from './effects';
9
+ export * from './math';
@@ -1,4 +1,4 @@
1
- export*from"three-shader-graph";export{linearEyeDepth,fragmentLinearEyeDepth,depthSampler}from"./depth";export{timeUniforms}from"./time";export*from"./layers";export*from"./landscape";
1
+ export*from"three-shader-graph";export{linearEyeDepth,fragmentLinearEyeDepth,depthSampler}from"./depth";export{timeUniforms}from"./time";export*from"./layers";export*from"./landscape";export*from"./shapes";export*from"./voronoi";export*from"./effects";export*from"./math";
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -0,0 +1,2 @@
1
+ import { FloatNode, IntNode, Vec2Node, Vec3Node, Vec4Node } from "three-shader-graph";
2
+ export declare function oneMinus<T extends FloatNode | Vec2Node | Vec3Node | Vec4Node | IntNode>(value: T): T;
@@ -0,0 +1,5 @@
1
+ import{FloatNode as t,IntNode as r,Vec2Node as e,Vec3Node as n,Vec4Node as s,float as a,int as c,vec2 as u,vec3 as o,vec4 as i}from"three-shader-graph";export function oneMinus(f){switch(!0){case f instanceof t:return a(1).subtract(f);case f instanceof r:return c(1).subtract(f);case f instanceof e:return u(1,1).subtract(f);case f instanceof n:return o(1,1,1).subtract(f);case f instanceof s:return i(1,1,1,1).subtract(f)}throw"Unsupported type "+f}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -0,0 +1,6 @@
1
+ export declare const particleEnergyUniformName = "hology_particle_energy";
2
+ export declare const particleVelcoityUniformName = "hology_particle_velocity";
3
+ export declare const particleUniforms: {
4
+ energy: import("three-shader-graph").UniformFloatNode;
5
+ velocity: import("three-shader-graph").UniformVec3Node;
6
+ };
@@ -0,0 +1,5 @@
1
+ import{uniformFloat as e,uniformVec3 as o}from"three-shader-graph";export const particleEnergyUniformName="hology_particle_energy";export const particleVelcoityUniformName="hology_particle_velocity";export const particleUniforms={energy:e("hology_particle_energy"),velocity:o("hology_particle_velocity")};
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -0,0 +1,3 @@
1
+ import { FloatNode, Vec2Node } from "three-shader-graph";
2
+ export declare function rectangleFloat(uv: Vec2Node, width: FloatNode, height: FloatNode): FloatNode;
3
+ export declare function roundedRectangleFloat(uv: Vec2Node, width: FloatNode, height: FloatNode, radius: FloatNode): FloatNode;
@@ -0,0 +1,5 @@
1
+ import{float as t,length as a,min as r,max as e,saturate as c,dFdx as d,dFdy as l,abs as u,ComponentsVec2Node as n,vec2 as i}from"three-shader-graph";export function rectangleFloat(t,a,e){const o=u(t.multiplyScalar(2).subtractScalar(1)).subtract(new n(a,e)),s=i(1,1).subtract(o.divide(u(d(p=o)).add(u(l(p)))));var p;return c(r(s.x(),s.y()))}export function roundedRectangleFloat(o,s,p,b){const m=e(r(r(u(b.multiply(2)),u(s)),u(p)),t(1e-5)),v=u(o.multiplyScalar(2).subtractScalar(1)).subtract(new n(s,p)).addScalar(m),S=a(e(i(0,0),v)).divide(m);return c(t(1).subtract(S).divide(u(d(y=S)).add(u(l(y)))));var y}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -0,0 +1,5 @@
1
+ import { FloatNode, Vec2Node } from "three-shader-graph";
2
+ export declare function voronoi(uv: Vec2Node, angleOffset: FloatNode, cellDensity: FloatNode): {
3
+ noise: FloatNode;
4
+ cells: FloatNode;
5
+ };
@@ -0,0 +1,5 @@
1
+ import{select as t,length as a,ComponentsVec2Node as r,ConstantMat2Node as l,fract as d,sin as n,cos as e,vec2 as o,vec3 as u,floor as c}from"three-shader-graph";export function voronoi(i,p,m){const y=i.multiplyScalar(m),s=c(y),x=d(y),f=[-1,0,1],h=f.flatMap((t=>f.map((a=>[t,a])))).reduce(((c,[i,m])=>{const y=o(i,m),f=function(t,a){const o=new l(15.27,47.63,99.41,89.98);return t=d(n(t.multiplyMat(o)).multiplyScalar(46839.32)),new r(n(t.y().add(a)).multiply(.5).add(.5),e(t.x().add(a)).multiply(.5).add(.5))}(y.add(s),p),h=a(y.add(f).subtract(x));return t(h.lt(c.x()),u(h,f.x(),f.y()),c)}),u(8,0,0));return{noise:h.x(),cells:h.y()}}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -1,4 +1,4 @@
1
- import*as t from"three";import{Vector3 as n}from"three";export function clamp(t,n,e){return Math.max(Math.min(e,t),n)}export function byChance(t,n){Math.random()<t&&n()}export function mean(t){let n=0,e=t.length;for(;--e>=0;)n+=t[e];return t.length>0?n/t.length:0}export function meanVectors3(t){const e=new n;for(const n of t)e.add(n);return e.divideScalar(t.length),e}export function meanBottomVectors3(t){const e=new n;let o=null;for(const n of t)e.add(n),(null==o||n.y<o)&&(o=n.y);return e.divideScalar(t.length),e.y=o,e}export function meanVectors3Mapped(t,e){const o=new n,r=new n;for(const n of t)r.add(e(n,o));return r.divideScalar(t.length),r}const e=new n;export function meanVectors3withWeight(t,n,o){let r=0;for(const t of n)r+=t;e.set(0,0,0);let a=0;for(const o of t){const t=n[a]/r;e.x+=o.x*t,e.y+=o.y*t,e.z+=o.z*t,a++}return o.copy(e),o}export function randomString(t=9){return Math.random().toString(36).substr(2,t)}export function toDegrees(t){return t*(180/Math.PI)}var o=new t.Sphere;export function boundingRadius(...n){o.makeEmpty();for(var e=0;e<n.length;e++)n[e].traverse((n=>{n instanceof t.Mesh&&(n.geometry.computeBoundingSphere(),o.union(n.geometry.boundingSphere))}));return o.radius}
1
+ import*as t from"three";import{Vector3 as e}from"three";export function clamp(t,e,n){return Math.max(Math.min(n,t),e)}export function byChance(t,e){Math.random()<t&&e()}export function mean(t){let e=0,n=t.length;for(;--n>=0;)e+=t[n];return t.length>0?e/t.length:0}export function meanVectors3(t){const e=n.set(0,0,0);for(const n of t)e.add(n);return e.divideScalar(t.length),e}export function meanBottomVectors3(t){const e=n.set(0,0,0);let o=null;for(const n of t)e.add(n),(null==o||n.y<o)&&(o=n.y);return e.divideScalar(t.length),e.y=o,e}export function meanVectors3Mapped(t,n){const o=new e,r=new e;for(const e of t)r.add(n(e,o));return r.divideScalar(t.length),r}const n=new e;export function meanVectors3withWeight(t,e,o){let r=0;for(const t of e)r+=t;n.set(0,0,0);let a=0;for(const o of t){const t=e[a]/r;n.x+=o.x*t,n.y+=o.y*t,n.z+=o.z*t,a++}return o.copy(n),o}export function randomString(t=9){return Math.random().toString(36).substr(2,t)}export function toDegrees(t){return t*(180/Math.PI)}var o=new t.Sphere;export function boundingRadius(...e){o.makeEmpty();for(var n=0;n<e.length;n++)e[n].traverse((e=>{e instanceof t.Mesh&&(e.geometry.computeBoundingSphere(),o.union(e.geometry.boundingSphere))}));return o.radius}
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hology/core",
3
- "version": "0.0.27",
3
+ "version": "0.0.30",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -84,6 +84,7 @@
84
84
  "dependencies": {
85
85
  "@dimforge/rapier3d-compat": "^0.11.2",
86
86
  "@plumier/reflect": "^1.1.0",
87
+ "@types/three-nebula": "^10.0.3",
87
88
  "cannon-es": "^0.20.0",
88
89
  "cannon-es-debugger": "^1.0.0",
89
90
  "rxjs": "7.4.0",
@@ -91,7 +92,7 @@
91
92
  "three": "^0.139.0",
92
93
  "three-csm": "^3.2.0",
93
94
  "three-mesh-bvh": "^0.4.0",
94
- "three-nebula": "10.0.3",
95
+ "three-nebula": "^10.0.3",
95
96
  "three-shader-graph": "^0.1.24",
96
97
  "three-stdlib": "~2.17.3",
97
98
  "ts-key-enum": "^2.0.12",