Merge branch 'master' into native-modular

This commit is contained in:
2youyouo2
2017-09-18 13:59:42 +08:00
21 changed files with 589 additions and 693 deletions
-4
View File
@@ -696,10 +696,6 @@ var game = {
cc.renderer = cc.rendererWebGL;
win.gl = this._renderContext; // global variable declared in CCMacro.js
cc.renderer.init();
cc.textureCache._initializingRenderer();
cc.glExt = {};
cc.glExt.instanced_arrays = win.gl.getExtension("ANGLE_instanced_arrays");
cc.glExt.element_uint = win.gl.getExtension("OES_element_index_uint");
} else {
cc._renderType = game.RENDER_TYPE_CANVAS;
cc.renderer = cc.rendererCanvas;
+1 -1
View File
@@ -1234,7 +1234,7 @@ _ccsg.Label = _ccsg.Node.extend({
var createLabelSprites = function () {
var texture = spriteFrame.getTexture();
self._textureLoaded = texture.isLoaded();
self._textureLoaded = texture.loaded;
self._createSpriteBatchNode(texture);
self.emit("load");
};
@@ -445,9 +445,9 @@
}
}
this._texture._textureLoaded = false;
// Hack. because we delete _htmlElementObj after usage in WEBGL mode
this._texture._htmlElementObj = this._labelCanvas;
this._texture.loaded = false;
// Hack. because we delete _image after usage in WEBGL mode
this._texture._image = this._labelCanvas;
this._texture.handleLoadedTexture(true);
};
@@ -545,7 +545,7 @@
sw = textureWidth;
sh = textureHeight;
var image = this._texture._htmlElementObj;
var image = this._texture._image;
if (this._texture._pattern !== '') {
wrapper.setFillStyle(context.createPattern(image, this._texture._pattern));
context.fillRect(x, y, w, h);
+19
View File
@@ -134,6 +134,9 @@ cc.rendererWebGL = {
var gl = cc._renderContext;
gl.disable(gl.CULL_FACE);
gl.disable(gl.DEPTH_TEST);
this._initExtensions([
'OES_element_index_uint'
]);
this.mat4Identity = new cc.math.Matrix4();
this.mat4Identity.identity();
@@ -143,6 +146,22 @@ cc.rendererWebGL = {
}
},
_initExtensions: function (extensions) {
this._extensions = this._extensions || {};
for (var i = 0; i < extensions.length; ++i) {
var name = extensions[i];
try {
var ext = gl.getExtension(name);
if (ext) {
this._extensions[name] = ext;
}
} catch (e) {
cc.error(e);
}
}
},
getVertexSize: function () {
return _maxVertexSize;
},
+2 -2
View File
@@ -516,7 +516,7 @@ _ccsg.Sprite = _ccsg.Node.extend({
_t._offsetPosition.x = 0;
_t._offsetPosition.y = 0;
var locTextureLoaded = texture.isLoaded();
var locTextureLoaded = texture.loaded;
_t._textureLoaded = locTextureLoaded;
if (!locTextureLoaded) {
@@ -671,7 +671,7 @@ _ccsg.Sprite = _ccsg.Node.extend({
if(isFileName)
texture = cc.textureCache.addImage(texture);
if(texture._textureLoaded){
if(texture.loaded){
this._setTexture(texture, isFileName);
this.setColor(this._realColor);
this._textureLoaded = true;
@@ -48,7 +48,7 @@ proto.setDirtyRecursively = function (value) {};
proto._setTexture = function (texture) {
var node = this._node;
if (node._texture !== texture) {
node._textureLoaded = texture ? texture._textureLoaded : false;
node._textureLoaded = texture ? texture.loaded : false;
node._texture = texture;
var texSize = texture._contentSize;
var rect = cc.rect(0, 0, texSize.width, texSize.height);
@@ -102,7 +102,7 @@ proto.rendering = function (ctx, scaleX, scaleY) {
var texture = this._textureToRender || node._texture;
if ((texture && (locTextureCoord.width === 0 || locTextureCoord.height === 0|| !texture._textureLoaded)) || alpha === 0)
if ((texture && (locTextureCoord.width === 0 || locTextureCoord.height === 0|| !texture.loaded)) || alpha === 0)
return;
var wrapper = ctx || cc._renderContext, context = wrapper.getContext();
@@ -140,8 +140,8 @@ proto.rendering = function (ctx, scaleX, scaleY) {
w = locWidth;
h = locHeight;
if (texture&& texture._htmlElementObj) {
image = texture._htmlElementObj;
if (texture&& texture._image) {
image = texture._image;
if (texture._pattern !== "") {
wrapper.setFillStyle(context.createPattern(image, texture._pattern));
context.fillRect(x, y, w, h);
@@ -184,7 +184,7 @@ proto._updateForSetSpriteFrame = function (pNewTexture, textureLoaded){
this._colorized = false;
this._textureCoord.renderX = this._textureCoord.x;
this._textureCoord.renderY = this._textureCoord.y;
textureLoaded = textureLoaded || pNewTexture._textureLoaded;
textureLoaded = textureLoaded || pNewTexture.loaded;
if (textureLoaded) {
var curColor = this._node.getColor();
if (curColor.r !== 255 || curColor.g !== 255 || curColor.b !== 255)
@@ -68,7 +68,7 @@ proto._handleTextureForRotatedTexture = function (texture) {
proto.isFrameDisplayed = function (frame) {
var node = this._node;
return (cc.rectEqualToRect(frame.getRect(), node._rect) && frame.getTexture().getName() === node._texture.getName()
return (cc.rectEqualToRect(frame.getRect(), node._rect) && frame.getTexture().url === node._texture.url
&& cc.pointEqualToPoint(frame.getOffset(), node._unflippedOffsetPositionFromCenter));
};
@@ -204,7 +204,7 @@ proto._setTexture = function (texture) {
var node = this._node;
if(node._texture !== texture){
node._textureLoaded = texture ? texture._textureLoaded : false;
node._textureLoaded = texture ? texture.loaded : false;
node._texture = texture;
this._updateBlendFunc();
@@ -260,7 +260,7 @@ proto.needDraw = function () {
proto.uploadData = function (f32buffer, ui32buffer, vertexDataOffset) {
var node = this._node, locTexture = node._texture;
if (!(locTexture && locTexture._textureLoaded && node._rect.width && node._rect.height) || !this._displayedOpacity)
if (!(locTexture && locTexture.loaded && node._rect.width && node._rect.height) || !this._displayedOpacity)
return 0;
// Fill in vertex data with quad information (4 vertices for sprite)
+10 -10
View File
@@ -169,8 +169,8 @@ var simpleQuadGenerator = {
_calculateUVs: function (sprite, spriteFrame) {
var uvs = sprite._uvs;
var atlasWidth = spriteFrame._texture._pixelWidth;
var atlasHeight = spriteFrame._texture._pixelHeight;
var atlasWidth = spriteFrame._texture.width;
var atlasHeight = spriteFrame._texture.height;
var textureRect = spriteFrame._rect;
if (uvs.length < 8) {
@@ -291,8 +291,8 @@ var scale9QuadGenerator = {
_calculateUVs: function (sprite, spriteFrame, insetLeft, insetRight, insetTop, insetBottom) {
var uvs = sprite._uvs;
var rect = spriteFrame._rect;
var atlasWidth = spriteFrame._texture._pixelWidth;
var atlasHeight = spriteFrame._texture._pixelHeight;
var atlasWidth = spriteFrame._texture.width;
var atlasHeight = spriteFrame._texture.height;
//caculate texture coordinate
var leftWidth, centerWidth, rightWidth;
@@ -369,8 +369,8 @@ var tiledQuadGenerator = {
wt = sprite._renderCmd._worldTransform,
uvs = sprite._uvs;
//build uvs
var atlasWidth = spriteFrame._texture._pixelWidth;
var atlasHeight = spriteFrame._texture._pixelHeight;
var atlasWidth = spriteFrame._texture.width;
var atlasHeight = spriteFrame._texture.height;
var textureRect = spriteFrame._rect;
//uv computation should take spritesheet into account.
@@ -509,8 +509,8 @@ var fillQuadGeneratorBar = {
var l = 0, b = 0,
r = contentSize.width, t = contentSize.height;
//build uvs
var atlasWidth = spriteFrame._texture._pixelWidth;
var atlasHeight = spriteFrame._texture._pixelHeight;
var atlasWidth = spriteFrame._texture.width;
var atlasHeight = spriteFrame._texture.height;
var textureRect = spriteFrame._rect;
//uv computation should take spritesheet into account.
var ul, vb, ur, vt;
@@ -968,8 +968,8 @@ var fillQuadGeneratorRadial = {
},
_calculateUVs : function (spriteFrame) {
var atlasWidth = spriteFrame._texture._pixelWidth;
var atlasHeight = spriteFrame._texture._pixelHeight;
var atlasWidth = spriteFrame._texture.width;
var atlasHeight = spriteFrame._texture.height;
var textureRect = spriteFrame._rect;
//uv computation should take spritesheet into account.
@@ -97,9 +97,9 @@ proto.rendering = function (ctx, scaleX, scaleY) {
}
var sx,sy,sw,sh;
var x, y, w,h;
var textureWidth = this._textureToRender._pixelWidth;
var textureHeight = this._textureToRender._pixelHeight;
var image = this._textureToRender._htmlElementObj;
var textureWidth = this._textureToRender.width;
var textureHeight = this._textureToRender.height;
var image = this._textureToRender._image;
var vertices = node._vertices;
var uvs = node._uvs;
var i = 0, off = 0;
+1 -1
View File
@@ -185,7 +185,7 @@ cc.SpriteBatchNode = _ccsg.Node.extend(/** @lends cc.SpriteBatchNode# */{
setTexture: function(texture){
this._texture = texture;
if (texture._textureLoaded) {
if (texture.loaded) {
var children = this._children, i, len = children.length;
for (i = 0; i < len; ++i) {
children[i].setTexture(texture);
+1 -1
View File
@@ -264,7 +264,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{
_refreshTexture: function (texture) {
var self = this;
if (self._texture !== texture) {
var locLoaded = texture.isLoaded();
var locLoaded = texture.loaded;
this._textureLoaded = locLoaded;
this._texture = texture;
function textureLoadedCallback () {
File diff suppressed because it is too large Load Diff
+1 -52
View File
@@ -36,22 +36,8 @@ var textureCache = /** @lends cc.textureCache# */{
_textureColorsCache: {},
_textureKeySeq: (0 | Math.random() * 1000),
_loadedTexturesBefore: {},
handleLoadedTexture: null,
_initializingRenderer: function () {
var selPath;
//init texture from _loadedTexturesBefore
var locLoadedTexturesBefore = this._loadedTexturesBefore, locTextures = this._textures;
for (selPath in locLoadedTexturesBefore) {
var tex2d = locLoadedTexturesBefore[selPath];
tex2d.handleLoadedTexture();
locTextures[selPath] = tex2d;
}
this._loadedTexturesBefore = {};
},
/**
* Description
* @method description
@@ -111,7 +97,7 @@ var textureCache = /** @lends cc.textureCache# */{
* @example {@link utils/api/engine/docs/cocos2d/core/textures/getTextureColors.js}
*/
getTextureColors: function (texture) {
var image = texture._htmlElementObj;
var image = texture._image;
var key = this.getKeyByTexture(image);
if (!key) {
if (image instanceof HTMLImageElement)
@@ -228,34 +214,6 @@ var textureCache = /** @lends cc.textureCache# */{
this._textures[path] = texture2d;
},
/**
* <p>Returns a Texture2D object given an UIImage image<br />
* If the image was not previously loaded, it will create a new Texture2D object and it will return it.<br />
* Otherwise it will return a reference of a previously loaded image<br />
* The "key" parameter will be used as the "key" for the cache.<br />
* If "key" is null, then a new texture will be created each time.</p>
* @method addUIImage
* @param {HTMLImageElement|HTMLCanvasElement} image
* @param {String} key
* @return {Texture2D}
*/
addUIImage: function (image, key) {
cc.assertID(image, 3008);
if (key && this._textures[key]) {
return this._textures[key];
}
// prevents overloading the autorelease pool
var texture = new Texture2D();
texture.initWithImage(image);
if (key != null)
this._textures[key] = texture;
else
cc.logID(3004);
return texture;
},
/**
* <p>Output to cc.log the current contents of this TextureCache <br />
* This will attempt to calculate the size of each texture, and the total texture memory in use. </p>
@@ -293,7 +251,6 @@ var textureCache = /** @lends cc.textureCache# */{
this._textures = {};
this._textureColorsCache = {};
this._textureKeySeq = (0 | Math.random() * 1000);
this._loadedTexturesBefore = {};
}
};
@@ -354,10 +311,6 @@ game.once(game.EVENT_RENDERER_INITED, function () {
_p.handleLoadedTexture = function (url) {
var locTexs = this._textures, tex, premultiplied;
//remove judge(webgl)
if (!cc.game._rendererInitialized) {
locTexs = this._loadedTexturesBefore;
}
tex = locTexs[url];
if (!tex) {
cc.assertID(url, 3009);
@@ -372,10 +325,6 @@ game.once(game.EVENT_RENDERER_INITED, function () {
cc.assertID(url, 3112);
var locTexs = this._textures;
//remove judge(webgl)
if (!cc.game._rendererInitialized) {
locTexs = this._loadedTexturesBefore;
}
var tex = locTexs[url];
if (tex) {
if(tex.isLoaded()) {
+1 -1
View File
@@ -970,7 +970,7 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
if(!texture)
return;
if(texture.isLoaded()){
if(texture.loaded){
this.setTextureWithRect(texture, cc.rect(0, 0, texture.width, texture.height));
} else {
this._textureLoaded = false;
@@ -91,7 +91,7 @@ proto.rendering = function (ctx, scaleX, scaleY) {
var particleCount = this._node.particleCount, particles = this._node._particles;
if (node._texture) {
// Delay drawing until the texture is fully loaded by the browser
if (!node._texture._textureLoaded) {
if (!node._texture.loaded) {
wrapper.restore();
return;
}
+2 -2
View File
@@ -80,11 +80,11 @@ cc.RenderTexture = _ccsg.Node.extend(/** @lends cc.RenderTexture# */{
_ccsg.Node.prototype.ctor.call(this);
this._cascadeColorEnabled = true;
this._cascadeOpacityEnabled = true;
this._pixelFormat = cc.Texture2D.PIXEL_FORMAT_RGBA8888;
this._pixelFormat = cc.Texture2D.PixelFormat.RGBA8888;
this._clearColor = new cc.Color(0, 0, 0, 255);
if (width !== undefined && height !== undefined) {
format = format || cc.Texture2D.PIXEL_FORMAT_RGBA8888;
format = format || cc.Texture2D.PixelFormat.RGBA8888;
depthStencilFormat = depthStencilFormat || 0;
this.initWithWidthAndHeight(width, height, format, depthStencilFormat);
}
@@ -135,7 +135,7 @@ proto.updateClearColor = function(clearColor){ };
proto.initWithWidthAndHeight = function(width, height, format, depthStencilFormat){
var node = this._node;
if(format === cc.Texture2D.PIXEL_FORMAT_A8)
if(format === cc.Texture2D.PixelFormat.A8)
cc.log( "cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");
var gl = cc._renderContext;
@@ -188,7 +188,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
gl.bindFramebuffer(gl.FRAMEBUFFER, this._fBO);
// associate texture with FBO
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, locTexture._webTextureObj, 0);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, locTexture._glID, 0);
if (depthStencilFormat !== 0) {
//create and attach depth buffer
@@ -237,12 +237,10 @@ proto.begin = function(){
var director = cc.director;
director.setProjection(director.getProjection());
var texSize = node._texture.getContentSizeInPixels();
// Calculate the adjustment ratios based on the old and new projections
var size = cc.director.getWinSizeInPixels();
var widthRatio = size.width / texSize.width;
var heightRatio = size.height / texSize.height;
var widthRatio = size.width / node._texture.width;
var heightRatio = size.height / node._texture.height;
var orthoMatrix = cc.math.Matrix4.createOrthographicProjection(-1.0 / widthRatio, 1.0 / widthRatio,
-1.0 / heightRatio, 1.0 / heightRatio, -1, 1);
@@ -268,10 +266,10 @@ proto.begin = function(){
*/
if (cc.configuration.checkForGLExtension("GL_QCOM")) {
// -- bind a temporary texture so we can clear the render buffer without losing our texture
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._textureCopy._webTextureObj, 0);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._textureCopy._glID, 0);
//cc.checkGLErrorDebug();
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, node._texture._webTextureObj, 0);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, node._texture._glID, 0);
}
};
+19 -19
View File
@@ -175,10 +175,10 @@ cc.gl.setProjectionMatrixDirty = function () {
* If the texture is not already bound, it binds it.<br/>
* If cc.macro.ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
* @function
* @param {Texture2D} textureId
* @param {Texture2D} texture
*/
cc.gl.bindTexture2D = function (textureId) {
cc.gl.bindTexture2DN(0, textureId);
cc.gl.bindTexture2D = function (texture) {
cc.gl.bindTexture2DN(0, texture);
};
/**
@@ -186,24 +186,24 @@ cc.gl.bindTexture2D = function (textureId) {
* If cc.macro.ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
* @function
* @param {Number} textureUnit
* @param {Texture2D} textureId
* @param {Texture2D} texture
*/
cc.gl.bindTexture2DN = ENABLE_GL_STATE_CACHE ? function (textureUnit, textureId) {
if (_currentBoundTexture[textureUnit] === textureId)
cc.gl.bindTexture2DN = ENABLE_GL_STATE_CACHE ? function (textureUnit, texture) {
if (_currentBoundTexture[textureUnit] === texture)
return;
_currentBoundTexture[textureUnit] = textureId;
_currentBoundTexture[textureUnit] = texture;
var ctx = cc._renderContext;
ctx.activeTexture(ctx.TEXTURE0 + textureUnit);
if(textureId)
ctx.bindTexture(ctx.TEXTURE_2D, textureId._webTextureObj);
if(texture)
ctx.bindTexture(ctx.TEXTURE_2D, texture._glID);
else
ctx.bindTexture(ctx.TEXTURE_2D, null);
} : function (textureUnit, textureId) {
} : function (textureUnit, texture) {
var ctx = cc._renderContext;
ctx.activeTexture(ctx.TEXTURE0 + textureUnit);
if(textureId)
ctx.bindTexture(ctx.TEXTURE_2D, textureId._webTextureObj);
if(texture)
ctx.bindTexture(ctx.TEXTURE_2D, texture._glID);
else
ctx.bindTexture(ctx.TEXTURE_2D, null);
};
@@ -212,10 +212,10 @@ cc.gl.bindTexture2DN = ENABLE_GL_STATE_CACHE ? function (textureUnit, textureId)
* It will delete a given texture. If the texture was bound, it will invalidate the cached. <br/>
* If cc.macro.ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
* @function
* @param {Texture2D} textureId
* @param {Texture2D} texture
*/
cc.gl.deleteTexture2D = function (textureId) {
cc.gl.deleteTexture2DN(0, textureId);
cc.gl.deleteTexture2D = function (texture) {
cc.gl.deleteTexture2DN(0, texture);
};
/**
@@ -223,14 +223,14 @@ cc.gl.deleteTexture2D = function (textureId) {
* If cc.macro.ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
* @function
* @param {Number} textureUnit
* @param {Texture2D} textureId
* @param {Texture2D} texture
*/
cc.gl.deleteTexture2DN = function (textureUnit, textureId) {
cc.gl.deleteTexture2DN = function (textureUnit, texture) {
if (ENABLE_GL_STATE_CACHE) {
if (textureId === _currentBoundTexture[ textureUnit ])
if (texture === _currentBoundTexture[ textureUnit ])
_currentBoundTexture[ textureUnit ] = -1;
}
cc._renderContext.deleteTexture(textureId._webTextureObj);
cc._renderContext.deleteTexture(texture._glID);
};
/**
+2 -2
View File
@@ -148,7 +148,7 @@ proto.rendering = function (ctx, scaleX, scaleY) {
continue;
}
tex = node._textures[grid.texId];
if (!tex || !tex._htmlElementObj) {
if (!tex || !tex._image) {
continue;
}
@@ -205,7 +205,7 @@ proto.rendering = function (ctx, scaleX, scaleY) {
context.scale(1, -1);
}
context.drawImage(tex._htmlElementObj,
context.drawImage(tex._image,
grid.x, grid.y, grid.width, grid.height,
left, top, dw, dh);
// Revert flip
+18 -16
View File
@@ -54,21 +54,10 @@ gulp.task('build-html5', ['build-html5-preview', 'build-html5-dev', 'build-html5
var jsbSkipModules = [
'../../cocos2d/core/CCGame',
'../../cocos2d/core/CCDrawingPrimitives.js',
'../../cocos2d/core/textures/CCTexture2D',
'../../cocos2d/core/sprites/CCSpriteFrame',
'../../cocos2d/core/load-pipeline/audio-downloader',
'../../cocos2d/audio/CCAudio',
'../../extensions/spine/SGSkeleton',
'../../extensions/spine/SGSkeletonAnimation',
'../../extensions/spine/SGSkeletonCanvasRenderCmd',
'../../extensions/spine/SGSkeletonWebGLRenderCmd',
'../../extensions/spine/lib/spine',
'../../extensions/dragonbones/lib/dragonBones',
'../../extensions/dragonbones/CCFactory',
'../../extensions/dragonbones/CCArmatureDisplay',
'../../extensions/dragonbones/CCSlot',
'../../extensions/dragonbones/CCTextureData',
'../../external/box2d/box2d.js',
'../../cocos2d/core/physics/platform/CCPhysicsDebugDraw.js',
'../../cocos2d/core/physics/platform/CCPhysicsUtils.js',
'../../cocos2d/core/physics/platform/CCPhysicsAABBQueryCallback.js',
@@ -78,12 +67,14 @@ var jsbSkipModules = [
'../../cocos2d/core/label/CCSGLabel.js',
'../../cocos2d/core/label/CCSGLabelCanvasRenderCmd.js',
'../../cocos2d/core/label/CCSGLabelWebGLRenderCmd.js',
'../../cocos2d/clipping-nodes/CCClippingNode.js',
'../../cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js',
'../../cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js',
'../../cocos2d/core/videoplayer/CCSGVideoPlayer.js',
'../../cocos2d/core/webview/CCSGWebView.js',
'../../cocos2d/core/editbox/CCSGEditBox.js',
'../../cocos2d/audio/CCAudio',
'../../cocos2d/shape-nodes/CCDrawNode.js',
'../../cocos2d/clipping-nodes/CCClippingNode.js',
'../../cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js',
'../../cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js',
'../../cocos2d/particle/CCSGParticleSystem.js',
'../../cocos2d/particle/CCSGParticleSystemCanvasRenderCmd.js',
'../../cocos2d/particle/CCSGParticleSystemWebGLRenderCmd.js',
@@ -98,7 +89,18 @@ var jsbSkipModules = [
'../../cocos2d/motion-streak/CCSGMotionStreakWebGLRenderCmd.js',
'../../cocos2d/render-texture/CCRenderTexture.js',
'../../cocos2d/render-texture/CCRenderTextureCanvasRenderCmd.js',
'../../cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js'
'../../cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js',
'../../extensions/spine/SGSkeleton',
'../../extensions/spine/SGSkeletonAnimation',
'../../extensions/spine/SGSkeletonCanvasRenderCmd',
'../../extensions/spine/SGSkeletonWebGLRenderCmd',
'../../extensions/spine/lib/spine',
'../../extensions/dragonbones/lib/dragonBones',
'../../extensions/dragonbones/CCFactory',
'../../extensions/dragonbones/CCArmatureDisplay',
'../../extensions/dragonbones/CCSlot',
'../../extensions/dragonbones/CCTextureData',
'../../external/box2d/box2d.js',
];
gulp.task('build-jsb-dev', function (done) {
+57 -3
View File
@@ -91,14 +91,68 @@ cc.textureCache.removeTextureForKey = function (key) {
cc.Class._fastDefine('cc.Texture2D', cc.Texture2D, []);
cc.js.value(cc.Texture2D, '$super', cc.RawAsset); // not inheritable in JSB and TypeScript
const GL_NEAREST = 9728; // gl.NEAREST
const GL_LINEAR = 9729; // gl.LINEAR
const GL_REPEAT = 10497; // gl.REPEAT
const GL_CLAMP_TO_EDGE = 33071; // gl.CLAMP_TO_EDGE
const GL_MIRRORED_REPEAT = 33648; // gl.MIRRORED_REPEAT
cc.Texture2D.PixelFormat = cc.Enum({
RGB565: cc.Texture2D.PIXEL_FORMAT_RGB565,
RGB5A1: cc.Texture2D.PIXEL_FORMAT_RGB5A1,
RGBA4444: cc.Texture2D.PIXEL_FORMAT_RGBA4444,
RGB888: cc.Texture2D.PIXEL_FORMAT_RGB888,
RGBA8888: cc.Texture2D.PIXEL_FORMAT_RGBA8888,
A8: cc.Texture2D.PIXEL_FORMAT_A8,
I8: cc.Texture2D.PIXEL_FORMAT_I8,
AI8: cc.Texture2D.PIXEL_FORMAT_AI8
});
cc.Texture2D.WrapMode = cc.Enum({
REPEAT: 0x2901,
CLAMP_TO_EDGE: 0x812f,
MIRRORED_REPEAT: 0x8370
REPEAT: GL_REPEAT,
CLAMP_TO_EDGE: GL_CLAMP_TO_EDGE,
MIRRORED_REPEAT: GL_MIRRORED_REPEAT
});
cc.Texture2D.Filter = cc.Enum({
LINEAR: GL_LINEAR,
NEAREST: GL_NEAREST
});
var prototype = cc.Texture2D.prototype;
prototype.loaded = true;
prototype.update = function (options) {
var updateTexParam = false;
var genMipmap = false;
if (options) {
if (options.minFilter !== undefined) {
this._minFilter = options.minFilter;
updateTexParam = true;
}
if (options.magFilter !== undefined) {
this._magFilter = options.magFilter;
updateTexParam = true;
}
if (options.wrapS !== undefined) {
this._wrapS = options.wrapS;
updateTexParam = true;
}
if (options.wrapT !== undefined) {
this._wrapT = options.wrapT;
updateTexParam = true;
}
if (options.mipmap !== undefined) {
genMipmap = this._hasMipmap = options.mipmap;
}
}
if (updateTexParam) {
this.setTexParameters(options);
}
if (genMipmap) {
this.generateMipmap();
}
}
prototype.isLoaded = function () {
return true;
};