@hology/core 0.0.159 → 0.0.161
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/trail-renderer.js +1 -1
- package/dist/effects/vfx/vfx-actor.js +1 -1
- package/dist/effects/vfx/vfx-materializer.js +1 -1
- package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -1
- package/dist/gameplay/services/physics/physics-system.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/rendering/outline-effect.d.ts +2 -2
- package/dist/rendering/outline-effect.js +1 -1
- package/dist/rendering/ssr/SSRPass.d.ts +9 -7
- package/dist/rendering/ssr/SSRPass.js +1 -1
- package/dist/rendering.d.ts +44 -1
- package/dist/rendering.js +1 -1
- package/dist/scene/batched-mesh-2.d.ts +7 -0
- package/dist/scene/batched-mesh-2.js +1 -1
- package/dist/scene/materializer.js +1 -1
- package/dist/scene/model.d.ts +2 -1
- package/dist/scene/model.js +1 -1
- package/dist/scene/sky.js +1 -1
- package/dist/shader/builtin/decal-standard-shader.js +1 -1
- package/dist/shader/decal-shader.js +1 -1
- package/dist/shader/parameter.d.ts +2 -1
- package/dist/shader-nodes/depth.d.ts +1 -0
- package/dist/shader-nodes/depth.js +1 -1
- package/dist/shader-nodes/scene-sample.d.ts +13 -1
- package/dist/shader-nodes/scene-sample.js +1 -1
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/dist/scene/sky.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 d,rgb as m,mix as c,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*Math.PI);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),f=new e.Color(13431551),u=s(i.modelMatrix.multiplyVec(n(r.position,1)).xyz),g=d(u.addScalar(a)).y,S=w(p(w(g,h(0)),h(t)),h(0)),y=n(c(m(f),m(l),S),h(1)),b=new o({color:y.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.name="default_sky",t}/*
|
|
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 d,rgb as m,mix as c,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*Math.PI);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),f=new e.Color(13431551),u=s(i.modelMatrix.multiplyVec(n(r.position,1)).xyz),g=d(u.addScalar(a)).y,S=w(p(w(g,h(0)),h(t)),h(0)),y=n(c(m(f),m(l),S),h(1)),b=new o({color:y.rgba});return b.side=e.BackSide,b.depthTest=!1,b.name="default sky",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.name="default_sky",t}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as e,__metadata as t}from"tslib";import{Color as a,Texture as s,Vector2 as
|
|
1
|
+
import{__decorate as e,__metadata as t}from"tslib";import{Color as a,Texture as s,Vector2 as r}from"three";import{colorToNormal as i,float as o,rgba as l,standardMaterial as p,textureSampler2d as n,uniforms as d,normalize as h,varying as m,rgb as c,AttributeVec3Node as y,ifDefApply as S,Vec3ExpressionNode as u,vec2 as g}from"three-shader-graph";import{decalAlpha as v,decalNormal as M,decalUV as D}from"../../shader-nodes/decal.js";import{depthWorldPosition as b}from"../../shader-nodes/depth.js";import{DecalNodeShader as f}from"../decal-shader.js";import{Parameter as I}from"../parameter.js";import{sampleScreenAO as x}from"../../shader-nodes/scene-sample.js";export class DecalStandardShader extends f{constructor(){super(...arguments),this.color=new a("#FFFFFF"),this.opacity=1,this.roughness=1,this.metalness=0,this.normalScale=new r(1,1),this.atlasSize=new r(1,1),this.atlasTile=1}output(){let e=tileUv(D,this.atlasSize,this.atlasTile);const t=m(new y("particleData"));let a=S("IS_PARTICLE",o(this.opacity),()=>t.x);null!=this.alphaMap&&(a=a.multiply(n(this.alphaMap).sample(e).r)),a=a.multiply(v);const s=m(S("IS_PARTICLE",c(this.color),()=>new u("instanceColor")));let r=S("IS_PARTICLE",c(this.color),()=>s.rgb),g=l(r,a);null!=this.colorMap&&(g=g.multiply(n(this.colorMap).sample(e)));let f=l(this.emissive,a);null!=this.emissiveMap&&(f=f.multiply(n(this.emissiveMap).sample(e)));let I=o(this.roughness);null!=this.roughnessMap&&(I=I.multiply(n(this.roughnessMap).sample(e).g));let T=o(this.metalness);null!=this.metalnessMap&&(T=T.multiply(n(this.metalnessMap).sample(e).b));let w=h(m(d.normalMatrix).multiplyVec(M));null!=this.normalMap&&(w=i(n(this.normalMap).sample(e),this.normalScale?.x??1,w,b,e));let F=null;return null!=this.aoMap&&(F=n(this.aoMap).sample(e).r),{color:p({color:l(g.rgb.multiplyScalar(x()),g.a),emissive:f,emissiveIntensity:o(this.emissiveIntensity??1),roughness:I,metalness:T,normal:w,ambientOcclusion:F,ambientOcclusionIntensity:o(this.aoMapIntensity??1),worldPosition:b}),normal:w,roughness:I}}build(){const e=super.build();return e.depthTest=!0,e.depthWrite=!1,e.userData.isDecal=!0,e}}e([I(),t("design:type",a)],DecalStandardShader.prototype,"color",void 0),e([I({range:[0,1]}),t("design:type",Number)],DecalStandardShader.prototype,"opacity",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"colorMap",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"alphaMap",void 0),e([I({range:[0,1]}),t("design:type",Number)],DecalStandardShader.prototype,"roughness",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"roughnessMap",void 0),e([I({range:[0,1]}),t("design:type",Number)],DecalStandardShader.prototype,"metalness",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"metalnessMap",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"aoMap",void 0),e([I(),t("design:type",Number)],DecalStandardShader.prototype,"aoMapIntensity",void 0),e([I(),t("design:type",a)],DecalStandardShader.prototype,"emissive",void 0),e([I({range:[0,10]}),t("design:type",Number)],DecalStandardShader.prototype,"emissiveIntensity",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"emissiveMap",void 0),e([I(),t("design:type",s)],DecalStandardShader.prototype,"normalMap",void 0),e([I(),t("design:type",r)],DecalStandardShader.prototype,"normalScale",void 0),e([I(),t("design:type",r)],DecalStandardShader.prototype,"atlasSize",void 0),e([I({range:[1,64],precision:0}),t("design:type",Number)],DecalStandardShader.prototype,"atlasTile",void 0);export function tileUv(e,t,a){if(t&&(t.x>1||t.y>1)&&t.x>0&&t.y>0&&null!=a&&a>0){const s=t.x,r=t.y;if(s>0&&r>0){const t=a-1,i=t%s,o=Math.floor(t/s);e=e.divide(g(s,r)).add(g(i/s,o/r))}}return e}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{NodeShaderMaterial as r}from"../shader-nodes/index.js";import{decalDiscard as
|
|
1
|
+
import{NodeShaderMaterial as r}from"../shader-nodes/index.js";import{decalDiscard as s}from"../shader-nodes/decal.js";export class DecalNodeShader{build(){const e=this.output();let d=s;null!=e.discard&&(d=d.or(e.discard));const a=new r({transparent:!1,...e,discard:d});return a.userData.isDecal=!0,a}}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -4,9 +4,10 @@ import { BaseActor } from '../gameplay/actors/actor.js';
|
|
|
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/index.js';
|
|
6
6
|
import { VisualEffect } from '../effects/vfx/vfx-param.js';
|
|
7
|
+
import { Prefab } from '../scene/objects/prefab.js';
|
|
7
8
|
import { Curve2 } from '../utils/curve.js';
|
|
8
9
|
import { ColorLayer, MaskLayer } from './color-layer.js';
|
|
9
|
-
export type ParameterType = Type<FloatNode | Number | Texture | Sampler2DNode | Boolean | BooleanNode | Vector2 | Vec2Node | Vector3 | Vec3Node | Vector4 | Vec4Node | Color | RgbNode | String | BaseActor | Euler | Object3D | Material | VisualEffect | Curve2 | ColorLayer | MaskLayer>;
|
|
10
|
+
export type ParameterType = Type<FloatNode | Number | Texture | Sampler2DNode | Boolean | BooleanNode | Vector2 | Vec2Node | Vector3 | Vec3Node | Vector4 | Vec4Node | Color | RgbNode | String | BaseActor | Euler | Object3D | Material | VisualEffect | Prefab | Curve2 | ColorLayer | MaskLayer>;
|
|
10
11
|
export type ParameterOption<T> = {
|
|
11
12
|
name: string;
|
|
12
13
|
value: T;
|
|
@@ -7,6 +7,7 @@ export declare const nearUniformName = "hology_camera_near";
|
|
|
7
7
|
export declare const farUniformName = "hology_camera_far";
|
|
8
8
|
export declare const sceneNormalUniformName = "hology_scene_normal_map";
|
|
9
9
|
export declare const depthSampler: import("three-shader-graph").UniformSampler2d;
|
|
10
|
+
export declare const highPrecisionEyeDepth: import("three-shader-graph").FloatAddNode;
|
|
10
11
|
export declare const fragmentLinearEyeDepth: FloatNode;
|
|
11
12
|
export declare const resolution: import("three-shader-graph").UniformVec2Node;
|
|
12
13
|
export declare const screenUV: Vec2Node;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as e from"three";import{Vector2 as t}from"three";import{cross as o,dot as r,float as n,FloatExpressionNode as s,FloatNode as c,inverse as a,normalize as i,texture2d as p,
|
|
1
|
+
import*as e from"three";import{Vector2 as t}from"three";import{cross as o,dot as r,float as n,FloatExpressionNode as s,FloatNode as c,inverse as a,normalize as i,texture2d as p,transformed as l,uniformFloat as m,uniforms as h,uniformSampler2d as u,uniformVec2 as d,unpackRGBToNormal as x,varying as f,vec2 as _,Vec2ExpressionNode as y,vec4 as U,Vec4Node as g}from"three-shader-graph";export function supportsDepthTextureExtension(e){return!0}export const depthUniformName="hology_depth_map";export const resolutionUniformName="hology_resolution";export const nearUniformName="hology_camera_near";export const farUniformName="hology_camera_far";export const sceneNormalUniformName="hology_scene_normal_map";export const depthSampler=u(depthUniformName,new e.DepthTexture(1,1));const k=m(nearUniformName,.5),$=m(farUniformName,500);class N extends c{compile(e){const t=e.variable();var o=e.get(k),r=e.get($);return{chunk:`\n float depth_${t} = 2.0 * ${o} * ${r} / (${r} + ${o} - (2.0 * ${e.get(this.depth)} - 1.0) * (${r} - ${o}));\n `,out:`depth_${t}`}}constructor(e){super(),this.depth=e}}function v(e){return new N(e)}new class extends g{constructor(){super(...arguments),this.k="31u50"}compile(e){return{pars:`\n const float UnpackDownscale_${this.k} = 255. / 256.; // 0..1 -> fraction (excluding 1)\n const vec4 PackFactors_${this.k} = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\n const vec4 UnpackFactors_${this.k} = vec4( UnpackDownscale_${this.k} / PackFactors_${this.k}.rgb, 1.0 / PackFactors_${this.k}.a );\n `,out:`UnpackFactors_${this.k}`}}};function w(e){return p(depthSampler,e).r}const V=f(h.projectionMatrix.multiplyVec(l.mvPosition).zw);export const highPrecisionEyeDepth=V.x.multiply(.5).divide(V.y).add(.5);const P=new s("gl_FragCoord.z");export const fragmentLinearEyeDepth=v(P);export const resolution=d("hology_resolution",new t(250,1e3));export const screenUV=new y("gl_FragCoord.xy").divide(resolution);export const linearEyeDepth=v(w(screenUV));const b=f(a(h.projectionMatrix)),D=f(a(h.viewMatrix));function F(e=screenUV){const t=w(e).multiply(2).subtract(1),o=e.multiplyScalar(2).subtractScalar(1),r=U(o.x,o.y,t,1),n=b.multiplyVec(r),s=n.xyz.divideScalar(n.w);return D.multiplyVec(U(s,1)).xyz}export const depthWorldPosition=F(screenUV);const S=n(1).divide(resolution.x),z=n(1).divide(resolution.y),E=F(screenUV.add(_(S,n(0)))),M=F(screenUV.add(_(n(0),z)));export const depthNormal=i(o(E.subtract(depthWorldPosition),M.subtract(depthWorldPosition)));export const sceneNormalSampler=u(sceneNormalUniformName,new e.Texture);export const sceneNormal=x(sceneNormalSampler.sample(screenUV).rgb);/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { RgbaNode, Vec2Node, Vec3ExpressionNode } from 'three-shader-graph';
|
|
1
|
+
import { FloatNode, RgbaNode, Vec2Node, Vec3ExpressionNode } from 'three-shader-graph';
|
|
2
2
|
export declare const sceneMapUniformName = "hology_scene_map";
|
|
3
3
|
export declare const sceneColorSampler: import("three-shader-graph").UniformSampler2d;
|
|
4
4
|
export declare function sampleSceneColor(uv: Vec2Node): RgbaNode;
|
|
5
5
|
export declare const fragCoord: Vec3ExpressionNode;
|
|
6
|
+
export declare const aoMapUniformName = "hology_ao_map";
|
|
7
|
+
export declare const aoColorSampler: import("three-shader-graph").UniformSampler2d;
|
|
8
|
+
/**
|
|
9
|
+
* Sample the screen ambient occlusion.
|
|
10
|
+
* This can be necessary when you want AO to appear on materails that are otherwise
|
|
11
|
+
* not included when calculating screen space ambient occlusion such as transparante
|
|
12
|
+
* meterials or those that utilize scene depth or scene color as they have to
|
|
13
|
+
* be rendered after the opaque pass.
|
|
14
|
+
* @param uv
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare function sampleScreenAO(uv?: Vec2Node): FloatNode;
|
|
6
18
|
//# sourceMappingURL=scene-sample.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{float as o,ifDefApply as e,uniformSampler2d as r,Vec3ExpressionNode as a}from"three-shader-graph";import*as p from"three";import{screenUV as t}from"./depth";export const sceneMapUniformName="hology_scene_map";export const sceneColorSampler=r("hology_scene_map",new p.Texture);export function sampleSceneColor(o){return sceneColorSampler.sample(o)}export const fragCoord=new a("gl_FragCoord");export const aoMapUniformName="hology_ao_map";export const aoColorSampler=r("hology_ao_map",new p.Texture);export function sampleScreenAO(r=t){return e("USE_SSAO_MAP",o(1),()=>aoColorSampler.sample(r).r)}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hology/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.161",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
"recast-navigation": "0.39.0",
|
|
175
175
|
"rxjs": "7.8.1",
|
|
176
176
|
"three-mesh-bvh": "^0.7.5",
|
|
177
|
-
"three-shader-graph": "^0.2.
|
|
177
|
+
"three-shader-graph": "^0.2.27",
|
|
178
178
|
"three-stdlib": "2.34.0",
|
|
179
179
|
"ts-key-enum": "^2.0.12",
|
|
180
180
|
"typedi": "^0.10.0"
|