Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Nov 28, 2016
1 parent c581678 commit 64fd4cc
Show file tree
Hide file tree
Showing 33 changed files with 121 additions and 94 deletions.
19 changes: 11 additions & 8 deletions build/amd/hilo-amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
renderType:'webgl',
gl:null,
_isContextLost:false,
_cacheTexture:{},
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
Expand Down Expand Up @@ -1569,7 +1570,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{

this.canvas.addEventListener('webglcontextrestored', function(e){
that._isContextLost = false;
_cacheTexture = {};
that.setupWebGLStateAndResource();
}, false);

Expand All @@ -1583,6 +1583,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
gl.disable(gl.CULL_FACE);
gl.enable(gl.BLEND);

this._cacheTexture = {};
this._initShaders();
this.defaultShader.active();

Expand Down Expand Up @@ -1729,7 +1730,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
target.updateViewport();
}
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
}else{
}
else if(target.parent){
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
this._setConcatenatedMatrix(target, target.parent);
}
Expand Down Expand Up @@ -1917,7 +1919,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
},
_getTexture:function(sprite){
var image = sprite.__textureImage;
var texture = _cacheTexture[image.src];
var texture = this._cacheTexture[image.src];
if(!texture){
texture = this.activeShader.uploadTexture(image);
}
Expand All @@ -1936,7 +1938,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
* @param {Array} attr.attributes attribute数组
* @param {Array} attr.uniforms uniform数组
*/
var _cacheTexture = {};
var Shader = function(renderer, source, attr){
this.renderer = renderer;
this.gl = renderer.gl;
Expand Down Expand Up @@ -1993,7 +1994,7 @@ Shader.prototype = {
gl.uniform1i(u_Sampler, 0);
gl.bindTexture(gl.TEXTURE_2D, null);

_cacheTexture[image.src] = texture;
this.renderer._cacheTexture[image.src] = texture;
return texture;
},
_createProgram:function(gl, vshader, fshader){
Expand Down Expand Up @@ -7427,7 +7428,7 @@ var ParticleSystem = (function(){
onUpdate: function(dt) {
dt *= .001;
if(this._died){
return;
return false;
}
var ax = this.ax + this.system.gx;
var ay = this.ay + this.system.gy;
Expand All @@ -7447,8 +7448,9 @@ var ParticleSystem = (function(){
this.scaleX = this.scaleY = this.scale;

this._time += dt;
if (this._time >= this.life || this.alpha < 0) {
if (this._time >= this.life || this.alpha <= 0) {
this.destroy();
return false;
}
},
/**
Expand All @@ -7469,7 +7471,8 @@ var ParticleSystem = (function(){
* Destroy the particle.
*/
destroy: function() {
this.died = true;
this._died = true;
this.alpha = 0;
this.removeFromParent();
diedParticles.push(this);
},
Expand Down
6 changes: 3 additions & 3 deletions build/amd/hilo-amd.min.js

Large diffs are not rendered by default.

Binary file modified build/amd/hilo-amd.zip
Binary file not shown.
8 changes: 5 additions & 3 deletions build/amd/hilo/game/ParticleSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ var ParticleSystem = (function(){
onUpdate: function(dt) {
dt *= .001;
if(this._died){
return;
return false;
}
var ax = this.ax + this.system.gx;
var ay = this.ay + this.system.gy;
Expand All @@ -216,8 +216,9 @@ var ParticleSystem = (function(){
this.scaleX = this.scaleY = this.scale;

this._time += dt;
if (this._time >= this.life || this.alpha < 0) {
if (this._time >= this.life || this.alpha <= 0) {
this.destroy();
return false;
}
},
/**
Expand All @@ -238,7 +239,8 @@ var ParticleSystem = (function(){
* Destroy the particle.
*/
destroy: function() {
this.died = true;
this._died = true;
this.alpha = 0;
this.removeFromParent();
diedParticles.push(this);
},
Expand Down
2 changes: 1 addition & 1 deletion build/amd/hilo/game/ParticleSystem.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions build/amd/hilo/renderer/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
renderType:'webgl',
gl:null,
_isContextLost:false,
_cacheTexture:{},
constructor: function(properties){
WebGLRenderer.superclass.constructor.call(this, properties);
var that = this;
Expand Down Expand Up @@ -92,7 +93,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{

this.canvas.addEventListener('webglcontextrestored', function(e){
that._isContextLost = false;
_cacheTexture = {};
that.setupWebGLStateAndResource();
}, false);

Expand All @@ -106,6 +106,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
gl.disable(gl.CULL_FACE);
gl.enable(gl.BLEND);

this._cacheTexture = {};
this._initShaders();
this.defaultShader.active();

Expand Down Expand Up @@ -252,7 +253,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
target.updateViewport();
}
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
}else{
}
else if(target.parent){
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
this._setConcatenatedMatrix(target, target.parent);
}
Expand Down Expand Up @@ -440,7 +442,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
},
_getTexture:function(sprite){
var image = sprite.__textureImage;
var texture = _cacheTexture[image.src];
var texture = this._cacheTexture[image.src];
if(!texture){
texture = this.activeShader.uploadTexture(image);
}
Expand All @@ -459,7 +461,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
* @param {Array} attr.attributes attribute数组
* @param {Array} attr.uniforms uniform数组
*/
var _cacheTexture = {};
var Shader = function(renderer, source, attr){
this.renderer = renderer;
this.gl = renderer.gl;
Expand Down Expand Up @@ -516,7 +517,7 @@ Shader.prototype = {
gl.uniform1i(u_Sampler, 0);
gl.bindTexture(gl.TEXTURE_2D, null);

_cacheTexture[image.src] = texture;
this.renderer._cacheTexture[image.src] = texture;
return texture;
},
_createProgram:function(gl, vshader, fshader){
Expand Down
Loading

0 comments on commit 64fd4cc

Please sign in to comment.