Skip to content

Commit 64fd4cc

Browse files
committed
build
1 parent c581678 commit 64fd4cc

33 files changed

+121
-94
lines changed

build/amd/hilo-amd.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
15371537
renderType:'webgl',
15381538
gl:null,
15391539
_isContextLost:false,
1540+
_cacheTexture:{},
15401541
constructor: function(properties){
15411542
WebGLRenderer.superclass.constructor.call(this, properties);
15421543
var that = this;
@@ -1569,7 +1570,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
15691570

15701571
this.canvas.addEventListener('webglcontextrestored', function(e){
15711572
that._isContextLost = false;
1572-
_cacheTexture = {};
15731573
that.setupWebGLStateAndResource();
15741574
}, false);
15751575

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

1586+
this._cacheTexture = {};
15861587
this._initShaders();
15871588
this.defaultShader.active();
15881589

@@ -1729,7 +1730,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
17291730
target.updateViewport();
17301731
}
17311732
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
1732-
}else{
1733+
}
1734+
else if(target.parent){
17331735
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
17341736
this._setConcatenatedMatrix(target, target.parent);
17351737
}
@@ -1917,7 +1919,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
19171919
},
19181920
_getTexture:function(sprite){
19191921
var image = sprite.__textureImage;
1920-
var texture = _cacheTexture[image.src];
1922+
var texture = this._cacheTexture[image.src];
19211923
if(!texture){
19221924
texture = this.activeShader.uploadTexture(image);
19231925
}
@@ -1936,7 +1938,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
19361938
* @param {Array} attr.attributes attribute数组
19371939
* @param {Array} attr.uniforms uniform数组
19381940
*/
1939-
var _cacheTexture = {};
19401941
var Shader = function(renderer, source, attr){
19411942
this.renderer = renderer;
19421943
this.gl = renderer.gl;
@@ -1993,7 +1994,7 @@ Shader.prototype = {
19931994
gl.uniform1i(u_Sampler, 0);
19941995
gl.bindTexture(gl.TEXTURE_2D, null);
19951996

1996-
_cacheTexture[image.src] = texture;
1997+
this.renderer._cacheTexture[image.src] = texture;
19971998
return texture;
19981999
},
19992000
_createProgram:function(gl, vshader, fshader){
@@ -7427,7 +7428,7 @@ var ParticleSystem = (function(){
74277428
onUpdate: function(dt) {
74287429
dt *= .001;
74297430
if(this._died){
7430-
return;
7431+
return false;
74317432
}
74327433
var ax = this.ax + this.system.gx;
74337434
var ay = this.ay + this.system.gy;
@@ -7447,8 +7448,9 @@ var ParticleSystem = (function(){
74477448
this.scaleX = this.scaleY = this.scale;
74487449

74497450
this._time += dt;
7450-
if (this._time >= this.life || this.alpha < 0) {
7451+
if (this._time >= this.life || this.alpha <= 0) {
74517452
this.destroy();
7453+
return false;
74527454
}
74537455
},
74547456
/**
@@ -7469,7 +7471,8 @@ var ParticleSystem = (function(){
74697471
* Destroy the particle.
74707472
*/
74717473
destroy: function() {
7472-
this.died = true;
7474+
this._died = true;
7475+
this.alpha = 0;
74737476
this.removeFromParent();
74747477
diedParticles.push(this);
74757478
},

build/amd/hilo-amd.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/amd/hilo-amd.zip

76 Bytes
Binary file not shown.

build/amd/hilo/game/ParticleSystem.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ var ParticleSystem = (function(){
196196
onUpdate: function(dt) {
197197
dt *= .001;
198198
if(this._died){
199-
return;
199+
return false;
200200
}
201201
var ax = this.ax + this.system.gx;
202202
var ay = this.ay + this.system.gy;
@@ -216,8 +216,9 @@ var ParticleSystem = (function(){
216216
this.scaleX = this.scaleY = this.scale;
217217

218218
this._time += dt;
219-
if (this._time >= this.life || this.alpha < 0) {
219+
if (this._time >= this.life || this.alpha <= 0) {
220220
this.destroy();
221+
return false;
221222
}
222223
},
223224
/**
@@ -238,7 +239,8 @@ var ParticleSystem = (function(){
238239
* Destroy the particle.
239240
*/
240241
destroy: function() {
241-
this.died = true;
242+
this._died = true;
243+
this.alpha = 0;
242244
this.removeFromParent();
243245
diedParticles.push(this);
244246
},

build/amd/hilo/game/ParticleSystem.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/amd/hilo/renderer/WebGLRenderer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
6060
renderType:'webgl',
6161
gl:null,
6262
_isContextLost:false,
63+
_cacheTexture:{},
6364
constructor: function(properties){
6465
WebGLRenderer.superclass.constructor.call(this, properties);
6566
var that = this;
@@ -92,7 +93,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
9293

9394
this.canvas.addEventListener('webglcontextrestored', function(e){
9495
that._isContextLost = false;
95-
_cacheTexture = {};
9696
that.setupWebGLStateAndResource();
9797
}, false);
9898

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

109+
this._cacheTexture = {};
109110
this._initShaders();
110111
this.defaultShader.active();
111112

@@ -252,7 +253,8 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
252253
target.updateViewport();
253254
}
254255
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
255-
}else{
256+
}
257+
else if(target.parent){
256258
target.__webglWorldMatrix = target.__webglWorldMatrix||new Matrix(1, 0, 0, 1, 0, 0);
257259
this._setConcatenatedMatrix(target, target.parent);
258260
}
@@ -440,7 +442,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
440442
},
441443
_getTexture:function(sprite){
442444
var image = sprite.__textureImage;
443-
var texture = _cacheTexture[image.src];
445+
var texture = this._cacheTexture[image.src];
444446
if(!texture){
445447
texture = this.activeShader.uploadTexture(image);
446448
}
@@ -459,7 +461,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{
459461
* @param {Array} attr.attributes attribute数组
460462
* @param {Array} attr.uniforms uniform数组
461463
*/
462-
var _cacheTexture = {};
463464
var Shader = function(renderer, source, attr){
464465
this.renderer = renderer;
465466
this.gl = renderer.gl;
@@ -516,7 +517,7 @@ Shader.prototype = {
516517
gl.uniform1i(u_Sampler, 0);
517518
gl.bindTexture(gl.TEXTURE_2D, null);
518519

519-
_cacheTexture[image.src] = texture;
520+
this.renderer._cacheTexture[image.src] = texture;
520521
return texture;
521522
},
522523
_createProgram:function(gl, vshader, fshader){

0 commit comments

Comments
 (0)