Typos and Started tackling the WebGL, and tests
This commit is contained in:
parent
8a769a64be
commit
e3de999e21
4 changed files with 81 additions and 7 deletions
|
@ -26,6 +26,7 @@ module.exports = function(grunt) {
|
||||||
'<%= dirs.src %>/filters/FilterBlock.js',
|
'<%= dirs.src %>/filters/FilterBlock.js',
|
||||||
'<%= dirs.src %>/text/Text.js',
|
'<%= dirs.src %>/text/Text.js',
|
||||||
'<%= dirs.src %>/text/BitmapText.js',
|
'<%= dirs.src %>/text/BitmapText.js',
|
||||||
|
'<%= dirs.src %>/InteractionData.js',
|
||||||
'<%= dirs.src %>/InteractionManager.js',
|
'<%= dirs.src %>/InteractionManager.js',
|
||||||
'<%= dirs.src %>/display/Stage.js',
|
'<%= dirs.src %>/display/Stage.js',
|
||||||
'<%= dirs.src %>/utils/Utils.js',
|
'<%= dirs.src %>/utils/Utils.js',
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PIXI.determineMatrixArrayType = function() {
|
PIXI.determineMatrixArrayType = function() {
|
||||||
return (typeof Float32Array !== 'undefined') ? Float32Array : Array;
|
return (typeof Float32Array !== 'undefined') ? Float32Array : Array;
|
||||||
}
|
};
|
||||||
|
|
||||||
PIXI.Matrix = PIXI.determineMatrixArrayType();
|
PIXI.Matrix = PIXI.determineMatrixArrayType();
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param width=800 {Number} the width of the canvas view
|
* @param width=800 {Number} the width of the canvas view
|
||||||
* @param height=600 {Number} the height of the canvas view
|
* @param height=600 {Number} the height of the canvas view
|
||||||
* @param view {{HTMLCanvasElement}} the canvas to use as a view, optional
|
* @param [view] {HTMLCanvasElement} the canvas to use as a view, optional
|
||||||
* @param transparent=false {Boolean} the transparency of the render view, default false
|
* @param [transparent=false] {Boolean} the transparency of the render view, default false
|
||||||
*/
|
*/
|
||||||
PIXI.CanvasRenderer = function(width, height, view, transparent)
|
PIXI.CanvasRenderer = function(width, height, view, transparent)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ PIXI.CanvasRenderer = function(width, height, view, transparent)
|
||||||
* The canvas element that everything is drawn to
|
* The canvas element that everything is drawn to
|
||||||
*
|
*
|
||||||
* @property view
|
* @property view
|
||||||
* @type {HTMLCanvasElement}
|
* @type HTMLCanvasElement
|
||||||
*/
|
*/
|
||||||
this.view = view || document.createElement( "canvas" );
|
this.view = view || document.createElement( "canvas" );
|
||||||
|
|
||||||
|
@ -123,6 +123,11 @@ PIXI.CanvasRenderer = function(width, height, view, transparent)
|
||||||
*/
|
*/
|
||||||
this.maskManager = new PIXI.CanvasMaskManager();
|
this.maskManager = new PIXI.CanvasMaskManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RenderSession TODO-Alvin
|
||||||
|
* @property renderSession
|
||||||
|
* @type Object
|
||||||
|
*/
|
||||||
this.renderSession = {
|
this.renderSession = {
|
||||||
context: this.context,
|
context: this.context,
|
||||||
maskManager: this.maskManager,
|
maskManager: this.maskManager,
|
||||||
|
|
|
@ -14,7 +14,7 @@ PIXI.glContexts = []; // this is where we store the webGL contexts for easy acce
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param width=0 {Number} the width of the canvas view
|
* @param width=0 {Number} the width of the canvas view
|
||||||
* @param height=0 {Number} the height of the canvas view
|
* @param height=0 {Number} the height of the canvas view
|
||||||
* @param view {Canvas} the canvas to use as a view, optional
|
* @param view {HTMLCanvasElement} the canvas to use as a view, optional
|
||||||
* @param transparent=false {Boolean} If the render view is transparent, default false
|
* @param transparent=false {Boolean} If the render view is transparent, default false
|
||||||
* @param antialias=false {Boolean} sets antialias (only applicable in chrome at the moment)
|
* @param antialias=false {Boolean} sets antialias (only applicable in chrome at the moment)
|
||||||
*
|
*
|
||||||
|
@ -26,17 +26,44 @@ PIXI.WebGLRenderer = function(width, height, view, transparent, antialias)
|
||||||
this.type = PIXI.WEBGL_RENDERER;
|
this.type = PIXI.WEBGL_RENDERER;
|
||||||
|
|
||||||
// do a catch.. only 1 webGL renderer..
|
// do a catch.. only 1 webGL renderer..
|
||||||
|
/**
|
||||||
|
* Whether the render view is transparent
|
||||||
|
*
|
||||||
|
* @property transparent
|
||||||
|
* @type Boolean
|
||||||
|
*/
|
||||||
this.transparent = !!transparent;
|
this.transparent = !!transparent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The width of the canvas view
|
||||||
|
*
|
||||||
|
* @property width
|
||||||
|
* @type Number
|
||||||
|
* @default 800
|
||||||
|
*/
|
||||||
this.width = width || 800;
|
this.width = width || 800;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the canvas view
|
||||||
|
*
|
||||||
|
* @property height
|
||||||
|
* @type Number
|
||||||
|
* @default 600
|
||||||
|
*/
|
||||||
this.height = height || 600;
|
this.height = height || 600;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The canvas element that everything is drawn to
|
||||||
|
*
|
||||||
|
* @property view
|
||||||
|
* @type HTMLCanvasElement
|
||||||
|
*/
|
||||||
this.view = view || document.createElement( 'canvas' );
|
this.view = view || document.createElement( 'canvas' );
|
||||||
this.view.width = this.width;
|
this.view.width = this.width;
|
||||||
this.view.height = this.height;
|
this.view.height = this.height;
|
||||||
|
|
||||||
// deal with losing context..
|
// deal with losing context..
|
||||||
|
// TODO-Alvin
|
||||||
this.contextLost = this.handleContextLost.bind(this);
|
this.contextLost = this.handleContextLost.bind(this);
|
||||||
this.contextRestoredLost = this.handleContextRestored.bind(this);
|
this.contextRestoredLost = this.handleContextRestored.bind(this);
|
||||||
// console.log(this.handleContextRestored)
|
// console.log(this.handleContextRestored)
|
||||||
|
@ -215,6 +242,14 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a display Object
|
||||||
|
*
|
||||||
|
* @method renderDIsplayObject
|
||||||
|
* @param displayObject {DisplayObject} The DisplayObject to render
|
||||||
|
* @param projection {Point}
|
||||||
|
* @param buffer {Array} buffer TODO-Alvin
|
||||||
|
*/
|
||||||
PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, projection, buffer)
|
PIXI.WebGLRenderer.prototype.renderDisplayObject = function(displayObject, projection, buffer)
|
||||||
{
|
{
|
||||||
// reset the render session data..
|
// reset the render session data..
|
||||||
|
@ -289,6 +324,13 @@ PIXI.WebGLRenderer.destroyTexture = function(texture)
|
||||||
texture._glTextures.length = 0;
|
texture._glTextures.length = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO-Alvin
|
||||||
|
*
|
||||||
|
* @method updateTextureFrame
|
||||||
|
* @param texture {Texture} The texture to update the frame from
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
PIXI.WebGLRenderer.updateTextureFrame = function(texture)
|
PIXI.WebGLRenderer.updateTextureFrame = function(texture)
|
||||||
{
|
{
|
||||||
texture.updateFrame = false;
|
texture.updateFrame = false;
|
||||||
|
@ -319,6 +361,14 @@ PIXI.WebGLRenderer.prototype.resize = function(width, height)
|
||||||
this.projection.y = -this.height/2;
|
this.projection.y = -this.height/2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a WebGL texture
|
||||||
|
*
|
||||||
|
* @method createWebGLTexture
|
||||||
|
* @param texture {Texture} the texture to render
|
||||||
|
* @param gl {webglContext} the WebGL context
|
||||||
|
* @static
|
||||||
|
*/
|
||||||
PIXI.createWebGLTexture = function(texture, gl)
|
PIXI.createWebGLTexture = function(texture, gl)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -353,6 +403,14 @@ PIXI.createWebGLTexture = function(texture, gl)
|
||||||
return texture._glTextures[gl.id];
|
return texture._glTextures[gl.id];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a WebGL texture
|
||||||
|
*
|
||||||
|
* @method updateWebGLTexture
|
||||||
|
* @param texture {Texture} the texture to update
|
||||||
|
* @param gl {webglContext} the WebGL context
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
PIXI.updateWebGLTexture = function(texture, gl)
|
PIXI.updateWebGLTexture = function(texture, gl)
|
||||||
{
|
{
|
||||||
if( texture._glTextures[gl.id] )
|
if( texture._glTextures[gl.id] )
|
||||||
|
@ -446,10 +504,20 @@ PIXI.WebGLRenderer.prototype.handleContextRestored = function()
|
||||||
texture._glTextures = [];
|
texture._glTextures = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the context was lost
|
||||||
|
* @property contextLost
|
||||||
|
* @type Boolean
|
||||||
|
*/
|
||||||
this.contextLost = false;
|
this.contextLost = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy TODO-Alvin
|
||||||
|
*
|
||||||
|
* @method destroy
|
||||||
|
*/
|
||||||
PIXI.WebGLRenderer.prototype.destroy = function()
|
PIXI.WebGLRenderer.prototype.destroy = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue