@woosh/meep-engine 2.119.51 → 2.119.53

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.119.51",
8
+ "version": "2.119.53",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,5 +1,5 @@
1
1
  import {System} from "../../../../ecs/System";
2
- import {ShadedGeometry} from "../../mesh-v2/ShadedGeometry";
2
+ import {ShadedGeometry} from "../../mesh-v2/ShadedGeometry.js";
3
3
  import Highlight from "../Highlight";
4
4
  import Engine from "../../../../Engine";
5
5
 
@@ -1,26 +1,153 @@
1
- import {BufferGeometry, Material} from "three";
2
- import {AABB3} from "../../../../core/geom/3d/aabb/AABB3";
3
- import {DrawMode} from "./DrawMode";
4
-
5
- export class ShadedGeometry {
6
- geometry: BufferGeometry
7
- material: Material
8
- draw_method: number
9
- flags: number
10
-
11
- readonly mode: DrawMode
12
-
13
- getBoundingBox(destination: AABB3): void
14
-
15
- from(geometry: BufferGeometry, material: Material, draw_mode?: DrawMode): void
16
-
17
- copy(other: ShadedGeometry): void
18
-
19
- clone(): ShadedGeometry
20
-
21
- equals(other: ShadedGeometry): boolean
22
-
23
- hash(): number
24
-
25
- static from(geometry: BufferGeometry, material: Material, draw_mode?: DrawMode): ShadedGeometry
26
- }
1
+ /**
2
+ * Represents a primitive 3d object, a combination of a material and geometry
3
+ * This is roughly equivalent to single draw call, note that his is not a hierarchical data structure, if you want that - you will need to combine multiple entities, each with a `ShadedGeometry` component
4
+ */
5
+ export class ShadedGeometry {
6
+ /**
7
+ *
8
+ * @param {THREE.BufferGeometry} geometry
9
+ * @param {THREE.Material} material
10
+ * @param {DrawMode} [draw_mode]
11
+ * @return {ShadedGeometry}
12
+ */
13
+ static from(geometry: THREE.BufferGeometry, material: THREE.Material, draw_mode?: DrawMode): ShadedGeometry;
14
+ /**
15
+ *
16
+ * @type {THREE.BufferGeometry|null}
17
+ */
18
+ geometry: THREE.BufferGeometry | null;
19
+ /**
20
+ *
21
+ * @type {THREE.Material|null}
22
+ */
23
+ material: THREE.Material | null;
24
+ /**
25
+ * Optional extra material used for shadowmaps
26
+ * @type {THREE.Material|null}
27
+ */
28
+ depth_material: THREE.Material | null;
29
+ __bvh_leaf: BvhClient;
30
+ /**
31
+ * Transient, assigned in the system
32
+ * @type {number}
33
+ * @private
34
+ */
35
+ private __entity;
36
+ /**
37
+ * Transient, cached for convenience. Associated transform component from the same entity
38
+ * @type {Transform|null}
39
+ * @private
40
+ */
41
+ private __c_transform;
42
+ /**
43
+ *
44
+ * @type {DrawMode|number}
45
+ */
46
+ mode: DrawMode | number;
47
+ /**
48
+ * Transient property signifying how to render object, such as using INSTANCED draw
49
+ * @type {number}
50
+ */
51
+ draw_method: number;
52
+ /**
53
+ *
54
+ * @type {number}
55
+ */
56
+ flags: number;
57
+ /**
58
+ * @deprecated
59
+ * @private
60
+ */
61
+ private get __cached_object();
62
+ /**
63
+ *
64
+ * @param {number|ShadedGeometryFlags} flag
65
+ * @returns {void}
66
+ */
67
+ setFlag(flag: number | ShadedGeometryFlags): void;
68
+ /**
69
+ *
70
+ * @param {number|ShadedGeometryFlags} flag
71
+ * @returns {void}
72
+ */
73
+ clearFlag(flag: number | ShadedGeometryFlags): void;
74
+ /**
75
+ *
76
+ * @param {number|ShadedGeometryFlags} flag
77
+ * @param {boolean} value
78
+ */
79
+ writeFlag(flag: number | ShadedGeometryFlags, value: boolean): void;
80
+ /**
81
+ *
82
+ * @param {number|ShadedGeometryFlags} flag
83
+ * @returns {boolean}
84
+ */
85
+ getFlag(flag: number | ShadedGeometryFlags): boolean;
86
+ /**
87
+ *
88
+ * @return {number}
89
+ */
90
+ hash(): number;
91
+ /**
92
+ *
93
+ * @param {ShadedGeometry} other
94
+ * @returns {boolean}
95
+ */
96
+ equals(other: ShadedGeometry): boolean;
97
+ /**
98
+ *
99
+ * @param {ShadedGeometry} other
100
+ */
101
+ copy(other: ShadedGeometry): void;
102
+ /**
103
+ *
104
+ * @returns {ShadedGeometry}
105
+ */
106
+ clone(): ShadedGeometry;
107
+ /**
108
+ * Current cached entity that this component is attached to
109
+ * @return {number}
110
+ */
111
+ get entity(): number;
112
+ /**
113
+ * Global transform matrix
114
+ * 4x4 matrix
115
+ * @return {null|number[]}
116
+ */
117
+ get transform(): number[];
118
+ /**
119
+ * @deprecated
120
+ */
121
+ get bvh(): void;
122
+ /**
123
+ *
124
+ * @param {AABB3} destination
125
+ */
126
+ getBoundingBox(destination: AABB3): void;
127
+ /**
128
+ *
129
+ * @param {THREE.BufferGeometry} geometry
130
+ * @param {THREE.Material} material
131
+ * @param {DrawMode} [draw_mode]
132
+ */
133
+ from(geometry: THREE.BufferGeometry, material: THREE.Material, draw_mode?: DrawMode): void;
134
+ updateTransform(): void;
135
+ update_bounds(): void;
136
+ /**
137
+ *
138
+ * @param {SurfacePoint3} contact if found, contact is written here
139
+ * @param {ArrayLike<number>|number[]|Float32Array} ray 6-tuple: [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
140
+ * @param {ArrayLike<number>|number[]|Float32Array} transform_matrix4 transform applied to the geometry
141
+ * @returns {boolean}
142
+ */
143
+ query_raycast_nearest(contact: SurfacePoint3, ray: ArrayLike<number> | number[] | Float32Array, transform_matrix4: ArrayLike<number> | number[] | Float32Array): boolean;
144
+ }
145
+ export namespace ShadedGeometry {
146
+ let typeName: string;
147
+ let serializable: boolean;
148
+ }
149
+ import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
150
+ import { DrawMode } from "./DrawMode.js";
151
+ import { ShadedGeometryFlags } from "./ShadedGeometryFlags.js";
152
+ import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
153
+ //# sourceMappingURL=ShadedGeometry.d.ts.map
@@ -2,7 +2,7 @@ import {BVH} from "../../../../core/bvh2/bvh3/BVH";
2
2
  import {SurfacePoint3} from "../../../../core/geom/3d/SurfacePoint3";
3
3
  import {System} from "../../../ecs/System";
4
4
  import Engine from "../../../Engine";
5
- import {ShadedGeometry} from "./ShadedGeometry";
5
+ import {ShadedGeometry} from "./ShadedGeometry.js";
6
6
 
7
7
  export class ShadedGeometrySystem extends System<ShadedGeometry> {
8
8
  constructor(engine: Engine)
@@ -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":"AAOA;;;;GAIG;AACH,+GAqCC"}
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
- if (light.type.getValue() === LightType.DIRECTION) {
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
  });