Fixed graphics bug + updated docs

Fixed issue with getBounds being incorrect for graphics
Updated docs
Linted code
This commit is contained in:
Mat Groves 2014-01-01 23:54:45 +00:00
parent 53506da65e
commit 7713731ab3
145 changed files with 15583 additions and 24078 deletions

View file

@ -19,7 +19,7 @@
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.3.0</em>
<em>API Docs for: 1.4.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
@ -45,6 +45,8 @@
<li><a href="../classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="../classes/AtlasLoader.html">AtlasLoader</a></li>
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
@ -61,7 +63,7 @@
<li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
<li><a href="../classes/ColorStepFilter.html">ColorStepFilter</a></li>
<li><a href="../classes/DisplacementFilter.html">DisplacementFilter</a></li>
@ -75,7 +77,7 @@
<li><a href="../classes/Graphics.html">Graphics</a></li>
<li><a href="../classes/GreyFilter.html">GreyFilter</a></li>
<li><a href="../classes/GrayFilter.html">GrayFilter</a></li>
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
@ -87,6 +89,8 @@
<li><a href="../classes/PixelateFilter.html">PixelateFilter</a></li>
<li><a href="../classes/PIXI.PixiShader.html">PIXI.PixiShader</a></li>
<li><a href="../classes/Point.html">Point</a></li>
<li><a href="../classes/Polygon.html">Polygon</a></li>
@ -109,10 +113,10 @@
<li><a href="../classes/Spine.html">Spine</a></li>
<li><a href="../classes/Sprite.html">Sprite</a></li>
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="../classes/Sprite™.html">Sprite™</a></li>
<li><a href="../classes/Stage.html">Stage</a></li>
<li><a href="../classes/Text.html">Text</a></li>
@ -121,8 +125,6 @@
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="../classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="../classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
@ -175,58 +177,66 @@
*/
PIXI.PrimitiveShader = function()
PIXI.PrimitiveShader = function(gl)
{
// the webGL program..
this.program;
this.gl = gl;
// the webGL program..
this.program = null;
this.fragmentSrc = [
&quot;precision mediump float;&quot;,
&quot;varying vec4 vColor;&quot;,
&quot;void main(void) {&quot;,
&quot;gl_FragColor = vColor;&quot;,
&quot;}&quot;
&#x27;precision mediump float;&#x27;,
&#x27;varying vec4 vColor;&#x27;,
&#x27;void main(void) {&#x27;,
&#x27; gl_FragColor = vColor;&#x27;,
&#x27;}&#x27;
];
this.vertexSrc = [
&quot;attribute vec2 aVertexPosition;&quot;,
&quot;attribute vec4 aColor;&quot;,
&quot;uniform mat3 translationMatrix;&quot;,
&quot;uniform vec2 projectionVector;&quot;,
&quot;uniform vec2 offsetVector;&quot;,
&quot;uniform float alpha;&quot;,
&quot;varying vec4 vColor;&quot;,
&quot;void main(void) {&quot;,
&quot;vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);&quot;,
&quot;v -= offsetVector.xyx;&quot;,
&quot;gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);&quot;,
&quot;vColor = aColor * alpha;&quot;,
&quot;}&quot;
&#x27;attribute vec2 aVertexPosition;&#x27;,
&#x27;attribute vec4 aColor;&#x27;,
&#x27;uniform mat3 translationMatrix;&#x27;,
&#x27;uniform vec2 projectionVector;&#x27;,
&#x27;uniform vec2 offsetVector;&#x27;,
&#x27;uniform float alpha;&#x27;,
&#x27;uniform vec3 tint;&#x27;,
&#x27;varying vec4 vColor;&#x27;,
&#x27;void main(void) {&#x27;,
&#x27; vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);&#x27;,
&#x27; v -= offsetVector.xyx;&#x27;,
&#x27; gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);&#x27;,
&#x27; vColor = aColor * vec4(tint * alpha, alpha);&#x27;,
&#x27;}&#x27;
];
}
this.init();
};
PIXI.PrimitiveShader.prototype.init = function()
{
var program = PIXI.compileProgram(this.vertexSrc, this.fragmentSrc);
var gl = PIXI.gl;
gl.useProgram(program);
// get and store the uniforms for the shader
this.projectionVector = gl.getUniformLocation(program, &quot;projectionVector&quot;);
this.offsetVector = gl.getUniformLocation(program, &quot;offsetVector&quot;);
this.colorAttribute = gl.getAttribLocation(program, &quot;aColor&quot;);
// get and store the attributes
this.aVertexPosition = gl.getAttribLocation(program, &quot;aVertexPosition&quot;);
this.translationMatrix = gl.getUniformLocation(program, &quot;translationMatrix&quot;);
this.alpha = gl.getUniformLocation(program, &quot;alpha&quot;);
this.program = program;
}
var gl = this.gl;
var program = PIXI.compileProgram(gl, this.vertexSrc, this.fragmentSrc);
gl.useProgram(program);
// get and store the uniforms for the shader
this.projectionVector = gl.getUniformLocation(program, &#x27;projectionVector&#x27;);
this.offsetVector = gl.getUniformLocation(program, &#x27;offsetVector&#x27;);
this.tintColor = gl.getUniformLocation(program, &#x27;tint&#x27;);
// get and store the attributes
this.aVertexPosition = gl.getAttribLocation(program, &#x27;aVertexPosition&#x27;);
this.colorAttribute = gl.getAttribLocation(program, &#x27;aColor&#x27;);
this.translationMatrix = gl.getUniformLocation(program, &#x27;translationMatrix&#x27;);
this.alpha = gl.getUniformLocation(program, &#x27;alpha&#x27;);
this.program = program;
};
</pre>
</div>