diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js index c139710f72..4581a54a5b 100644 --- a/cocos2d/core/CCDirector.js +++ b/cocos2d/core/CCDirector.js @@ -24,75 +24,8 @@ THE SOFTWARE. ****************************************************************************/ -//Possible OpenGL projections used by director -/** - * sets a 2D projection (orthogonal projection) - * @constant - * @type Number - */ -cc.DIRECTOR_PROJECTION_2D = 0; - cc.g_NumberOfDraws = 0; -/** - * sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500. - * @constant - * @type Number - */ -cc.DIRECTOR_PROJECTION_3D = 1; - -/** - * it calls "updateProjection" on the projection delegate. - * @constant - * @type Number - */ -cc.DIRECTOR_PROJECTION_CUSTOM = 3; - -/** - * Default projection is 3D projection - * @constant - * @type Number - */ -cc.DIRECTOR_PROJECTION_DEFAULT = cc.DIRECTOR_PROJECTION_3D; - -//---------------------------------------------------------------------------------------------------------------------- -//Possible device orientations -/** - * Device oriented vertically, home button on the bottom (UIDeviceOrientationPortrait) - * @constant - * @type Number - */ -cc.DEVICE_ORIENTATION_PORTRAIT = 0; - -/** - * Device oriented horizontally, home button on the right (UIDeviceOrientationLandscapeLeft) - * @constant - * @type Number - */ -cc.DEVICE_ORIENTATION_LANDSCAPE_LEFT = 1; - -/** - * Device oriented vertically, home button on the top (UIDeviceOrientationPortraitUpsideDown) - * @constant - * @type Number - */ -cc.DEVICE_ORIENTATION_PORTRAIT_UPSIDE_DOWN = 2; - -/** - * Device oriented horizontally, home button on the left (UIDeviceOrientationLandscapeRight) - * @constant - * @type Number - */ -cc.DEVICE_ORIENTATION_LANDSCAPE_RIGHT = 3; - -/** - * In browsers, we only support 2 orientations by change window size. - * @constant - * @type Number - */ -cc.DEVICE_MAX_ORIENTATIONS = 2; - - cc.GLToClipTransform = function (transformOut) { var projection = new cc.kmMat4(); cc.kmGLGetMatrix(cc.KM_GL_PROJECTION, projection); @@ -197,7 +130,7 @@ cc.Director = cc.Class.extend(/** @lends cc.director# */{ this._oldAnimationInterval = this._animationInterval = 1.0 / cc.defaultFPS; this._scenesStack = []; // Set default projection (3D) - this._projection = cc.DIRECTOR_PROJECTION_DEFAULT; + this._projection = cc.Director.PROJECTION_DEFAULT; // projection delegate if "Custom" projection is used this._projectionDelegate = null; @@ -872,6 +805,35 @@ cc.Director._getInstance = function () { */ cc.defaultFPS = 60; +//Possible OpenGL projections used by director +/** + * sets a 2D projection (orthogonal projection) + * @constant + * @type Number + */ +cc.Director.PROJECTION_2D = 0; + +/** + * sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500. + * @constant + * @type Number + */ +cc.Director.PROJECTION_3D = 1; + +/** + * it calls "updateProjection" on the projection delegate. + * @constant + * @type Number + */ +cc.Director.PROJECTION_CUSTOM = 3; + +/** + * Default projection is 3D projection + * @constant + * @type Number + */ +cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_3D; + if (cc._renderType === cc._RENDER_TYPE_CANVAS) { var _p = cc.Director.prototype; diff --git a/cocos2d/core/CCDirectorWebGL.js b/cocos2d/core/CCDirectorWebGL.js index f45a0194ca..5351a14ae5 100644 --- a/cocos2d/core/CCDirectorWebGL.js +++ b/cocos2d/core/CCDirectorWebGL.js @@ -49,7 +49,7 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) { _t.setViewport(); switch (projection) { - case cc.DIRECTOR_PROJECTION_2D: + case cc.Director.PROJECTION_2D: cc.kmGLMatrixMode(cc.KM_GL_PROJECTION); cc.kmGLLoadIdentity(); var orthoMatrix = new cc.kmMat4(); @@ -58,7 +58,7 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) { cc.kmGLMatrixMode(cc.KM_GL_MODELVIEW); cc.kmGLLoadIdentity(); break; - case cc.DIRECTOR_PROJECTION_3D: + case cc.Director.PROJECTION_3D: var zeye = _t.getZEye(); var matrixPerspective = new cc.kmMat4(), matrixLookup = new cc.kmMat4(); cc.kmGLMatrixMode(cc.KM_GL_PROJECTION); @@ -77,7 +77,7 @@ if (cc._renderType === cc._RENDER_TYPE_WEBGL) { cc.kmMat4LookAt(matrixLookup, eye, center, up); cc.kmGLMultMatrix(matrixLookup); break; - case cc.DIRECTOR_PROJECTION_CUSTOM: + case cc.Director.PROJECTION_CUSTOM: if (_t._projectionDelegate) _t._projectionDelegate.updateProjection(); break; diff --git a/cocos2d/core/base-nodes/BaseNodesWebGL.js b/cocos2d/core/base-nodes/BaseNodesWebGL.js index 5fcf177c15..6216f5cbbf 100644 --- a/cocos2d/core/base-nodes/BaseNodesWebGL.js +++ b/cocos2d/core/base-nodes/BaseNodesWebGL.js @@ -131,10 +131,14 @@ _tmp.WebGLCCNode = function () { if (_t._camera != null && !(_t.grid != null && _t.grid.isActive())) { var apx = _t._anchorPointInPoints.x, apy = _t._anchorPointInPoints.y; var translate = (apx !== 0.0 || apy !== 0.0); - if (translate) { - cc.kmGLTranslatef(cc.RENDER_IN_SUBPIXEL(apx), cc.RENDER_IN_SUBPIXEL(apy), 0); + if (translate){ + if(!cc.SPRITEBATCHNODE_RENDER_SUBPIXEL) { + apx = 0 | apx; + apy = 0 | apy; + } + cc.kmGLTranslatef(apx, apy, 0); _t._camera.locate(); - cc.kmGLTranslatef(cc.RENDER_IN_SUBPIXEL(-apx), cc.RENDER_IN_SUBPIXEL(-apy), 0); + cc.kmGLTranslatef(-apx, -apy, 0); } else { _t._camera.locate(); } diff --git a/cocos2d/core/platform/CCClass.js b/cocos2d/core/platform/CCClass.js index fa4c3e4a5f..fa61107aae 100644 --- a/cocos2d/core/platform/CCClass.js +++ b/cocos2d/core/platform/CCClass.js @@ -252,7 +252,12 @@ cc.defineGetterSetter = function (proto, prop, getter, setter, getterName, sette var hasGetter = (getter != null), hasSetter = (setter != undefined), props = Object.getOwnPropertyNames(proto); for (var i = 0; i < props.length; i++) { var name = props[i]; - if( proto.__lookupGetter__(name) || typeof proto[name] !== "function" ) continue; + + if( (Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(proto, name) + : proto.__lookupGetter__(name)) + || typeof proto[name] !== "function" ) + continue; + var func = proto[name]; if (hasGetter && func === getter) { getterName = name; diff --git a/cocos2d/core/platform/CCConfig.js b/cocos2d/core/platform/CCConfig.js index 8d63ca65a1..2b52726809 100644 --- a/cocos2d/core/platform/CCConfig.js +++ b/cocos2d/core/platform/CCConfig.js @@ -33,7 +33,7 @@ * @constant * @type String */ -cc.ENGINE_VERSION = "Cocos2d-html5-v3.0 alpha"; +cc.ENGINE_VERSION = "Cocos2d-html5-v3.0 alpha 2"; /** *
diff --git a/cocos2d/core/platform/CCMacro.js b/cocos2d/core/platform/CCMacro.js index ff68d5e53d..16a82fc979 100644 --- a/cocos2d/core/platform/CCMacro.js +++ b/cocos2d/core/platform/CCMacro.js @@ -414,3 +414,290 @@ cc.checkGLErrorDebug = function () { } } }; + +//Possible device orientations +/** + * Device oriented vertically, home button on the bottom (UIDeviceOrientationPortrait) + * @constant + * @type Number + */ +cc.DEVICE_ORIENTATION_PORTRAIT = 0; + +/** + * Device oriented horizontally, home button on the right (UIDeviceOrientationLandscapeLeft) + * @constant + * @type Number + */ +cc.DEVICE_ORIENTATION_LANDSCAPE_LEFT = 1; + +/** + * Device oriented vertically, home button on the top (UIDeviceOrientationPortraitUpsideDown) + * @constant + * @type Number + */ +cc.DEVICE_ORIENTATION_PORTRAIT_UPSIDE_DOWN = 2; + +/** + * Device oriented horizontally, home button on the left (UIDeviceOrientationLandscapeRight) + * @constant + * @type Number + */ +cc.DEVICE_ORIENTATION_LANDSCAPE_RIGHT = 3; + +/** + * In browsers, we only support 2 orientations by change window size. + * @constant + * @type Number + */ +cc.DEVICE_MAX_ORIENTATIONS = 2; + + +// ------------------- vertex attrib flags ----------------------------- +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_FLAG_NONE = 0; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_FLAG_POSITION = 1 << 0; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_FLAG_COLOR = 1 << 1; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_FLAG_TEX_COORDS = 1 << 2; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = ( cc.VERTEX_ATTRIB_FLAG_POSITION | cc.VERTEX_ATTRIB_FLAG_COLOR | cc.VERTEX_ATTRIB_FLAG_TEX_COORDS ); + +/** + * GL server side states + * @constant + * @type {Number} + */ +cc.GL_ALL = 0; + +//-------------Vertex Attributes----------- +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_POSITION = 0; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_COLOR = 1; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_TEX_COORDS = 2; +/** + * @constant + * @type {Number} + */ +cc.VERTEX_ATTRIB_MAX = 3; + +//------------Uniforms------------------ +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_PMATRIX = 0; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_MVMATRIX = 1; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_MVPMATRIX = 2; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_TIME = 3; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_SINTIME = 4; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_COSTIME = 5; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_RANDOM01 = 6; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_SAMPLER = 7; +/** + * @constant + * @type {Number} + */ +cc.UNIFORM_MAX = 8; + +//------------Shader Name--------------- +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_TEXTURECOLOR = "ShaderPositionTextureColor"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_TEXTURECOLORALPHATEST = "ShaderPositionTextureColorAlphaTest"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_COLOR = "ShaderPositionColor"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_TEXTURE = "ShaderPositionTexture"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_TEXTURE_UCOLOR = "ShaderPositionTexture_uColor"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_TEXTUREA8COLOR = "ShaderPositionTextureA8Color"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_UCOLOR = "ShaderPosition_uColor"; +/** + * @constant + * @type {String} + */ +cc.SHADER_POSITION_LENGTHTEXTURECOLOR = "ShaderPositionLengthTextureColor"; + +//------------uniform names---------------- +/** + * @constant + * @type {String} + */ +cc.UNIFORM_PMATRIX_S = "CC_PMatrix"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_MVMATRIX_S = "CC_MVMatrix"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_MVPMATRIX_S = "CC_MVPMatrix"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_TIME_S = "CC_Time"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_SINTIME_S = "CC_SinTime"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_COSTIME_S = "CC_CosTime"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_RANDOM01_S = "CC_Random01"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_SAMPLER_S = "CC_Texture0"; +/** + * @constant + * @type {String} + */ +cc.UNIFORM_ALPHA_TEST_VALUE_S = "CC_alpha_value"; + +//------------Attribute names-------------- +/** + * @constant + * @type {String} + */ +cc.ATTRIBUTE_NAME_COLOR = "a_color"; +/** + * @constant + * @type {String} + */ +cc.ATTRIBUTE_NAME_POSITION = "a_position"; +/** + * @constant + * @type {String} + */ +cc.ATTRIBUTE_NAME_TEX_COORD = "a_texCoord"; + + +/** + * default size for font size + * @constant + * @type Number + */ +cc.ITEM_SIZE = 32; + +/** + * default tag for current item + * @constant + * @type Number + */ +cc.CURRENT_ITEM = 0xc0c05001; +/** + * default tag for zoom action tag + * @constant + * @type Number + */ +cc.ZOOM_ACTION_TAG = 0xc0c05002; +/** + * default tag for normal + * @constant + * @type Number + */ +cc.NORMAL_TAG = 8801; + +/** + * default selected tag + * @constant + * @type Number + */ +cc.SELECTED_TAG = 8802; + +/** + * default disabled tag + * @constant + * @type Number + */ +cc.DISABLE_TAG = 8803; \ No newline at end of file diff --git a/cocos2d/core/sprites/CCSprite.js b/cocos2d/core/sprites/CCSprite.js index 2791d81674..9b3ee418ea 100644 --- a/cocos2d/core/sprites/CCSprite.js +++ b/cocos2d/core/sprites/CCSprite.js @@ -24,13 +24,6 @@ THE SOFTWARE. ****************************************************************************/ -/** - * cc.Sprite invalid index on the cc.SpriteBatchNode - * @constant - * @type Number - */ -cc.SPRITE_INDEX_NOT_INITIALIZED = -1; - /** * generate texture's cache for texture tint * @function @@ -224,15 +217,6 @@ cc.cutRotateImageToCanvas = function (texture, rect) { return nCanvas; }; -cc.RENDER_IN_SUBPIXEL = function (A) { - return (0 | A); -}; -if (cc.SPRITEBATCHNODE_RENDER_SUBPIXEL) { - cc.RENDER_IN_SUBPIXEL = function (A) { - return A; - }; -} - /** *
cc.Sprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) )
*
@@ -910,7 +894,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
// renders using Sprite Manager
if (this._batchNode) {
- if (this.atlasIndex != cc.SPRITE_INDEX_NOT_INITIALIZED) {
+ if (this.atlasIndex != cc.Sprite.INDEX_NOT_INITIALIZED) {
this.textureAtlas.updateQuad(locQuad, this.atlasIndex)
} else {
// no need to set it recursively
@@ -1158,6 +1142,14 @@ cc.Sprite.create = function (fileName, rect) {
};
+/**
+ * cc.Sprite invalid index on the cc.SpriteBatchNode
+ * @constant
+ * @type Number
+ */
+cc.Sprite.INDEX_NOT_INITIALIZED = -1;
+
+
if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
var _p = cc.Sprite.prototype;
@@ -1489,7 +1481,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
// self render
if (!_t._batchNode) {
- _t.atlasIndex = cc.SPRITE_INDEX_NOT_INITIALIZED;
+ _t.atlasIndex = cc.Sprite.INDEX_NOT_INITIALIZED;
_t.textureAtlas = null;
_t._recursiveDirty = false;
_t.dirty = false;
diff --git a/cocos2d/core/sprites/SpritesWebGL.js b/cocos2d/core/sprites/SpritesWebGL.js
index 08fa729048..57b12e09ef 100644
--- a/cocos2d/core/sprites/SpritesWebGL.js
+++ b/cocos2d/core/sprites/SpritesWebGL.js
@@ -303,10 +303,20 @@ _tmp.WebGLSprite = function () {
var dy = x1 * sr + y2 * cr2 + y;
var locVertexZ = _t._vertexZ;
- locQuad.bl.vertices = {x: cc.RENDER_IN_SUBPIXEL(ax), y: cc.RENDER_IN_SUBPIXEL(ay), z: locVertexZ};
- locQuad.br.vertices = {x: cc.RENDER_IN_SUBPIXEL(bx), y: cc.RENDER_IN_SUBPIXEL(by), z: locVertexZ};
- locQuad.tl.vertices = {x: cc.RENDER_IN_SUBPIXEL(dx), y: cc.RENDER_IN_SUBPIXEL(dy), z: locVertexZ};
- locQuad.tr.vertices = {x: cc.RENDER_IN_SUBPIXEL(cx), y: cc.RENDER_IN_SUBPIXEL(cy), z: locVertexZ};
+ if(!cc.SPRITEBATCHNODE_RENDER_SUBPIXEL) {
+ ax = 0 | ax;
+ ay = 0 | ay;
+ bx = 0 | bx;
+ by = 0 | by;
+ cx = 0 | cx;
+ cy = 0 | cy;
+ dx = 0 | dx;
+ dy = 0 | dy;
+ }
+ locQuad.bl.vertices = {x: ax, y: ay, z: locVertexZ};
+ locQuad.br.vertices = {x: bx, y: by, z: locVertexZ};
+ locQuad.tl.vertices = {x: dx, y: dy, z: locVertexZ};
+ locQuad.tr.vertices = {x: cx, y: cy, z: locVertexZ};
}
_t.textureAtlas.updateQuad(locQuad, _t.atlasIndex);
_t._recursiveDirty = false;
@@ -420,7 +430,7 @@ _tmp.WebGLSprite = function () {
// self render
if (!_t._batchNode) {
- _t.atlasIndex = cc.SPRITE_INDEX_NOT_INITIALIZED;
+ _t.atlasIndex = cc.Sprite.INDEX_NOT_INITIALIZED;
_t.textureAtlas = null;
_t._recursiveDirty = false;
_t.dirty = false;
diff --git a/cocos2d/menus/CCMenuItem.js b/cocos2d/menus/CCMenuItem.js
index 00899c34dc..e366f25418 100644
--- a/cocos2d/menus/CCMenuItem.js
+++ b/cocos2d/menus/CCMenuItem.js
@@ -24,51 +24,10 @@
THE SOFTWARE.
****************************************************************************/
-
-/**
- * default size for font size
- * @constant
- * @type Number
- */
-cc.ITEM_SIZE = 32;
-
cc._globalFontSize = cc.ITEM_SIZE;
cc._globalFontName = "Arial";
cc._globalFontNameRelease = false;
-/**
- * default tag for current item
- * @constant
- * @type Number
- */
-cc.CURRENT_ITEM = 0xc0c05001;
-/**
- * default tag for zoom action tag
- * @constant
- * @type Number
- */
-cc.ZOOM_ACTION_TAG = 0xc0c05002;
-/**
- * default tag for normal
- * @constant
- * @type Number
- */
-cc.NORMAL_TAG = 8801;
-
-/**
- * default selected tag
- * @constant
- * @type Number
- */
-cc.SELECTED_TAG = 8802;
-
-/**
- * default disabled tag
- * @constant
- * @type Number
- */
-cc.DISABLE_TAG = 8803;
-
/**
* Subclass cc.MenuItem (or any subclass) to create your custom cc.MenuItem objects.
* @class
diff --git a/cocos2d/node-grid/CCNodeGrid.js b/cocos2d/node-grid/CCNodeGrid.js
index a94f388fb7..b5cc41e2a5 100644
--- a/cocos2d/node-grid/CCNodeGrid.js
+++ b/cocos2d/node-grid/CCNodeGrid.js
@@ -113,9 +113,13 @@ cc.NodeGrid = cc.Node.extend({
var apx = this._anchorPointInPoints.x, apy = this._anchorPointInPoints.y;
var translate = (apx !== 0.0 || apy !== 0.0);
if (translate) {
- cc.kmGLTranslatef(cc.RENDER_IN_SUBPIXEL(apx), cc.RENDER_IN_SUBPIXEL(apy), 0);
+ if(!cc.SPRITEBATCHNODE_RENDER_SUBPIXEL) {
+ apx = 0 | apx;
+ apy = 0 | apy;
+ }
+ cc.kmGLTranslatef(apx, apy, 0);
this._camera.locate();
- cc.kmGLTranslatef(cc.RENDER_IN_SUBPIXEL(-apx), cc.RENDER_IN_SUBPIXEL(-apy), 0);
+ cc.kmGLTranslatef(-apx, -apy, 0);
} else {
this._camera.locate();
}
diff --git a/cocos2d/render-texture/CCRenderTexture.js b/cocos2d/render-texture/CCRenderTexture.js
index bd48dcc2a6..e41a78ee9b 100644
--- a/cocos2d/render-texture/CCRenderTexture.js
+++ b/cocos2d/render-texture/CCRenderTexture.js
@@ -491,7 +491,7 @@ cc.RenderTexture = cc.Node.extend(/** @lends cc.RenderTexture# */{
gl.viewport(0, 0, size.width * cc.contentScaleFactor(), size.height * cc.contentScaleFactor());
// special viewport for 3d projection + retina display
- if (director.getProjection() == cc.DIRECTOR_PROJECTION_3D && cc.contentScaleFactor() != 1) {
+ if (director.getProjection() == cc.Director.PROJECTION_3D && cc.contentScaleFactor() != 1) {
gl.viewport((-size.width / 2), (-size.height / 2), (size.width * cc.contentScaleFactor()), (size.height * cc.contentScaleFactor()));
}
diff --git a/cocos2d/shaders/CCGLProgram.js b/cocos2d/shaders/CCGLProgram.js
index 703f9dfde8..991efd0722 100644
--- a/cocos2d/shaders/CCGLProgram.js
+++ b/cocos2d/shaders/CCGLProgram.js
@@ -26,181 +26,6 @@
THE SOFTWARE.
****************************************************************************/
-//-------------Vertex Attributes-----------
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_POSITION = 0;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_COLOR = 1;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_TEX_COORDS = 2;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_MAX = 3;
-
-//------------Uniforms------------------
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_PMATRIX = 0;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_MVMATRIX = 1;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_MVPMATRIX = 2;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_TIME = 3;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_SINTIME = 4;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_COSTIME = 5;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_RANDOM01 = 6;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_SAMPLER = 7;
-/**
- * @constant
- * @type {Number}
- */
-cc.UNIFORM_MAX = 8;
-
-//------------Shader Name---------------
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_TEXTURECOLOR = "ShaderPositionTextureColor";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_TEXTURECOLORALPHATEST = "ShaderPositionTextureColorAlphaTest";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_COLOR = "ShaderPositionColor";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_TEXTURE = "ShaderPositionTexture";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_TEXTURE_UCOLOR = "ShaderPositionTexture_uColor";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_TEXTUREA8COLOR = "ShaderPositionTextureA8Color";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_UCOLOR = "ShaderPosition_uColor";
-/**
- * @constant
- * @type {String}
- */
-cc.SHADER_POSITION_LENGTHTEXTURECOLOR = "ShaderPositionLengthTextureColor";
-
-//------------uniform names----------------
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_PMATRIX_S = "CC_PMatrix";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_MVMATRIX_S = "CC_MVMatrix";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_MVPMATRIX_S = "CC_MVPMatrix";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_TIME_S = "CC_Time";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_SINTIME_S = "CC_SinTime";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_COSTIME_S = "CC_CosTime";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_RANDOM01_S = "CC_Random01";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_SAMPLER_S = "CC_Texture0";
-/**
- * @constant
- * @type {String}
- */
-cc.UNIFORM_ALPHA_TEST_VALUE_S = "CC_alpha_value";
-
-//------------Attribute names--------------
-/**
- * @constant
- * @type {String}
- */
-cc.ATTRIBUTE_NAME_COLOR = "a_color";
-/**
- * @constant
- * @type {String}
- */
-cc.ATTRIBUTE_NAME_POSITION = "a_position";
-/**
- * @constant
- * @type {String}
- */
-cc.ATTRIBUTE_NAME_TEX_COORD = "a_texCoord";
-
cc.HashUniformEntry = function (value, location, hh) {
this.value = value;
this.location = location;
diff --git a/cocos2d/shaders/CCGLStateCache.js b/cocos2d/shaders/CCGLStateCache.js
index 401ff36a72..c8d890ae32 100644
--- a/cocos2d/shaders/CCGLStateCache.js
+++ b/cocos2d/shaders/CCGLStateCache.js
@@ -24,40 +24,6 @@
THE SOFTWARE.
****************************************************************************/
-// ------------------- vertex attrib flags -----------------------------
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_FLAG_NONE = 0;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_FLAG_POSITION = 1 << 0;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_FLAG_COLOR = 1 << 1;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_FLAG_TEX_COORDS = 1 << 2;
-/**
- * @constant
- * @type {Number}
- */
-cc.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = ( cc.VERTEX_ATTRIB_FLAG_POSITION | cc.VERTEX_ATTRIB_FLAG_COLOR | cc.VERTEX_ATTRIB_FLAG_TEX_COORDS );
-
-/**
- * GL server side states
- * @constant
- * @type {Number}
- */
-cc.GL_ALL = 0;
-
cc._currentProjectionMatrix = -1;
cc._vertexAttribPosition = false;
cc._vertexAttribColor = false;