CanvasGraphics Class
+ + + + +A set of functions used by the webGL renderer to draw the primitive graphics data
+-
+
- Index + + + + + +
diff --git a/Gruntfile.js b/Gruntfile.js
index b3b8ac7..b083b49 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -11,27 +11,33 @@ module.exports = function(grunt) {
srcFiles = [
'<%= dirs.src %>/Intro.js',
'<%= dirs.src %>/Pixi.js',
- '<%= dirs.src %>/Point.js',
- '<%= dirs.src %>/Rectangle.js',
- '<%= dirs.src %>/Polygon.js',
- '<%= dirs.src %>/DisplayObject.js',
- '<%= dirs.src %>/DisplayObjectContainer.js',
- '<%= dirs.src %>/Sprite.js',
- '<%= dirs.src %>/MovieClip.js',
+ '<%= dirs.src %>/core/Point.js',
+ '<%= dirs.src %>/core/Rectangle.js',
+ '<%= dirs.src %>/core/Polygon.js',
+ '<%= dirs.src %>/core/Circle.js',
+ '<%= dirs.src %>/core/Ellipse.js',
+ '<%= dirs.src %>/core/Matrix.js',
+ '<%= dirs.src %>/display/DisplayObject.js',
+ '<%= dirs.src %>/display/DisplayObjectContainer.js',
+ '<%= dirs.src %>/display/Sprite.js',
+ '<%= dirs.src %>/display/MovieClip.js',
+ '<%= dirs.src %>/filters/FilterBlock.js',
'<%= dirs.src %>/text/Text.js',
'<%= dirs.src %>/text/BitmapText.js',
- '<%= dirs.src %>/Text.js',
'<%= dirs.src %>/InteractionManager.js',
- '<%= dirs.src %>/Stage.js',
+ '<%= dirs.src %>/display/Stage.js',
'<%= dirs.src %>/utils/Utils.js',
'<%= dirs.src %>/utils/EventTarget.js',
- '<%= dirs.src %>/utils/Matrix.js',
'<%= dirs.src %>/utils/Detector.js',
- '<%= dirs.src %>/renderers/WebGLShaders.js',
- '<%= dirs.src %>/renderers/WebGLRenderer.js',
- '<%= dirs.src %>/renderers/WebGLBatch.js',
- '<%= dirs.src %>/renderers/WebGLRenderGroup.js',
- '<%= dirs.src %>/renderers/CanvasRenderer.js',
+ '<%= dirs.src %>/utils/Polyk.js',
+ '<%= dirs.src %>/renderers/webgl/WebGLShaders.js',
+ '<%= dirs.src %>/renderers/webgl/WebGLGraphics.js',
+ '<%= dirs.src %>/renderers/webgl/WebGLRenderer.js',
+ '<%= dirs.src %>/renderers/webgl/WebGLBatch.js',
+ '<%= dirs.src %>/renderers/webgl/WebGLRenderGroup.js',
+ '<%= dirs.src %>/renderers/canvas/CanvasRenderer.js',
+ '<%= dirs.src %>/renderers/canvas/CanvasGraphics.js',
+ '<%= dirs.src %>/primitives/Graphics.js',
'<%= dirs.src %>/extras/Strip.js',
'<%= dirs.src %>/extras/Rope.js',
'<%= dirs.src %>/extras/TilingSprite.js',
@@ -116,7 +122,9 @@ module.exports = function(grunt) {
'examples/example 9 - Tiling Texture',
'examples/example 10 - Text',
'examples/example 11 - RenderTexture',
- 'examples/example 12 - Spine'
+ 'examples/example 12 - Spine',
+ 'examples/example 13 - Graphics',
+ 'examples/example 14 - Masking'
]
},
connect: {
diff --git a/README.md b/README.md
index a363de9..1993a75 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,10 @@ any breakthroughs will be posted up there too!
- [Render Texture Demo](
src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -631,7 +653,7 @@ http://www.bmglyph.com/ for mac.
src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -721,7 +743,7 @@ http://www.bmglyph.com/ for mac.
src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -875,7 +897,7 @@ http://www.bmglyph.com/ for mac.
- src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -904,7 +926,7 @@ http://www.bmglyph.com/ for mac.
src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -1043,7 +1065,7 @@ http://www.bmglyph.com/ for mac.
- src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1127,7 +1149,7 @@ http://www.bmglyph.com/ for mac.
- src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1211,7 +1233,7 @@ http://www.bmglyph.com/ for mac.
- src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1296,7 +1318,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
- src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1381,7 +1403,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1410,7 +1432,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1476,7 +1498,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1789,7 +1812,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1944,7 +1967,7 @@ basically a touch version of click
- src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -2028,7 +2051,7 @@ basically a touch version of click
- src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -2113,7 +2136,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -2186,7 +2209,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -2227,7 +2250,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -2268,7 +2291,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2309,7 +2332,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2328,6 +2351,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2392,7 +2499,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2433,7 +2540,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2474,7 +2581,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2515,7 +2622,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2556,7 +2663,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2597,7 +2704,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/CanvasGraphics.html b/docs/classes/CanvasGraphics.html
new file mode 100644
index 0000000..0e44412
--- /dev/null
+++ b/docs/classes/CanvasGraphics.html
@@ -0,0 +1,222 @@
+
+
+
+
+ A set of functions used by the webGL renderer to draw the primitive graphics data
+src/pixi/renderers/CanvasRenderer.js:6
+ Defined in: src/pixi/renderers/canvas/CanvasRenderer.js:6
src/pixi/renderers/CanvasRenderer.js:6
+ src/pixi/renderers/canvas/CanvasRenderer.js:6
@@ -442,7 +450,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/CanvasRenderer.js:66
+ src/pixi/renderers/canvas/CanvasRenderer.js:66
@@ -518,7 +526,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/CanvasRenderer.js:55
+ src/pixi/renderers/canvas/CanvasRenderer.js:55
@@ -562,7 +570,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/CanvasRenderer.js:31
+ src/pixi/renderers/canvas/CanvasRenderer.js:31
@@ -608,7 +616,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/CanvasRenderer.js:41
+ src/pixi/renderers/canvas/CanvasRenderer.js:41
@@ -652,7 +660,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/CanvasRenderer.js:24
+ src/pixi/renderers/canvas/CanvasRenderer.js:24
diff --git a/docs/classes/Circle.html b/docs/classes/Circle.html
new file mode 100644
index 0000000..e67296d
--- /dev/null
+++ b/docs/classes/Circle.html
@@ -0,0 +1,751 @@
+
+
+
+
+ Circle
x
+
+ y
+
+ radius
+
+ x
+ Number
+
+
+
+
+ The X coord of the upper-left corner of the framing rectangle of this circle
+y
+ Number
+
+
+
+
+ The Y coord of the upper-left corner of the framing rectangle of this circle
+radius
+ Number
+
+
+
+
+ The radius of the circle
+clone
contains
x
+
+ y
+
+ x
+ Number
+
+
+
+
+ The X coord of the point to test
+y
+ Number
+
+
+
+
+ The Y coord of the point to test
+radius
Default: 0
+ + + + + +x
Default: 0
+ + + + + +y
Default: 0
+ + + + + +src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -487,7 +509,7 @@
src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -571,7 +593,7 @@
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -655,7 +677,7 @@
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -739,7 +761,7 @@
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -824,7 +846,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -909,7 +931,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -975,7 +997,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1078,7 +1101,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -1162,7 +1185,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -1247,7 +1270,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -1331,7 +1354,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -1416,7 +1439,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -1457,7 +1480,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -1476,6 +1499,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -1540,7 +1647,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -1581,7 +1688,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -1622,7 +1729,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -1663,7 +1770,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -1704,7 +1811,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -1745,7 +1852,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/DisplayObject.html b/docs/classes/DisplayObject.html
index d9531c8..12cec79 100644
--- a/docs/classes/DisplayObject.html
+++ b/docs/classes/DisplayObject.html
@@ -19,7 +19,7 @@
src/pixi/DisplayObject.js:5
+ Defined in: src/pixi/display/DisplayObject.js:5
src/pixi/DisplayObject.js:5
+ src/pixi/display/DisplayObject.js:5
@@ -244,15 +252,6 @@
autoDetectRenderer
width
-
- height
-
- view
-
- transparent
-
- This helper function will automatically detect which renderer you should be using. -WebGL is the preferred renderer as it is a lot fastest. If webGL is not supported by the browser then this function will return a canvas renderer
-width
- Number
-
-
-
-
- the width of the renderers view
-height
- Number
-
-
-
-
- the height of the renderers view
-view
- Canvas
-
-
-
-
- the canvas to use as a view, optional
-transparent
- Boolean
-
-
-
-
- the transparency of the render view, default false
-click
src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -648,7 +508,7 @@ WebGL is the preferred renderer as it is a lot fastest. If webGL is not supporte
src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -735,7 +595,7 @@ WebGL is the preferred renderer as it is a lot fastest. If webGL is not supporte
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -822,7 +682,7 @@ WebGL is the preferred renderer as it is a lot fastest. If webGL is not supporte
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -909,7 +769,7 @@ WebGL is the preferred renderer as it is a lot fastest. If webGL is not supporte
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -997,7 +857,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1085,7 +945,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1154,7 +1014,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1260,7 +1121,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -1347,7 +1208,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -1435,7 +1296,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -1522,7 +1383,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -1613,7 +1474,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -1657,7 +1518,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -1676,6 +1537,96 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -1746,7 +1697,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -1790,7 +1741,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -1834,7 +1785,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -1878,7 +1829,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -1922,7 +1873,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -1966,7 +1917,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/DisplayObjectContainer.html b/docs/classes/DisplayObjectContainer.html
index 0d1e17b..aff6af1 100644
--- a/docs/classes/DisplayObjectContainer.html
+++ b/docs/classes/DisplayObjectContainer.html
@@ -19,7 +19,7 @@
src/pixi/DisplayObjectContainer.js:6
+ Defined in: src/pixi/display/DisplayObjectContainer.js:6
src/pixi/DisplayObjectContainer.js:6
+ src/pixi/display/DisplayObjectContainer.js:6
@@ -396,6 +404,20 @@
+
+
+ src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -596,7 +618,7 @@
- src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -695,7 +717,7 @@
- src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -724,7 +746,7 @@
src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -866,7 +888,7 @@
- src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -895,7 +917,7 @@
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -979,7 +1001,7 @@
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1063,7 +1085,7 @@
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1148,7 +1170,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1233,7 +1255,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1375,7 +1397,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1386,7 +1408,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1567,7 +1590,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1597,7 +1620,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -1681,7 +1704,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -1766,7 +1789,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -1850,7 +1873,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -1935,7 +1958,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -1979,7 +2002,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2020,7 +2043,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2039,6 +2062,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2103,7 +2210,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2144,7 +2251,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2185,7 +2292,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2226,7 +2333,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2267,7 +2374,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2308,7 +2415,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/Ellipse.html b/docs/classes/Ellipse.html
new file mode 100644
index 0000000..c5b5e4e
--- /dev/null
+++ b/docs/classes/Ellipse.html
@@ -0,0 +1,825 @@
+
+
+
+
+ Ellipse
x
+
+ y
+
+ width
+
+ height
+
+ x
+ Number
+
+
+
+
+ The X coord of the upper-left corner of the framing rectangle of this circle
+y
+ Number
+
+
+
+
+ The Y coord of the upper-left corner of the framing rectangle of this circle
+width
+ Number
+
+
+
+
+ The overall height of this ellipse
+height
+ Number
+
+
+
+
+ The overall width of this ellipse
+clone
contains
x
+
+ y
+
+ x
+ Number
+
+
+
+
+ The X coord of the point to test
+y
+ Number
+
+
+
+
+ The Y coord of the point to test
+height
Default: 0
+ + + + + +width
Default: 0
+ + + + + +x
Default: 0
+ + + + + +y
Default: 0
+ + + + + +The Graphics class contains a set of methods that you can use to create primitive shapes and lines. +It is important to know that with the webGL renderer only simple polys can be filled at this stage +Complex polys will not be filled. Heres an example of a complex poly: http://www.goodboydigital.com/wp-content/uploads/2013/06/complexPolygon.png
+Graphics
addChild
DisplayObject
+
+ Adds a child to the container.
+DisplayObject
+ DisplayObject
+
+
+
+
+ addChildAt
DisplayObject
+
+ index
+
+ Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown
+DisplayObject
+ DisplayObject
+
+
+
+
+ index
+ Number
+
+
+
+
+ beginFill
color
+
+ alpha
+
+ Specifies a simple one-color fill that subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) use when drawing.
+color
+ Uint
+
+
+
+
+ the color of the fill
+alpha
+ Number
+
+
+
+
+ the alpha
+clear
Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
+click
interactionData
+
+ A callback that is used when the users clicks on the displayObject with their mouse
+interactionData
+ InteractionData
+
+
+
+
+ drawCircle
x
+
+ y
+
+ radius
+
+ Draws a circle.
+x
+ Number
+
+
+
+
+ y
+ Number
+
+
+
+
+ radius
+ Number
+
+
+
+
+ drawElipse
x
+
+ y
+
+ width
+
+ height
+
+ Draws an elipse.
+x
+ Number
+
+
+
+
+ y
+ Number
+
+
+
+
+ width
+ Number
+
+
+
+
+ height
+ Number
+
+
+
+
+ drawRect
x
+
+ y
+
+ width
+
+ height
+
+ x
+ Number
+
+
+
+
+ y
+ Number
+
+
+
+
+ width
+ Number
+
+
+
+
+ height
+ Number
+
+
+
+
+ endFill
Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.
+getChildAt
index
+
+ Returns the Child at the specified index
+index
+ Number
+
+
+
+
+ lineStyle
lineWidth
+
+ color
+
+ alpha
+
+ Specifies a line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method.
+lineWidth
+ Number
+
+
+
+
+ color
+ Number
+
+
+
+
+ alpha
+ Number
+
+
+
+
+ lineTo
x
+
+ y
+
+ Draws a line using the current line style from the current drawing position to (x, y); the current drawing position is then set to (x, y).
+x
+ Number
+
+
+
+
+ y
+ Number
+
+
+
+
+ mousedown
interactionData
+
+ A callback that is used when the user clicks the mouse down over the sprite
+interactionData
+ InteractionData
+
+
+
+
+ mouseout
interactionData
+
+ A callback that is used when the users mouse leaves the displayObject
+interactionData
+ InteractionData
+
+
+
+
+ mouseover
interactionData
+
+ A callback that is used when the users mouse rolls over the displayObject
+interactionData
+ InteractionData
+
+
+
+
+ mouseup
interactionData
+
+ A callback that is used when the user releases the mouse that was over the displayObject +for this callback to be fired the mouse must have been pressed down over the displayObject
+interactionData
+ InteractionData
+
+
+
+
+ mouseupoutside
interactionData
+
+ A callback that is used when the user releases the mouse that was over the displayObject but is no longer over the displayObject +for this callback to be fired, The touch must have started over the displayObject
+interactionData
+ InteractionData
+
+
+
+
+ moveTo
x
+
+ y
+
+ Moves the current drawing position to (x, y).
+x
+ Number
+
+
+
+
+ y
+ Number
+
+
+
+
+ removeChild
DisplayObject
+
+ Removes a child from the container.
+DisplayObject
+ DisplayObject
+
+
+
+
+ setInteractive
interactive
+
+ [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
+interactive
+ Boolean
+
+
+
+
+ swapChildren
DisplayObject
+
+ DisplayObject2
+
+ Swaps the depth of 2 displayObjects
+DisplayObject
+ DisplayObject
+
+
+
+
+ DisplayObject2
+ DisplayObject
+
+
+
+
+ tap
interactionData
+
+ A callback that is used when the users taps on the sprite with their finger +basically a touch version of click
+interactionData
+ InteractionData
+
+
+
+
+ touchend
interactionData
+
+ A callback that is used when the user releases a touch over the displayObject
+interactionData
+ InteractionData
+
+
+
+
+ touchendoutside
interactionData
+
+ A callback that is used when the user releases the touch that was over the displayObject +for this callback to be fired, The touch must have started over the sprite
+interactionData
+ InteractionData
+
+
+
+
+ touchstart
interactionData
+
+ A callback that is used when the user touch's over the displayObject
+interactionData
+ InteractionData
+
+
+
+
+ alpha
The opacity of the object.
+children
[read-only] The of children of this container.
+hitArea
This is the defined area that will pick up mouse / touch events. It is null by default. +Setting it is a neat way of optimising the hitTest function that the interactionManager will use (as it will not need to hit test all the children)
+interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+parent
[read-only] The display object container that contains this display object.
+pivot
The pivot point of the displayObject that it rotates around
+position
The coordinate of the object relative to the local coordinates of the parent.
+rotation
The rotation of the object in radians.
+stage
[read-only] The stage the display object is connected to, or undefined if it is not connected to the stage.
+visible
The visibility of the object.
+src/pixi/InteractionManager.js:513
+ Defined in: src/pixi/InteractionManager.js:493
src/pixi/InteractionManager.js:513
+ src/pixi/InteractionManager.js:493
@@ -266,6 +274,13 @@
+
+
+ src/pixi/InteractionManager.js:537
+ src/pixi/InteractionManager.js:524
@@ -424,7 +439,7 @@
- src/pixi/InteractionManager.js:519
+ src/pixi/InteractionManager.js:499
@@ -442,6 +457,50 @@
+originalEvent
When passed to an event handler, this will be the original DOM Event that was captured
+src/pixi/InteractionManager.js:529
+ src/pixi/InteractionManager.js:509
diff --git a/docs/classes/InteractionManager.html b/docs/classes/InteractionManager.html
index 9669e2e..54f508b 100644
--- a/docs/classes/InteractionManager.html
+++ b/docs/classes/InteractionManager.html
@@ -19,7 +19,7 @@
autoDetectRenderer
width
+
+ height
+
+ view
+
+ transparent
+
+ This helper function will automatically detect which renderer you should be using. +WebGL is the preferred renderer as it is a lot fastest. If webGL is not supported by the browser then this function will return a canvas renderer
+width
+ Number
+
+
+
+
+ the width of the renderers view
+height
+ Number
+
+
+
+
+ the height of the renderers view
+view
+ Canvas
+
+
+
+
+ the canvas to use as a view, optional
+transparent
+ Boolean
+
+
+
+
+ the transparency of the render view, default false
+src/pixi/MovieClip.js:5
+ Defined in: src/pixi/display/MovieClip.js:5
src/pixi/MovieClip.js:5
+ src/pixi/display/MovieClip.js:5
@@ -499,6 +507,13 @@
+
+
+ src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -735,7 +757,7 @@
- src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -834,7 +856,7 @@
- src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -863,7 +885,7 @@
src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -1005,7 +1027,7 @@
- src/pixi/MovieClip.js:94
+ src/pixi/display/MovieClip.js:94
@@ -1092,7 +1114,7 @@
- src/pixi/MovieClip.js:81
+ src/pixi/display/MovieClip.js:81
@@ -1176,7 +1198,7 @@
- src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -1205,7 +1227,7 @@
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1289,7 +1311,7 @@
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1373,7 +1395,7 @@
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1458,7 +1480,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1543,7 +1565,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/MovieClip.js:72
+ src/pixi/display/MovieClip.js:72
@@ -1652,7 +1674,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1736,7 +1758,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1747,7 +1769,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/Sprite.js:103
+ src/pixi/display/Sprite.js:103
@@ -1897,7 +1920,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/MovieClip.js:63
+ src/pixi/display/MovieClip.js:63
@@ -1964,7 +1987,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -2063,7 +2086,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -2093,7 +2116,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -2177,7 +2200,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -2262,7 +2285,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -2346,7 +2369,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -2431,7 +2454,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/Sprite.js:21
+ src/pixi/display/Sprite.js:21
@@ -2478,7 +2501,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
- src/pixi/MovieClip.js:30
+ src/pixi/display/MovieClip.js:30
@@ -2519,7 +2542,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
- src/pixi/Sprite.js:38
+ src/pixi/display/Sprite.js:38
@@ -2561,7 +2584,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -2602,7 +2625,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2646,7 +2669,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/MovieClip.js:23
+ src/pixi/display/MovieClip.js:23
@@ -2687,7 +2710,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/Sprite.js:53
+ src/pixi/display/Sprite.js:53
@@ -2728,7 +2751,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2747,6 +2770,47 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+src/pixi/MovieClip.js:37
+ src/pixi/display/MovieClip.js:37
@@ -2791,6 +2855,49 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/MovieClip.js:44
+ src/pixi/display/MovieClip.js:44
@@ -2858,7 +2965,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2899,7 +3006,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2943,7 +3050,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/MovieClip.js:51
+ src/pixi/display/MovieClip.js:51
@@ -2984,7 +3091,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -3025,7 +3132,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -3066,7 +3173,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -3107,7 +3214,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -3148,7 +3255,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/Sprite.js:31
+ src/pixi/display/Sprite.js:31
@@ -3192,7 +3299,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/MovieClip.js:16
+ src/pixi/display/MovieClip.js:16
@@ -3233,7 +3340,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
@@ -3274,7 +3381,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/Sprite.js:46
+ src/pixi/display/Sprite.js:46
diff --git a/docs/classes/Point.html b/docs/classes/Point.html
index 87114ce..9cc03ce 100644
--- a/docs/classes/Point.html
+++ b/docs/classes/Point.html
@@ -19,7 +19,7 @@
src/pixi/Point.js:5
+ Defined in: src/pixi/core/Point.js:5
src/pixi/Point.js:5
+ src/pixi/core/Point.js:5
@@ -379,7 +387,7 @@
- src/pixi/Point.js:29
+ src/pixi/core/Point.js:29
@@ -443,7 +451,7 @@
- src/pixi/Point.js:14
+ src/pixi/core/Point.js:14
@@ -489,7 +497,7 @@
- src/pixi/Point.js:21
+ src/pixi/core/Point.js:21
diff --git a/docs/classes/Polygon.html b/docs/classes/Polygon.html
index 6669a83..587eb48 100644
--- a/docs/classes/Polygon.html
+++ b/docs/classes/Polygon.html
@@ -19,7 +19,7 @@
src/pixi/Polygon.js:5
+ Defined in: src/pixi/core/Polygon.js:5
src/pixi/Polygon.js:5
+ src/pixi/core/Polygon.js:5
@@ -229,13 +237,14 @@
points
- Array
+ ArrayThis cna be an array of Points or a flat array of numbers + that will be interpreted as [x,y, x,y, ...]
src/pixi/Polygon.js:15
+ src/pixi/core/Polygon.js:28
@@ -364,6 +380,129 @@
+contains
x
+
+ y
+
+ x
+ Number
+
+
+
+
+ The X coord of the point to test
+y
+ Number
+
+
+
+
+ The Y coord of the point to test
+src/pixi/Rectangle.js:5
+ Defined in: src/pixi/core/Rectangle.js:5
src/pixi/Rectangle.js:5
+ src/pixi/core/Rectangle.js:5
@@ -345,6 +353,13 @@
+
+
+ src/pixi/Rectangle.js:45
+ src/pixi/core/Rectangle.js:45
@@ -465,6 +480,129 @@
+contains
x
+
+ y
+
+ x
+ Number
+
+
+
+
+ The X coord of the point to test
+y
+ Number
+
+
+
+
+ The Y coord of the point to test
+src/pixi/Rectangle.js:37
+ src/pixi/core/Rectangle.js:37
@@ -545,7 +683,7 @@
- src/pixi/Rectangle.js:30
+ src/pixi/core/Rectangle.js:30
@@ -591,7 +729,7 @@
- src/pixi/Rectangle.js:16
+ src/pixi/core/Rectangle.js:16
@@ -637,7 +775,7 @@
- src/pixi/Rectangle.js:23
+ src/pixi/core/Rectangle.js:23
diff --git a/docs/classes/RenderTexture.html b/docs/classes/RenderTexture.html
index 7e465aa..e274141 100644
--- a/docs/classes/RenderTexture.html
+++ b/docs/classes/RenderTexture.html
@@ -19,7 +19,7 @@
A RenderTexture is a special texture that allows any pixi displayObject to be rendered to it.
+ +Hint: All DisplayObjects (exmpl. Sprites) that renders on RenderTexture should be preloaded. +Otherwise black rectangles will be drawn instead.
+ +RenderTexture takes snapshot of DisplayObject passed to render method. If DisplayObject is passed to render method, position and rotation of it will be ignored. For example:
+ +var renderTexture = new PIXI.RenderTexture(800, 600);
+var sprite = PIXI.Sprite.fromImage("spinObj_01.png");
+sprite.position.x = 800/2;
+sprite.position.y = 600/2;
+sprite.anchor.x = 0.5;
+sprite.anchor.y = 0.5;
+renderTexture.render(sprite);
+
+
+Sprite in this case will be rendered to 0,0 position. To render this sprite at center DisplayObjectContainer should be used:
+ +var doc = new PIXI.DisplayObjectContainer();
+doc.addChild(sprite);
+renderTexture.render(doc); // Renders to center of renderTexture
+
src/pixi/textures/RenderTexture.js:90
+ src/pixi/textures/RenderTexture.js:112
diff --git a/docs/classes/Spine.html b/docs/classes/Spine.html
index 5ef8e25..07fba75 100644
--- a/docs/classes/Spine.html
+++ b/docs/classes/Spine.html
@@ -19,7 +19,7 @@
src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -628,7 +650,7 @@ When loaded this class will dispatch a "loaded" event
- src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -727,7 +749,7 @@ When loaded this class will dispatch a "loaded" event
- src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -756,7 +778,7 @@ When loaded this class will dispatch a "loaded" event
src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -895,7 +917,7 @@ When loaded this class will dispatch a "loaded" event
- src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -924,7 +946,7 @@ When loaded this class will dispatch a "loaded" event
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1008,7 +1030,7 @@ When loaded this class will dispatch a "loaded" event
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1092,7 +1114,7 @@ When loaded this class will dispatch a "loaded" event
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1177,7 +1199,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1262,7 +1284,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1401,7 +1423,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1412,7 +1434,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1590,7 +1613,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1620,7 +1643,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -1704,7 +1727,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -1789,7 +1812,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -1873,7 +1896,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -1958,7 +1981,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -1999,7 +2022,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2040,7 +2063,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2059,6 +2082,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2123,7 +2230,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2164,7 +2271,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2205,7 +2312,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2246,7 +2353,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2287,7 +2394,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2328,7 +2435,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/Sprite.html b/docs/classes/Sprite.html
index 1219a2e..aea92ff 100644
--- a/docs/classes/Sprite.html
+++ b/docs/classes/Sprite.html
@@ -19,7 +19,7 @@
src/pixi/Sprite.js:10
+ Defined in: src/pixi/display/Sprite.js:10
src/pixi/Sprite.js:10
+ src/pixi/display/Sprite.js:10
@@ -475,6 +483,20 @@
+
+
+ src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -683,7 +705,7 @@
- src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -782,7 +804,7 @@
- src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -811,7 +833,7 @@
src/pixi/Sprite.js:135
+ src/pixi/display/Sprite.js:135
@@ -982,7 +1004,7 @@
- src/pixi/Sprite.js:151
+ src/pixi/display/Sprite.js:151
@@ -1080,7 +1102,7 @@
- src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -1164,7 +1186,7 @@
- src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -1193,7 +1215,7 @@
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1277,7 +1299,7 @@
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1361,7 +1383,7 @@
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1446,7 +1468,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1531,7 +1553,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1670,7 +1692,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1681,7 +1703,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/Sprite.js:103
+ src/pixi/display/Sprite.js:103
@@ -1847,7 +1870,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1946,7 +1969,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1976,7 +1999,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -2060,7 +2083,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -2145,7 +2168,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -2229,7 +2252,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -2317,7 +2340,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/Sprite.js:21
+ src/pixi/display/Sprite.js:21
@@ -2364,7 +2387,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
- src/pixi/Sprite.js:38
+ src/pixi/display/Sprite.js:38
@@ -2406,7 +2429,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -2447,7 +2470,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2491,7 +2514,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/Sprite.js:53
+ src/pixi/display/Sprite.js:53
@@ -2532,7 +2555,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2551,6 +2574,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2615,7 +2722,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2656,7 +2763,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2697,7 +2804,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2738,7 +2845,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2779,7 +2886,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2823,7 +2930,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/Sprite.js:31
+ src/pixi/display/Sprite.js:31
@@ -2864,7 +2971,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
@@ -2908,7 +3015,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/Sprite.js:46
+ src/pixi/display/Sprite.js:46
diff --git a/docs/classes/SpriteSheetLoader.html b/docs/classes/SpriteSheetLoader.html
index 30efbcc..f1091f0 100644
--- a/docs/classes/SpriteSheetLoader.html
+++ b/docs/classes/SpriteSheetLoader.html
@@ -19,7 +19,7 @@
src/pixi/Stage.js:5
+ Defined in: src/pixi/display/Stage.js:5
src/pixi/Stage.js:5
+ src/pixi/display/Stage.js:5
@@ -471,6 +479,20 @@
+
+
+ src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -665,7 +687,7 @@
- src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -764,7 +786,7 @@
- src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -793,7 +815,7 @@
src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -929,7 +951,7 @@
- src/pixi/Stage.js:76
+ src/pixi/display/Stage.js:78
@@ -1003,7 +1025,7 @@
- src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -1032,7 +1054,7 @@
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1116,7 +1138,7 @@
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1200,7 +1222,7 @@
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1285,7 +1307,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1370,7 +1392,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1512,7 +1534,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/Stage.js:63
+ src/pixi/display/Stage.js:65
@@ -1596,7 +1618,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1607,7 +1629,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1785,7 +1808,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1815,7 +1838,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -1899,7 +1922,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -1984,7 +2007,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -2068,7 +2091,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/Stage.js:40
+ src/pixi/display/Stage.js:42
@@ -2166,7 +2189,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -2207,7 +2230,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -2248,7 +2271,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2289,7 +2312,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2308,6 +2331,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2372,7 +2479,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2413,7 +2520,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2454,7 +2561,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2495,7 +2602,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2536,7 +2643,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2577,7 +2684,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/Text.html b/docs/classes/Text.html
index 9c342b1..db91c58 100644
--- a/docs/classes/Text.html
+++ b/docs/classes/Text.html
@@ -19,7 +19,7 @@
src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -735,7 +757,7 @@
src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -825,7 +847,7 @@
src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -979,7 +1001,7 @@
- src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -1008,7 +1030,7 @@
src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -1147,7 +1169,7 @@
- src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1231,7 +1253,7 @@
- src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1315,7 +1337,7 @@
- src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1400,7 +1422,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
- src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1485,7 +1507,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1514,7 +1536,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1580,7 +1602,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/Sprite.js:103
+ src/pixi/display/Sprite.js:103
@@ -1940,7 +1963,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1969,7 +1992,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -2124,7 +2147,7 @@ basically a touch version of click
- src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -2208,7 +2231,7 @@ basically a touch version of click
- src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -2293,7 +2316,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -2366,7 +2389,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -2407,7 +2430,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/Sprite.js:21
+ src/pixi/display/Sprite.js:21
@@ -2451,7 +2474,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
- src/pixi/Sprite.js:38
+ src/pixi/display/Sprite.js:38
@@ -2493,7 +2516,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -2534,7 +2557,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2575,7 +2598,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/Sprite.js:53
+ src/pixi/display/Sprite.js:53
@@ -2616,7 +2639,7 @@ currently supports PIXI.blendModes.NORMAL and PIXI.blendModes.SCREEN
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2635,6 +2658,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2699,7 +2806,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2740,7 +2847,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2781,7 +2888,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2822,7 +2929,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2863,7 +2970,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2904,7 +3011,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/Sprite.js:31
+ src/pixi/display/Sprite.js:31
@@ -2945,7 +3052,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
@@ -2986,7 +3093,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/Sprite.js:46
+ src/pixi/display/Sprite.js:46
diff --git a/docs/classes/Texture.html b/docs/classes/Texture.html
index 04a5a8f..5069fde 100644
--- a/docs/classes/Texture.html
+++ b/docs/classes/Texture.html
@@ -19,7 +19,7 @@
src/pixi/DisplayObjectContainer.js:41
+ src/pixi/display/DisplayObjectContainer.js:42
@@ -679,7 +701,7 @@
- src/pixi/DisplayObjectContainer.js:73
+ src/pixi/display/DisplayObjectContainer.js:139
@@ -778,7 +800,7 @@
- src/pixi/DisplayObject.js:106
+ src/pixi/display/DisplayObject.js:109
@@ -807,7 +829,7 @@
src/pixi/DisplayObjectContainer.js:168
+ src/pixi/display/DisplayObjectContainer.js:274
@@ -946,7 +968,7 @@
- src/pixi/DisplayObject.js:112
+ src/pixi/display/DisplayObject.js:115
@@ -975,7 +997,7 @@
src/pixi/DisplayObject.js:138
+ src/pixi/display/DisplayObject.js:141
@@ -1059,7 +1081,7 @@
src/pixi/DisplayObject.js:132
+ src/pixi/display/DisplayObject.js:135
@@ -1143,7 +1165,7 @@
src/pixi/DisplayObject.js:118
+ src/pixi/display/DisplayObject.js:121
@@ -1228,7 +1250,7 @@ for this callback to be fired the mouse must have been pressed down over the dis
src/pixi/DisplayObject.js:125
+ src/pixi/display/DisplayObject.js:128
@@ -1313,7 +1335,7 @@ for this callback to be fired, The touch must have started over the displayObjec
src/pixi/DisplayObjectContainer.js:186
+ src/pixi/display/DisplayObjectContainer.js:291
@@ -1452,7 +1474,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:190
+ src/pixi/display/DisplayObject.js:193
@@ -1463,7 +1485,8 @@ for this callback to be fired, The touch must have started over the displayObjec
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+[Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default +Instead of using this function you can now simply set the interactive property to true or false
src/pixi/DisplayObjectContainer.js:128
+ src/pixi/display/DisplayObjectContainer.js:227
@@ -1641,7 +1664,7 @@ for this callback to be fired, The touch must have started over the displayObjec
- src/pixi/DisplayObject.js:149
+ src/pixi/display/DisplayObject.js:152
@@ -1671,7 +1694,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:162
+ src/pixi/display/DisplayObject.js:165
@@ -1755,7 +1778,7 @@ basically a touch version of click
src/pixi/DisplayObject.js:168
+ src/pixi/display/DisplayObject.js:171
@@ -1840,7 +1863,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:156
+ src/pixi/display/DisplayObject.js:159
@@ -1924,7 +1947,7 @@ for this callback to be fired, The touch must have started over the sprite
src/pixi/DisplayObject.js:40
+ src/pixi/display/DisplayObject.js:43
@@ -2009,7 +2032,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:95
+ src/pixi/display/DisplayObject.js:98
@@ -2050,7 +2073,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObjectContainer.js:16
+ src/pixi/display/DisplayObjectContainer.js:16
@@ -2091,7 +2114,7 @@ for this callback to be fired, The touch must have started over the sprite
- src/pixi/DisplayObject.js:69
+ src/pixi/display/DisplayObject.js:72
@@ -2110,6 +2133,90 @@ Setting it is a neat way of optimising the hitTest function that the interaction
+
+
+
+ interactive
Indicates if the sprite will have touch and mouse interactivity. It is false by default
+mask
Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. +In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. +To remove a mask, set this property to null.
+src/pixi/DisplayObject.js:55
+ src/pixi/display/DisplayObject.js:58
@@ -2174,7 +2281,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:26
+ src/pixi/display/DisplayObject.js:29
@@ -2215,7 +2322,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:12
+ src/pixi/display/DisplayObject.js:15
@@ -2256,7 +2363,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:33
+ src/pixi/display/DisplayObject.js:36
@@ -2297,7 +2404,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:19
+ src/pixi/display/DisplayObject.js:22
@@ -2338,7 +2445,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:62
+ src/pixi/display/DisplayObject.js:65
@@ -2382,7 +2489,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/extras/TilingSprite.js:29
+ src/pixi/extras/TilingSprite.js:28
@@ -2426,7 +2533,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/extras/TilingSprite.js:23
+ src/pixi/extras/TilingSprite.js:22
@@ -2467,7 +2574,7 @@ Setting it is a neat way of optimising the hitTest function that the interaction
- src/pixi/DisplayObject.js:47
+ src/pixi/display/DisplayObject.js:50
diff --git a/docs/classes/WebGLBatch.html b/docs/classes/WebGLBatch.html
index 7de62b9..39646be 100644
--- a/docs/classes/WebGLBatch.html
+++ b/docs/classes/WebGLBatch.html
@@ -19,7 +19,7 @@
src/pixi/renderers/WebGLRenderGroup.js:8
+ Defined in: src/pixi/renderers/webgl/WebGLRenderGroup.js:8
src/pixi/renderers/WebGLBatch.js:98
+ src/pixi/renderers/webgl/WebGLBatch.js:98
@@ -400,7 +408,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:145
+ src/pixi/renderers/webgl/WebGLBatch.js:145
@@ -508,7 +516,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:117
+ src/pixi/renderers/webgl/WebGLBatch.js:117
@@ -610,7 +618,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:268
+ src/pixi/renderers/webgl/WebGLBatch.js:268
@@ -687,7 +695,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:346
+ src/pixi/renderers/webgl/WebGLBatch.js:346
@@ -751,7 +759,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:175
+ src/pixi/renderers/webgl/WebGLBatch.js:175
@@ -828,7 +836,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:513
+ src/pixi/renderers/webgl/WebGLBatch.js:513
@@ -896,7 +904,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:218
+ src/pixi/renderers/webgl/WebGLBatch.js:218
@@ -986,7 +994,7 @@ if a group of sprites all have the same baseTexture and blendMode then they can
- src/pixi/renderers/WebGLBatch.js:401
+ src/pixi/renderers/webgl/WebGLBatch.js:401
diff --git a/docs/classes/WebGLRenderer.html b/docs/classes/WebGLRenderer.html
index 5cb2a66..4b5ffef 100644
--- a/docs/classes/WebGLRenderer.html
+++ b/docs/classes/WebGLRenderer.html
@@ -19,7 +19,7 @@
src/pixi/renderers/WebGLRenderer.js:11
+ Defined in: src/pixi/renderers/webgl/WebGLRenderer.js:11
src/pixi/renderers/WebGLRenderer.js:11
+ src/pixi/renderers/webgl/WebGLRenderer.js:11
@@ -411,7 +419,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/WebGLRenderer.js:144
+ src/pixi/renderers/webgl/WebGLRenderer.js:121
@@ -504,7 +512,7 @@ Dont forget to add the view to your DOM or you will not see anything :)
- src/pixi/renderers/WebGLRenderer.js:284
+ src/pixi/renderers/webgl/WebGLRenderer.js:263
diff --git a/docs/data.json b/docs/data.json
index b9ee342..d450277 100644
--- a/docs/data.json
+++ b/docs/data.json
@@ -2,11 +2,101 @@
"project": {
"name": "Pixi.JS",
"description": "Pixi.js is a fast lightweight 2D library that works across all devices.",
- "version": "1.0.0",
+ "version": "1.3.0",
"url": "http://goodboydigital.com/",
"logo": "http://www.goodboydigital.com/pixijs/logo_small.png"
},
"files": {
+ "src/pixi/core/Circle.js": {
+ "name": "src/pixi/core/Circle.js",
+ "modules": {},
+ "classes": {
+ "Circle": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/core/Ellipse.js": {
+ "name": "src/pixi/core/Ellipse.js",
+ "modules": {},
+ "classes": {
+ "Ellipse": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/core/Point.js": {
+ "name": "src/pixi/core/Point.js",
+ "modules": {},
+ "classes": {
+ "Point": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/core/Polygon.js": {
+ "name": "src/pixi/core/Polygon.js",
+ "modules": {},
+ "classes": {
+ "Polygon": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/core/Rectangle.js": {
+ "name": "src/pixi/core/Rectangle.js",
+ "modules": {},
+ "classes": {
+ "Rectangle": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/display/DisplayObject.js": {
+ "name": "src/pixi/display/DisplayObject.js",
+ "modules": {},
+ "classes": {
+ "DisplayObject": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/display/DisplayObjectContainer.js": {
+ "name": "src/pixi/display/DisplayObjectContainer.js",
+ "modules": {},
+ "classes": {
+ "DisplayObjectContainer": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/display/MovieClip.js": {
+ "name": "src/pixi/display/MovieClip.js",
+ "modules": {},
+ "classes": {
+ "MovieClip": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/display/Sprite.js": {
+ "name": "src/pixi/display/Sprite.js",
+ "modules": {},
+ "classes": {
+ "Sprite": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/display/Stage.js": {
+ "name": "src/pixi/display/Stage.js",
+ "modules": {},
+ "classes": {
+ "Stage": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
"src/pixi/extras/CustomRenderable.js": {
"name": "src/pixi/extras/CustomRenderable.js",
"modules": {},
@@ -46,6 +136,20 @@
"fors": {},
"namespaces": {}
},
+ "src/pixi/filters/FilterBlock.js": {
+ "name": "src/pixi/filters/FilterBlock.js",
+ "modules": {},
+ "classes": {},
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/filters/MaskFilter.js": {
+ "name": "src/pixi/filters/MaskFilter.js",
+ "modules": {},
+ "classes": {},
+ "fors": {},
+ "namespaces": {}
+ },
"src/pixi/loaders/AssetLoader.js": {
"name": "src/pixi/loaders/AssetLoader.js",
"modules": {},
@@ -100,8 +204,24 @@
"fors": {},
"namespaces": {}
},
- "src/pixi/renderers/CanvasRenderer.js": {
- "name": "src/pixi/renderers/CanvasRenderer.js",
+ "src/pixi/primitives/Graphics.js": {
+ "name": "src/pixi/primitives/Graphics.js",
+ "modules": {},
+ "classes": {
+ "Graphics": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/renderers/canvas/CanvasGraphics.js": {
+ "name": "src/pixi/renderers/canvas/CanvasGraphics.js",
+ "modules": {},
+ "classes": {},
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/renderers/canvas/CanvasRenderer.js": {
+ "name": "src/pixi/renderers/canvas/CanvasRenderer.js",
"modules": {},
"classes": {
"CanvasRenderer": 1
@@ -109,15 +229,24 @@
"fors": {},
"namespaces": {}
},
- "src/pixi/renderers/WebGLBatch.js": {
- "name": "src/pixi/renderers/WebGLBatch.js",
+ "src/pixi/renderers/webgl/WebGLBatch.js": {
+ "name": "src/pixi/renderers/webgl/WebGLBatch.js",
"modules": {},
"classes": {},
"fors": {},
"namespaces": {}
},
- "src/pixi/renderers/WebGLRenderGroup.js": {
- "name": "src/pixi/renderers/WebGLRenderGroup.js",
+ "src/pixi/renderers/webgl/WebGLGraphics.js": {
+ "name": "src/pixi/renderers/webgl/WebGLGraphics.js",
+ "modules": {},
+ "classes": {
+ "CanvasGraphics": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/pixi/renderers/webgl/WebGLRenderGroup.js": {
+ "name": "src/pixi/renderers/webgl/WebGLRenderGroup.js",
"modules": {},
"classes": {
"WebGLBatch": 1
@@ -125,8 +254,8 @@
"fors": {},
"namespaces": {}
},
- "src/pixi/renderers/WebGLRenderer.js": {
- "name": "src/pixi/renderers/WebGLRenderer.js",
+ "src/pixi/renderers/webgl/WebGLRenderer.js": {
+ "name": "src/pixi/renderers/webgl/WebGLRenderer.js",
"modules": {},
"classes": {
"WebGLRenderer": 1
@@ -134,8 +263,8 @@
"fors": {},
"namespaces": {}
},
- "src/pixi/renderers/WebGLShaders.js": {
- "name": "src/pixi/renderers/WebGLShaders.js",
+ "src/pixi/renderers/webgl/WebGLShaders.js": {
+ "name": "src/pixi/renderers/webgl/WebGLShaders.js",
"modules": {},
"classes": {},
"fors": {},
@@ -207,24 +336,6 @@
"fors": {},
"namespaces": {}
},
- "src/pixi/DisplayObject.js": {
- "name": "src/pixi/DisplayObject.js",
- "modules": {},
- "classes": {
- "DisplayObject": 1
- },
- "fors": {},
- "namespaces": {}
- },
- "src/pixi/DisplayObjectContainer.js": {
- "name": "src/pixi/DisplayObjectContainer.js",
- "modules": {},
- "classes": {
- "DisplayObjectContainer": 1
- },
- "fors": {},
- "namespaces": {}
- },
"src/pixi/InteractionManager.js": {
"name": "src/pixi/InteractionManager.js",
"modules": {},
@@ -242,15 +353,6 @@
"fors": {},
"namespaces": {}
},
- "src/pixi/MovieClip.js": {
- "name": "src/pixi/MovieClip.js",
- "modules": {},
- "classes": {
- "MovieClip": 1
- },
- "fors": {},
- "namespaces": {}
- },
"src/pixi/Outro.js": {
"name": "src/pixi/Outro.js",
"modules": {},
@@ -266,51 +368,6 @@
"classes": {},
"fors": {},
"namespaces": {}
- },
- "src/pixi/Point.js": {
- "name": "src/pixi/Point.js",
- "modules": {},
- "classes": {
- "Point": 1
- },
- "fors": {},
- "namespaces": {}
- },
- "src/pixi/Polygon.js": {
- "name": "src/pixi/Polygon.js",
- "modules": {},
- "classes": {
- "Polygon": 1
- },
- "fors": {},
- "namespaces": {}
- },
- "src/pixi/Rectangle.js": {
- "name": "src/pixi/Rectangle.js",
- "modules": {},
- "classes": {
- "Rectangle": 1
- },
- "fors": {},
- "namespaces": {}
- },
- "src/pixi/Sprite.js": {
- "name": "src/pixi/Sprite.js",
- "modules": {},
- "classes": {
- "Sprite": 1
- },
- "fors": {},
- "namespaces": {}
- },
- "src/pixi/Stage.js": {
- "name": "src/pixi/Stage.js",
- "modules": {},
- "classes": {
- "Stage": 1
- },
- "fors": {},
- "namespaces": {}
}
},
"modules": {
@@ -318,6 +375,16 @@
"name": "PIXI",
"submodules": {},
"classes": {
+ "Circle": 1,
+ "Ellipse": 1,
+ "Point": 1,
+ "Polygon": 1,
+ "Rectangle": 1,
+ "DisplayObject": 1,
+ "DisplayObjectContainer": 1,
+ "MovieClip": 1,
+ "Sprite": 1,
+ "Stage": 1,
"CustomRenderable": 1,
"Spine": 1,
"TilingSprite": 1,
@@ -326,6 +393,8 @@
"ImageLoader": 1,
"JsonLoader": 1,
"SpriteSheetLoader": 1,
+ "Graphics": 1,
+ "CanvasGraphics": 1,
"CanvasRenderer": 1,
"WebGLBatch": 1,
"WebGLRenderer": 1,
@@ -334,25 +403,264 @@
"BaseTexture": 1,
"RenderTexture": 1,
"Texture": 1,
- "DisplayObject": 1,
- "DisplayObjectContainer": 1,
"InteractionManager": 1,
- "InteractionData": 1,
- "MovieClip": 1,
- "Point": 1,
- "Polygon": 1,
- "Rectangle": 1,
- "Sprite": 1,
- "Stage": 1
+ "InteractionData": 1
},
"fors": {},
"namespaces": {},
"tag": "module",
- "file": "src/pixi/Stage.js",
- "line": 5
+ "file": "src/pixi/InteractionManager.js",
+ "line": 493
}
},
"classes": {
+ "Circle": {
+ "name": "Circle",
+ "shortname": "Circle",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "PIXI",
+ "file": "src/pixi/core/Circle.js",
+ "line": 5,
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "x",
+ "description": "The X coord of the upper-left corner of the framing rectangle of this circle",
+ "type": "Number"
+ },
+ {
+ "name": "y",
+ "description": "The Y coord of the upper-left corner of the framing rectangle of this circle",
+ "type": "Number"
+ },
+ {
+ "name": "radius",
+ "description": "The radius of the circle",
+ "type": "Number"
+ }
+ ]
+ },
+ "Ellipse": {
+ "name": "Ellipse",
+ "shortname": "Ellipse",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "PIXI",
+ "file": "src/pixi/core/Ellipse.js",
+ "line": 5,
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "x",
+ "description": "The X coord of the upper-left corner of the framing rectangle of this circle",
+ "type": "Number"
+ },
+ {
+ "name": "y",
+ "description": "The Y coord of the upper-left corner of the framing rectangle of this circle",
+ "type": "Number"
+ },
+ {
+ "name": "width",
+ "description": "The overall height of this ellipse",
+ "type": "Number"
+ },
+ {
+ "name": "height",
+ "description": "The overall width of this ellipse",
+ "type": "Number"
+ }
+ ]
+ },
+ "Point": {
+ "name": "Point",
+ "shortname": "Point",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "PIXI",
+ "file": "src/pixi/core/Point.js",
+ "line": 5,
+ "description": "The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "x",
+ "description": "position of the point",
+ "type": "Number"
+ },
+ {
+ "name": "y",
+ "description": "position of the point",
+ "type": "Number"
+ }
+ ]
+ },
+ "Polygon": {
+ "name": "Polygon",
+ "shortname": "Polygon",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "PIXI",
+ "file": "src/pixi/core/Polygon.js",
+ "line": 5,
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "points",
+ "description": "This cna be an array of Points or a flat array of numbers\n that will be interpreted as [x,y, x,y, ...]",
+ "type": "Array+/** + * @author Chad Engler <chad@pantherdev.com> + */ + +/** + * @class Circle + * @constructor + * @param x {Number} The X coord of the upper-left corner of the framing rectangle of this circle + * @param y {Number} The Y coord of the upper-left corner of the framing rectangle of this circle + * @param radius {Number} The radius of the circle + */ +PIXI.Circle = function(x, y, radius) +{ + /** + * @property x + * @type Number + * @default 0 + */ + this.x = x || 0; + + /** + * @property y + * @type Number + * @default 0 + */ + this.y = y || 0; + + /** + * @property radius + * @type Number + * @default 0 + */ + this.radius = radius || 0; +} + +/** + * @method clone + * @return a copy of the polygon + */ +PIXI.Circle.prototype.clone = function() +{ + return new PIXI.Circle(this.x, this.y, this.radius); +} + +/** + * @method contains + * @param x {Number} The X coord of the point to test + * @param y {Number} The Y coord of the point to test + * @return if the x/y coords are within this polygon + */ +PIXI.Circle.prototype.contains = function(x, y) +{ + if(this.radius <= 0) + return false; + + var dx = (this.x - x), + dy = (this.y - y), + r2 = this.radius * this.radius; + + dx *= dx; + dy *= dy; + + return (dx + dy <= r2); +} + +PIXI.Circle.constructor = PIXI.Circle; + + ++
+/** + * @author Chad Engler <chad@pantherdev.com> + */ + +/** + * @class Ellipse + * @constructor + * @param x {Number} The X coord of the upper-left corner of the framing rectangle of this circle + * @param y {Number} The Y coord of the upper-left corner of the framing rectangle of this circle + * @param width {Number} The overall height of this ellipse + * @param height {Number} The overall width of this ellipse + */ +PIXI.Ellipse = function(x, y, width, height) +{ + /** + * @property x + * @type Number + * @default 0 + */ + this.x = x || 0; + + /** + * @property y + * @type Number + * @default 0 + */ + this.y = y || 0; + + /** + * @property width + * @type Number + * @default 0 + */ + this.width = width || 0; + + /** + * @property height + * @type Number + * @default 0 + */ + this.height = height || 0; +} + +/** + * @method clone + * @return a copy of the polygon + */ +PIXI.Ellipse.prototype.clone = function() +{ + return new PIXI.Ellipse(this.x, this.y, this.width, this.height); +} + +/** + * @method contains + * @param x {Number} The X coord of the point to test + * @param y {Number} The Y coord of the point to test + * @return if the x/y coords are within this polygon + */ +PIXI.Ellipse.prototype.contains = function(x, y) +{ + if(this.width <= 0 || this.height <= 0) + return false; + + //normalize the coords to an ellipse with center 0,0 + //and a radius of 0.5 + var normx = ((x - this.x) / this.width) - 0.5, + normy = ((y - this.y) / this.height) - 0.5; + + normx *= normx; + normy *= normy; + + return (normx + normy < 0.25); +} + +PIXI.Ellipse.getBounds = function() +{ + return new PIXI.Rectangle(this.x, this.y, this.width, this.height); +} + +PIXI.Ellipse.constructor = PIXI.Ellipse; + + ++
diff --git a/docs/files/src_pixi_core_Polygon.js.html b/docs/files/src_pixi_core_Polygon.js.html new file mode 100644 index 0000000..4ea7868 --- /dev/null +++ b/docs/files/src_pixi_core_Polygon.js.html @@ -0,0 +1,234 @@ + + + + +src/pixi/core/Polygon.js - Pixi.JS + + + + + + + + +++ + + + + + + + + + diff --git a/docs/files/src_pixi_Rectangle.js.html b/docs/files/src_pixi_core_Rectangle.js.html similarity index 87% rename from docs/files/src_pixi_Rectangle.js.html rename to docs/files/src_pixi_core_Rectangle.js.html index 48a4adc..de18763 100644 --- a/docs/files/src_pixi_Rectangle.js.html +++ b/docs/files/src_pixi_core_Rectangle.js.html @@ -2,7 +2,7 @@ -+++ +++ +
+ API Docs for: 1.3.0 +++ ++++ ++++ Show: + + + + + + + ++ + +++++++File: src/pixi/core/Polygon.js
+ +++ ++/** + * @author Adrien Brault <adrien.brault@gmail.com> + */ + +/** + * @class Polygon + * @constructor + * @param points {Array<Point>|Array<Number>} This cna be an array of Points or a flat array of numbers + * that will be interpreted as [x,y, x,y, ...] + */ +PIXI.Polygon = function(points) +{ + //if this is a flat array of numbers, convert it to points + if(typeof points[0] === 'number') { + var p = []; + for(var i = 0, il = points.length; i < il; i+=2) { + p.push( + new PIXI.Point(points[i], points[i + 1]) + ); + } + + points = p; + } + + this.points = points; +} + +/** + * @method clone + * @return a copy of the polygon + */ +PIXI.Polygon.prototype.clone = function() +{ + var points = []; + for (var i=0; i<this.points.length; i++) { + points.push(this.points[i].clone()); + } + + return new PIXI.Polygon(points); +} + +/** + * @method contains + * @param x {Number} The X coord of the point to test + * @param y {Number} The Y coord of the point to test + * @return if the x/y coords are within this polygon + */ +PIXI.Polygon.prototype.contains = function(x, y) +{ + var inside = false; + + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + for(var i = 0, j = this.points.length - 1; i < this.points.length; j = i++) { + var xi = this.points[i].x, yi = this.points[i].y, + xj = this.points[j].x, yj = this.points[j].y, + intersect = ((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); + + if(intersect) inside = !inside; + } + + return inside; +} + +PIXI.Polygon.constructor = PIXI.Polygon; + + ++src/pixi/Rectangle.js - Pixi.JS +src/pixi/core/Rectangle.js - Pixi.JS @@ -19,7 +19,7 @@
@@ -191,6 +199,31 @@ PIXI.Rectangle.prototype.clone = function() return new PIXI.Rectangle(this.x, this.y, this.width, this.height); } +/** + * @method contains + * @param x {Number} The X coord of the point to test + * @param y {Number} The Y coord of the point to test + * @return if the x/y coords are within this polygon + */ +PIXI.Rectangle.prototype.contains = function(x, y) +{ + if(this.width <= 0 || this.height <= 0) + return false; + + var x1 = this.x; + if(x > x1 && x < x1 + this.width) + { + var y1 = this.y; + + if(y > y1 && y < y1 + this.height) + { + return true; + } + } + + return false; +} + // constructor PIXI.Rectangle.constructor = PIXI.Rectangle; diff --git a/docs/files/src_pixi_DisplayObject.js.html b/docs/files/src_pixi_display_DisplayObject.js.html similarity index 71% rename from docs/files/src_pixi_DisplayObject.js.html rename to docs/files/src_pixi_display_DisplayObject.js.html index b24abfe..f4c2f15 100644 --- a/docs/files/src_pixi_DisplayObject.js.html +++ b/docs/files/src_pixi_display_DisplayObject.js.html @@ -2,7 +2,7 @@ -src/pixi/DisplayObject.js - Pixi.JS +src/pixi/display/DisplayObject.js - Pixi.JS @@ -19,7 +19,7 @@
@@ -149,6 +157,9 @@ */ PIXI.DisplayObject = function() { + this.last = this; + this.first = this; + /** * The coordinate of the object relative to the local coordinates of the parent. * @property position @@ -230,7 +241,7 @@ PIXI.DisplayObject = function() this.renderable = false; // [readonly] best not to toggle directly! use setInteractive() - this.interactive = false; + this._interactive = false; /** * This is used to indicate if the displayObject should display a mouse hand cursor on rollover @@ -328,18 +339,210 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'visible', { });*/ /** - * Indicates if the sprite will have touch and mouse interactivity. It is false by default + * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default + * Instead of using this function you can now simply set the interactive property to true or false * @method setInteractive * @param interactive {Boolean} */ PIXI.DisplayObject.prototype.setInteractive = function(interactive) { this.interactive = interactive; - // TODO more to be done here.. - // need to sort out a re-crawl! - if(this.stage)this.stage.dirty = true; } +/** + * Indicates if the sprite will have touch and mouse interactivity. It is false by default + * @property interactive + * @type Boolean + */ +Object.defineProperty(PIXI.DisplayObject.prototype, 'interactive', { + get: function() { + return this._interactive; + }, + set: function(value) { + this._interactive = value; + + // TODO more to be done here.. + // need to sort out a re-crawl! + if(this.stage)this.stage.dirty = true; + } +}); + +/** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. + * In PIXI a regular mask must be a PIXI.Ggraphics object. This allows for much faster masking in canvas as it utilises shape clipping. + * To remove a mask, set this property to null. + * @property mask + * @type PIXI.Graphics + */ +Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', { + get: function() { + return this._mask; + }, + set: function(value) { + + this._mask = value; + + if(value) + { + this.addFilter(value) + } + else + { + this.removeFilter(); + } + } +}); + +/* + * private + */ +PIXI.DisplayObject.prototype.addFilter = function(mask) +{ + if(this.filter)return; + this.filter = true; + + + // insert a filter block.. + var start = new PIXI.FilterBlock(); + var end = new PIXI.FilterBlock(); + + + start.mask = mask; + end.mask = mask; + + start.first = start.last = this; + end.first = end.last = this; + + start.open = true; + + /* + * + * insert start + * + */ + + var childFirst = start + var childLast = start + var nextObject; + var previousObject; + + previousObject = this.first._iPrev; + + if(previousObject) + { + nextObject = previousObject._iNext; + childFirst._iPrev = previousObject; + previousObject._iNext = childFirst; + } + else + { + nextObject = this; + } + + if(nextObject) + { + nextObject._iPrev = childLast; + childLast._iNext = nextObject; + } + + + // now insert the end filter block.. + + /* + * + * insert end filter + * + */ + var childFirst = end + var childLast = end + var nextObject = null; + var previousObject = null; + + previousObject = this.last; + nextObject = previousObject._iNext; + + if(nextObject) + { + nextObject._iPrev = childLast; + childLast._iNext = nextObject; + } + + childFirst._iPrev = previousObject; + previousObject._iNext = childFirst; + + var updateLast = this; + + var prevLast = this.last; + while(updateLast) + { + if(updateLast.last == prevLast) + { + updateLast.last = end; + } + updateLast = updateLast.parent; + } + + this.first = start; + + // if webGL... + if(this.__renderGroup) + { + this.__renderGroup.addFilterBlocks(start, end); + } + + mask.renderable = false; + +} + +PIXI.DisplayObject.prototype.removeFilter = function() +{ + if(!this.filter)return; + this.filter = false; + + // modify the list.. + var startBlock = this.first; + + var nextObject = startBlock._iNext; + var previousObject = startBlock._iPrev; + + if(nextObject)nextObject._iPrev = previousObject; + if(previousObject)previousObject._iNext = nextObject; + + this.first = startBlock._iNext; + + + // remove the end filter + var lastBlock = this.last; + + var nextObject = lastBlock._iNext; + var previousObject = lastBlock._iPrev; + + if(nextObject)nextObject._iPrev = previousObject; + previousObject._iNext = nextObject; + + // this is always true too! +// if(this.last == lastBlock) + //{ + var tempLast = lastBlock._iPrev; + // need to make sure the parents last is updated too + var updateLast = this; + while(updateLast.last == lastBlock) + { + updateLast.last = tempLast; + updateLast = updateLast.parent; + if(!updateLast)break; + } + + var mask = startBlock.mask + mask.renderable = true; + + // if webGL... + if(this.__renderGroup) + { + this.__renderGroup.removeFilterBlocks(startBlock, lastBlock); + } + //} +} /** * @private @@ -363,24 +566,21 @@ PIXI.DisplayObject.prototype.updateTransform = function() localTransform[3] = this._sr * this.scale.x; localTransform[4] = this._cr * this.scale.y; - ///AAARR GETTER SETTTER! - //localTransform[2] = this.position.x; - //localTransform[5] = this.position.y; + // TODO --> do we even need a local matrix??? var px = this.pivot.x; var py = this.pivot.y; - ///AAARR GETTER SETTTER! - localTransform[2] = this.position.x - localTransform[0] * px - py * localTransform[1]; - localTransform[5] = this.position.y - localTransform[4] * py - px * localTransform[3]; - // Cache the matrix values (makes for huge speed increases!) - var a00 = localTransform[0], a01 = localTransform[1], a02 = localTransform[2], - a10 = localTransform[3], a11 = localTransform[4], a12 = localTransform[5], + var a00 = localTransform[0], a01 = localTransform[1], a02 = this.position.x - localTransform[0] * px - py * localTransform[1], + a10 = localTransform[3], a11 = localTransform[4], a12 = this.position.y - localTransform[4] * py - px * localTransform[3], b00 = parentTransform[0], b01 = parentTransform[1], b02 = parentTransform[2], b10 = parentTransform[3], b11 = parentTransform[4], b12 = parentTransform[5]; + localTransform[2] = a02 + localTransform[5] = a12 + worldTransform[0] = b00 * a00 + b01 * a10; worldTransform[1] = b00 * a01 + b01 * a11; worldTransform[2] = b00 * a02 + b01 * a12 + b02; @@ -393,7 +593,6 @@ PIXI.DisplayObject.prototype.updateTransform = function() // mat3.multiply(this.localTransform, this.parent.worldTransform, this.worldTransform); this.worldAlpha = this.alpha * this.parent.worldAlpha; - }diff --git a/docs/files/src_pixi_DisplayObjectContainer.js.html b/docs/files/src_pixi_display_DisplayObjectContainer.js.html similarity index 72% rename from docs/files/src_pixi_DisplayObjectContainer.js.html rename to docs/files/src_pixi_display_DisplayObjectContainer.js.html index f77ccd8..0875822 100644 --- a/docs/files/src_pixi_DisplayObjectContainer.js.html +++ b/docs/files/src_pixi_display_DisplayObjectContainer.js.html @@ -2,7 +2,7 @@ -
@@ -160,6 +168,7 @@ PIXI.DisplayObjectContainer = function() this.children = []; //s this.renderable = false; + } // constructor @@ -185,21 +194,85 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible' */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { + + //this.addChildAt(child, this.children.length) + //return; + if(child.parent != undefined) { + + //// COULD BE THIS??? child.parent.removeChild(child); + // return; } child.parent = this; - child.childIndex = this.children.length; + //child.childIndex = this.children.length; this.children.push(child); + // updae the stage refference.. + if(this.stage) { - this.stage.__addChild(child); + var tmpChild = child; + do + { + if(tmpChild.interactive)this.stage.dirty = true; + tmpChild.stage = this.stage; + tmpChild = tmpChild._iNext; + } + while(tmpChild) } + // LINKED LIST // + + // modify the list.. + var childFirst = child.first + var childLast = child.last; +// console.log(childFirst) + var nextObject; + var previousObject; + + // this could be wrong if there is a filter?? + if(this.filter) + { + previousObject = this.last._iPrev; + } + else + { + previousObject = this.last; + } +// if(this.last._iNext) + + //console.log( this.last._iNext); + nextObject = previousObject._iNext; + + // always true in this case + //this.last = child.last; + // need to make sure the parents last is updated too + var updateLast = this; + var prevLast = previousObject; + + while(updateLast) + { + if(updateLast.last == prevLast) + { + updateLast.last = child.last; + } + updateLast = updateLast.parent; + } + + if(nextObject) + { + nextObject._iPrev = childLast; + childLast._iNext = nextObject; + } + + childFirst._iPrev = previousObject; + previousObject._iNext = childFirst; + +// console.log(childFirst); // need to remove any render groups.. if(this.__renderGroup) { @@ -208,6 +281,7 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child) // add them to the new render group.. this.__renderGroup.addDisplayObjectAndChildren(child); } + } /** @@ -224,30 +298,63 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { child.parent.removeChild(child); } - - if (index == this.children.length) - { - this.children.push(child); - } - else - { - this.children.splice(index, 0, child); - } - child.parent = this; - child.childIndex = index; - - var length = this.children.length; - for (var i=index; i < length; i++) - { - this.children[i].childIndex = i; - } if(this.stage) { - this.stage.__addChild(child); + var tmpChild = child; + do + { + if(tmpChild.interactive)this.stage.dirty = true; + tmpChild.stage = this.stage; + tmpChild = tmpChild._iNext; + } + while(tmpChild) } + // modify the list.. + var childFirst = child.first + var childLast = child.last; + var nextObject; + var previousObject; + + if(index == this.children.length) + { + previousObject = this.last; + var updateLast = this;//.parent; + var prevLast = this.last; + while(updateLast) + { + if(updateLast.last == prevLast) + { + updateLast.last = child.last; + } + updateLast = updateLast.parent; + } + } + else if(index == 0) + { + previousObject = this; + } + else + { + previousObject = this.children[index-1].last; + } + + nextObject = previousObject._iNext; + + // always true in this case + if(nextObject) + { + nextObject._iPrev = childLast; + childLast._iNext = nextObject; + } + + childFirst._iPrev = previousObject; + previousObject._iNext = childFirst; + + + this.children.splice(index, 0, child); // need to remove any render groups.. if(this.__renderGroup) { @@ -256,11 +363,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) // add them to the new render group.. this.__renderGroup.addDisplayObjectAndChildren(child); } + + console.log(this.children) } else { - // error! - throw new Error(child + " The index "+ index +" supplied is out of bounds " + this.children.length); } } @@ -273,6 +380,14 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { + /* + * this funtion needs to be recoded.. + * can be done a lot faster.. + */ + return; + + // need to fix this function :/ + /* // TODO I already know this?? var index = this.children.indexOf( child ); var index2 = this.children.indexOf( child2 ); @@ -280,6 +395,8 @@ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) if ( index !== -1 && index2 !== -1 ) { // cool + + /* if(this.stage) { // this is to satisfy the webGL batching.. @@ -291,9 +408,6 @@ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) this.stage.__addChild(child2); } - // swap the indexes.. - child.childIndex = index2; - child2.childIndex = index; // swap the positions.. this.children[index] = child2; this.children[index2] = child; @@ -302,7 +416,7 @@ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) else { throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this); - } + }*/ } /** @@ -319,7 +433,6 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) else { throw new Error(child + " Both the supplied DisplayObjects must be a child of the caller " + this); - } } @@ -331,30 +444,57 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { var index = this.children.indexOf( child ); - if ( index !== -1 ) { - if(this.stage) + //console.log(">>") + // unlink // + // modify the list.. + var childFirst = child.first + var childLast = child.last; + + var nextObject = childLast._iNext; + var previousObject = childFirst._iPrev; + + if(nextObject)nextObject._iPrev = previousObject; + previousObject._iNext = nextObject; + + if(this.last == childLast) { - this.stage.__removeChild(child); + var tempLast = childFirst._iPrev; + // need to make sure the parents last is updated too + var updateLast = this; + while(updateLast.last == childLast.last) + { + updateLast.last = tempLast; + updateLast = updateLast.parent; + if(!updateLast)break; + } } + childLast._iNext = null; + childFirst._iPrev = null; + + // update the stage reference.. + if(this.stage) + { + var tmpChild = child; + do + { + if(tmpChild.interactive)this.stage.dirty = true; + tmpChild.stage = null; + tmpChild = tmpChild._iNext; + } + while(tmpChild) + } + // webGL trim if(child.__renderGroup) { child.__renderGroup.removeDisplayObjectAndChildren(child); } - // console.log(">" + child.__renderGroup) child.parent = undefined; - this.children.splice( index, 1 ); - - // update in dexs! - for(var i=index,j=this.children.length; i<j; i++) - { - this.children[i].childIndex -= 1; - } } else { diff --git a/docs/files/src_pixi_MovieClip.js.html b/docs/files/src_pixi_display_MovieClip.js.html similarity index 94% rename from docs/files/src_pixi_MovieClip.js.html rename to docs/files/src_pixi_display_MovieClip.js.html index 789564a..87e0a59 100644 --- a/docs/files/src_pixi_MovieClip.js.html +++ b/docs/files/src_pixi_display_MovieClip.js.html @@ -2,7 +2,7 @@ -src/pixi/MovieClip.js - Pixi.JS +src/pixi/display/MovieClip.js - Pixi.JS @@ -19,7 +19,7 @@
diff --git a/docs/files/src_pixi_Sprite.js.html b/docs/files/src_pixi_display_Sprite.js.html similarity index 95% rename from docs/files/src_pixi_Sprite.js.html rename to docs/files/src_pixi_display_Sprite.js.html index da5682d..48e9042 100644 --- a/docs/files/src_pixi_Sprite.js.html +++ b/docs/files/src_pixi_display_Sprite.js.html @@ -2,7 +2,7 @@ -src/pixi/Sprite.js - Pixi.JS +src/pixi/display/Sprite.js - Pixi.JS @@ -19,7 +19,7 @@
diff --git a/docs/files/src_pixi_Stage.js.html b/docs/files/src_pixi_display_Stage.js.html similarity index 92% rename from docs/files/src_pixi_Stage.js.html rename to docs/files/src_pixi_display_Stage.js.html index 7ccceb0..6c0dc32 100644 --- a/docs/files/src_pixi_Stage.js.html +++ b/docs/files/src_pixi_display_Stage.js.html @@ -2,7 +2,7 @@ -src/pixi/Stage.js - Pixi.JS +src/pixi/display/Stage.js - Pixi.JS @@ -19,7 +19,7 @@
@@ -154,21 +162,23 @@ PIXI.Stage = function(backgroundColor, interactive) { PIXI.DisplayObjectContainer.call( this ); + this.worldTransform = PIXI.mat3.create() this.__childrenAdded = []; this.__childrenRemoved = []; - this.childIndex = 0; - this.stage= this; + + //this.childIndex = 0; + this.stage = this; + this.interactive = interactive; this.stage.hitArea = new PIXI.Rectangle(0,0,100000, 100000); // interaction! - this.interactive = !!interactive; + // this.interactive = !!interactive; this.interactionManager = new PIXI.InteractionManager(this); this.setBackgroundColor(backgroundColor); this.worldVisible = true; - this.stage.dirty = true; } @@ -222,7 +232,7 @@ PIXI.Stage.prototype.getMousePosition = function() { return this.interactionManager.mouse.global; } - +/* PIXI.Stage.prototype.__addChild = function(child) { if(child.interactive)this.dirty = true; @@ -253,7 +263,7 @@ PIXI.Stage.prototype.__removeChild = function(child) this.__removeChild(child.children[i]); } } -} +}*/
/** - * @author Adrien Brault <adrien.brault@gmail.com> + * @author Mat Groves http://matgroves.com/ @Doormat23 */ -/** - * @class Polygon - * @constructor - * @param points {Array} - */ -PIXI.Polygon = function(points) + + +PIXI.FilterBlock = function(mask) { - this.points = points; + this.graphics = mask + this.visible = true; + this.renderable = true; } -/** - * @method clone - * @return a copy of the polygon - */ -PIXI.Polygon.clone = function() -{ - var points = []; - for (var i=0; i<this.points.length; i++) { - points.push(this.points[i].clone()); - } - - return new PIXI.Polygon(points); -} - -PIXI.Polygon.constructor = PIXI.Polygon; -
- /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ -PIXI.shaderFragmentSrc = [ - "precision mediump float;", - "varying vec2 vTextureCoord;", - "varying float vColor;", - "uniform sampler2D uSampler;", - "void main(void) {", - "gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));", - "gl_FragColor = gl_FragColor * vColor;", - "}" -]; -PIXI.shaderVertexSrc = [ - "attribute vec2 aVertexPosition;", - "attribute vec2 aTextureCoord;", - "attribute float aColor;", - "uniform mat4 uMVMatrix;", - "varying vec2 vTextureCoord;", - "varying float vColor;", - "void main(void) {", - "gl_Position = uMVMatrix * vec4(aVertexPosition, 1.0, 1.0);", - "vTextureCoord = aTextureCoord;", - "vColor = aColor;", - "}" -]; -PIXI.CompileVertexShader = function(gl, shaderSrc) +PIXI.MaskFilter = function(graphics) { - return PIXI._CompileShader(gl, shaderSrc, gl.VERTEX_SHADER); + // the graphics data that will be used for filtering + this.graphics; } -PIXI.CompileFragmentShader = function(gl, shaderSrc) -{ - return PIXI._CompileShader(gl, shaderSrc, gl.FRAGMENT_SHADER); -} - -PIXI._CompileShader = function(gl, shaderSrc, shaderType) -{ - var src = shaderSrc.join("\n"); - var shader = gl.createShader(shaderType); - gl.shaderSource(shader, src); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { - alert(gl.getShaderInfoLog(shader)); - return null; - } - - return shader; -}
+/** + * @author Mat Groves http://matgroves.com/ @Doormat23 + */ + + +/** + * The Graphics class contains a set of methods that you can use to create primitive shapes and lines. + * It is important to know that with the webGL renderer only simple polys can be filled at this stage + * Complex polys will not be filled. Heres an example of a complex poly: http://www.goodboydigital.com/wp-content/uploads/2013/06/complexPolygon.png + * @class Graphics + * @extends DisplayObjectContainer + * @constructor + */ +PIXI.Graphics = function() +{ + PIXI.DisplayObjectContainer.call( this ); + + this.renderable = true; + + this.fillAlpha = 1; + + this.lineWidth = 0; + this.lineColor = "black"; + + this.graphicsData = []; + + this.currentPath = {points:[]}; +} + +// constructor +PIXI.Graphics.constructor = PIXI.Graphics; +PIXI.Graphics.prototype = Object.create( PIXI.DisplayObjectContainer.prototype ); + +/** + * Specifies a line style used for subsequent calls to Graphics methods such as the lineTo() method or the drawCircle() method. + * @method lineStyle + * @param lineWidth {Number} + * @param color {Number} + * @param alpha {Number} + */ +PIXI.Graphics.prototype.lineStyle = function(lineWidth, color, alpha) +{ + if(this.currentPath.points.length == 0)this.graphicsData.pop(); + + this.lineWidth = lineWidth || 0; + this.lineColor = color || 0; + this.lineAlpha = (alpha == undefined) ? 1 : alpha; + + this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha, + fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, points:[], type:PIXI.Graphics.POLY}; + + this.graphicsData.push(this.currentPath); +} + +/** + * Moves the current drawing position to (x, y). + * @method moveTo + * @param x {Number} + * @param y {Number} + */ +PIXI.Graphics.prototype.moveTo = function(x, y) +{ + if(this.currentPath.points.length == 0)this.graphicsData.pop(); + + this.currentPath = this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha, + fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, points:[], type:PIXI.Graphics.POLY}; + + this.currentPath.points.push(x, y); + + this.graphicsData.push(this.currentPath); +} + +/** + * Draws a line using the current line style from the current drawing position to (x, y); the current drawing position is then set to (x, y). + * @method lineTo + * @param x {Number} + * @param y {Number} + */ +PIXI.Graphics.prototype.lineTo = function(x, y) +{ + this.currentPath.points.push(x, y); + this.dirty = true; +} + +/** + * Specifies a simple one-color fill that subsequent calls to other Graphics methods (such as lineTo() or drawCircle()) use when drawing. + * @method beginFill + * @param color {uint} the color of the fill + * @param alpha {Number} the alpha + */ +PIXI.Graphics.prototype.beginFill = function(color, alpha) +{ + this.filling = true; + this.fillColor = color || 0; + this.fillAlpha = alpha || 1; +} + +/** + * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. + * @method endFill + */ +PIXI.Graphics.prototype.endFill = function() +{ + this.filling = false; + this.fillColor = null; + this.fillAlpha = 1; +} + +/** + * @method drawRect + * @param x {Number} + * @param y {Number} + * @param width {Number} + * @param height {Number} + */ +PIXI.Graphics.prototype.drawRect = function( x, y, width, height ) +{ + if(this.currentPath.points.length == 0)this.graphicsData.pop(); + + this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha, + fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, + points:[x, y, width, height], type:PIXI.Graphics.RECT}; + + this.graphicsData.push(this.currentPath); + this.dirty = true; +} + +/** + * Draws a circle. + * @method drawCircle + * @param x {Number} + * @param y {Number} + * @param radius {Number} + */ +PIXI.Graphics.prototype.drawCircle = function( x, y, radius) +{ + if(this.currentPath.points.length == 0)this.graphicsData.pop(); + + this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha, + fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, + points:[x, y, radius, radius], type:PIXI.Graphics.CIRC}; + + this.graphicsData.push(this.currentPath); + this.dirty = true; +} + +/** + * Draws an elipse. + * @method drawElipse + * @param x {Number} + * @param y {Number} + * @param width {Number} + * @param height {Number} + */ +PIXI.Graphics.prototype.drawElipse = function( x, y, width, height) +{ + if(this.currentPath.points.length == 0)this.graphicsData.pop(); + + this.currentPath = {lineWidth:this.lineWidth, lineColor:this.lineColor, lineAlpha:this.lineAlpha, + fillColor:this.fillColor, fillAlpha:this.fillAlpha, fill:this.filling, + points:[x, y, width, height], type:PIXI.Graphics.ELIP}; + + this.graphicsData.push(this.currentPath); + this.dirty = true; +} + +/** + * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. + * @method clear + */ +PIXI.Graphics.prototype.clear = function() +{ + this.lineWidth = 0; + this.filling = false; + + this.dirty = true; + this.clearDirty = true; + this.graphicsData = []; +} + +// SOME TYPES: +PIXI.Graphics.POLY = 0; +PIXI.Graphics.RECT = 1; +PIXI.Graphics.CIRC = 2; +PIXI.Graphics.ELIP = 3; + ++
+/** + * @author Mat Groves http://matgroves.com/ @Doormat23 + */ + + +/** + * A set of functions used by the canvas renderer to draw the primitive graphics data + * @class CanvasGraphics + */ +PIXI.CanvasGraphics = function() +{ + +} + + +/* + * @private + * @static + * @method renderGraphics + * @param graphics {Graphics} + * @param context {Context2D} + */ +PIXI.CanvasGraphics.renderGraphics = function(graphics, context) +{ + var worldAlpha = graphics.worldAlpha; + + for (var i=0; i < graphics.graphicsData.length; i++) + { + var data = graphics.graphicsData[i]; + var points = data.points; + + context.strokeStyle = color = '#' + ('00000' + ( data.lineColor | 0).toString(16)).substr(-6); + + context.lineWidth = data.lineWidth; + + if(data.type == PIXI.Graphics.POLY) + { + //if(data.lineWidth <= 0)continue; + + context.beginPath(); + + context.moveTo(points[0], points[1]); + + for (var j=1; j < points.length/2; j++) + { + context.lineTo(points[j * 2], points[j * 2 + 1]); + } + + // if the first and last point are the same close the path - much neater :) + if(points[0] == points[points.length-2] && points[1] == points[points.length-1]) + { + context.closePath(); + } + + if(data.fill) + { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + if(data.lineWidth) + { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.stroke(); + } + } + else if(data.type == PIXI.Graphics.RECT) + { + + // TODO - need to be Undefined! + if(data.fillColor) + { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6); + context.rect(points[0], points[1], points[2], points[3]); + + } + if(data.lineWidth) + { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.strokeRect(points[0], points[1], points[2], points[3]); + } + + } + else if(data.type == PIXI.Graphics.CIRC) + { + // TODO - need to be Undefined! + context.beginPath(); + context.arc(points[0], points[1], points[2],0,2*Math.PI); + context.closePath(); + + if(data.fill) + { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + if(data.lineWidth) + { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.stroke(); + } + } + else if(data.type == PIXI.Graphics.ELIP) + { + + // elipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + + var elipseData = data.points; + + var w = elipseData[2] * 2; + var h = elipseData[3] * 2; + + var x = elipseData[0] - w/2; + var y = elipseData[1] - h/2; + + context.beginPath(); + + var kappa = .5522848, + ox = (w / 2) * kappa, // control point offset horizontal + oy = (h / 2) * kappa, // control point offset vertical + xe = x + w, // x-end + ye = y + h, // y-end + xm = x + w / 2, // x-middle + ym = y + h / 2; // y-middle + + context.moveTo(x, ym); + context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + + context.closePath(); + + if(data.fill) + { + context.globalAlpha = data.fillAlpha * worldAlpha; + context.fillStyle = color = '#' + ('00000' + ( data.fillColor | 0).toString(16)).substr(-6); + context.fill(); + } + if(data.lineWidth) + { + context.globalAlpha = data.lineAlpha * worldAlpha; + context.stroke(); + } + } + + }; +} + +/* + * @private + * @static + * @method renderGraphicsMask + * @param graphics {Graphics} + * @param context {Context2D} + */ +PIXI.CanvasGraphics.renderGraphicsMask = function(graphics, context) +{ + var worldAlpha = graphics.worldAlpha; + + var len = graphics.graphicsData.length; + if(len > 1) + { + len = 1; + console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object") + } + + for (var i=0; i < 1; i++) + { + var data = graphics.graphicsData[i]; + var points = data.points; + + if(data.type == PIXI.Graphics.POLY) + { + //if(data.lineWidth <= 0)continue; + + context.beginPath(); + context.moveTo(points[0], points[1]); + + for (var j=1; j < points.length/2; j++) + { + context.lineTo(points[j * 2], points[j * 2 + 1]); + } + + // if the first and last point are the same close the path - much neater :) + if(points[0] == points[points.length-2] && points[1] == points[points.length-1]) + { + context.closePath(); + } + + } + else if(data.type == PIXI.Graphics.RECT) + { + context.beginPath(); + context.rect(points[0], points[1], points[2], points[3]); + context.closePath(); + } + else if(data.type == PIXI.Graphics.CIRC) + { + // TODO - need to be Undefined! + context.beginPath(); + context.arc(points[0], points[1], points[2],0,2*Math.PI); + context.closePath(); + } + else if(data.type == PIXI.Graphics.ELIP) + { + + // elipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + var elipseData = data.points; + + var w = elipseData[2] * 2; + var h = elipseData[3] * 2; + + var x = elipseData[0] - w/2; + var y = elipseData[1] - h/2; + + context.beginPath(); + + var kappa = .5522848, + ox = (w / 2) * kappa, // control point offset horizontal + oy = (h / 2) * kappa, // control point offset vertical + xe = x + w, // x-end + ye = y + h, // y-end + xm = x + w / 2, // x-middle + ym = y + h / 2; // y-middle + + context.moveTo(x, ym); + context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + context.closePath(); + } + + + }; +} + ++
@@ -267,47 +275,43 @@ PIXI.CanvasRenderer.prototype.resize = function(width, height) PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject) { - var transform = displayObject.worldTransform; + // no loger recurrsive! + var transform; var context = this.context; - //context.globalCompositeOperation = "source-over" - var blit = false; - if(!displayObject.visible)return; - - if(displayObject instanceof PIXI.Sprite) + context.globalCompositeOperation = 'source-over'; + + // one the display object hits this. we can break the loop + var testObject = displayObject.last._iNext; + displayObject = displayObject.first; + + do { - var frame = displayObject.texture.frame; + transform = displayObject.worldTransform; - if(frame) + if(!displayObject.visible) { - context.globalAlpha = displayObject.worldAlpha; + displayObject = displayObject.last._iNext; + continue; + } + + if(!displayObject.renderable) + { + displayObject = displayObject._iNext; + continue; + } + + if(displayObject instanceof PIXI.Sprite) + { + + var frame = displayObject.texture.frame; - // BLITZ!!! - /* - * if the rotation is 0 then we can blitz it - * meaning we dont need to do a transform and also we - * can round to the nearest round number for a little extra speed! - */ - /*if(displayObject.rotation == 0) + if(frame) { - if(!blit)this.context.setTransform(1,0,0,1,0,0); - blit = true; - context.drawImage(displayObject.texture.baseTexture.image, - frame.x, - frame.y, - frame.width, - frame.height, - (transform[2]+ ((displayObject.anchor.x - displayObject.texture.trim.x) * -frame.width) * transform[0]), - (transform[5]+ ((displayObject.anchor.y - displayObject.texture.trim.y) * -frame.height)* transform[4]), - (displayObject.width * transform[0]), - (displayObject.height * transform[4])); + context.globalAlpha = displayObject.worldAlpha; - } - else - {*/ - // blit = false; context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]); - + context.drawImage(displayObject.texture.baseTexture.source, frame.x, frame.y, @@ -315,41 +319,67 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject) frame.height, (displayObject.anchor.x) * -frame.width, (displayObject.anchor.y) * -frame.height, - // (displayObject.anchor.x - displayObject.texture.trim.x) * -frame.width, - // (displayObject.anchor.y - displayObject.texture.trim.y) * -frame.height, - frame.width, frame.height); - //} - } - } - else if(displayObject instanceof PIXI.Strip) - { - context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]) - this.renderStrip(displayObject); - } - else if(displayObject instanceof PIXI.TilingSprite) - { - context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]) - this.renderTilingSprite(displayObject); - } - else if(displayObject instanceof PIXI.CustomRenderable) - { - displayObject.renderCanvas(this); - } - - // render! - if(displayObject.children) - { - for (var i=0; i < displayObject.children.length; i++) + } + } + else if(displayObject instanceof PIXI.Strip) { - this.renderDisplayObject(displayObject.children[i]); + context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]) + this.renderStrip(displayObject); } + else if(displayObject instanceof PIXI.TilingSprite) + { + context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]) + this.renderTilingSprite(displayObject); + } + else if(displayObject instanceof PIXI.CustomRenderable) + { + displayObject.renderCanvas(this); + } + else if(displayObject instanceof PIXI.Graphics) + { + context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]) + PIXI.CanvasGraphics.renderGraphics(displayObject, context); + } + else if(displayObject instanceof PIXI.FilterBlock) + { + if(displayObject.open) + { + context.save(); + + var cacheAlpha = displayObject.mask.alpha; + var maskTransform = displayObject.mask.worldTransform; + + context.setTransform(maskTransform[0], maskTransform[3], maskTransform[1], maskTransform[4], maskTransform[2], maskTransform[5]) + + displayObject.mask.worldAlpha = 0.5; + + context.worldAlpha = 0; + + PIXI.CanvasGraphics.renderGraphicsMask(displayObject.mask, context); + // context.fillStyle = 0xFF0000; + // context.fillRect(0, 0, 200, 200); + context.clip(); + + displayObject.mask.worldAlpha = cacheAlpha; + //context.globalCompositeOperation = 'lighter'; + } + else + { + //context.globalCompositeOperation = 'source-over'; + context.restore(); + } + } + // count++ + displayObject = displayObject._iNext; + + } - - this.context.setTransform(1,0,0,1,0,0); + while(displayObject != testObject) } + /** * @private */ @@ -378,11 +408,9 @@ PIXI.CanvasRenderer.prototype.renderStripFlat = function(strip) }; -// context.globalCompositeOperation = 'lighter'; context.fillStyle = "#FF0000"; context.fill(); context.closePath(); - //context.globalCompositeOperation = 'source-over'; } /** @@ -392,6 +420,8 @@ PIXI.CanvasRenderer.prototype.renderTilingSprite = function(sprite) { var context = this.context; + context.globalAlpha = sprite.worldAlpha; + if(!sprite.__tilePattern) sprite.__tilePattern = context.createPattern(sprite.texture.baseTexture.source, "repeat"); context.beginPath(); diff --git a/docs/files/src_pixi_renderers_WebGLBatch.js.html b/docs/files/src_pixi_renderers_webgl_WebGLBatch.js.html similarity index 97% rename from docs/files/src_pixi_renderers_WebGLBatch.js.html rename to docs/files/src_pixi_renderers_webgl_WebGLBatch.js.html index 35eccd3..3d14d09 100644 --- a/docs/files/src_pixi_renderers_WebGLBatch.js.html +++ b/docs/files/src_pixi_renderers_webgl_WebGLBatch.js.html @@ -2,7 +2,7 @@ -src/pixi/renderers/WebGLBatch.js - Pixi.JS +src/pixi/renderers/webgl/WebGLBatch.js - Pixi.JS @@ -19,7 +19,7 @@
@@ -656,6 +664,7 @@ PIXI.WebGLBatch.prototype.update = function() */ PIXI.WebGLBatch.prototype.render = function(start, end) { + // console.log(start + " :: " + end + " : " + this.size); start = start || 0; //end = end || this.size; @@ -668,13 +677,13 @@ PIXI.WebGLBatch.prototype.render = function(start, end) } + if (this.size == 0)return; this.update(); var gl = this.gl; //TODO optimize this! - gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); var shaderProgram = PIXI.shaderProgram; gl.useProgram(shaderProgram); @@ -684,7 +693,6 @@ PIXI.WebGLBatch.prototype.render = function(start, end) // ok.. gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.verticies) gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, 2, gl.FLOAT, false, 0, 0); - // update the uvs gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer); diff --git a/docs/files/src_pixi_renderers_webgl_WebGLGraphics.js.html b/docs/files/src_pixi_renderers_webgl_WebGLGraphics.js.html new file mode 100644 index 0000000..0240783 --- /dev/null +++ b/docs/files/src_pixi_renderers_webgl_WebGLGraphics.js.html @@ -0,0 +1,633 @@ + + + + +src/pixi/renderers/webgl/WebGLGraphics.js - Pixi.JS + + + + + + + + +++ + + + + + + + + + diff --git a/docs/files/src_pixi_renderers_WebGLRenderGroup.js.html b/docs/files/src_pixi_renderers_webgl_WebGLRenderGroup.js.html similarity index 70% rename from docs/files/src_pixi_renderers_WebGLRenderGroup.js.html rename to docs/files/src_pixi_renderers_webgl_WebGLRenderGroup.js.html index 264cc48..d73c577 100644 --- a/docs/files/src_pixi_renderers_WebGLRenderGroup.js.html +++ b/docs/files/src_pixi_renderers_webgl_WebGLRenderGroup.js.html @@ -2,7 +2,7 @@ -+++ +++ +
+ API Docs for: 1.3.0 +++ ++++ ++++ Show: + + + + + + + ++ + +++++++File: src/pixi/renderers/webgl/WebGLGraphics.js
+ +++ ++/** + * @author Mat Groves http://matgroves.com/ @Doormat23 + */ + + + +/** + * A set of functions used by the webGL renderer to draw the primitive graphics data + * @class CanvasGraphics + */ +PIXI.WebGLGraphics = function() +{ + +} + +PIXI.WebGLGraphics.renderGraphics = function(graphics, projection) +{ + + var gl = PIXI.gl; + + if(!graphics._webGL)graphics._webGL = {points:[], indices:[], lastIndex:0, + buffer:gl.createBuffer(), + indexBuffer:gl.createBuffer()}; + + if(graphics.dirty) + { + graphics.dirty = false; + + if(graphics.clearDirty) + { + graphics.clearDirty = false; + + graphics._webGL.lastIndex = 0; + graphics._webGL.points = []; + graphics._webGL.indices = []; + + } + + PIXI.WebGLGraphics.updateGraphics(graphics); + } + + + PIXI.activatePrimitiveShader(); + + // This could be speeded up fo sure! + var m = PIXI.mat3.clone(graphics.worldTransform); + + PIXI.mat3.transpose(m); + + // set the matrix transform for the + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + + gl.uniformMatrix3fv(PIXI.primitiveProgram.translationMatrix, false, m); + + gl.uniform2f(PIXI.primitiveProgram.projectionVector, projection.x, projection.y); + + gl.uniform1f(PIXI.primitiveProgram.alpha, graphics.worldAlpha); + + gl.bindBuffer(gl.ARRAY_BUFFER, graphics._webGL.buffer); + + // WHY DOES THIS LINE NEED TO BE THERE??? + gl.vertexAttribPointer(PIXI.shaderProgram.vertexPositionAttribute, 2, gl.FLOAT, false, 0, 0); + // its not even used.. but need to be set or it breaks? + // only on pc though.. + + gl.vertexAttribPointer(PIXI.primitiveProgram.vertexPositionAttribute, 2, gl.FLOAT, false, 4 * 6, 0); + gl.vertexAttribPointer(PIXI.primitiveProgram.colorAttribute, 4, gl.FLOAT, false,4 * 6, 2 * 4); + + // set the index buffer! + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.indexBuffer); + + gl.drawElements(gl.TRIANGLE_STRIP, graphics._webGL.indices.length, gl.UNSIGNED_SHORT, 0 ); + + // return to default shader... + PIXI.activateDefaultShader(); +} + +PIXI.WebGLGraphics.updateGraphics = function(graphics) +{ + for (var i=graphics._webGL.lastIndex; i < graphics.graphicsData.length; i++) + { + var data = graphics.graphicsData[i]; + + if(data.type == PIXI.Graphics.POLY) + { + if(data.fill) + { + if(data.points.length>3) + PIXI.WebGLGraphics.buildPoly(data, graphics._webGL); + } + + if(data.lineWidth > 0) + { + PIXI.WebGLGraphics.buildLine(data, graphics._webGL); + } + } + else if(data.type == PIXI.Graphics.RECT) + { + PIXI.WebGLGraphics.buildRectangle(data, graphics._webGL); + } + else if(data.type == PIXI.Graphics.CIRC || data.type == PIXI.Graphics.ELIP) + { + PIXI.WebGLGraphics.buildCircle(data, graphics._webGL); + } + }; + + graphics._webGL.lastIndex = graphics.graphicsData.length; + + var gl = PIXI.gl; + + graphics._webGL.glPoints = new Float32Array(graphics._webGL.points); + + gl.bindBuffer(gl.ARRAY_BUFFER, graphics._webGL.buffer); + gl.bufferData(gl.ARRAY_BUFFER, graphics._webGL.glPoints, gl.STATIC_DRAW); + + graphics._webGL.glIndicies = new Uint16Array(graphics._webGL.indices); + + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, graphics._webGL.glIndicies, gl.STATIC_DRAW); +} + + +PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData) +{ + // --- // + // need to convert points to a nice regular data + // + var rectData = graphicsData.points; + var x = rectData[0]; + var y = rectData[1]; + var width = rectData[2]; + var height = rectData[3]; + + + if(graphicsData.fill) + { + var color = HEXtoRGB(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var verts = webGLData.points; + var indices = webGLData.indices; + + var vertPos = verts.length/6; + + // start + verts.push(x, y); + verts.push(r, g, b, alpha); + + verts.push(x + width, y); + verts.push(r, g, b, alpha); + + verts.push(x , y + height); + verts.push(r, g, b, alpha); + + verts.push(x + width, y + height); + verts.push(r, g, b, alpha); + + // insert 2 dead triangles.. + indices.push(vertPos, vertPos, vertPos+1, vertPos+2, vertPos+3, vertPos+3) + } + + if(graphicsData.lineWidth) + { + graphicsData.points = [x, y, + x + width, y, + x + width, y + height, + x, y + height, + x, y]; + + PIXI.WebGLGraphics.buildLine(graphicsData, webGLData); + } + +} + +PIXI.WebGLGraphics.buildCircle = function(graphicsData, webGLData) +{ + // --- // + // need to convert points to a nice regular data + // + var rectData = graphicsData.points; + var x = rectData[0]; + var y = rectData[1]; + var width = rectData[2]; + var height = rectData[3]; + + var totalSegs = 40; + var seg = (Math.PI * 2) / totalSegs ; + + if(graphicsData.fill) + { + var color = HEXtoRGB(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var verts = webGLData.points; + var indices = webGLData.indices; + + var vecPos = verts.length/6; + + indices.push(vecPos); + + for (var i=0; i < totalSegs + 1 ; i++) + { + verts.push(x,y, r, g, b, alpha); + + verts.push(x + Math.sin(seg * i) * width, + y + Math.cos(seg * i) * height, + r, g, b, alpha); + + indices.push(vecPos++, vecPos++); + }; + + indices.push(vecPos-1); + } + + if(graphicsData.lineWidth) + { + graphicsData.points = []; + + for (var i=0; i < totalSegs + 1; i++) + { + graphicsData.points.push(x + Math.sin(seg * i) * width, + y + Math.cos(seg * i) * height) + }; + + PIXI.WebGLGraphics.buildLine(graphicsData, webGLData); + } + +} + +PIXI.WebGLGraphics.buildLine = function(graphicsData, webGLData) +{ + // TODO OPTIMISE! + + var wrap = true; + var points = graphicsData.points; + if(points.length == 0)return; + + // get first and last point.. figure out the middle! + var firstPoint = new PIXI.Point( points[0], points[1] ); + var lastPoint = new PIXI.Point( points[points.length - 2], points[points.length - 1] ); + + // if the first point is the last point - goona have issues :) + if(firstPoint.x == lastPoint.x && firstPoint.y == lastPoint.y) + { + points.pop(); + points.pop(); + + lastPoint = new PIXI.Point( points[points.length - 2], points[points.length - 1] ); + + var midPointX = lastPoint.x + (firstPoint.x - lastPoint.x) *0.5; + var midPointY = lastPoint.y + (firstPoint.y - lastPoint.y) *0.5; + + points.unshift(midPointX, midPointY); + points.push(midPointX, midPointY) + } + + var verts = webGLData.points; + var indices = webGLData.indices; + var length = points.length / 2; + var indexCount = points.length; + var indexStart = verts.length/6; + + // DRAW the Line + var width = graphicsData.lineWidth / 2; + + // sort color + var color = HEXtoRGB(graphicsData.lineColor); + var alpha = graphicsData.lineAlpha; + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var p1x, p1y, p2x, p2y, p3x, p3y; + var perpx, perpy, perp2x, perp2y, perp3x, perp3y; + var ipx, ipy; + var a1, b1, c1, a2, b2, c2; + var denom, pdist, dist; + + p1x = points[0]; + p1y = points[1]; + + p2x = points[2]; + p2y = points[3]; + + perpx = -(p1y - p2y); + perpy = p1x - p2x; + + dist = Math.sqrt(perpx*perpx + perpy*perpy); + + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + + // start + verts.push(p1x - perpx , p1y - perpy, + r, g, b, alpha); + + verts.push(p1x + perpx , p1y + perpy, + r, g, b, alpha); + + for (var i = 1; i < length-1; i++) + { + p1x = points[(i-1)*2]; + p1y = points[(i-1)*2 + 1]; + + p2x = points[(i)*2] + p2y = points[(i)*2 + 1] + + p3x = points[(i+1)*2]; + p3y = points[(i+1)*2 + 1]; + + perpx = -(p1y - p2y); + perpy = p1x - p2x; + + dist = Math.sqrt(perpx*perpx + perpy*perpy); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + + perp2x = -(p2y - p3y); + perp2y = p2x - p3x; + + dist = Math.sqrt(perp2x*perp2x + perp2y*perp2y); + perp2x /= dist; + perp2y /= dist; + perp2x *= width; + perp2y *= width; + + a1 = (-perpy + p1y) - (-perpy + p2y); + b1 = (-perpx + p2x) - (-perpx + p1x); + c1 = (-perpx + p1x) * (-perpy + p2y) - (-perpx + p2x) * (-perpy + p1y); + a2 = (-perp2y + p3y) - (-perp2y + p2y); + b2 = (-perp2x + p2x) - (-perp2x + p3x); + c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y); + + denom = a1*b2 - a2*b1; + + if (denom == 0) { + denom+=1; + } + + px = (b1*c2 - b2*c1)/denom; + py = (a2*c1 - a1*c2)/denom; + + pdist = (px -p2x) * (px -p2x) + (py -p2y) + (py -p2y); + + if(pdist > 140 * 140) + { + perp3x = perpx - perp2x; + perp3y = perpy - perp2y; + + dist = Math.sqrt(perp3x*perp3x + perp3y*perp3y); + perp3x /= dist; + perp3y /= dist; + perp3x *= width; + perp3y *= width; + + verts.push(p2x - perp3x, p2y -perp3y); + verts.push(r, g, b, alpha); + + verts.push(p2x + perp3x, p2y +perp3y); + verts.push(r, g, b, alpha); + + verts.push(p2x - perp3x, p2y -perp3y); + verts.push(r, g, b, alpha); + + indexCount++; + } + else + { + verts.push(px , py); + verts.push(r, g, b, alpha); + + verts.push(p2x - (px-p2x), p2y - (py - p2y));//, 4); + verts.push(r, g, b, alpha); + } + } + + p1x = points[(length-2)*2] + p1y = points[(length-2)*2 + 1] + + p2x = points[(length-1)*2] + p2y = points[(length-1)*2 + 1] + + perpx = -(p1y - p2y) + perpy = p1x - p2x; + + dist = Math.sqrt(perpx*perpx + perpy*perpy); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + + verts.push(p2x - perpx , p2y - perpy) + verts.push(r, g, b, alpha); + + verts.push(p2x + perpx , p2y + perpy) + verts.push(r, g, b, alpha); + + indices.push(indexStart); + + for (var i=0; i < indexCount; i++) + { + indices.push(indexStart++); + }; + + indices.push(indexStart-1); +} + + +PIXI.WebGLGraphics.buildPoly = function(graphicsData, webGLData) +{ + var points = graphicsData.points; + if(points.length < 6)return; + + // get first and last point.. figure out the middle! + var verts = webGLData.points; + var indices = webGLData.indices; + + var length = points.length / 2; + + // sort color + var color = HEXtoRGB(graphicsData.fillColor); + var alpha = graphicsData.fillAlpha; + var r = color[0] * alpha; + var g = color[1] * alpha; + var b = color[2] * alpha; + + var triangles = PIXI.PolyK.Triangulate(points); + + var vertPos = verts.length / 6; + + for (var i=0; i < triangles.length; i+=3) + { + indices.push(triangles[i] + vertPos); + indices.push(triangles[i] + vertPos); + indices.push(triangles[i+1] + vertPos); + indices.push(triangles[i+2] +vertPos); + indices.push(triangles[i+2] + vertPos); + }; + + for (var i = 0; i < length; i++) + { + verts.push(points[i * 2], points[i * 2 + 1], + r, g, b, alpha); + }; +} + +function HEXtoRGB(hex) { + return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255]; +} + + + + + ++src/pixi/renderers/WebGLRenderGroup.js - Pixi.JS +src/pixi/renderers/webgl/WebGLRenderGroup.js - Pixi.JS @@ -19,7 +19,7 @@
@@ -162,7 +170,6 @@ PIXI.WebGLRenderGroup = function(gl) this.toRemove = []; } - // constructor PIXI.WebGLRenderGroup.constructor = PIXI.WebGLRenderGroup; @@ -178,20 +185,17 @@ PIXI.WebGLRenderGroup.prototype.setRenderable = function(displayObject) // TODO what if its already has an object? should remove it this.root = displayObject; - //displayObject.__renderGroup = this; this.addDisplayObjectAndChildren(displayObject); - //displayObject } -PIXI.WebGLRenderGroup.prototype.render = function(projectionMatrix) +PIXI.WebGLRenderGroup.prototype.render = function(projection) { - PIXI.WebGLRenderer.updateTextures(); var gl = this.gl; - - // set the flipped matrix.. - gl.uniformMatrix4fv(PIXI.shaderProgram.mvMatrixUniform, false, projectionMatrix); + + gl.uniform2f(PIXI.shaderProgram.projectionVector, projection.x, projection.y); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); // TODO remove this by replacing visible with getter setters.. this.checkVisibility(this.root, this.root.visible); @@ -209,26 +213,59 @@ PIXI.WebGLRenderGroup.prototype.render = function(projectionMatrix) } else if(renderable instanceof PIXI.TilingSprite) { - if(renderable.visible)this.renderTilingSprite(renderable, projectionMatrix); + if(renderable.visible)this.renderTilingSprite(renderable, projection); } else if(renderable instanceof PIXI.Strip) { - if(renderable.visible)this.renderStrip(renderable, projectionMatrix); + if(renderable.visible)this.renderStrip(renderable, projection); + } + else if(renderable instanceof PIXI.Graphics) + { + if(renderable.visible && renderable.renderable) PIXI.WebGLGraphics.renderGraphics(renderable, projection);//, projectionMatrix); + } + else if(renderable instanceof PIXI.FilterBlock) + { + /* + * for now only masks are supported.. + */ + if(renderable.open) + { + gl.enable(gl.STENCIL_TEST); + + gl.colorMask(false, false, false, false); + gl.stencilFunc(gl.ALWAYS,1,0xff); + gl.stencilOp(gl.KEEP,gl.KEEP,gl.REPLACE); + + PIXI.WebGLGraphics.renderGraphics(renderable.mask, projection); + + gl.colorMask(true, true, true, false); + gl.stencilFunc(gl.NOTEQUAL,0,0xff); + gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP); + } + else + { + gl.disable(gl.STENCIL_TEST); + } } } } -PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, projectionMatrix) +PIXI.WebGLRenderGroup.prototype.handleFilter = function(filter, projection) +{ + +} + +PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, projection) { PIXI.WebGLRenderer.updateTextures(); var gl = this.gl; this.checkVisibility(displayObject, displayObject.visible); - gl.uniformMatrix4fv(PIXI.shaderProgram.mvMatrixUniform, false, projectionMatrix); - - //console.log("SPECIFIC"); +// gl.uniformMatrix4fv(PIXI.shaderProgram.mvMatrixUniform, false, projectionMatrix); + gl.uniform2f(PIXI.shaderProgram.projectionVector, projection.x, projection.y); + // to do! // render part of the scene... @@ -238,8 +275,18 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project var endIndex; var endBatchIndex; - // get NEXT Renderable! - var nextRenderable = displayObject.renderable ? displayObject : this.getNextRenderable(displayObject); + /* + * LOOK FOR THE NEXT SPRITE + * This part looks for the closest next sprite that can go into a batch + * it keeps looking until it finds a sprite or gets to the end of the display + * scene graph + */ + var nextRenderable = displayObject.last; + while(nextRenderable._iNext) + { + nextRenderable = nextRenderable._iNext; + if(nextRenderable.renderable && nextRenderable.__renderGroup)break; + } var startBatch = nextRenderable.batch; if(nextRenderable instanceof PIXI.Sprite) @@ -308,26 +355,16 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project // TODO - need to fold this up a bit! - if(startBatch == endBatch) { if(startBatch instanceof PIXI.WebGLBatch) { startBatch.render(startIndex, endIndex+1); } - else if(startBatch instanceof PIXI.TilingSprite) + else { - if(startBatch.visible)this.renderTilingSprite(startBatch, projectionMatrix); + this.renderSpecial(startBatch); } - else if(startBatch instanceof PIXI.Strip) - { - if(startBatch.visible)this.renderStrip(startBatch, projectionMatrix); - } - else if(startBatch instanceof PIXI.CustomRenderable) - { - if(startBatch.visible) startBatch.renderWebGL(this, projectionMatrix); - } - return; } @@ -340,17 +377,9 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project { startBatch.render(startIndex); } - else if(startBatch instanceof PIXI.TilingSprite) + else { - if(startBatch.visible)this.renderTilingSprite(startBatch, projectionMatrix); - } - else if(startBatch instanceof PIXI.Strip) - { - if(startBatch.visible)this.renderStrip(startBatch, projectionMatrix); - } - else if(startBatch instanceof PIXI.CustomRenderable) - { - if(startBatch.visible) startBatch.renderWebGL(this, projectionMatrix); + this.renderSpecial(startBatch); } // DO the middle batchs.. @@ -362,19 +391,10 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project { this.batchs[i].render(); } - else if(renderable instanceof PIXI.TilingSprite) + else { - if(renderable.visible)this.renderTilingSprite(renderable, projectionMatrix); + this.renderSpecial(renderable); } - else if(renderable instanceof PIXI.Strip) - { - if(renderable.visible)this.renderStrip(renderable, projectionMatrix); - } - else if(renderable instanceof PIXI.CustomRenderable) - { - if(renderable.visible) renderable.renderWebGL(this, projectionMatrix); - } - } // DO the last batch.. @@ -382,30 +402,66 @@ PIXI.WebGLRenderGroup.prototype.renderSpecific = function(displayObject, project { endBatch.render(0, endIndex+1); } - else if(endBatch instanceof PIXI.TilingSprite) + else { - if(endBatch.visible)this.renderTilingSprite(endBatch); + this.renderSpecial(endBatch); } - else if(endBatch instanceof PIXI.Strip) +} + +PIXI.WebGLRenderGroup.prototype.renderSpecial = function(renderable) +{ + if(renderable instanceof PIXI.TilingSprite) { - if(endBatch.visible)this.renderStrip(endBatch); + if(renderable.visible)this.renderTilingSprite(renderable, projectionMatrix); } - else if(endBatch instanceof PIXI.CustomRenderable) + else if(renderable instanceof PIXI.Strip) { - if(endBatch.visible) endBatch.renderWebGL(this, projectionMatrix); + if(renderable.visible)this.renderStrip(renderable, projectionMatrix); + } + else if(renderable instanceof PIXI.CustomRenderable) + { + if(renderable.visible) renderable.renderWebGL(this, projectionMatrix); + } + else if(renderable instanceof PIXI.Graphics) + { + if(renderable.visible && renderable.renderable) PIXI.WebGLGraphics.renderGraphics(renderable);//, projectionMatrix); + } + else if(renderable instanceof PIXI.FilterBlock) + { + /* + * for now only masks are supported.. + */ + if(renderable.open) + { + gl.enable(gl.STENCIL_TEST); + + gl.colorMask(false, false, false, false); + gl.stencilFunc(gl.ALWAYS,1,0xff); + gl.stencilOp(gl.KEEP,gl.KEEP,gl.REPLACE); + + PIXI.WebGLGraphics.renderGraphics(renderable.mask, projection); + + gl.colorMask(true, true, true, false); + gl.stencilFunc(gl.NOTEQUAL,0,0xff); + gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP); + } + else + { + gl.disable(gl.STENCIL_TEST); + } } } PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, globalVisible) { - // give the dp a refference to its renderGroup... + // give the dp a reference to its renderGroup... var children = displayObject.children; //displayObject.worldVisible = globalVisible; for (var i=0; i < children.length; i++) { var child = children[i]; - // TODO optimize... shouldt need to loop through everything all the time + // TODO optimize... should'nt need to loop through everything all the time child.worldVisible = child.visible && globalVisible; // everything should have a batch! @@ -413,12 +469,7 @@ PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, global if(child.textureChange) { child.textureChange = false; - if(child.worldVisible) - { - this.removeDisplayObject(child); - this.addDisplayObject(child); - //this.updateTexture(child); - } + if(child.worldVisible)this.updateTexture(child); // update texture!! } @@ -431,135 +482,159 @@ PIXI.WebGLRenderGroup.prototype.checkVisibility = function(displayObject, global PIXI.WebGLRenderGroup.prototype.updateTexture = function(displayObject) { - // we know this exists.. - // is it in a batch.. - // check batch length - if(displayObject.batch.length == 1) + + // TODO definitely can optimse this function.. + + this.removeObject(displayObject); + + /* + * LOOK FOR THE PREVIOUS RENDERABLE + * This part looks for the closest previous sprite that can go into a batch + * It keeps going back until it finds a sprite or the stage + */ + var previousRenderable = displayObject.first; + while(previousRenderable != this.root) { - // just one! this guy! so simply swap the texture - displayObject.batch.texture = displayObject.texture.baseTexture; - return; + previousRenderable = previousRenderable._iPrev; + if(previousRenderable.renderable && previousRenderable.__renderGroup)break; } - // early out! - if(displayObject.batch.texture == displayObject.texture.baseTexture)return; + /* + * LOOK FOR THE NEXT SPRITE + * This part looks for the closest next sprite that can go into a batch + * it keeps looking until it finds a sprite or gets to the end of the display + * scene graph + */ + var nextRenderable = displayObject.last; + while(nextRenderable._iNext) + { + nextRenderable = nextRenderable._iNext; + if(nextRenderable.renderable && nextRenderable.__renderGroup)break; + } - - if(displayObject.batch.head == displayObject) - { - //console.log("HEAD") - var currentBatch = displayObject.batch; - - var index = this.batchs.indexOf( currentBatch ); - var previousBatch = this.batchs[index-1]; - currentBatch.remove(displayObject); - - if(previousBatch) - { - if(previousBatch.texture == displayObject.texture.baseTexture && previousBatch.blendMode == displayObject.blendMode) - { - previousBatch.insertAfter(displayObject, previousBatch.tail); - } - else - { - // add it before.. - var batch = PIXI.WebGLRenderer.getBatch(); - batch.init(displayObject); - this.batchs.splice(index-1, 0, batch); - } - - } - else - { - // we are 0! - var batch = PIXI.WebGLRenderer.getBatch(); - batch.init(displayObject); - this.batchs.splice(0, 0, batch); - } - - } - else if(displayObject.batch.tail == displayObject) - { - var currentBatch = displayObject.batch; - - var index = this.batchs.indexOf( currentBatch ); - var nextBatch = this.batchs[index+1]; - currentBatch.remove(displayObject); - - if(nextBatch) - { - if(nextBatch.texture == displayObject.texture.baseTexture && nextBatch.blendMode == displayObject.blendMode) - { - nextBatch.insertBefore(displayObject, nextBatch.head); - return; - } - else - { - // add it before.. - var batch = PIXI.WebGLRenderer.getBatch(); - batch.init(displayObject); - this.batchs.splice(index+1, 0, batch); - } - - } - else - { - // we are 0! - var batch = PIXI.WebGLRenderer.getBatch(); - batch.init(displayObject); - this.batchs.push(batch); - } - } - else - { - // console.log("MIDDLE") - var currentBatch = displayObject.batch; - - // split the batch into 2 - // AH! dont split on the current display object as the texture is wrong! - var splitBatch = currentBatch.split(displayObject); - - // now remove the display object - splitBatch.remove(displayObject); - - var batch = PIXI.WebGLRenderer.getBatch(); - var index = this.batchs.indexOf( currentBatch ); - batch.init(displayObject); - this.batchs.splice(index+1, 0, batch, splitBatch); - } + this.insertObject(displayObject, previousRenderable, nextRenderable); } -PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject) +PIXI.WebGLRenderGroup.prototype.addFilterBlocks = function(start, end) +{ + start.__renderGroup = this; + end.__renderGroup = this; + /* + * LOOK FOR THE PREVIOUS RENDERABLE + * This part looks for the closest previous sprite that can go into a batch + * It keeps going back until it finds a sprite or the stage + */ + var previousRenderable = start; + while(previousRenderable != this.root) + { + previousRenderable = previousRenderable._iPrev; + if(previousRenderable.renderable && previousRenderable.__renderGroup)break; + } + this.insertAfter(start, previousRenderable); + + /* + * LOOK FOR THE NEXT SPRITE + * This part looks for the closest next sprite that can go into a batch + * it keeps looking until it finds a sprite or gets to the end of the display + * scene graph + */ + var previousRenderable2 = end; + while(previousRenderable2 != this.root) + { + previousRenderable2 = previousRenderable2._iPrev; + if(previousRenderable2.renderable && previousRenderable2.__renderGroup)break; + } + this.insertAfter(end, previousRenderable2); +} + +PIXI.WebGLRenderGroup.prototype.removeFilterBlocks = function(start, end) +{ + this.removeObject(start); + this.removeObject(end); +} + +PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayObject) { - // add a child to the render group.. if(displayObject.__renderGroup)displayObject.__renderGroup.removeDisplayObjectAndChildren(displayObject); - - // DONT htink this is needed? - // displayObject.batch = null; - displayObject.__renderGroup = this; + /* + * LOOK FOR THE PREVIOUS RENDERABLE + * This part looks for the closest previous sprite that can go into a batch + * It keeps going back until it finds a sprite or the stage + */ + + var previousRenderable = displayObject.first; + while(previousRenderable != this.root) + { + previousRenderable = previousRenderable._iPrev; + if(previousRenderable.renderable && previousRenderable.__renderGroup)break; + } + + /* + * LOOK FOR THE NEXT SPRITE + * This part looks for the closest next sprite that can go into a batch + * it keeps looking until it finds a sprite or gets to the end of the display + * scene graph + */ + var nextRenderable = displayObject.last; + while(nextRenderable._iNext) + { + nextRenderable = nextRenderable._iNext; + if(nextRenderable.renderable && nextRenderable.__renderGroup)break; + } + + // one the display object hits this. we can break the loop + + var tempObject = displayObject.first; + var testObject = displayObject.last._iNext; + do + { + tempObject.__renderGroup = this; + + if(tempObject.renderable) + { + + this.insertObject(tempObject, previousRenderable, nextRenderable); + previousRenderable = tempObject; + } + + tempObject = tempObject._iNext; + } + while(tempObject != testObject) +} - //displayObject.cacheVisible = true; - if(!displayObject.renderable)return; +PIXI.WebGLRenderGroup.prototype.removeDisplayObjectAndChildren = function(displayObject) +{ + if(displayObject.__renderGroup != this)return; + +// var displayObject = displayObject.first; + var lastObject = displayObject.last; + do + { + displayObject.__renderGroup = null; + if(displayObject.renderable)this.removeObject(displayObject); + displayObject = displayObject._iNext; + } + while(displayObject) +} + + +PIXI.WebGLRenderGroup.prototype.insertObject = function(displayObject, previousObject, nextObject) +{ // while looping below THE OBJECT MAY NOT HAVE BEEN ADDED - //displayObject.__inWebGL = true; + var previousSprite = previousObject; + var nextSprite = nextObject; - var previousSprite = this.getPreviousRenderable(displayObject); - var nextSprite = this.getNextRenderable(displayObject); - - /* * so now we have the next renderable and the previous renderable * */ - if(displayObject instanceof PIXI.Sprite) { var previousBatch var nextBatch - //console.log( previousSprite) if(previousSprite instanceof PIXI.Sprite) { previousBatch = previousSprite.batch; @@ -619,6 +694,7 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject) else { // TODO re-word! + nextBatch = nextSprite; } } @@ -641,40 +717,88 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObject = function(displayObject) { this.batchs.push(batch); } - + + return; } else if(displayObject instanceof PIXI.TilingSprite) { + // add to a batch!! this.initTilingSprite(displayObject); - this.batchs.push(displayObject); + // this.batchs.push(displayObject); } else if(displayObject instanceof PIXI.Strip) { // add to a batch!! this.initStrip(displayObject); - this.batchs.push(displayObject); + // this.batchs.push(displayObject); + } + else if(displayObject)// instanceof PIXI.Graphics) + { + //displayObject.initWebGL(this); + + // add to a batch!! + //this.initStrip(displayObject); + //this.batchs.push(displayObject); } - // if its somthing else... then custom codes! - this.batchUpdate = true; + this.insertAfter(displayObject, previousSprite); + + // insert and SPLIT! + } -PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayObject) + + +PIXI.WebGLRenderGroup.prototype.insertAfter = function(item, displayObject) { - // TODO - this can be faster - but not as important right now - - this.addDisplayObject(displayObject); - var children = displayObject.children; - - for (var i=0; i < children.length; i++) + if(displayObject instanceof PIXI.Sprite) { - this.addDisplayObjectAndChildren(children[i]); - }; + var previousBatch = displayObject.batch; + + if(previousBatch) + { + // so this object is in a batch! + + // is it not? need to split the batch + if(previousBatch.tail == displayObject) + { + // is it tail? insert in to batchs + var index = this.batchs.indexOf( previousBatch ); + this.batchs.splice(index+1, 0, item); + } + else + { + // TODO MODIFY ADD / REMOVE CHILD TO ACCOUNT FOR FILTERS (also get prev and next) // + + // THERE IS A SPLIT IN THIS BATCH! // + var splitBatch = previousBatch.split(displayObject.__next); + + // COOL! + // add it back into the array + /* + * OOPS! + * seems the new sprite is in the middle of a batch + * lets split it.. + */ + var index = this.batchs.indexOf( previousBatch ); + this.batchs.splice(index+1, 0, item, splitBatch); + } + } + else + { + this.batchs.push(item); + } + } + else + { + var index = this.batchs.indexOf( displayObject ); + this.batchs.splice(index+1, 0, item); + } } -PIXI.WebGLRenderGroup.prototype.removeDisplayObject = function(displayObject) +PIXI.WebGLRenderGroup.prototype.removeObject = function(displayObject) { // loop through children.. // display object // @@ -682,10 +806,7 @@ PIXI.WebGLRenderGroup.prototype.removeDisplayObject = function(displayObject) // add a child from the render group.. // remove it and all its children! //displayObject.cacheVisible = false;//displayObject.visible; - displayObject.__renderGroup = null; - - if(!displayObject.renderable)return; - + /* * removing is a lot quicker.. * @@ -743,111 +864,18 @@ PIXI.WebGLRenderGroup.prototype.removeDisplayObject = function(displayObject) } } - this.batchs.splice(index, 1); if(batchToRemove instanceof PIXI.WebGLBatch)PIXI.WebGLRenderer.returnBatch(batchToRemove); } } -PIXI.WebGLRenderGroup.prototype.removeDisplayObjectAndChildren = function(displayObject) -{ - // TODO - this can be faster - but not as important right now - if(displayObject.__renderGroup != this)return; - - this.removeDisplayObject(displayObject); - var children = displayObject.children; - - for (var i=0; i < children.length; i++) - { - this.removeDisplayObjectAndChildren(children[i]); - }; -} /** * @private */ -PIXI.WebGLRenderGroup.prototype.getNextRenderable = function(displayObject) -{ - /* - * LOOK FOR THE NEXT SPRITE - * This part looks for the closest next sprite that can go into a batch - * it keeps looking until it finds a sprite or gets to the end of the display - * scene graph - * - * These look a lot scarier than the actually are... - */ - - var nextSprite = displayObject; - do - { - // moving forward! - // if it has no children.. - if(nextSprite.children.length == 0) - { - //maynot have a parent - if(!nextSprite.parent)return null; - - // go along to the parent.. - while(nextSprite.childIndex == nextSprite.parent.children.length-1) - { - nextSprite = nextSprite.parent; - //console.log(">" + nextSprite); -// console.log(">-" + this.root); - if(nextSprite == this.root || !nextSprite.parent)//displayObject.stage) - { - nextSprite = null - break; - } - } - - if(nextSprite)nextSprite = nextSprite.parent.children[nextSprite.childIndex+1]; - } - else - { - nextSprite = nextSprite.children[0]; - } - if(!nextSprite)break; - } - while(!nextSprite.renderable || !nextSprite.__renderGroup) - - return nextSprite; -} -PIXI.WebGLRenderGroup.prototype.getPreviousRenderable = function(displayObject) -{ - /* - * LOOK FOR THE PREVIOUS SPRITE - * This part looks for the closest previous sprite that can go into a batch - * It keeps going back until it finds a sprite or the stage - */ - var previousSprite = displayObject; - do - { - if(previousSprite.childIndex == 0) - { - previousSprite = previousSprite.parent; - if(!previousSprite)return null; - } - else - { - - previousSprite = previousSprite.parent.children[previousSprite.childIndex-1]; - // what if the bloop has children??? - while(previousSprite.children.length != 0) - { - // keep diggin till we get to the last child - previousSprite = previousSprite.children[previousSprite.children.length-1]; - } - } - - if(previousSprite == this.root)break; - } - while(!previousSprite.renderable || !previousSprite.__renderGroup); - - return previousSprite; -} /** * @private @@ -872,7 +900,6 @@ PIXI.WebGLRenderGroup.prototype.initTilingSprite = function(sprite) sprite.indices = new Uint16Array([0, 1, 3,2])//, 2]); - sprite._vertexBuffer = gl.createBuffer(); sprite._indexBuffer = gl.createBuffer(); sprite._uvBuffer = gl.createBuffer(); @@ -908,17 +935,28 @@ PIXI.WebGLRenderGroup.prototype.initTilingSprite = function(sprite) /** * @private */ -PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projectionMatrix) +PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projection) { var gl = this.gl; var shaderProgram = PIXI.shaderProgram; // mat - var mat4Real = PIXI.mat3.toMat4(strip.worldTransform); - PIXI.mat4.transpose(mat4Real); - PIXI.mat4.multiply(projectionMatrix, mat4Real, mat4Real ) + //var mat4Real = PIXI.mat3.toMat4(strip.worldTransform); + //PIXI.mat4.transpose(mat4Real); + //PIXI.mat4.multiply(projectionMatrix, mat4Real, mat4Real ) - gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mat4Real); - + + gl.useProgram(PIXI.stripShaderProgram); + + var m = PIXI.mat3.clone(strip.worldTransform); + + PIXI.mat3.transpose(m); + + // set the matrix transform for the + gl.uniformMatrix3fv(PIXI.stripShaderProgram.translationMatrix, false, m); + gl.uniform2f(PIXI.stripShaderProgram.projectionVector, projection.x, projection.y); + gl.uniform1f(PIXI.stripShaderProgram.alpha, strip.worldAlpha); + +/* if(strip.blendMode == PIXI.blendModes.NORMAL) { gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); @@ -927,6 +965,8 @@ PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projectionMatrix) { gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_COLOR); } + */ + if(!strip.dirty) { @@ -947,8 +987,6 @@ PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projectionMatrix) // dont need to upload! gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, strip._indexBuffer); - - } else { @@ -974,11 +1012,11 @@ PIXI.WebGLRenderGroup.prototype.renderStrip = function(strip, projectionMatrix) gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, strip.indices, gl.STATIC_DRAW); } - //console.log(gl.TRIANGLE_STRIP) + //console.log(gl.TRIANGLE_STRIP); + gl.drawElements(gl.TRIANGLE_STRIP, strip.indices.length, gl.UNSIGNED_SHORT, 0); - gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, projectionMatrix); - + gl.useProgram(PIXI.shaderProgram); } @@ -1022,7 +1060,7 @@ PIXI.WebGLRenderGroup.prototype.renderTilingSprite = function(sprite, projection /** * @private */ -PIXI.WebGLRenderer.prototype.initStrip = function(strip) +PIXI.WebGLRenderGroup.prototype.initStrip = function(strip) { // build the strip! var gl = this.gl; diff --git a/docs/files/src_pixi_renderers_WebGLRenderer.js.html b/docs/files/src_pixi_renderers_webgl_WebGLRenderer.js.html similarity index 86% rename from docs/files/src_pixi_renderers_WebGLRenderer.js.html rename to docs/files/src_pixi_renderers_webgl_WebGLRenderer.js.html index 15ac256..eb6aae6 100644 --- a/docs/files/src_pixi_renderers_WebGLRenderer.js.html +++ b/docs/files/src_pixi_renderers_webgl_WebGLRenderer.js.html @@ -2,7 +2,7 @@ -src/pixi/renderers/WebGLRenderer.js - Pixi.JS +src/pixi/renderers/webgl/WebGLRenderer.js - Pixi.JS @@ -19,7 +19,7 @@
@@ -174,7 +182,7 @@ PIXI.WebGLRenderer = function(width, height, view, transparent) this.view = view || document.createElement( 'canvas' ); this.view.width = this.width; - this.view.height = this.height; + this.view.height = this.height; // deal with losing context.. var scope = this; @@ -187,8 +195,9 @@ PIXI.WebGLRenderer = function(width, height, view, transparent) { PIXI.gl = this.gl = this.view.getContext("experimental-webgl", { alpha: this.transparent, - antialias:false, // SPEED UP?? - premultipliedAlpha:false + antialias:true, // SPEED UP?? + premultipliedAlpha:false, + stencil:true }); } catch (e) @@ -196,8 +205,11 @@ PIXI.WebGLRenderer = function(width, height, view, transparent) throw new Error(" This browser does not support webGL. Try using the canvas renderer" + this); } - this.initShaders(); + PIXI.initPrimitiveShader(); + PIXI.initDefaultShader(); + PIXI.initDefaultStripShader(); + PIXI.activateDefaultShader(); var gl = this.gl; PIXI.WebGLRenderer.gl = gl; @@ -205,10 +217,15 @@ PIXI.WebGLRenderer = function(width, height, view, transparent) this.batch = new PIXI.WebGLBatch(gl); gl.disable(gl.DEPTH_TEST); gl.disable(gl.CULL_FACE); + + // + + gl.enable(gl.BLEND); gl.colorMask(true, true, true, this.transparent); - this.projectionMatrix = PIXI.mat4.create(); + PIXI.projection = new PIXI.Point(400, 300); + this.resize(this.width, this.height); this.contextLost = false; @@ -246,39 +263,7 @@ PIXI.WebGLRenderer.returnBatch = function(batch) /** * @private */ -PIXI.WebGLRenderer.prototype.initShaders = function() -{ - var gl = this.gl; - var fragmentShader = PIXI.CompileFragmentShader(gl, PIXI.shaderFragmentSrc); - var vertexShader = PIXI.CompileVertexShader(gl, PIXI.shaderVertexSrc); - - PIXI.shaderProgram = gl.createProgram(); - - var shaderProgram = PIXI.shaderProgram; - - gl.attachShader(shaderProgram, vertexShader); - gl.attachShader(shaderProgram, fragmentShader); - gl.linkProgram(shaderProgram); - if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) { - alert("Could not initialise shaders"); - } - - gl.useProgram(shaderProgram); - - shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); - gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); - - shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); - gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); - - shaderProgram.colorAttribute = gl.getAttribLocation(shaderProgram, "aColor"); - gl.enableVertexAttribArray(shaderProgram.colorAttribute); - - - shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); - shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); -} /** @@ -327,16 +312,18 @@ PIXI.WebGLRenderer.prototype.render = function(stage) gl.viewport(0, 0, this.width, this.height); // set the correct matrix.. - // gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.projectionMatrix); + // gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.projectionMatrix); gl.bindFramebuffer(gl.FRAMEBUFFER, null); gl.clearColor(stage.backgroundColorSplit[0],stage.backgroundColorSplit[1],stage.backgroundColorSplit[2], !this.transparent); gl.clear(gl.COLOR_BUFFER_BIT); - + // HACK TO TEST + //PIXI.projectionMatrix = this.projectionMatrix; + this.stageRenderGroup.backgroundColor = stage.backgroundColorSplit; - this.stageRenderGroup.render(this.projectionMatrix); + this.stageRenderGroup.render(PIXI.projection); // interaction // run interaction! @@ -437,12 +424,15 @@ PIXI.WebGLRenderer.prototype.resize = function(width, height) this.gl.viewport(0, 0, this.width, this.height); - var projectionMatrix = this.projectionMatrix; + //var projectionMatrix = this.projectionMatrix; - projectionMatrix[0] = 2/this.width; - projectionMatrix[5] = -2/this.height; - projectionMatrix[12] = -1; - projectionMatrix[13] = 1; + PIXI.projection.x = this.width/2; + PIXI.projection.y = this.height/2; + +// projectionMatrix[0] = 2/this.width; +// projectionMatrix[5] = -2/this.height; +// projectionMatrix[12] = -1; +// projectionMatrix[13] = 1; } /** @@ -465,9 +455,11 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function(event) this.initShaders(); - for (var i=0; i < PIXI.TextureCache.length; i++) + for(var key in PIXI.TextureCache) { - this.updateTexture(PIXI.TextureCache[i]); + var texture = PIXI.TextureCache[key].baseTexture; + texture._glTexture = null; + PIXI.WebGLRenderer.updateTexture(texture); }; for (var i=0; i < this.batchs.length; i++) diff --git a/docs/files/src_pixi_renderers_webgl_WebGLShaders.js.html b/docs/files/src_pixi_renderers_webgl_WebGLShaders.js.html new file mode 100644 index 0000000..1dff6c3 --- /dev/null +++ b/docs/files/src_pixi_renderers_webgl_WebGLShaders.js.html @@ -0,0 +1,399 @@ + + + + +src/pixi/renderers/webgl/WebGLShaders.js - Pixi.JS + + + + + + + + +++ + + + + + + + + + diff --git a/docs/files/src_pixi_text_BitmapText.js.html b/docs/files/src_pixi_text_BitmapText.js.html index c8f4d4c..5e9bbc2 100644 --- a/docs/files/src_pixi_text_BitmapText.js.html +++ b/docs/files/src_pixi_text_BitmapText.js.html @@ -19,7 +19,7 @@+++ +++ +
+ API Docs for: 1.3.0 +++ ++++ ++++ Show: + + + + + + + ++ + +++++++File: src/pixi/renderers/webgl/WebGLShaders.js
+ +++ ++ +/** + * @author Mat Groves http://matgroves.com/ @Doormat23 + */ + + +/* + * the default suoer fast shader! + */ + +PIXI.shaderFragmentSrc = [ + "precision mediump float;", + "varying vec2 vTextureCoord;", + "varying float vColor;", + "uniform sampler2D uSampler;", + "void main(void) {", + "gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));", + "gl_FragColor = gl_FragColor * vColor;", + "}" +]; + +PIXI.shaderVertexSrc = [ + "attribute vec2 aVertexPosition;", + "attribute vec2 aTextureCoord;", + "attribute float aColor;", + //"uniform mat4 uMVMatrix;", + + "uniform vec2 projectionVector;", + "varying vec2 vTextureCoord;", + "varying float vColor;", + "void main(void) {", + // "gl_Position = uMVMatrix * vec4(aVertexPosition, 1.0, 1.0);", + "gl_Position = vec4( aVertexPosition.x / projectionVector.x -1.0, aVertexPosition.y / -projectionVector.y + 1.0 , 0.0, 1.0);", + "vTextureCoord = aTextureCoord;", + "vColor = aColor;", + "}" +]; + +/* + * the triangle strip shader.. + */ + +PIXI.stripShaderFragmentSrc = [ + "precision mediump float;", + "varying vec2 vTextureCoord;", + "varying float vColor;", + "uniform float alpha;", + "uniform sampler2D uSampler;", + "void main(void) {", + "gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));", + "gl_FragColor = gl_FragColor * alpha;", + "}" +]; + + +PIXI.stripShaderVertexSrc = [ + "attribute vec2 aVertexPosition;", + "attribute vec2 aTextureCoord;", + "attribute float aColor;", + "uniform mat3 translationMatrix;", + "uniform vec2 projectionVector;", + "varying vec2 vTextureCoord;", + "varying float vColor;", + "void main(void) {", + "vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);", + "gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);", + "vTextureCoord = aTextureCoord;", + "vColor = aColor;", + "}" +]; + + +/* + * primitive shader.. + */ + +PIXI.primitiveShaderFragmentSrc = [ + "precision mediump float;", + "varying vec4 vColor;", + "void main(void) {", + "gl_FragColor = vColor;", + "}" +]; + +PIXI.primitiveShaderVertexSrc = [ + "attribute vec2 aVertexPosition;", + "attribute vec4 aColor;", + "uniform mat3 translationMatrix;", + "uniform vec2 projectionVector;", + "uniform float alpha;", + "varying vec4 vColor;", + "void main(void) {", + "vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);", + "gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);", + "vColor = aColor * alpha;", + "}" +]; + +PIXI.initPrimitiveShader = function() +{ + var gl = PIXI.gl; + + var shaderProgram = PIXI.compileProgram(PIXI.primitiveShaderVertexSrc, PIXI.primitiveShaderFragmentSrc) + + gl.useProgram(shaderProgram); + + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + shaderProgram.colorAttribute = gl.getAttribLocation(shaderProgram, "aColor"); + + shaderProgram.projectionVector = gl.getUniformLocation(shaderProgram, "projectionVector"); + shaderProgram.translationMatrix = gl.getUniformLocation(shaderProgram, "translationMatrix"); + + shaderProgram.alpha = gl.getUniformLocation(shaderProgram, "alpha"); + + PIXI.primitiveProgram = shaderProgram; +} + +PIXI.initDefaultShader = function() +{ + var gl = this.gl; + var shaderProgram = PIXI.compileProgram(PIXI.shaderVertexSrc, PIXI.shaderFragmentSrc) + + gl.useProgram(shaderProgram); + + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + shaderProgram.projectionVector = gl.getUniformLocation(shaderProgram, "projectionVector"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.colorAttribute = gl.getAttribLocation(shaderProgram, "aColor"); + + // shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + + PIXI.shaderProgram = shaderProgram; +} + +PIXI.initDefaultStripShader = function() +{ + var gl = this.gl; + var shaderProgram = PIXI.compileProgram(PIXI.stripShaderVertexSrc, PIXI.stripShaderFragmentSrc) + + gl.useProgram(shaderProgram); + + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + shaderProgram.projectionVector = gl.getUniformLocation(shaderProgram, "projectionVector"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.translationMatrix = gl.getUniformLocation(shaderProgram, "translationMatrix"); + shaderProgram.alpha = gl.getUniformLocation(shaderProgram, "alpha"); + + shaderProgram.colorAttribute = gl.getAttribLocation(shaderProgram, "aColor"); + + shaderProgram.projectionVector = gl.getUniformLocation(shaderProgram, "projectionVector"); + + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + + PIXI.stripShaderProgram = shaderProgram; +} + +PIXI.CompileVertexShader = function(gl, shaderSrc) +{ + return PIXI._CompileShader(gl, shaderSrc, gl.VERTEX_SHADER); +} + +PIXI.CompileFragmentShader = function(gl, shaderSrc) +{ + return PIXI._CompileShader(gl, shaderSrc, gl.FRAGMENT_SHADER); +} + +PIXI._CompileShader = function(gl, shaderSrc, shaderType) +{ + var src = shaderSrc.join("\n"); + var shader = gl.createShader(shaderType); + gl.shaderSource(shader, src); + gl.compileShader(shader); + + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + alert(gl.getShaderInfoLog(shader)); + return null; + } + + return shader; +} + + +PIXI.compileProgram = function(vertexSrc, fragmentSrc) +{ + var gl = PIXI.gl; + var fragmentShader = PIXI.CompileFragmentShader(gl, fragmentSrc); + var vertexShader = PIXI.CompileVertexShader(gl, vertexSrc); + + var shaderProgram = gl.createProgram(); + + gl.attachShader(shaderProgram, vertexShader); + gl.attachShader(shaderProgram, fragmentShader); + gl.linkProgram(shaderProgram); + + if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) { + alert("Could not initialise shaders"); + } + + return shaderProgram; +} + + +PIXI.activateDefaultShader = function() +{ + var gl = PIXI.gl; + var shaderProgram = PIXI.shaderProgram; + + gl.useProgram(shaderProgram); + + + gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); + gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); + gl.enableVertexAttribArray(shaderProgram.colorAttribute); +} + + + +PIXI.activatePrimitiveShader = function() +{ + var gl = PIXI.gl; + + gl.disableVertexAttribArray(PIXI.shaderProgram.textureCoordAttribute); + gl.disableVertexAttribArray(PIXI.shaderProgram.colorAttribute); + + gl.useProgram(PIXI.primitiveProgram); + + gl.enableVertexAttribArray(PIXI.primitiveProgram.vertexPositionAttribute); + gl.enableVertexAttribArray(PIXI.primitiveProgram.colorAttribute); +} + + ++
src/pixi/Stage.js:5
+ Defined in: src/pixi/InteractionManager.js:493