From 9cfe6fe0bd13f52d4e2eb7db5532b2013e4d03f7 Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Mon, 30 Jun 2014 10:34:28 +0200 Subject: [PATCH 1/7] Setting view.x / view.y now positions viewport correctly Not sure if this._pRenderer._pStageGL.x / .y is the best way to access these StageGL properties --- src/away/containers/View.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/away/containers/View.ts b/src/away/containers/View.ts index 27f5c706..de951793 100644 --- a/src/away/containers/View.ts +++ b/src/away/containers/View.ts @@ -381,7 +381,8 @@ module away.containers if (this._pRenderer.x == value) return; - this._pRenderer.x == value; + this._pRenderer.x = value; + this._pRenderer._pStageGL.x = value; this._htmlElement.style.left = value + "px"; } @@ -398,7 +399,8 @@ module away.containers if (this._pRenderer.y == value) return; - this._pRenderer.y == value; + this._pRenderer.y = value; + this._pRenderer._pStageGL.y = value; this._htmlElement.style.top = value + "px"; } From 4d46be40388e375ba394002cfd3aecaa0d9414b9 Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Wed, 2 Jul 2014 09:19:00 +0200 Subject: [PATCH 2/7] Fix for exception thrown by RemoveChild() when _iAssignedPartition is null Line 95 of the iRegisterEntity function could be changed the same way, just to be sure (has not thrown an exception in my project yet) --- src/away/containers/Scene.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/away/containers/Scene.ts b/src/away/containers/Scene.ts index 025ec378..a79559e7 100644 --- a/src/away/containers/Scene.ts +++ b/src/away/containers/Scene.ts @@ -116,7 +116,7 @@ module away.containers if (displayObject.partition) this.iUnregisterPartition(displayObject.partition); - if (displayObject.isEntity) + if ((displayObject.isEntity) && (displayObject._iAssignedPartition)) displayObject._iAssignedPartition.iRemoveEntity(displayObject); } From 252bdfa523e10a662f4722d2103f317387b25340 Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Wed, 2 Jul 2014 10:12:59 +0200 Subject: [PATCH 3/7] Revert "Fix for exception thrown by RemoveChild() when _iAssignedPartition is null" This reverts commit 4d46be40388e375ba394002cfd3aecaa0d9414b9. --- src/away/containers/Scene.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/away/containers/Scene.ts b/src/away/containers/Scene.ts index a79559e7..025ec378 100644 --- a/src/away/containers/Scene.ts +++ b/src/away/containers/Scene.ts @@ -116,7 +116,7 @@ module away.containers if (displayObject.partition) this.iUnregisterPartition(displayObject.partition); - if ((displayObject.isEntity) && (displayObject._iAssignedPartition)) + if (displayObject.isEntity) displayObject._iAssignedPartition.iRemoveEntity(displayObject); } From 1e10ddf2249c7df8765ff2c23864196ff17246fd Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Wed, 2 Jul 2014 13:37:15 +0200 Subject: [PATCH 4/7] Fix for "_iAssignedPartition ist NULL"-exception on removeChild() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When calling removeChild(), an "_iAssignedPartition ist NULL" is thrown when the child does not have an _explicitPartition set. This can be fixed by calling „this._pUpdateImplicitPartition(null);“ AFTER „this._iSetScene(null);“, so that the _pImplicitPartition of the child is not null also. --- src/away/core/base/DisplayObject.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/away/core/base/DisplayObject.ts b/src/away/core/base/DisplayObject.ts index a7ba4868..92c940d7 100644 --- a/src/away/core/base/DisplayObject.ts +++ b/src/away/core/base/DisplayObject.ts @@ -1958,9 +1958,8 @@ module away.base } else { this._pUpdateImplicitMouseEnabled(true); this._pUpdateImplicitVisibility(true); - this._pUpdateImplicitPartition(null); - this._iSetScene(null); + this._pUpdateImplicitPartition(null); } } From 594ee005ceda956cb3ed92965ad5f282d67e3713 Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Wed, 2 Jul 2014 13:39:57 +0200 Subject: [PATCH 5/7] Revert "Fix for "_iAssignedPartition ist NULL"-exception on removeChild()" This reverts commit 1e10ddf2249c7df8765ff2c23864196ff17246fd. --- src/away/core/base/DisplayObject.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/away/core/base/DisplayObject.ts b/src/away/core/base/DisplayObject.ts index 92c940d7..a7ba4868 100644 --- a/src/away/core/base/DisplayObject.ts +++ b/src/away/core/base/DisplayObject.ts @@ -1958,8 +1958,9 @@ module away.base } else { this._pUpdateImplicitMouseEnabled(true); this._pUpdateImplicitVisibility(true); - this._iSetScene(null); this._pUpdateImplicitPartition(null); + + this._iSetScene(null); } } From 837b22d8b8b6f6dfa891a8bfbfb888bbabbc5a71 Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Tue, 29 Jul 2014 14:33:27 +0200 Subject: [PATCH 6/7] Fix for bitmapData.setPixels() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When calling renderer.queueSnapshot(), a buffer overrun („"ByteArray out of bounds read.“) is logged by ByteArray.readUnsignedInt() after 1/4 of the image data buffer has been processed. This happens because the bitmapData.setPixels() function calls inputByteArray.readUnsignedInt() 4 times within a loop iteration, where it should only request the unsigned int one time and split it into the RGBA components (like setPixel() and setPixel32() do). Also the loops had to be changed (the outer loop iterates over the y/height, the inner loop over the x/width), and the outer loop has to decrease the height value instead of increasing it, to compensate for the different y orientations of bitmaps and WebGL --- src/away/core/base/BitmapData.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/away/core/base/BitmapData.ts b/src/away/core/base/BitmapData.ts index 6023b8b5..81ad9d5c 100644 --- a/src/away/core/base/BitmapData.ts +++ b/src/away/core/base/BitmapData.ts @@ -179,14 +179,15 @@ module away.base if (this._imageData) { inputByteArray.position = 0; var i:number /*uint*/, j:number /*uint*/, index:number /*uint*/; - for (i = 0; i < rect.width; ++i) { - for (j = 0; j < rect.height; ++j) { - index = (i + rect.x + (j + rect.y)*this._imageCanvas.width)*4; - - this._imageData.data[index + 0] = inputByteArray.readUnsignedInt(); - this._imageData.data[index + 1] = inputByteArray.readUnsignedInt(); - this._imageData.data[index + 2] = inputByteArray.readUnsignedInt(); - this._imageData.data[index + 3] = inputByteArray.readUnsignedInt(); + for (i = rect.height-1; i >= 0; --i) { // height counter has to be in the outer loop, reversed y orientation + for (j = 0; j < rect.width; ++j) { + index = (j + rect.x + (i + rect.y)*this._imageCanvas.width)*4; + + var argb = away.utils.ColorUtils.float32ColorToARGB(inputByteArray.readUnsignedInt()); // readUnsignedInt returns a 32 bit color value + this._imageData.data[index + 0] = argb[3]; // B + this._imageData.data[index + 1] = argb[2]; // G + this._imageData.data[index + 2] = argb[1]; // R + this._imageData.data[index + 3] = argb[0]; // A } } } From 04dd1681b0aedb2f97366e1f8380685d738698ff Mon Sep 17 00:00:00 2001 From: Joachim Baur Date: Wed, 30 Jul 2014 17:32:07 +0200 Subject: [PATCH 7/7] Fix for CylinderPrefab topClosed and bottomClosed The top and bottom caps were not rendered, because the faces/triangles were created with wrong indices (I compared the resulting indices array to the corresponding RawIndices array of the ActionScript CylinderPrefab to find the correct order) --- src/away/prefabs/PrimitiveCylinderPrefab.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/away/prefabs/PrimitiveCylinderPrefab.ts b/src/away/prefabs/PrimitiveCylinderPrefab.ts index e580d2fd..65b75385 100644 --- a/src/away/prefabs/PrimitiveCylinderPrefab.ts +++ b/src/away/prefabs/PrimitiveCylinderPrefab.ts @@ -319,7 +319,7 @@ module away.prefabs if (i > 0) { // add triangle - indices[fidx++] = nextVertexIndex; + indices[fidx++] = nextVertexIndex + 3; indices[fidx++] = nextVertexIndex + 1; indices[fidx++] = nextVertexIndex + 2; @@ -394,9 +394,9 @@ module away.prefabs if (i > 0) { // add triangle - indices[fidx++] = nextVertexIndex; indices[fidx++] = nextVertexIndex + 2; indices[fidx++] = nextVertexIndex + 1; + indices[fidx++] = nextVertexIndex + 3; nextVertexIndex += 2; }