From 3da8c536b11eb16096714e98a6402c6307c067a8 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Tue, 28 Jul 2015 19:49:19 +0300 Subject: [PATCH 01/11] [FIX] Don't initialize script component multiple times --- src/framework/components/script/script_component.js | 2 ++ src/framework/components/script/script_system.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/framework/components/script/script_component.js b/src/framework/components/script/script_component.js index 45a41c148ac..14b38906936 100644 --- a/src/framework/components/script/script_component.js +++ b/src/framework/components/script/script_component.js @@ -91,6 +91,8 @@ pc.extend(pc, function () { this.system._destroyScriptComponent(this); this.data.areScriptsLoaded = false; + this.data.initialized = false; + this.data.postInitialized = false; // get the urls var scripts = newValue; diff --git a/src/framework/components/script/script_system.js b/src/framework/components/script/script_system.js index e53b084c252..a1cee26db84 100644 --- a/src/framework/components/script/script_system.js +++ b/src/framework/components/script/script_system.js @@ -113,7 +113,7 @@ pc.extend(pc, function () { this._registerInstances(root); if (root.enabled) { - if (root.script && root.script.enabled) { + if (root.script && root.script.enabled && !root.script.data.initialized) { this._initializeScriptComponent(root.script); } @@ -136,7 +136,7 @@ pc.extend(pc, function () { */ onPostInitialize: function (root) { if (root.enabled) { - if (root.script && root.script.enabled) { + if (root.script && root.script.enabled && !root.script.data.postInitialized) { this._postInitializeScriptComponent(root.script); } From 4bf5dac0d4373b254326b40911df7a4525c36910 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Tue, 28 Jul 2015 20:02:18 +0300 Subject: [PATCH 02/11] Revert "[FIX] Don't initialize script component multiple times" This reverts commit 3da8c536b11eb16096714e98a6402c6307c067a8. --- src/framework/components/script/script_component.js | 2 -- src/framework/components/script/script_system.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/framework/components/script/script_component.js b/src/framework/components/script/script_component.js index 14b38906936..45a41c148ac 100644 --- a/src/framework/components/script/script_component.js +++ b/src/framework/components/script/script_component.js @@ -91,8 +91,6 @@ pc.extend(pc, function () { this.system._destroyScriptComponent(this); this.data.areScriptsLoaded = false; - this.data.initialized = false; - this.data.postInitialized = false; // get the urls var scripts = newValue; diff --git a/src/framework/components/script/script_system.js b/src/framework/components/script/script_system.js index a1cee26db84..e53b084c252 100644 --- a/src/framework/components/script/script_system.js +++ b/src/framework/components/script/script_system.js @@ -113,7 +113,7 @@ pc.extend(pc, function () { this._registerInstances(root); if (root.enabled) { - if (root.script && root.script.enabled && !root.script.data.initialized) { + if (root.script && root.script.enabled) { this._initializeScriptComponent(root.script); } @@ -136,7 +136,7 @@ pc.extend(pc, function () { */ onPostInitialize: function (root) { if (root.enabled) { - if (root.script && root.script.enabled && !root.script.data.postInitialized) { + if (root.script && root.script.enabled) { this._postInitializeScriptComponent(root.script); } From ed444a1ba072554b1cfca38ffed0569c44a4fdaa Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Thu, 30 Jul 2015 13:18:15 +0300 Subject: [PATCH 03/11] Revert "Revert "[FIX] Don't initialize script component multiple times"" This reverts commit 4bf5dac0d4373b254326b40911df7a4525c36910. --- src/framework/components/script/script_component.js | 2 ++ src/framework/components/script/script_system.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/framework/components/script/script_component.js b/src/framework/components/script/script_component.js index 45a41c148ac..14b38906936 100644 --- a/src/framework/components/script/script_component.js +++ b/src/framework/components/script/script_component.js @@ -91,6 +91,8 @@ pc.extend(pc, function () { this.system._destroyScriptComponent(this); this.data.areScriptsLoaded = false; + this.data.initialized = false; + this.data.postInitialized = false; // get the urls var scripts = newValue; diff --git a/src/framework/components/script/script_system.js b/src/framework/components/script/script_system.js index e53b084c252..a1cee26db84 100644 --- a/src/framework/components/script/script_system.js +++ b/src/framework/components/script/script_system.js @@ -113,7 +113,7 @@ pc.extend(pc, function () { this._registerInstances(root); if (root.enabled) { - if (root.script && root.script.enabled) { + if (root.script && root.script.enabled && !root.script.data.initialized) { this._initializeScriptComponent(root.script); } @@ -136,7 +136,7 @@ pc.extend(pc, function () { */ onPostInitialize: function (root) { if (root.enabled) { - if (root.script && root.script.enabled) { + if (root.script && root.script.enabled && !root.script.data.postInitialized) { this._postInitializeScriptComponent(root.script); } From 45f3447453970efc29b0be2c1fa65e7054b893d8 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Thu, 30 Jul 2015 13:35:26 +0300 Subject: [PATCH 04/11] [RELEASE] v0.169.18 --- CHANGES.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9f952f994cb..c64e5468d75 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # PlayCanvas Engine Changes +### 0.169.18 +* [FIX] Do not initialize scripts multiple times +* [FIX] Material loading for engine-only users when materials have no textures + ### 0.169.17 * [FIX] Audio loading errors no longer hang app loading diff --git a/VERSION b/VERSION index e9d5c31c064..6cf5dfb71bb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.170.0-dev +0.169.18 From ace5f848fe3e7105857403241515b5e6704b7171 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Thu, 30 Jul 2015 13:35:53 +0300 Subject: [PATCH 05/11] [VERSION] 0.170.0-dev --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6cf5dfb71bb..e9d5c31c064 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.169.18 +0.170.0-dev From ca19231f425afa67e0f2890206458eb68f7babe5 Mon Sep 17 00:00:00 2001 From: Mr F Date: Thu, 30 Jul 2015 13:46:08 +0300 Subject: [PATCH 06/11] don't use DPs and SHs in the old phong material version --- src/graphics/programlib/programlib_phong.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics/programlib/programlib_phong.js b/src/graphics/programlib/programlib_phong.js index 3d318e03be9..54632cf636c 100644 --- a/src/graphics/programlib/programlib_phong.js +++ b/src/graphics/programlib/programlib_phong.js @@ -130,6 +130,8 @@ pc.programlib.phong = { options.fresnelModel = 0; options.specularAA = false; options.prefilteredCubemap = false; + options.dpAtlas = false; + options.ambientSH = false; } else { options.fresnelModel = (options.fresnelModel===0)? pc.FRESNEL_SCHLICK : options.fresnelModel; } From 190bcf63814b23b1b55df2aba88d5f4bb25f9880 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Thu, 30 Jul 2015 13:56:35 +0300 Subject: [PATCH 07/11] Revert "Revert "Revert "[FIX] Don't initialize script component multiple times""" This reverts commit ed444a1ba072554b1cfca38ffed0569c44a4fdaa. --- src/framework/components/script/script_component.js | 2 -- src/framework/components/script/script_system.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/framework/components/script/script_component.js b/src/framework/components/script/script_component.js index 14b38906936..45a41c148ac 100644 --- a/src/framework/components/script/script_component.js +++ b/src/framework/components/script/script_component.js @@ -91,8 +91,6 @@ pc.extend(pc, function () { this.system._destroyScriptComponent(this); this.data.areScriptsLoaded = false; - this.data.initialized = false; - this.data.postInitialized = false; // get the urls var scripts = newValue; diff --git a/src/framework/components/script/script_system.js b/src/framework/components/script/script_system.js index a1cee26db84..e53b084c252 100644 --- a/src/framework/components/script/script_system.js +++ b/src/framework/components/script/script_system.js @@ -113,7 +113,7 @@ pc.extend(pc, function () { this._registerInstances(root); if (root.enabled) { - if (root.script && root.script.enabled && !root.script.data.initialized) { + if (root.script && root.script.enabled) { this._initializeScriptComponent(root.script); } @@ -136,7 +136,7 @@ pc.extend(pc, function () { */ onPostInitialize: function (root) { if (root.enabled) { - if (root.script && root.script.enabled && !root.script.data.postInitialized) { + if (root.script && root.script.enabled) { this._postInitializeScriptComponent(root.script); } From b1f4527242066d0896fc0f4b8e921fb85f755545 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Thu, 30 Jul 2015 13:58:34 +0300 Subject: [PATCH 08/11] [RELEASE] v0.169.19 --- CHANGES.md | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c64e5468d75..384218fd215 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,8 @@ # PlayCanvas Engine Changes +### 0.169.19 +* [REVERT FIX] Do not initialize scripts multiple times + ### 0.169.18 * [FIX] Do not initialize scripts multiple times * [FIX] Material loading for engine-only users when materials have no textures diff --git a/VERSION b/VERSION index e9d5c31c064..f8b5f067914 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.170.0-dev +0.169.19 From 58030a9d161d1907224aa54c9f65f27d398784c0 Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Thu, 30 Jul 2015 13:58:59 +0300 Subject: [PATCH 09/11] [VERSION] 0.170.0-dev --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f8b5f067914..e9d5c31c064 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.169.19 +0.170.0-dev From bf4cf0b781605f87001ed9dbc1c32b6d4e4c5c37 Mon Sep 17 00:00:00 2001 From: Mr F Date: Thu, 30 Jul 2015 15:09:53 +0300 Subject: [PATCH 10/11] removed scene_pickmaterial --- build/dependencies.txt | 1 - src/scene/scene_pickmaterial.js | 57 --------------------------------- 2 files changed, 58 deletions(-) delete mode 100644 src/scene/scene_pickmaterial.js diff --git a/build/dependencies.txt b/build/dependencies.txt index b0c351fb04a..2d8b664ce82 100644 --- a/build/dependencies.txt +++ b/build/dependencies.txt @@ -71,7 +71,6 @@ ../src/scene/scene_basicmaterial.js ../src/scene/scene_depthmaterial.js ../src/scene/scene_phongmaterial.js -../src/scene/scene_pickmaterial.js ../src/scene/scene_mesh.js ../src/scene/scene_skin.js ../src/scene/scene_skinpartition.js diff --git a/src/scene/scene_pickmaterial.js b/src/scene/scene_pickmaterial.js deleted file mode 100644 index 61e0aa79697..00000000000 --- a/src/scene/scene_pickmaterial.js +++ /dev/null @@ -1,57 +0,0 @@ -pc.extend(pc, function () { - - /** - * @name pc.PickMaterial - * @class A Pick material is for rendering a scene into the frame buffer such that different meshes - * have different colors that can be queried on a frame buffer read at a specific pixel (normally a - * click coordinate). This implements frame buffer picking. - * @property {pc.Color} color The flat color to be written to the frame buffer. RGBA, with each - * component between 0 and 1. - */ - var PickMaterial = function () { - this.color = new pc.Color(1, 1, 1, 1); - this.colorMap = null; - - this.update(); - }; - - PickMaterial = pc.inherits(PickMaterial, pc.Material); - - pc.extend(PickMaterial.prototype, { - /** - * @function - * @name pc.PickMaterial#clone - * @description Duplicates a Basic material. All properties are duplicated except textures - * where only the references are copied. - * @returns {pc.PickMaterial} A cloned Basic material. - */ - clone: function () { - var clone = new pc.PickMaterial(); - - Material.prototype._cloneInternal.call(this, clone); - - clone.color.copy(this.color); - - clone.update(); - return clone; - }, - - update: function () { - this.clearParameters(); - - this.setParameter('uColor', this.color.data); - }, - - updateShader: function (device) { - var options = { - skin: !!this.meshInstances[0].skinInstance - }; - var library = device.getProgramLibrary(); - this.shader = library.getProgram('pick', options); - } - }); - - return { - PickMaterial: PickMaterial - }; -}()); \ No newline at end of file From 70c7873fe9e2c755c20df053e08407b7098fe0ac Mon Sep 17 00:00:00 2001 From: Mr F Date: Thu, 30 Jul 2015 18:08:01 +0300 Subject: [PATCH 11/11] pick parameter for meshInstance --- src/scene/scene_mesh.js | 1 + src/scene/scene_pick.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/scene/scene_mesh.js b/src/scene/scene_mesh.js index 316485a5688..76ae3571802 100644 --- a/src/scene/scene_mesh.js +++ b/src/scene/scene_mesh.js @@ -75,6 +75,7 @@ pc.extend(pc, function () { this._receiveShadow = true; this.drawToDepth = true; this.cull = true; + this.pick = true; // 64-bit integer key that defines render order of this mesh instance this.key = 0; diff --git a/src/scene/scene_pick.js b/src/scene/scene_pick.js index cfbf525ee12..2d6b6efdc2d 100644 --- a/src/scene/scene_pick.js +++ b/src/scene/scene_pick.js @@ -56,7 +56,7 @@ pc.extend(pc, function () { * x: 10, * y: 20 * }); - * + * * // Get all models in rectangle with corners at (10,20) and (20,40) * var selection = picker.getSelection({ * x: 10, @@ -110,7 +110,7 @@ pc.extend(pc, function () { * @name pc.Picker#prepare * @description Primes the pick buffer with a rendering of the specified models from the point of view * of the supplied camera. Once the pick buffer has been prepared, pc.Picker#getSelection can be - * called multiple times on the same picker object. Therefore, if the models or camera do not change + * called multiple times on the same picker object. Therefore, if the models or camera do not change * in any way, pc.Picker#prepare does not need to be called again. * @param {pc.Camera} camera The camera used to render the scene, note this is the CameraNode, not an Entity * @param {pc.Scene} scene The scene containing the pickable mesh instances. @@ -152,7 +152,7 @@ pc.extend(pc, function () { projId.setValue(projMat.data); viewProjId.setValue(viewProjMat.data); - + // copy scene drawCalls this.drawCalls = scene.drawCalls.slice(0); // sort same as forward renderer @@ -162,6 +162,7 @@ pc.extend(pc, function () { if (this.drawCalls[i].command) { this.drawCalls[i].command(); } else { + if (!this.drawCalls[i].pick) continue; meshInstance = this.drawCalls[i]; mesh = meshInstance.mesh; material = meshInstance.material; @@ -184,7 +185,7 @@ pc.extend(pc, function () { var h = meshInstance.skinInstance.boneTexture.height; boneTextureSizeId.setValue([w, h]) } else { - poseMatrixId.setValue(meshInstance.skinInstance.matrixPalette); + poseMatrixId.setValue(meshInstance.skinInstance.matrixPalette); } } @@ -214,7 +215,7 @@ pc.extend(pc, function () { * @function * @name pc.Picker#resize * @description Sets the resolution of the pick buffer. The pick buffer resolution does not need - * to match the resolution of the corresponding frame buffer use for general rendering of the + * to match the resolution of the corresponding frame buffer use for general rendering of the * 3D scene. However, the lower the resolution of the pick buffer, the less accurate the selection * results returned by pc.Picker#getSelection. On the other hand, smaller pick buffers will * yield greater performance, so there is a trade off.