|
@@ -1367,6 +1367,10 @@ function toComponents(source, target) {
|
|
|
|
|
|
class Color {
|
|
|
constructor(r, g, b) {
|
|
|
+ this.r = 1;
|
|
|
+ this.g = 1;
|
|
|
+ this.b = 1;
|
|
|
+
|
|
|
if (g === undefined && b === undefined) {
|
|
|
// r is THREE.Color, hex or string
|
|
|
return this.set(r);
|
|
@@ -1756,9 +1760,6 @@ class Color {
|
|
|
|
|
|
Color.NAMES = _colorKeywords;
|
|
|
Color.prototype.isColor = true;
|
|
|
-Color.prototype.r = 1;
|
|
|
-Color.prototype.g = 1;
|
|
|
-Color.prototype.b = 1;
|
|
|
|
|
|
let _canvas;
|
|
|
|
|
@@ -13783,35 +13784,44 @@ function getPureArraySetter(type) {
|
|
|
} // --- Uniform Classes ---
|
|
|
|
|
|
|
|
|
-function SingleUniform(id, activeInfo, addr) {
|
|
|
- this.id = id;
|
|
|
- this.addr = addr;
|
|
|
- this.cache = [];
|
|
|
- this.setValue = getSingularSetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
|
|
|
-}
|
|
|
+class SingleUniform {
|
|
|
+ constructor(id, activeInfo, addr) {
|
|
|
+ this.id = id;
|
|
|
+ this.addr = addr;
|
|
|
+ this.cache = [];
|
|
|
+ this.setValue = getSingularSetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
|
|
|
+ }
|
|
|
|
|
|
-function PureArrayUniform(id, activeInfo, addr) {
|
|
|
- this.id = id;
|
|
|
- this.addr = addr;
|
|
|
- this.cache = [];
|
|
|
- this.size = activeInfo.size;
|
|
|
- this.setValue = getPureArraySetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
|
|
|
}
|
|
|
|
|
|
-function StructuredUniform(id) {
|
|
|
- this.id = id;
|
|
|
- this.seq = [];
|
|
|
- this.map = {};
|
|
|
+class PureArrayUniform {
|
|
|
+ constructor(id, activeInfo, addr) {
|
|
|
+ this.id = id;
|
|
|
+ this.addr = addr;
|
|
|
+ this.cache = [];
|
|
|
+ this.size = activeInfo.size;
|
|
|
+ this.setValue = getPureArraySetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-StructuredUniform.prototype.setValue = function (gl, value, textures) {
|
|
|
- const seq = this.seq;
|
|
|
+class StructuredUniform {
|
|
|
+ constructor(id) {
|
|
|
+ this.id = id;
|
|
|
+ this.seq = [];
|
|
|
+ this.map = {};
|
|
|
+ }
|
|
|
+
|
|
|
+ setValue(gl, value, textures) {
|
|
|
+ const seq = this.seq;
|
|
|
|
|
|
- for (let i = 0, n = seq.length; i !== n; ++i) {
|
|
|
- const u = seq[i];
|
|
|
- u.setValue(gl, value[u.id], textures);
|
|
|
+ for (let i = 0, n = seq.length; i !== n; ++i) {
|
|
|
+ const u = seq[i];
|
|
|
+ u.setValue(gl, value[u.id], textures);
|
|
|
+ }
|
|
|
}
|
|
|
-}; // --- Top-level ---
|
|
|
+
|
|
|
+} // --- Top-level ---
|
|
|
// Parser - builds up the property tree from the path strings
|
|
|
|
|
|
|
|
@@ -13863,51 +13873,53 @@ function parseUniform(activeInfo, addr, container) {
|
|
|
} // Root Container
|
|
|
|
|
|
|
|
|
-function WebGLUniforms(gl, program) {
|
|
|
- this.seq = [];
|
|
|
- this.map = {};
|
|
|
- const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
|
|
|
+class WebGLUniforms {
|
|
|
+ constructor(gl, program) {
|
|
|
+ this.seq = [];
|
|
|
+ this.map = {};
|
|
|
+ const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
|
|
|
|
|
|
- for (let i = 0; i < n; ++i) {
|
|
|
- const info = gl.getActiveUniform(program, i),
|
|
|
- addr = gl.getUniformLocation(program, info.name);
|
|
|
- parseUniform(info, addr, this);
|
|
|
+ for (let i = 0; i < n; ++i) {
|
|
|
+ const info = gl.getActiveUniform(program, i),
|
|
|
+ addr = gl.getUniformLocation(program, info.name);
|
|
|
+ parseUniform(info, addr, this);
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-WebGLUniforms.prototype.setValue = function (gl, name, value, textures) {
|
|
|
- const u = this.map[name];
|
|
|
- if (u !== undefined) u.setValue(gl, value, textures);
|
|
|
-};
|
|
|
-
|
|
|
-WebGLUniforms.prototype.setOptional = function (gl, object, name) {
|
|
|
- const v = object[name];
|
|
|
- if (v !== undefined) this.setValue(gl, name, v);
|
|
|
-}; // Static interface
|
|
|
+ setValue(gl, name, value, textures) {
|
|
|
+ const u = this.map[name];
|
|
|
+ if (u !== undefined) u.setValue(gl, value, textures);
|
|
|
+ }
|
|
|
|
|
|
+ setOptional(gl, object, name) {
|
|
|
+ const v = object[name];
|
|
|
+ if (v !== undefined) this.setValue(gl, name, v);
|
|
|
+ }
|
|
|
|
|
|
-WebGLUniforms.upload = function (gl, seq, values, textures) {
|
|
|
- for (let i = 0, n = seq.length; i !== n; ++i) {
|
|
|
- const u = seq[i],
|
|
|
- v = values[u.id];
|
|
|
+ static upload(gl, seq, values, textures) {
|
|
|
+ for (let i = 0, n = seq.length; i !== n; ++i) {
|
|
|
+ const u = seq[i],
|
|
|
+ v = values[u.id];
|
|
|
|
|
|
- if (v.needsUpdate !== false) {
|
|
|
- // note: always updating when .needsUpdate is undefined
|
|
|
- u.setValue(gl, v.value, textures);
|
|
|
+ if (v.needsUpdate !== false) {
|
|
|
+ // note: always updating when .needsUpdate is undefined
|
|
|
+ u.setValue(gl, v.value, textures);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
|
|
|
-WebGLUniforms.seqWithValue = function (seq, values) {
|
|
|
- const r = [];
|
|
|
+ static seqWithValue(seq, values) {
|
|
|
+ const r = [];
|
|
|
|
|
|
- for (let i = 0, n = seq.length; i !== n; ++i) {
|
|
|
- const u = seq[i];
|
|
|
- if (u.id in values) r.push(u);
|
|
|
+ for (let i = 0, n = seq.length; i !== n; ++i) {
|
|
|
+ const u = seq[i];
|
|
|
+ if (u.id in values) r.push(u);
|
|
|
+ }
|
|
|
+
|
|
|
+ return r;
|
|
|
}
|
|
|
|
|
|
- return r;
|
|
|
-};
|
|
|
+}
|
|
|
|
|
|
function WebGLShader(gl, type, string) {
|
|
|
const shader = gl.createShader(type);
|
|
@@ -19228,10 +19240,9 @@ function WebGLRenderer(parameters = {}) {
|
|
|
this.toneMapping = NoToneMapping;
|
|
|
this.toneMappingExposure = 1.0; //
|
|
|
|
|
|
- Object.defineProperties(WebGLRenderer.prototype, {
|
|
|
+ Object.defineProperties(this, {
|
|
|
// @deprecated since r136, 0e21088102b4de7e0a0a33140620b7a3424b9e6d
|
|
|
gammaFactor: {
|
|
|
- configurable: true,
|
|
|
get: function () {
|
|
|
console.warn('THREE.WebGLRenderer: .gammaFactor has been removed.');
|
|
|
return 2;
|
|
@@ -28828,7 +28839,7 @@ class HemisphereLight extends Light {
|
|
|
}
|
|
|
|
|
|
copy(source) {
|
|
|
- Light.prototype.copy.call(this, source);
|
|
|
+ super.copy(source);
|
|
|
this.groundColor.copy(source.groundColor);
|
|
|
return this;
|
|
|
}
|
|
@@ -29919,7 +29930,7 @@ class ObjectLoader extends Loader {
|
|
|
let hasImages = false;
|
|
|
|
|
|
for (const uuid in images) {
|
|
|
- if (images[uuid] instanceof HTMLImageElement) {
|
|
|
+ if (images[uuid].data instanceof HTMLImageElement) {
|
|
|
hasImages = true;
|
|
|
break;
|
|
|
}
|