@woosh/meep-engine 2.34.37 → 2.34.38

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.
@@ -23,5 +23,5 @@ export function aabb3_computeDistanceAbovePlane(
23
23
  const pz = plane_normal_z > 0 ? _z1 : _z0;
24
24
 
25
25
  // dot(v4,v4) inlined for speed
26
- return (plane_normal_x * px + plane_normal_y * py + plane_normal_z * pz) + plane_constant;
26
+ return plane_constant + plane_normal_x * px + plane_normal_y * py + plane_normal_z * pz;
27
27
  }
@@ -176,7 +176,7 @@ export class InstancedFoliage {
176
176
  );
177
177
 
178
178
  //compute bounding box for this instance
179
- this.bomputeInstanceBoundsTight(position, rotation, scale, leaf);
179
+ this.computeInstanceBoundsTight(position, rotation, scale, leaf);
180
180
 
181
181
  //insert bounding box into the spatial index
182
182
  this.bvh.insertNode(leaf);
@@ -218,7 +218,7 @@ export class InstancedFoliage {
218
218
  * @param {Quaternion} rotation
219
219
  * @param {Vector3} scale
220
220
  */
221
- bomputeInstanceBoundsTight(position, rotation, scale, result) {
221
+ computeInstanceBoundsTight(position, rotation, scale, result) {
222
222
 
223
223
  const vertexData = this.geometry.attributes.position.array;
224
224
 
@@ -1,6 +1,5 @@
1
1
  import { BitSet } from "../../../core/binary/BitSet.js";
2
2
  import { InstancedMeshGroup } from "../../graphics/geometry/instancing/InstancedMeshGroup.js";
3
- import { assert } from "../../../core/assert.js";
4
3
  import { queryBinaryNode_FrustumIntersections_Data } from "../../../core/bvh2/traversal/queryBinaryNode_FrustumIntersections.js";
5
4
  import Quaternion from "../../../core/geom/Quaternion.js";
6
5
 
@@ -48,30 +47,6 @@ export class ViewState {
48
47
  this.instances.dispose();
49
48
  }
50
49
 
51
-
52
- /**
53
- *
54
- * @param {number} index
55
- * @param {int} ref
56
- */
57
- __updateVisibility(index, ref) {
58
- assert.isNonNegativeInteger(ref, 'ref');
59
-
60
- /**
61
- *
62
- * @type {BitSet}
63
- */
64
- const visibleElementSet = this.__visible_set;
65
-
66
- if (!visibleElementSet.get(ref)) {
67
- //no longer visible
68
- this.__garbage[this.__garbagePointer++] = ref;
69
- } else {
70
- //visible, and is already in the group, update the set
71
- visibleElementSet.set(ref, false);
72
- }
73
- }
74
-
75
50
  __compute_visibility_update() {
76
51
  const instances = this.instances;
77
52
 
@@ -127,16 +102,16 @@ export class ViewState {
127
102
  */
128
103
  update(bvh, data) {
129
104
 
105
+ const visible_instance_set = this.__visible_set;
106
+
107
+ const instances = this.instances;
108
+
130
109
  // reset visible set
131
- this.__visible_set.reset();
110
+ visible_instance_set.reset();
132
111
 
133
112
  //reset garbage pointer
134
113
  this.__garbagePointer = 0;
135
114
 
136
- const instances = this.instances;
137
-
138
- const visible_instance_set = this.__visible_set;
139
-
140
115
 
141
116
  // collect visible instances
142
117
  const collected_nodes = queryBinaryNode_FrustumIntersections_Data(scratch_array, 0, bvh, this.__view.frustum);
@@ -44,8 +44,30 @@ function __getDepthMaterial(object) {
44
44
  * @return {boolean}
45
45
  */
46
46
  function scene_object_filter(object3D) {
47
- return object3D.castShadow
48
- && object3D.visible
47
+
48
+ if (object3D.castShadow === false) {
49
+ return false;
50
+ }
51
+
52
+ if (object3D.visible === false) {
53
+ return false;
54
+ }
55
+
56
+ if (object3D.isMesh) {
57
+
58
+ /**
59
+ * @type {THREE.Material|null|undefined}
60
+ */
61
+ const material = (object3D.customDepthMaterial !== null ? object3D.customDepthMaterial : object3D.material);
62
+
63
+ if (material && material.visible === false) {
64
+ //material's main
65
+ return false;
66
+ }
67
+
68
+ }
69
+
70
+ return true;
49
71
  }
50
72
 
51
73
  export class ThreeLightBinding extends LightBinding {
@@ -274,7 +274,7 @@ export class InstancedMeshGroup {
274
274
  //get index
275
275
  const index = this.count;
276
276
  //grow
277
- this.setCount(this.count + 1);
277
+ this.setCount(index + 1);
278
278
 
279
279
  this.indices[reference] = index;
280
280
  this.references[index] = reference;
@@ -68,13 +68,6 @@ export class MicronGeometryPatch {
68
68
  */
69
69
  this.children = [];
70
70
 
71
- /**
72
- * Runtime dependency patches, if this patch is refined at runtime - dependencies must be refined as well
73
- * These dependencies allow for more aggressive simplification of topology
74
- * @type {number[]}
75
- */
76
- this.dependencies = [];
77
-
78
71
  /**
79
72
  * Level of detail, lower number means more detailed
80
73
  * @type {number}
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.34.37",
8
+ "version": "2.34.38",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",