mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 11:31:59 +08:00
remove unused ParticleSystem’s shape mode on canvas
This commit is contained in:
@@ -166,7 +166,6 @@ cc.Particle.TemporaryPoints = [
|
||||
*
|
||||
* @property {Boolean} opacityModifyRGB - Indicate whether the alpha value modify color.
|
||||
* @property {Boolean} active - <@readonly> Indicate whether the particle system is activated.
|
||||
* @property {Number} shapeType - ShapeType of ParticleSystem : ccsg.ParticleSystem.BALL_SHAPE | ccsg.ParticleSystem.STAR_SHAPE.
|
||||
* @property {Number} atlasIndex - Index of system in batch node array.
|
||||
* @property {Number} particleCount - Current quantity of particles that are being simulated.
|
||||
* @property {Number} duration - How many seconds the emitter wil run. -1 means 'forever'
|
||||
@@ -337,7 +336,6 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
|
||||
|
||||
if (!plistFile || cc.js.isNumber(plistFile)) {
|
||||
var ton = plistFile || 100;
|
||||
this.setDrawMode(_ccsg.ParticleSystem.TEXTURE_MODE);
|
||||
this.initWithTotalParticles(ton);
|
||||
} else if (typeof plistFile === 'string') {
|
||||
this.initWithFile(plistFile);
|
||||
@@ -388,38 +386,6 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
|
||||
this.atlasIndex = atlasIndex;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return DrawMode of ParticleSystem (Canvas Mode only)
|
||||
* @return {Number}
|
||||
*/
|
||||
getDrawMode:function () {
|
||||
return this._renderCmd.getDrawMode();
|
||||
},
|
||||
|
||||
/**
|
||||
* DrawMode of ParticleSystem setter (Canvas Mode only)
|
||||
* @param {Number} drawMode
|
||||
*/
|
||||
setDrawMode:function (drawMode) {
|
||||
this._renderCmd.setDrawMode(drawMode);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return ShapeType of ParticleSystem (Canvas Mode only)
|
||||
* @return {Number}
|
||||
*/
|
||||
getShapeType:function () {
|
||||
return this._renderCmd.getShapeType();
|
||||
},
|
||||
|
||||
/**
|
||||
* ShapeType of ParticleSystem setter (Canvas Mode only)
|
||||
* @param {Number} shapeType
|
||||
*/
|
||||
setShapeType:function (shapeType) {
|
||||
this._renderCmd.setShapeType(shapeType);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return ParticleSystem is active
|
||||
* @return {Boolean}
|
||||
@@ -1928,12 +1894,6 @@ var _p = _ccsg.ParticleSystem.prototype;
|
||||
_p.opacityModifyRGB;
|
||||
cc.defineGetterSetter(_p, "opacityModifyRGB", _p.isOpacityModifyRGB, _p.setOpacityModifyRGB);
|
||||
/** @expose */
|
||||
_p.drawMode;
|
||||
cc.defineGetterSetter(_p, "drawMode", _p.getDrawMode, _p.setDrawMode);
|
||||
/** @expose */
|
||||
_p.shapeType;
|
||||
cc.defineGetterSetter(_p, "shapeType", _p.getShapeType, _p.setShapeType);
|
||||
/** @expose */
|
||||
_p.active;
|
||||
cc.defineGetterSetter(_p, "active", _p.isActive);
|
||||
/** @expose */
|
||||
@@ -2063,34 +2023,6 @@ _ccsg.ParticleSystem.ModeB = function (startRadius, startRadiusVar, endRadius, e
|
||||
this.rotatePerSecondVar = rotatePerSecondVar || 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Shape Mode of Particle Draw
|
||||
* @constant
|
||||
* @type Number
|
||||
*/
|
||||
_ccsg.ParticleSystem.SHAPE_MODE = 0;
|
||||
|
||||
/**
|
||||
* Texture Mode of Particle Draw
|
||||
* @constant
|
||||
* @type Number
|
||||
*/
|
||||
_ccsg.ParticleSystem.TEXTURE_MODE = 1;
|
||||
|
||||
/**
|
||||
* Star Shape for ShapeMode of Particle
|
||||
* @constant
|
||||
* @type Number
|
||||
*/
|
||||
_ccsg.ParticleSystem.STAR_SHAPE = 0;
|
||||
|
||||
/**
|
||||
* Ball Shape for ShapeMode of Particle
|
||||
* @constant
|
||||
* @type Number
|
||||
*/
|
||||
_ccsg.ParticleSystem.BALL_SHAPE = 1;
|
||||
|
||||
/**
|
||||
* The Particle emitter lives forever
|
||||
* @constant
|
||||
|
||||
@@ -29,9 +29,6 @@ _ccsg.ParticleSystem.CanvasRenderCmd = function(renderable){
|
||||
this._rootCtor(renderable);
|
||||
this._needDraw = true;
|
||||
|
||||
this._drawMode = _ccsg.ParticleSystem.TEXTURE_MODE;
|
||||
this._shapeType = _ccsg.ParticleSystem.BALL_SHAPE;
|
||||
|
||||
this._pointRect = cc.rect(0, 0, 0, 0);
|
||||
//region for local bb
|
||||
this._localRegion = new cc.Region();
|
||||
@@ -40,22 +37,6 @@ _ccsg.ParticleSystem.CanvasRenderCmd = function(renderable){
|
||||
var proto = _ccsg.ParticleSystem.CanvasRenderCmd.prototype = Object.create(_ccsg.Node.CanvasRenderCmd.prototype);
|
||||
proto.constructor = _ccsg.ParticleSystem.CanvasRenderCmd;
|
||||
|
||||
proto.getDrawMode = function(){
|
||||
return this._drawMode;
|
||||
};
|
||||
|
||||
proto.setDrawMode = function(drawMode){
|
||||
this._drawMode = drawMode;
|
||||
};
|
||||
|
||||
proto.getShapeType = function(){
|
||||
return this._shapeType;
|
||||
};
|
||||
|
||||
proto.setShapeType = function(shapeType){
|
||||
this._shapeType = shapeType;
|
||||
};
|
||||
|
||||
proto.updateQuadWithParticle = function (particle, newPosition) {
|
||||
//do nothing
|
||||
};
|
||||
@@ -108,7 +89,7 @@ proto.rendering = function (ctx, scaleX, scaleY) {
|
||||
|
||||
var i, particle, lpx, alpha;
|
||||
var particleCount = this._node.particleCount, particles = this._node._particles;
|
||||
if (node.drawMode !== _ccsg.ParticleSystem.SHAPE_MODE && node._texture) {
|
||||
if (node._texture) {
|
||||
// Delay drawing until the texture is fully loaded by the browser
|
||||
if (!node._texture._textureLoaded) {
|
||||
wrapper.restore();
|
||||
@@ -144,28 +125,9 @@ proto.rendering = function (ctx, scaleX, scaleY) {
|
||||
context.drawImage(drawElement, -(0 | (w / 2)), -(0 | (h / 2)));
|
||||
context.restore();
|
||||
}
|
||||
} else {
|
||||
var drawTool = cc._drawingUtil;
|
||||
for (i = 0; i < particleCount; i++) {
|
||||
particle = particles[i];
|
||||
lpx = (0 | (particle.size * 0.5));
|
||||
alpha = particle.color.a / 255;
|
||||
if (alpha === 0) continue;
|
||||
context.globalAlpha = alpha;
|
||||
|
||||
context.save();
|
||||
context.translate(0 | particle.drawPos.x, -(0 | particle.drawPos.y));
|
||||
if (node.shapeType === _ccsg.ParticleSystem.STAR_SHAPE) {
|
||||
if (particle.rotation)
|
||||
context.rotate(cc.degreesToRadians(particle.rotation));
|
||||
drawTool.drawStar(wrapper, lpx, particle.color);
|
||||
} else
|
||||
drawTool.drawColorBall(wrapper, lpx, particle.color);
|
||||
context.restore();
|
||||
}
|
||||
cc.g_NumberOfDraws++;
|
||||
}
|
||||
wrapper.restore();
|
||||
cc.g_NumberOfDraws++;
|
||||
};
|
||||
|
||||
proto._changeTextureColor = function (texture, color, rect) {
|
||||
|
||||
@@ -40,11 +40,6 @@ _ccsg.ParticleSystem.WebGLRenderCmd = function(renderable){
|
||||
var proto = _ccsg.ParticleSystem.WebGLRenderCmd.prototype = Object.create(_ccsg.Node.WebGLRenderCmd.prototype);
|
||||
proto.constructor = _ccsg.ParticleSystem.WebGLRenderCmd;
|
||||
|
||||
proto.getDrawMode = function(){};
|
||||
proto.setDrawMode = function(drawMode){};
|
||||
proto.getShapeType = function(){};
|
||||
proto.setShapeType = function(shapeType){};
|
||||
|
||||
proto.initIndices = function (totalParticles) {
|
||||
var locIndices = this._indices;
|
||||
for (var i = 0, len = totalParticles; i < len; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user