|
1 | 1 | /**
|
2 | 2 | * @license
|
3 |
| - * PlayCanvas Engine v1.34.0-dev revision adb2a859 |
| 3 | + * PlayCanvas Engine v1.34.0-dev revision 2680e004 |
4 | 4 | * Copyright 2011-2020 PlayCanvas Ltd. All rights reserved.
|
5 | 5 | */
|
6 | 6 | (function (global, factory) {
|
|
447 | 447 | return result;
|
448 | 448 | }();
|
449 | 449 | var version = "1.34.0-dev";
|
450 |
| - var revision = "adb2a859"; |
| 450 | + var revision = "2680e004"; |
451 | 451 | var config = { };
|
452 | 452 | var common = { };
|
453 | 453 | var apps = { };
|
|
50913 | 50913 | this.cubeMapMinUniform = new Float32Array(3);
|
50914 | 50914 | this.cubeMapMaxUniform = new Float32Array(3);
|
50915 | 50915 | },
|
50916 |
| - clone: function () { |
50917 |
| - var clone = new StandardMaterial(); |
| 50916 | + _cloneInternal: function (clone) { |
50918 | 50917 | Material.prototype._cloneInternal.call(this, clone);
|
50919 | 50918 | var pname;
|
50920 | 50919 | for (var i = 0; i < _propsSerial.length; i++) {
|
|
50931 | 50930 | }
|
50932 | 50931 | }
|
50933 | 50932 | }
|
| 50933 | + }, |
| 50934 | + clone: function () { |
| 50935 | + var clone = new StandardMaterial(); |
| 50936 | + this._cloneInternal(clone); |
50934 | 50937 | return clone;
|
50935 | 50938 | },
|
50936 | 50939 | _updateMapTransform: function (transform, tiling, offset) {
|
|
50990 | 50993 | updateUniforms: function () {
|
50991 | 50994 | var uniform;
|
50992 | 50995 | this._clearParameters();
|
50993 |
| - if (this._shaderGraphChunk) |
50994 |
| - { |
50995 |
| - var rootShaderGraph = shadergraph_nodeRegistry.getNode(this._shaderGraphChunk); |
50996 |
| - rootShaderGraph.updateShaderGraphUniforms(this); |
50997 |
| - } |
50998 | 50996 | this._setParameter('material_ambient', this.ambientUniform);
|
50999 | 50997 | if (!this.diffuseMap || this.diffuseTint) {
|
51000 | 50998 | this._setParameter('material_diffuse', this.diffuseUniform);
|
|
51121 | 51119 | }
|
51122 | 51120 | this.dirtyColor = false;
|
51123 | 51121 | },
|
51124 |
| - updateShader: function (device, scene, objDefs, staticLightList, pass, sortedLights) { |
| 51122 | + _updateShaderGlobals: function (device, scene) { |
51125 | 51123 | if (!this._colorProcessed && this._scene) {
|
51126 | 51124 | this._colorProcessed = true;
|
51127 | 51125 | this._processColor();
|
@@ -51182,15 +51180,16 @@
|
51182 | 51180 | console.log("Can't use prefiltered cubemap: " + allMips + ", " + useTexCubeLod + ", " + prefilteredCubeMap128._levels);
|
51183 | 51181 | }
|
51184 | 51182 | }
|
| 51183 | + return prefilteredCubeMap128; |
| 51184 | + }, |
| 51185 | + updateShader: function (device, scene, objDefs, staticLightList, pass, sortedLights) { |
| 51186 | + var prefilteredCubeMap128 = this._updateShaderGlobals(device, scene); |
51185 | 51187 | var minimalOptions = pass > SHADER_FORWARDHDR && pass <= SHADER_PICK;
|
51186 | 51188 | var options = minimalOptions ? standard.optionsContextMin : standard.optionsContext;
|
51187 | 51189 | if (minimalOptions)
|
51188 | 51190 | this.shaderOptBuilder.updateMinRef(options, device, scene, this, objDefs, staticLightList, pass, sortedLights, prefilteredCubeMap128);
|
51189 | 51191 | else
|
51190 | 51192 | this.shaderOptBuilder.updateRef(options, device, scene, this, objDefs, staticLightList, pass, sortedLights, prefilteredCubeMap128);
|
51191 |
| - if (this._shaderGraphChunk) { |
51192 |
| - options._shaderGraphChunk = this._shaderGraphChunk; |
51193 |
| - } |
51194 | 51193 | if (this.onUpdateShader) {
|
51195 | 51194 | options = this.onUpdateShader(options);
|
51196 | 51195 | }
|
|
54825 | 54824 | }
|
54826 | 54825 | };
|
54827 | 54826 |
|
| 54827 | + function StandardNodeMaterial(mat, chunk) { |
| 54828 | + StandardMaterial.call(this); |
| 54829 | + if (mat) |
| 54830 | + { |
| 54831 | + StandardMaterial.prototype._cloneInternal.call(mat, this); |
| 54832 | + } |
| 54833 | + if (chunk) |
| 54834 | + { |
| 54835 | + this._shaderGraphChunk = chunk.name; |
| 54836 | + } |
| 54837 | + } |
| 54838 | + StandardNodeMaterial.prototype = Object.create(StandardMaterial.prototype); |
| 54839 | + StandardNodeMaterial.prototype.constructor = StandardNodeMaterial; |
| 54840 | + Object.assign(StandardNodeMaterial.prototype, { |
| 54841 | + clone: function () { |
| 54842 | + var clone = new StandardNodeMaterial(); |
| 54843 | + StandardMaterial.prototype._cloneInternal.call(this, clone); |
| 54844 | + clone._shaderGraphChunk = this._shaderGraphChunk; |
| 54845 | + return clone; |
| 54846 | + }, |
| 54847 | + updateUniforms: function () { |
| 54848 | + StandardMaterial.prototype.updateUniforms.call(this); |
| 54849 | + if (this._shaderGraphChunk) |
| 54850 | + { |
| 54851 | + var rootShaderGraph = shadergraph_nodeRegistry.getNode(this._shaderGraphChunk); |
| 54852 | + rootShaderGraph.updateShaderGraphUniforms(this); |
| 54853 | + } |
| 54854 | + }, |
| 54855 | + updateShader: function (device, scene, objDefs, staticLightList, pass, sortedLights) { |
| 54856 | + var prefilteredCubeMap128 = StandardMaterial.prototype._updateShaderGlobals.call(this, device, scene); |
| 54857 | + var minimalOptions = pass > SHADER_FORWARDHDR && pass <= SHADER_PICK; |
| 54858 | + var options = minimalOptions ? standard.optionsContextMin : standard.optionsContext; |
| 54859 | + if (minimalOptions) |
| 54860 | + this.shaderOptBuilder.updateMinRef(options, device, scene, this, objDefs, staticLightList, pass, sortedLights, prefilteredCubeMap128); |
| 54861 | + else |
| 54862 | + this.shaderOptBuilder.updateRef(options, device, scene, this, objDefs, staticLightList, pass, sortedLights, prefilteredCubeMap128); |
| 54863 | + if (this._shaderGraphChunk) { |
| 54864 | + options._shaderGraphChunk = this._shaderGraphChunk; |
| 54865 | + } |
| 54866 | + if (this.onUpdateShader) { |
| 54867 | + options = this.onUpdateShader(options); |
| 54868 | + } |
| 54869 | + var library = device.getProgramLibrary(); |
| 54870 | + this.shader = library.getProgram('standard', options); |
| 54871 | + if (!objDefs) { |
| 54872 | + this.clearVariants(); |
| 54873 | + this.variants[0] = this.shader; |
| 54874 | + } |
| 54875 | + this.dirtyShader = false; |
| 54876 | + } |
| 54877 | + }); |
| 54878 | + |
54828 | 54879 | function ResourceHandler() {}
|
54829 | 54880 | Object.assign(ResourceHandler.prototype, {
|
54830 | 54881 | load: function (url, callback, asset) {
|
|
58374 | 58425 | exports.SpriteComponentSystem = SpriteComponentSystem;
|
58375 | 58426 | exports.SpriteHandler = SpriteHandler;
|
58376 | 58427 | exports.StandardMaterial = StandardMaterial;
|
| 58428 | + exports.StandardNodeMaterial = StandardNodeMaterial; |
58377 | 58429 | exports.StencilParameters = StencilParameters;
|
58378 | 58430 | exports.TEXHINT_ASSET = TEXHINT_ASSET;
|
58379 | 58431 | exports.TEXHINT_LIGHTMAP = TEXHINT_LIGHTMAP;
|
|
0 commit comments