|
@@ -8556,143 +8556,144 @@
|
|
|
* }
|
|
|
*/
|
|
|
|
|
|
- function ShaderMaterial(parameters) {
|
|
|
- Material.call(this);
|
|
|
- this.type = 'ShaderMaterial';
|
|
|
- this.defines = {};
|
|
|
- this.uniforms = {};
|
|
|
- this.vertexShader = default_vertex;
|
|
|
- this.fragmentShader = default_fragment;
|
|
|
- this.linewidth = 1;
|
|
|
- this.wireframe = false;
|
|
|
- this.wireframeLinewidth = 1;
|
|
|
- this.fog = false; // set to use scene fog
|
|
|
-
|
|
|
- this.lights = false; // set to use scene lights
|
|
|
-
|
|
|
- this.clipping = false; // set to use user-defined clipping planes
|
|
|
-
|
|
|
- this.skinning = false; // set to use skinning attribute streams
|
|
|
-
|
|
|
- this.morphTargets = false; // set to use morph targets
|
|
|
-
|
|
|
- this.morphNormals = false; // set to use morph normals
|
|
|
-
|
|
|
- this.extensions = {
|
|
|
- derivatives: false,
|
|
|
- // set to use derivatives
|
|
|
- fragDepth: false,
|
|
|
- // set to use fragment depth values
|
|
|
- drawBuffers: false,
|
|
|
- // set to use draw buffers
|
|
|
- shaderTextureLOD: false // set to use shader texture LOD
|
|
|
-
|
|
|
- }; // When rendered geometry doesn't include these attributes but the material does,
|
|
|
- // use these default values in WebGL. This avoids errors when buffer data is missing.
|
|
|
-
|
|
|
- this.defaultAttributeValues = {
|
|
|
- 'color': [1, 1, 1],
|
|
|
- 'uv': [0, 0],
|
|
|
- 'uv2': [0, 0]
|
|
|
- };
|
|
|
- this.index0AttributeName = undefined;
|
|
|
- this.uniformsNeedUpdate = false;
|
|
|
- this.glslVersion = null;
|
|
|
+ class ShaderMaterial extends Material {
|
|
|
+ constructor(parameters) {
|
|
|
+ super();
|
|
|
+ this.type = 'ShaderMaterial';
|
|
|
+ this.defines = {};
|
|
|
+ this.uniforms = {};
|
|
|
+ this.vertexShader = default_vertex;
|
|
|
+ this.fragmentShader = default_fragment;
|
|
|
+ this.linewidth = 1;
|
|
|
+ this.wireframe = false;
|
|
|
+ this.wireframeLinewidth = 1;
|
|
|
+ this.fog = false; // set to use scene fog
|
|
|
|
|
|
- if (parameters !== undefined) {
|
|
|
- if (parameters.attributes !== undefined) {
|
|
|
- console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.');
|
|
|
- }
|
|
|
+ this.lights = false; // set to use scene lights
|
|
|
|
|
|
- this.setValues(parameters);
|
|
|
- }
|
|
|
- }
|
|
|
+ this.clipping = false; // set to use user-defined clipping planes
|
|
|
|
|
|
- ShaderMaterial.prototype = Object.create(Material.prototype);
|
|
|
- ShaderMaterial.prototype.constructor = ShaderMaterial;
|
|
|
- ShaderMaterial.prototype.isShaderMaterial = true;
|
|
|
+ this.skinning = false; // set to use skinning attribute streams
|
|
|
|
|
|
- ShaderMaterial.prototype.copy = function (source) {
|
|
|
- Material.prototype.copy.call(this, source);
|
|
|
- this.fragmentShader = source.fragmentShader;
|
|
|
- this.vertexShader = source.vertexShader;
|
|
|
- this.uniforms = cloneUniforms(source.uniforms);
|
|
|
- this.defines = Object.assign({}, source.defines);
|
|
|
- this.wireframe = source.wireframe;
|
|
|
- this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
- this.lights = source.lights;
|
|
|
- this.clipping = source.clipping;
|
|
|
- this.skinning = source.skinning;
|
|
|
- this.morphTargets = source.morphTargets;
|
|
|
- this.morphNormals = source.morphNormals;
|
|
|
- this.extensions = Object.assign({}, source.extensions);
|
|
|
- this.glslVersion = source.glslVersion;
|
|
|
- return this;
|
|
|
- };
|
|
|
+ this.morphTargets = false; // set to use morph targets
|
|
|
|
|
|
- ShaderMaterial.prototype.toJSON = function (meta) {
|
|
|
- const data = Material.prototype.toJSON.call(this, meta);
|
|
|
- data.glslVersion = this.glslVersion;
|
|
|
- data.uniforms = {};
|
|
|
+ this.morphNormals = false; // set to use morph normals
|
|
|
|
|
|
- for (const name in this.uniforms) {
|
|
|
- const uniform = this.uniforms[name];
|
|
|
- const value = uniform.value;
|
|
|
+ this.extensions = {
|
|
|
+ derivatives: false,
|
|
|
+ // set to use derivatives
|
|
|
+ fragDepth: false,
|
|
|
+ // set to use fragment depth values
|
|
|
+ drawBuffers: false,
|
|
|
+ // set to use draw buffers
|
|
|
+ shaderTextureLOD: false // set to use shader texture LOD
|
|
|
|
|
|
- if (value && value.isTexture) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 't',
|
|
|
- value: value.toJSON(meta).uuid
|
|
|
- };
|
|
|
- } else if (value && value.isColor) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 'c',
|
|
|
- value: value.getHex()
|
|
|
- };
|
|
|
- } else if (value && value.isVector2) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 'v2',
|
|
|
- value: value.toArray()
|
|
|
- };
|
|
|
- } else if (value && value.isVector3) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 'v3',
|
|
|
- value: value.toArray()
|
|
|
- };
|
|
|
- } else if (value && value.isVector4) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 'v4',
|
|
|
- value: value.toArray()
|
|
|
- };
|
|
|
- } else if (value && value.isMatrix3) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 'm3',
|
|
|
- value: value.toArray()
|
|
|
- };
|
|
|
- } else if (value && value.isMatrix4) {
|
|
|
- data.uniforms[name] = {
|
|
|
- type: 'm4',
|
|
|
- value: value.toArray()
|
|
|
- };
|
|
|
- } else {
|
|
|
- data.uniforms[name] = {
|
|
|
- value: value
|
|
|
- }; // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far
|
|
|
+ }; // When rendered geometry doesn't include these attributes but the material does,
|
|
|
+ // use these default values in WebGL. This avoids errors when buffer data is missing.
|
|
|
+
|
|
|
+ this.defaultAttributeValues = {
|
|
|
+ 'color': [1, 1, 1],
|
|
|
+ 'uv': [0, 0],
|
|
|
+ 'uv2': [0, 0]
|
|
|
+ };
|
|
|
+ this.index0AttributeName = undefined;
|
|
|
+ this.uniformsNeedUpdate = false;
|
|
|
+ this.glslVersion = null;
|
|
|
+
|
|
|
+ if (parameters !== undefined) {
|
|
|
+ if (parameters.attributes !== undefined) {
|
|
|
+ console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.setValues(parameters);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (Object.keys(this.defines).length > 0) data.defines = this.defines;
|
|
|
- data.vertexShader = this.vertexShader;
|
|
|
- data.fragmentShader = this.fragmentShader;
|
|
|
- const extensions = {};
|
|
|
+ copy(source) {
|
|
|
+ super.copy(source);
|
|
|
+ this.fragmentShader = source.fragmentShader;
|
|
|
+ this.vertexShader = source.vertexShader;
|
|
|
+ this.uniforms = cloneUniforms(source.uniforms);
|
|
|
+ this.defines = Object.assign({}, source.defines);
|
|
|
+ this.wireframe = source.wireframe;
|
|
|
+ this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
+ this.lights = source.lights;
|
|
|
+ this.clipping = source.clipping;
|
|
|
+ this.skinning = source.skinning;
|
|
|
+ this.morphTargets = source.morphTargets;
|
|
|
+ this.morphNormals = source.morphNormals;
|
|
|
+ this.extensions = Object.assign({}, source.extensions);
|
|
|
+ this.glslVersion = source.glslVersion;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ toJSON(meta) {
|
|
|
+ const data = super.toJSON(meta);
|
|
|
+ data.glslVersion = this.glslVersion;
|
|
|
+ data.uniforms = {};
|
|
|
+
|
|
|
+ for (const name in this.uniforms) {
|
|
|
+ const uniform = this.uniforms[name];
|
|
|
+ const value = uniform.value;
|
|
|
+
|
|
|
+ if (value && value.isTexture) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 't',
|
|
|
+ value: value.toJSON(meta).uuid
|
|
|
+ };
|
|
|
+ } else if (value && value.isColor) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 'c',
|
|
|
+ value: value.getHex()
|
|
|
+ };
|
|
|
+ } else if (value && value.isVector2) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 'v2',
|
|
|
+ value: value.toArray()
|
|
|
+ };
|
|
|
+ } else if (value && value.isVector3) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 'v3',
|
|
|
+ value: value.toArray()
|
|
|
+ };
|
|
|
+ } else if (value && value.isVector4) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 'v4',
|
|
|
+ value: value.toArray()
|
|
|
+ };
|
|
|
+ } else if (value && value.isMatrix3) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 'm3',
|
|
|
+ value: value.toArray()
|
|
|
+ };
|
|
|
+ } else if (value && value.isMatrix4) {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ type: 'm4',
|
|
|
+ value: value.toArray()
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ data.uniforms[name] = {
|
|
|
+ value: value
|
|
|
+ }; // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Object.keys(this.defines).length > 0) data.defines = this.defines;
|
|
|
+ data.vertexShader = this.vertexShader;
|
|
|
+ data.fragmentShader = this.fragmentShader;
|
|
|
+ const extensions = {};
|
|
|
+
|
|
|
+ for (const key in this.extensions) {
|
|
|
+ if (this.extensions[key] === true) extensions[key] = true;
|
|
|
+ }
|
|
|
|
|
|
- for (const key in this.extensions) {
|
|
|
- if (this.extensions[key] === true) extensions[key] = true;
|
|
|
+ if (Object.keys(extensions).length > 0) data.extensions = extensions;
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
- if (Object.keys(extensions).length > 0) data.extensions = extensions;
|
|
|
- return data;
|
|
|
- };
|
|
|
+ }
|
|
|
+
|
|
|
+ ShaderMaterial.prototype.isShaderMaterial = true;
|
|
|
|
|
|
class Camera extends Object3D {
|
|
|
constructor() {
|
|
@@ -22746,95 +22747,96 @@
|
|
|
* }
|
|
|
*/
|
|
|
|
|
|
- function MeshStandardMaterial(parameters) {
|
|
|
- Material.call(this);
|
|
|
- this.defines = {
|
|
|
- 'STANDARD': ''
|
|
|
- };
|
|
|
- this.type = 'MeshStandardMaterial';
|
|
|
- this.color = new Color(0xffffff); // diffuse
|
|
|
-
|
|
|
- this.roughness = 1.0;
|
|
|
- this.metalness = 0.0;
|
|
|
- this.map = null;
|
|
|
- this.lightMap = null;
|
|
|
- this.lightMapIntensity = 1.0;
|
|
|
- this.aoMap = null;
|
|
|
- this.aoMapIntensity = 1.0;
|
|
|
- this.emissive = new Color(0x000000);
|
|
|
- this.emissiveIntensity = 1.0;
|
|
|
- this.emissiveMap = null;
|
|
|
- this.bumpMap = null;
|
|
|
- this.bumpScale = 1;
|
|
|
- this.normalMap = null;
|
|
|
- this.normalMapType = TangentSpaceNormalMap;
|
|
|
- this.normalScale = new Vector2(1, 1);
|
|
|
- this.displacementMap = null;
|
|
|
- this.displacementScale = 1;
|
|
|
- this.displacementBias = 0;
|
|
|
- this.roughnessMap = null;
|
|
|
- this.metalnessMap = null;
|
|
|
- this.alphaMap = null;
|
|
|
- this.envMap = null;
|
|
|
- this.envMapIntensity = 1.0;
|
|
|
- this.refractionRatio = 0.98;
|
|
|
- this.wireframe = false;
|
|
|
- this.wireframeLinewidth = 1;
|
|
|
- this.wireframeLinecap = 'round';
|
|
|
- this.wireframeLinejoin = 'round';
|
|
|
- this.skinning = false;
|
|
|
- this.morphTargets = false;
|
|
|
- this.morphNormals = false;
|
|
|
- this.flatShading = false;
|
|
|
- this.vertexTangents = false;
|
|
|
- this.setValues(parameters);
|
|
|
- }
|
|
|
-
|
|
|
- MeshStandardMaterial.prototype = Object.create(Material.prototype);
|
|
|
- MeshStandardMaterial.prototype.constructor = MeshStandardMaterial;
|
|
|
- MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
|
|
|
+ class MeshStandardMaterial extends Material {
|
|
|
+ constructor(parameters) {
|
|
|
+ super();
|
|
|
+ this.defines = {
|
|
|
+ 'STANDARD': ''
|
|
|
+ };
|
|
|
+ this.type = 'MeshStandardMaterial';
|
|
|
+ this.color = new Color(0xffffff); // diffuse
|
|
|
|
|
|
- MeshStandardMaterial.prototype.copy = function (source) {
|
|
|
- Material.prototype.copy.call(this, source);
|
|
|
- this.defines = {
|
|
|
- 'STANDARD': ''
|
|
|
- };
|
|
|
- this.color.copy(source.color);
|
|
|
- this.roughness = source.roughness;
|
|
|
- this.metalness = source.metalness;
|
|
|
- this.map = source.map;
|
|
|
- this.lightMap = source.lightMap;
|
|
|
- this.lightMapIntensity = source.lightMapIntensity;
|
|
|
- this.aoMap = source.aoMap;
|
|
|
- this.aoMapIntensity = source.aoMapIntensity;
|
|
|
- this.emissive.copy(source.emissive);
|
|
|
- this.emissiveMap = source.emissiveMap;
|
|
|
- this.emissiveIntensity = source.emissiveIntensity;
|
|
|
- this.bumpMap = source.bumpMap;
|
|
|
- this.bumpScale = source.bumpScale;
|
|
|
- this.normalMap = source.normalMap;
|
|
|
- this.normalMapType = source.normalMapType;
|
|
|
- this.normalScale.copy(source.normalScale);
|
|
|
- this.displacementMap = source.displacementMap;
|
|
|
- this.displacementScale = source.displacementScale;
|
|
|
- this.displacementBias = source.displacementBias;
|
|
|
- this.roughnessMap = source.roughnessMap;
|
|
|
- this.metalnessMap = source.metalnessMap;
|
|
|
- this.alphaMap = source.alphaMap;
|
|
|
- this.envMap = source.envMap;
|
|
|
- this.envMapIntensity = source.envMapIntensity;
|
|
|
- this.refractionRatio = source.refractionRatio;
|
|
|
- this.wireframe = source.wireframe;
|
|
|
- this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
- this.wireframeLinecap = source.wireframeLinecap;
|
|
|
- this.wireframeLinejoin = source.wireframeLinejoin;
|
|
|
- this.skinning = source.skinning;
|
|
|
- this.morphTargets = source.morphTargets;
|
|
|
- this.morphNormals = source.morphNormals;
|
|
|
- this.flatShading = source.flatShading;
|
|
|
- this.vertexTangents = source.vertexTangents;
|
|
|
- return this;
|
|
|
- };
|
|
|
+ this.roughness = 1.0;
|
|
|
+ this.metalness = 0.0;
|
|
|
+ this.map = null;
|
|
|
+ this.lightMap = null;
|
|
|
+ this.lightMapIntensity = 1.0;
|
|
|
+ this.aoMap = null;
|
|
|
+ this.aoMapIntensity = 1.0;
|
|
|
+ this.emissive = new Color(0x000000);
|
|
|
+ this.emissiveIntensity = 1.0;
|
|
|
+ this.emissiveMap = null;
|
|
|
+ this.bumpMap = null;
|
|
|
+ this.bumpScale = 1;
|
|
|
+ this.normalMap = null;
|
|
|
+ this.normalMapType = TangentSpaceNormalMap;
|
|
|
+ this.normalScale = new Vector2(1, 1);
|
|
|
+ this.displacementMap = null;
|
|
|
+ this.displacementScale = 1;
|
|
|
+ this.displacementBias = 0;
|
|
|
+ this.roughnessMap = null;
|
|
|
+ this.metalnessMap = null;
|
|
|
+ this.alphaMap = null;
|
|
|
+ this.envMap = null;
|
|
|
+ this.envMapIntensity = 1.0;
|
|
|
+ this.refractionRatio = 0.98;
|
|
|
+ this.wireframe = false;
|
|
|
+ this.wireframeLinewidth = 1;
|
|
|
+ this.wireframeLinecap = 'round';
|
|
|
+ this.wireframeLinejoin = 'round';
|
|
|
+ this.skinning = false;
|
|
|
+ this.morphTargets = false;
|
|
|
+ this.morphNormals = false;
|
|
|
+ this.flatShading = false;
|
|
|
+ this.vertexTangents = false;
|
|
|
+ this.setValues(parameters);
|
|
|
+ }
|
|
|
+
|
|
|
+ copy(source) {
|
|
|
+ super.copy(source);
|
|
|
+ this.defines = {
|
|
|
+ 'STANDARD': ''
|
|
|
+ };
|
|
|
+ this.color.copy(source.color);
|
|
|
+ this.roughness = source.roughness;
|
|
|
+ this.metalness = source.metalness;
|
|
|
+ this.map = source.map;
|
|
|
+ this.lightMap = source.lightMap;
|
|
|
+ this.lightMapIntensity = source.lightMapIntensity;
|
|
|
+ this.aoMap = source.aoMap;
|
|
|
+ this.aoMapIntensity = source.aoMapIntensity;
|
|
|
+ this.emissive.copy(source.emissive);
|
|
|
+ this.emissiveMap = source.emissiveMap;
|
|
|
+ this.emissiveIntensity = source.emissiveIntensity;
|
|
|
+ this.bumpMap = source.bumpMap;
|
|
|
+ this.bumpScale = source.bumpScale;
|
|
|
+ this.normalMap = source.normalMap;
|
|
|
+ this.normalMapType = source.normalMapType;
|
|
|
+ this.normalScale.copy(source.normalScale);
|
|
|
+ this.displacementMap = source.displacementMap;
|
|
|
+ this.displacementScale = source.displacementScale;
|
|
|
+ this.displacementBias = source.displacementBias;
|
|
|
+ this.roughnessMap = source.roughnessMap;
|
|
|
+ this.metalnessMap = source.metalnessMap;
|
|
|
+ this.alphaMap = source.alphaMap;
|
|
|
+ this.envMap = source.envMap;
|
|
|
+ this.envMapIntensity = source.envMapIntensity;
|
|
|
+ this.refractionRatio = source.refractionRatio;
|
|
|
+ this.wireframe = source.wireframe;
|
|
|
+ this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
+ this.wireframeLinecap = source.wireframeLinecap;
|
|
|
+ this.wireframeLinejoin = source.wireframeLinejoin;
|
|
|
+ this.skinning = source.skinning;
|
|
|
+ this.morphTargets = source.morphTargets;
|
|
|
+ this.morphNormals = source.morphNormals;
|
|
|
+ this.flatShading = source.flatShading;
|
|
|
+ this.vertexTangents = source.vertexTangents;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
|
|
|
|
|
|
/**
|
|
|
* parameters = {
|
|
@@ -22855,64 +22857,65 @@
|
|
|
* }
|
|
|
*/
|
|
|
|
|
|
- function MeshPhysicalMaterial(parameters) {
|
|
|
- MeshStandardMaterial.call(this);
|
|
|
- this.defines = {
|
|
|
- 'STANDARD': '',
|
|
|
- 'PHYSICAL': ''
|
|
|
- };
|
|
|
- this.type = 'MeshPhysicalMaterial';
|
|
|
- this.clearcoat = 0.0;
|
|
|
- this.clearcoatMap = null;
|
|
|
- this.clearcoatRoughness = 0.0;
|
|
|
- this.clearcoatRoughnessMap = null;
|
|
|
- this.clearcoatNormalScale = new Vector2(1, 1);
|
|
|
- this.clearcoatNormalMap = null;
|
|
|
- this.reflectivity = 0.5; // maps to F0 = 0.04
|
|
|
-
|
|
|
- Object.defineProperty(this, 'ior', {
|
|
|
- get: function () {
|
|
|
- return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity);
|
|
|
- },
|
|
|
- set: function (ior) {
|
|
|
- this.reflectivity = MathUtils.clamp(2.5 * (ior - 1) / (ior + 1), 0, 1);
|
|
|
- }
|
|
|
- });
|
|
|
- this.sheen = null; // null will disable sheen bsdf
|
|
|
+ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
+ constructor(parameters) {
|
|
|
+ super();
|
|
|
+ this.defines = {
|
|
|
+ 'STANDARD': '',
|
|
|
+ 'PHYSICAL': ''
|
|
|
+ };
|
|
|
+ this.type = 'MeshPhysicalMaterial';
|
|
|
+ this.clearcoat = 0.0;
|
|
|
+ this.clearcoatMap = null;
|
|
|
+ this.clearcoatRoughness = 0.0;
|
|
|
+ this.clearcoatRoughnessMap = null;
|
|
|
+ this.clearcoatNormalScale = new Vector2(1, 1);
|
|
|
+ this.clearcoatNormalMap = null;
|
|
|
+ this.reflectivity = 0.5; // maps to F0 = 0.04
|
|
|
+
|
|
|
+ Object.defineProperty(this, 'ior', {
|
|
|
+ get: function () {
|
|
|
+ return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity);
|
|
|
+ },
|
|
|
+ set: function (ior) {
|
|
|
+ this.reflectivity = MathUtils.clamp(2.5 * (ior - 1) / (ior + 1), 0, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.sheen = null; // null will disable sheen bsdf
|
|
|
|
|
|
- this.transmission = 0.0;
|
|
|
- this.transmissionMap = null;
|
|
|
- this.setValues(parameters);
|
|
|
- }
|
|
|
+ this.transmission = 0.0;
|
|
|
+ this.transmissionMap = null;
|
|
|
+ this.setValues(parameters);
|
|
|
+ }
|
|
|
|
|
|
- MeshPhysicalMaterial.prototype = Object.create(MeshStandardMaterial.prototype);
|
|
|
- MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial;
|
|
|
- MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
|
|
|
+ copy(source) {
|
|
|
+ super.copy(source);
|
|
|
+ this.defines = {
|
|
|
+ 'STANDARD': '',
|
|
|
+ 'PHYSICAL': ''
|
|
|
+ };
|
|
|
+ this.clearcoat = source.clearcoat;
|
|
|
+ this.clearcoatMap = source.clearcoatMap;
|
|
|
+ this.clearcoatRoughness = source.clearcoatRoughness;
|
|
|
+ this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
|
|
|
+ this.clearcoatNormalMap = source.clearcoatNormalMap;
|
|
|
+ this.clearcoatNormalScale.copy(source.clearcoatNormalScale);
|
|
|
+ this.reflectivity = source.reflectivity;
|
|
|
|
|
|
- MeshPhysicalMaterial.prototype.copy = function (source) {
|
|
|
- MeshStandardMaterial.prototype.copy.call(this, source);
|
|
|
- this.defines = {
|
|
|
- 'STANDARD': '',
|
|
|
- 'PHYSICAL': ''
|
|
|
- };
|
|
|
- this.clearcoat = source.clearcoat;
|
|
|
- this.clearcoatMap = source.clearcoatMap;
|
|
|
- this.clearcoatRoughness = source.clearcoatRoughness;
|
|
|
- this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
|
|
|
- this.clearcoatNormalMap = source.clearcoatNormalMap;
|
|
|
- this.clearcoatNormalScale.copy(source.clearcoatNormalScale);
|
|
|
- this.reflectivity = source.reflectivity;
|
|
|
-
|
|
|
- if (source.sheen) {
|
|
|
- this.sheen = (this.sheen || new Color()).copy(source.sheen);
|
|
|
- } else {
|
|
|
- this.sheen = null;
|
|
|
+ if (source.sheen) {
|
|
|
+ this.sheen = (this.sheen || new Color()).copy(source.sheen);
|
|
|
+ } else {
|
|
|
+ this.sheen = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.transmission = source.transmission;
|
|
|
+ this.transmissionMap = source.transmissionMap;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
- this.transmission = source.transmission;
|
|
|
- this.transmissionMap = source.transmissionMap;
|
|
|
- return this;
|
|
|
- };
|
|
|
+ }
|
|
|
+
|
|
|
+ MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
|
|
|
|
|
|
/**
|
|
|
* parameters = {
|
|
@@ -29135,9 +29138,9 @@
|
|
|
|
|
|
AmbientLightProbe.prototype.isAmbientLightProbe = true;
|
|
|
|
|
|
- const _eyeRight = new Matrix4();
|
|
|
+ const _eyeRight = /*@__PURE__*/new Matrix4();
|
|
|
|
|
|
- const _eyeLeft = new Matrix4();
|
|
|
+ const _eyeLeft = /*@__PURE__*/new Matrix4();
|
|
|
|
|
|
class StereoCamera {
|
|
|
constructor() {
|
|
@@ -29980,61 +29983,71 @@
|
|
|
|
|
|
const _supportedObjectNames = ['material', 'materials', 'bones'];
|
|
|
|
|
|
- function Composite(targetGroup, path, optionalParsedPath) {
|
|
|
- const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path);
|
|
|
- this._targetGroup = targetGroup;
|
|
|
- this._bindings = targetGroup.subscribe_(path, parsedPath);
|
|
|
- }
|
|
|
+ class Composite {
|
|
|
+ constructor(targetGroup, path, optionalParsedPath) {
|
|
|
+ const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path);
|
|
|
+ this._targetGroup = targetGroup;
|
|
|
+ this._bindings = targetGroup.subscribe_(path, parsedPath);
|
|
|
+ }
|
|
|
|
|
|
- Object.assign(Composite.prototype, {
|
|
|
- getValue: function (array, offset) {
|
|
|
+ getValue(array, offset) {
|
|
|
this.bind(); // bind all binding
|
|
|
|
|
|
const firstValidIndex = this._targetGroup.nCachedObjects_,
|
|
|
binding = this._bindings[firstValidIndex]; // and only call .getValue on the first
|
|
|
|
|
|
if (binding !== undefined) binding.getValue(array, offset);
|
|
|
- },
|
|
|
- setValue: function (array, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ setValue(array, offset) {
|
|
|
const bindings = this._bindings;
|
|
|
|
|
|
for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
|
|
|
bindings[i].setValue(array, offset);
|
|
|
}
|
|
|
- },
|
|
|
- bind: function () {
|
|
|
+ }
|
|
|
+
|
|
|
+ bind() {
|
|
|
const bindings = this._bindings;
|
|
|
|
|
|
for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
|
|
|
bindings[i].bind();
|
|
|
}
|
|
|
- },
|
|
|
- unbind: function () {
|
|
|
+ }
|
|
|
+
|
|
|
+ unbind() {
|
|
|
const bindings = this._bindings;
|
|
|
|
|
|
for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
|
|
|
bindings[i].unbind();
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
|
|
|
- function PropertyBinding(rootNode, path, parsedPath) {
|
|
|
- this.path = path;
|
|
|
- this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path);
|
|
|
- this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName) || rootNode;
|
|
|
- this.rootNode = rootNode;
|
|
|
- }
|
|
|
+ } // Note: This class uses a State pattern on a per-method basis:
|
|
|
+ // 'bind' sets 'this.getValue' / 'setValue' and shadows the
|
|
|
+ // prototype version of these methods with one that represents
|
|
|
+ // the bound state. When the property is not found, the methods
|
|
|
+ // become no-ops.
|
|
|
+
|
|
|
+
|
|
|
+ class PropertyBinding {
|
|
|
+ constructor(rootNode, path, parsedPath) {
|
|
|
+ this.path = path;
|
|
|
+ this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path);
|
|
|
+ this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName) || rootNode;
|
|
|
+ this.rootNode = rootNode; // initial state of these methods that calls 'bind'
|
|
|
+
|
|
|
+ this.getValue = this._getValue_unbound;
|
|
|
+ this.setValue = this._setValue_unbound;
|
|
|
+ }
|
|
|
|
|
|
- Object.assign(PropertyBinding, {
|
|
|
- Composite: Composite,
|
|
|
- create: function (root, path, parsedPath) {
|
|
|
+ static create(root, path, parsedPath) {
|
|
|
if (!(root && root.isAnimationObjectGroup)) {
|
|
|
return new PropertyBinding(root, path, parsedPath);
|
|
|
} else {
|
|
|
return new PropertyBinding.Composite(root, path, parsedPath);
|
|
|
}
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
/**
|
|
|
* Replaces spaces with underscores and removes unsupported characters from
|
|
|
* node names, to ensure compatibility with parseTrackName().
|
|
@@ -30042,10 +30055,13 @@
|
|
|
* @param {string} name Node name to be sanitized.
|
|
|
* @return {string}
|
|
|
*/
|
|
|
- sanitizeNodeName: function (name) {
|
|
|
+
|
|
|
+
|
|
|
+ static sanitizeNodeName(name) {
|
|
|
return name.replace(/\s/g, '_').replace(_reservedRe, '');
|
|
|
- },
|
|
|
- parseTrackName: function (trackName) {
|
|
|
+ }
|
|
|
+
|
|
|
+ static parseTrackName(trackName) {
|
|
|
const matches = _trackRe.exec(trackName);
|
|
|
|
|
|
if (!matches) {
|
|
@@ -30080,8 +30096,9 @@
|
|
|
}
|
|
|
|
|
|
return results;
|
|
|
- },
|
|
|
- findNode: function (root, nodeName) {
|
|
|
+ }
|
|
|
+
|
|
|
+ static findNode(root, nodeName) {
|
|
|
if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) {
|
|
|
return root;
|
|
|
} // search into skeleton bones.
|
|
@@ -30120,54 +30137,59 @@
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
- }
|
|
|
- });
|
|
|
- Object.assign(PropertyBinding.prototype, {
|
|
|
- // prototype, continued
|
|
|
- // these are used to "bind" a nonexistent property
|
|
|
- _getValue_unavailable: function () {},
|
|
|
- _setValue_unavailable: function () {},
|
|
|
- BindingType: {
|
|
|
- Direct: 0,
|
|
|
- EntireArray: 1,
|
|
|
- ArrayElement: 2,
|
|
|
- HasFromToArray: 3
|
|
|
- },
|
|
|
- Versioning: {
|
|
|
- None: 0,
|
|
|
- NeedsUpdate: 1,
|
|
|
- MatrixWorldNeedsUpdate: 2
|
|
|
- },
|
|
|
- GetterByBindingType: [function getValue_direct(buffer, offset) {
|
|
|
+ } // these are used to "bind" a nonexistent property
|
|
|
+
|
|
|
+
|
|
|
+ _getValue_unavailable() {}
|
|
|
+
|
|
|
+ _setValue_unavailable() {} // Getters
|
|
|
+
|
|
|
+
|
|
|
+ _getValue_direct(buffer, offset) {
|
|
|
buffer[offset] = this.node[this.propertyName];
|
|
|
- }, function getValue_array(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _getValue_array(buffer, offset) {
|
|
|
const source = this.resolvedProperty;
|
|
|
|
|
|
for (let i = 0, n = source.length; i !== n; ++i) {
|
|
|
buffer[offset++] = source[i];
|
|
|
}
|
|
|
- }, function getValue_arrayElement(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _getValue_arrayElement(buffer, offset) {
|
|
|
buffer[offset] = this.resolvedProperty[this.propertyIndex];
|
|
|
- }, function getValue_toArray(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _getValue_toArray(buffer, offset) {
|
|
|
this.resolvedProperty.toArray(buffer, offset);
|
|
|
- }],
|
|
|
- SetterByBindingTypeAndVersioning: [[// Direct
|
|
|
- function setValue_direct(buffer, offset) {
|
|
|
+ } // Direct
|
|
|
+
|
|
|
+
|
|
|
+ _setValue_direct(buffer, offset) {
|
|
|
this.targetObject[this.propertyName] = buffer[offset];
|
|
|
- }, function setValue_direct_setNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_direct_setNeedsUpdate(buffer, offset) {
|
|
|
this.targetObject[this.propertyName] = buffer[offset];
|
|
|
this.targetObject.needsUpdate = true;
|
|
|
- }, function setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
this.targetObject[this.propertyName] = buffer[offset];
|
|
|
this.targetObject.matrixWorldNeedsUpdate = true;
|
|
|
- }], [// EntireArray
|
|
|
- function setValue_array(buffer, offset) {
|
|
|
+ } // EntireArray
|
|
|
+
|
|
|
+
|
|
|
+ _setValue_array(buffer, offset) {
|
|
|
const dest = this.resolvedProperty;
|
|
|
|
|
|
for (let i = 0, n = dest.length; i !== n; ++i) {
|
|
|
dest[i] = buffer[offset++];
|
|
|
}
|
|
|
- }, function setValue_array_setNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_array_setNeedsUpdate(buffer, offset) {
|
|
|
const dest = this.resolvedProperty;
|
|
|
|
|
|
for (let i = 0, n = dest.length; i !== n; ++i) {
|
|
@@ -30175,7 +30197,9 @@
|
|
|
}
|
|
|
|
|
|
this.targetObject.needsUpdate = true;
|
|
|
- }, function setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
const dest = this.resolvedProperty;
|
|
|
|
|
|
for (let i = 0, n = dest.length; i !== n; ++i) {
|
|
@@ -30183,39 +30207,50 @@
|
|
|
}
|
|
|
|
|
|
this.targetObject.matrixWorldNeedsUpdate = true;
|
|
|
- }], [// ArrayElement
|
|
|
- function setValue_arrayElement(buffer, offset) {
|
|
|
+ } // ArrayElement
|
|
|
+
|
|
|
+
|
|
|
+ _setValue_arrayElement(buffer, offset) {
|
|
|
this.resolvedProperty[this.propertyIndex] = buffer[offset];
|
|
|
- }, function setValue_arrayElement_setNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_arrayElement_setNeedsUpdate(buffer, offset) {
|
|
|
this.resolvedProperty[this.propertyIndex] = buffer[offset];
|
|
|
this.targetObject.needsUpdate = true;
|
|
|
- }, function setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
this.resolvedProperty[this.propertyIndex] = buffer[offset];
|
|
|
this.targetObject.matrixWorldNeedsUpdate = true;
|
|
|
- }], [// HasToFromArray
|
|
|
- function setValue_fromArray(buffer, offset) {
|
|
|
+ } // HasToFromArray
|
|
|
+
|
|
|
+
|
|
|
+ _setValue_fromArray(buffer, offset) {
|
|
|
this.resolvedProperty.fromArray(buffer, offset);
|
|
|
- }, function setValue_fromArray_setNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_fromArray_setNeedsUpdate(buffer, offset) {
|
|
|
this.resolvedProperty.fromArray(buffer, offset);
|
|
|
this.targetObject.needsUpdate = true;
|
|
|
- }, function setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {
|
|
|
this.resolvedProperty.fromArray(buffer, offset);
|
|
|
this.targetObject.matrixWorldNeedsUpdate = true;
|
|
|
- }]],
|
|
|
- getValue: function getValue_unbound(targetArray, offset) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _getValue_unbound(targetArray, offset) {
|
|
|
this.bind();
|
|
|
- this.getValue(targetArray, offset); // Note: This class uses a State pattern on a per-method basis:
|
|
|
- // 'bind' sets 'this.getValue' / 'setValue' and shadows the
|
|
|
- // prototype version of these methods with one that represents
|
|
|
- // the bound state. When the property is not found, the methods
|
|
|
- // become no-ops.
|
|
|
- },
|
|
|
- setValue: function getValue_unbound(sourceArray, offset) {
|
|
|
+ this.getValue(targetArray, offset);
|
|
|
+ }
|
|
|
+
|
|
|
+ _setValue_unbound(sourceArray, offset) {
|
|
|
this.bind();
|
|
|
this.setValue(sourceArray, offset);
|
|
|
- },
|
|
|
- // create getter / setter pair for a property in the scene graph
|
|
|
- bind: function () {
|
|
|
+ } // create getter / setter pair for a property in the scene graph
|
|
|
+
|
|
|
+
|
|
|
+ bind() {
|
|
|
let targetObject = this.node;
|
|
|
const parsedPath = this.parsedPath;
|
|
|
const objectName = parsedPath.objectName;
|
|
@@ -30358,21 +30393,36 @@
|
|
|
|
|
|
this.getValue = this.GetterByBindingType[bindingType];
|
|
|
this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning];
|
|
|
- },
|
|
|
- unbind: function () {
|
|
|
+ }
|
|
|
+
|
|
|
+ unbind() {
|
|
|
this.node = null; // back to the prototype version of getValue / setValue
|
|
|
// note: avoiding to mutate the shape of 'this' via 'delete'
|
|
|
|
|
|
this.getValue = this._getValue_unbound;
|
|
|
this.setValue = this._setValue_unbound;
|
|
|
}
|
|
|
- }); // DECLARE ALIAS AFTER assign prototype
|
|
|
|
|
|
- Object.assign(PropertyBinding.prototype, {
|
|
|
- // initial state of these methods that calls 'bind'
|
|
|
- _getValue_unbound: PropertyBinding.prototype.getValue,
|
|
|
- _setValue_unbound: PropertyBinding.prototype.setValue
|
|
|
- });
|
|
|
+ }
|
|
|
+
|
|
|
+ PropertyBinding.Composite = Composite;
|
|
|
+ PropertyBinding.prototype.BindingType = {
|
|
|
+ Direct: 0,
|
|
|
+ EntireArray: 1,
|
|
|
+ ArrayElement: 2,
|
|
|
+ HasFromToArray: 3
|
|
|
+ };
|
|
|
+ PropertyBinding.prototype.Versioning = {
|
|
|
+ None: 0,
|
|
|
+ NeedsUpdate: 1,
|
|
|
+ MatrixWorldNeedsUpdate: 2
|
|
|
+ };
|
|
|
+ PropertyBinding.prototype.GetterByBindingType = [PropertyBinding.prototype._getValue_direct, PropertyBinding.prototype._getValue_array, PropertyBinding.prototype._getValue_arrayElement, PropertyBinding.prototype._getValue_toArray];
|
|
|
+ PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[// Direct
|
|
|
+ PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [// EntireArray
|
|
|
+ PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [// ArrayElement
|
|
|
+ PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [// HasToFromArray
|
|
|
+ PropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];
|
|
|
|
|
|
/**
|
|
|
*
|