|
@@ -13182,28 +13182,58 @@ function setValueV1i(gl, v) {
|
|
|
if (cache[0] === v) return;
|
|
|
gl.uniform1i(this.addr, v);
|
|
|
cache[0] = v;
|
|
|
-} // Single integer / boolean vector (from flat array)
|
|
|
+} // Single integer / boolean vector (from flat array or THREE.VectorN)
|
|
|
|
|
|
|
|
|
function setValueV2i(gl, v) {
|
|
|
const cache = this.cache;
|
|
|
- if (arraysEqual(cache, v)) return;
|
|
|
- gl.uniform2iv(this.addr, v);
|
|
|
- copyArray(cache, v);
|
|
|
+
|
|
|
+ if (v.x !== undefined) {
|
|
|
+ if (cache[0] !== v.x || cache[1] !== v.y) {
|
|
|
+ gl.uniform2i(this.addr, v.x, v.y);
|
|
|
+ cache[0] = v.x;
|
|
|
+ cache[1] = v.y;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arraysEqual(cache, v)) return;
|
|
|
+ gl.uniform2iv(this.addr, v);
|
|
|
+ copyArray(cache, v);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function setValueV3i(gl, v) {
|
|
|
const cache = this.cache;
|
|
|
- if (arraysEqual(cache, v)) return;
|
|
|
- gl.uniform3iv(this.addr, v);
|
|
|
- copyArray(cache, v);
|
|
|
+
|
|
|
+ if (v.x !== undefined) {
|
|
|
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
|
|
|
+ gl.uniform3i(this.addr, v.x, v.y, v.z);
|
|
|
+ cache[0] = v.x;
|
|
|
+ cache[1] = v.y;
|
|
|
+ cache[2] = v.z;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arraysEqual(cache, v)) return;
|
|
|
+ gl.uniform3iv(this.addr, v);
|
|
|
+ copyArray(cache, v);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function setValueV4i(gl, v) {
|
|
|
const cache = this.cache;
|
|
|
- if (arraysEqual(cache, v)) return;
|
|
|
- gl.uniform4iv(this.addr, v);
|
|
|
- copyArray(cache, v);
|
|
|
+
|
|
|
+ if (v.x !== undefined) {
|
|
|
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
|
|
|
+ gl.uniform4i(this.addr, v.x, v.y, v.z, v.w);
|
|
|
+ cache[0] = v.x;
|
|
|
+ cache[1] = v.y;
|
|
|
+ cache[2] = v.z;
|
|
|
+ cache[3] = v.w;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arraysEqual(cache, v)) return;
|
|
|
+ gl.uniform4iv(this.addr, v);
|
|
|
+ copyArray(cache, v);
|
|
|
+ }
|
|
|
} // Single unsigned integer
|
|
|
|
|
|
|
|
@@ -13212,28 +13242,58 @@ function setValueV1ui(gl, v) {
|
|
|
if (cache[0] === v) return;
|
|
|
gl.uniform1ui(this.addr, v);
|
|
|
cache[0] = v;
|
|
|
-} // Single unsigned integer vector (from flat array)
|
|
|
+} // Single unsigned integer vector (from flat array or THREE.VectorN)
|
|
|
|
|
|
|
|
|
function setValueV2ui(gl, v) {
|
|
|
const cache = this.cache;
|
|
|
- if (arraysEqual(cache, v)) return;
|
|
|
- gl.uniform2uiv(this.addr, v);
|
|
|
- copyArray(cache, v);
|
|
|
+
|
|
|
+ if (v.x !== undefined) {
|
|
|
+ if (cache[0] !== v.x || cache[1] !== v.y) {
|
|
|
+ gl.uniform2ui(this.addr, v.x, v.y);
|
|
|
+ cache[0] = v.x;
|
|
|
+ cache[1] = v.y;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arraysEqual(cache, v)) return;
|
|
|
+ gl.uniform2uiv(this.addr, v);
|
|
|
+ copyArray(cache, v);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function setValueV3ui(gl, v) {
|
|
|
const cache = this.cache;
|
|
|
- if (arraysEqual(cache, v)) return;
|
|
|
- gl.uniform3uiv(this.addr, v);
|
|
|
- copyArray(cache, v);
|
|
|
+
|
|
|
+ if (v.x !== undefined) {
|
|
|
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
|
|
|
+ gl.uniform3ui(this.addr, v.x, v.y, v.z);
|
|
|
+ cache[0] = v.x;
|
|
|
+ cache[1] = v.y;
|
|
|
+ cache[2] = v.z;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arraysEqual(cache, v)) return;
|
|
|
+ gl.uniform3uiv(this.addr, v);
|
|
|
+ copyArray(cache, v);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function setValueV4ui(gl, v) {
|
|
|
const cache = this.cache;
|
|
|
- if (arraysEqual(cache, v)) return;
|
|
|
- gl.uniform4uiv(this.addr, v);
|
|
|
- copyArray(cache, v);
|
|
|
+
|
|
|
+ if (v.x !== undefined) {
|
|
|
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
|
|
|
+ gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w);
|
|
|
+ cache[0] = v.x;
|
|
|
+ cache[1] = v.y;
|
|
|
+ cache[2] = v.z;
|
|
|
+ cache[3] = v.w;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arraysEqual(cache, v)) return;
|
|
|
+ gl.uniform4uiv(this.addr, v);
|
|
|
+ copyArray(cache, v);
|
|
|
+ }
|
|
|
} // Single texture (2D / Cube)
|
|
|
|
|
|
|
|
@@ -22069,6 +22129,8 @@ const _instanceWorldMatrix = /*@__PURE__*/new Matrix4();
|
|
|
|
|
|
const _instanceIntersects = [];
|
|
|
|
|
|
+const _identity = /*@__PURE__*/new Matrix4();
|
|
|
+
|
|
|
const _mesh = /*@__PURE__*/new Mesh();
|
|
|
|
|
|
class InstancedMesh extends Mesh {
|
|
@@ -22079,6 +22141,10 @@ class InstancedMesh extends Mesh {
|
|
|
this.instanceColor = null;
|
|
|
this.count = count;
|
|
|
this.frustumCulled = false;
|
|
|
+
|
|
|
+ for (let i = 0; i < count; i++) {
|
|
|
+ this.setMatrixAt(i, _identity);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
copy(source, recursive) {
|