@woosh/meep-engine 2.119.50 → 2.119.52
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/package.json +1 -1
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.frag.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js +15 -1
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.js +2 -2
- package/src/engine/graphics/sh3/shader/visualize.frag.d.ts +3 -0
- package/src/engine/graphics/sh3/shader/visualize.frag.d.ts.map +1 -0
- package/src/engine/graphics/sh3/shader/{visualize.frag.glsl → visualize.frag.js} +4 -1
- package/src/engine/graphics/sh3/shader/visualize.vert.d.ts +3 -0
- package/src/engine/graphics/sh3/shader/visualize.vert.d.ts.map +1 -0
- package/src/engine/graphics/sh3/shader/{visualize.vert.glsl → visualize.vert.js} +4 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate_path_traced_scene_from_ecd.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"populate_path_traced_scene_from_ecd.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,+GAkDC"}
|
|
@@ -4,6 +4,7 @@ import { Light } from "../../ecs/light/Light.js";
|
|
|
4
4
|
import { LightType } from "../../ecs/light/LightType.js";
|
|
5
5
|
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
6
6
|
import { DirectionalLight } from "../../render/forward_plus/model/DirectionalLight.js";
|
|
7
|
+
import { PointLight } from "../../render/forward_plus/model/PointLight.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
@@ -35,7 +36,8 @@ export function populate_path_traced_scene_from_ecd(ecd, scene) {
|
|
|
35
36
|
*/
|
|
36
37
|
(light, transform) => {
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
const type = light.type.getValue();
|
|
40
|
+
if (type === LightType.DIRECTION) {
|
|
39
41
|
|
|
40
42
|
const l = new DirectionalLight();
|
|
41
43
|
|
|
@@ -44,6 +46,18 @@ export function populate_path_traced_scene_from_ecd(ecd, scene) {
|
|
|
44
46
|
l.intensity.copy(light.intensity);
|
|
45
47
|
|
|
46
48
|
scene.addLight(l);
|
|
49
|
+
|
|
50
|
+
}else if(type === LightType.POINT){
|
|
51
|
+
|
|
52
|
+
const l = new PointLight();
|
|
53
|
+
|
|
54
|
+
l.color.copy(light.color);
|
|
55
|
+
l.position.copy(transform.position);
|
|
56
|
+
l.intensity.copy(light.intensity);
|
|
57
|
+
l.radius.copy(light.distance);
|
|
58
|
+
|
|
59
|
+
scene.addLight(l);
|
|
60
|
+
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShaderMaterial, Vector3 } from "three";
|
|
2
|
-
import shader_fg from './visualize.frag.
|
|
3
|
-
import shader_vx from './visualize.vert.
|
|
2
|
+
import shader_fg from './visualize.frag.js';
|
|
3
|
+
import shader_vx from './visualize.vert.js';
|
|
4
4
|
|
|
5
5
|
export class SH3VisualisationMaterial extends ShaderMaterial {
|
|
6
6
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: "\n#define RECIPROCAL_PI 0.318309886\n\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n // matrix is assumed to be orthogonal\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\n\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n // normal is assumed to have unit length\n float x = normal.x, y = normal.y, z = normal.z;\n\n // band 0\n vec3 result = shCoefficients[ 0 ] * 0.8862269254527579;\n\n // band 1\n result -= shCoefficients[ 1 ] * 1.0233267079464885 * y;\n result += shCoefficients[ 2 ] * 1.0233267079464885 * z;\n result -= shCoefficients[ 3 ] * 1.0233267079464885 * x;\n\n // band 2\n result += shCoefficients[ 4 ] * 0.8580855308097834 * x * y;\n result -= shCoefficients[ 5 ] * 0.8580855308097834 * y * z;\n result += shCoefficients[ 6 ] * ( 0.7431238683011272 * z * z - 0.24770795610037571 );\n result -= shCoefficients[ 7 ] * 0.8580855308097834 * x * z;\n result += shCoefficients[ 8 ] * 0.4290427654048917 * ( x * x - y * y );\n\n return result;\n}\n\nuniform vec3 sh[ 9 ]; // sh coefficients\nuniform float intensity; // light probe intensity\nvarying vec3 vNormal;\n\nvoid main() {\n vec3 normal = normalize( vNormal );\n vec3 worldNormal = normalize(inverseTransformDirection( normal, viewMatrix ));\n vec3 irradiance = shGetIrradianceAt( worldNormal, sh );\n vec3 outgoingLight = 1.0 * irradiance * intensity;\n gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=visualize.frag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualize.frag.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/shader/visualize.frag.js"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// language=GLSL
|
|
2
|
+
export default `
|
|
1
3
|
#define RECIPROCAL_PI 0.318309886
|
|
2
4
|
|
|
3
5
|
vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
|
|
@@ -38,4 +40,5 @@ void main() {
|
|
|
38
40
|
vec3 irradiance = shGetIrradianceAt( worldNormal, sh );
|
|
39
41
|
vec3 outgoingLight = 1.0 * irradiance * intensity;
|
|
40
42
|
gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );
|
|
41
|
-
}
|
|
43
|
+
}
|
|
44
|
+
`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: "\nvarying vec3 vNormal;\n\nvoid main() {\n\n vNormal = normalize( normalMatrix * normal );\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n}\n";
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=visualize.vert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualize.vert.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/shader/visualize.vert.js"],"names":[],"mappings":""}
|