--- /opt/cocos2d-x/cocos/renderer/ccShader_3D_PositionNormalTex.vert 2016-12-29 13:42:38.000000000 -0400 +++ /tmp/ccShader_3D_PositionNormalTex.vert 2017-01-04 15:03:03.470085652 -0400 @@ -1,70 +1,70 @@ -const char* cc3D_PositionNormalTex_vert = R"( +const char* cc3D_PositionNormalTex_vert = STRINGIFY( -#ifdef USE_NORMAL_MAPPING -#if (MAX_DIRECTIONAL_LIGHT_NUM > 0) +\n#ifdef USE_NORMAL_MAPPING\n +\n#if (MAX_DIRECTIONAL_LIGHT_NUM > 0)\n uniform vec3 u_DirLightSourceDirection[MAX_DIRECTIONAL_LIGHT_NUM]; -#endif -#endif -#if (MAX_POINT_LIGHT_NUM > 0) +\n#endif\n +\n#endif\n +\n#if (MAX_POINT_LIGHT_NUM > 0)\n uniform vec3 u_PointLightSourcePosition[MAX_POINT_LIGHT_NUM]; -#endif -#if (MAX_SPOT_LIGHT_NUM > 0) +\n#endif\n +\n#if (MAX_SPOT_LIGHT_NUM > 0)\n uniform vec3 u_SpotLightSourcePosition[MAX_SPOT_LIGHT_NUM]; -#ifdef USE_NORMAL_MAPPING +\n#ifdef USE_NORMAL_MAPPING\n uniform vec3 u_SpotLightSourceDirection[MAX_SPOT_LIGHT_NUM]; -#endif -#endif +\n#endif\n +\n#endif\n attribute vec4 a_position; attribute vec2 a_texCoord; attribute vec3 a_normal; -#ifdef USE_NORMAL_MAPPING +\n#ifdef USE_NORMAL_MAPPING\n attribute vec3 a_tangent; attribute vec3 a_binormal; -#endif +\n#endif\n varying vec2 TextureCoordOut; -#ifdef USE_NORMAL_MAPPING -#if MAX_DIRECTIONAL_LIGHT_NUM +\n#ifdef USE_NORMAL_MAPPING\n +\n#if MAX_DIRECTIONAL_LIGHT_NUM\n varying vec3 v_dirLightDirection[MAX_DIRECTIONAL_LIGHT_NUM]; -#endif -#endif -#if MAX_POINT_LIGHT_NUM +\n#endif\n +\n#endif\n +\n#if MAX_POINT_LIGHT_NUM\n varying vec3 v_vertexToPointLightDirection[MAX_POINT_LIGHT_NUM]; -#endif -#if MAX_SPOT_LIGHT_NUM +\n#endif\n +\n#if MAX_SPOT_LIGHT_NUM\n varying vec3 v_vertexToSpotLightDirection[MAX_SPOT_LIGHT_NUM]; -#ifdef USE_NORMAL_MAPPING +\n#ifdef USE_NORMAL_MAPPING\n varying vec3 v_spotLightDirection[MAX_SPOT_LIGHT_NUM]; -#endif -#endif +\n#endif\n +\n#endif\n -#ifndef USE_NORMAL_MAPPING -#if ((MAX_DIRECTIONAL_LIGHT_NUM > 0) || (MAX_POINT_LIGHT_NUM > 0) || (MAX_SPOT_LIGHT_NUM > 0)) +\n#ifndef USE_NORMAL_MAPPING\n +\n#if ((MAX_DIRECTIONAL_LIGHT_NUM > 0) || (MAX_POINT_LIGHT_NUM > 0) || (MAX_SPOT_LIGHT_NUM > 0))\n varying vec3 v_normal; -#endif -#endif +\n#endif\n +\n#endif\n void main(void) { vec4 ePosition = CC_MVMatrix * a_position; -#ifdef USE_NORMAL_MAPPING - #if ((MAX_DIRECTIONAL_LIGHT_NUM > 0) || (MAX_POINT_LIGHT_NUM > 0) || (MAX_SPOT_LIGHT_NUM > 0)) +\n#ifdef USE_NORMAL_MAPPING\n +\n #if ((MAX_DIRECTIONAL_LIGHT_NUM > 0) || (MAX_POINT_LIGHT_NUM > 0) || (MAX_SPOT_LIGHT_NUM > 0))\n vec3 eTangent = normalize(CC_NormalMatrix * a_tangent); vec3 eBinormal = normalize(CC_NormalMatrix * a_binormal); vec3 eNormal = normalize(CC_NormalMatrix * a_normal); - #endif - #if (MAX_DIRECTIONAL_LIGHT_NUM > 0) +\n #endif\n +\n #if (MAX_DIRECTIONAL_LIGHT_NUM > 0)\n for (int i = 0; i < MAX_DIRECTIONAL_LIGHT_NUM; ++i) { v_dirLightDirection[i].x = dot(eTangent, u_DirLightSourceDirection[i]); v_dirLightDirection[i].y = dot(eBinormal, u_DirLightSourceDirection[i]); v_dirLightDirection[i].z = dot(eNormal, u_DirLightSourceDirection[i]); } - #endif +\n #endif\n - #if (MAX_POINT_LIGHT_NUM > 0) +\n #if (MAX_POINT_LIGHT_NUM > 0)\n for (int i = 0; i < MAX_POINT_LIGHT_NUM; ++i) { vec3 pointLightDir = u_PointLightSourcePosition[i].xyz - ePosition.xyz; @@ -72,9 +72,9 @@ v_vertexToPointLightDirection[i].y = dot(eBinormal, pointLightDir); v_vertexToPointLightDirection[i].z = dot(eNormal, pointLightDir); } - #endif +\n #endif\n - #if (MAX_SPOT_LIGHT_NUM > 0) +\n #if (MAX_SPOT_LIGHT_NUM > 0)\n for (int i = 0; i < MAX_SPOT_LIGHT_NUM; ++i) { vec3 spotLightDir = u_SpotLightSourcePosition[i] - ePosition.xyz; @@ -86,32 +86,32 @@ v_spotLightDirection[i].y = dot(eBinormal, u_SpotLightSourceDirection[i]); v_spotLightDirection[i].z = dot(eNormal, u_SpotLightSourceDirection[i]); } - #endif -#else - #if (MAX_POINT_LIGHT_NUM > 0) +\n #endif\n +\n#else\n +\n #if (MAX_POINT_LIGHT_NUM > 0)\n for (int i = 0; i < MAX_POINT_LIGHT_NUM; ++i) { v_vertexToPointLightDirection[i] = u_PointLightSourcePosition[i].xyz - ePosition.xyz; } - #endif +\n #endif\n - #if (MAX_SPOT_LIGHT_NUM > 0) +\n #if (MAX_SPOT_LIGHT_NUM > 0)\n for (int i = 0; i < MAX_SPOT_LIGHT_NUM; ++i) { v_vertexToSpotLightDirection[i] = u_SpotLightSourcePosition[i] - ePosition.xyz; } - #endif +\n #endif\n - #if ((MAX_DIRECTIONAL_LIGHT_NUM > 0) || (MAX_POINT_LIGHT_NUM > 0) || (MAX_SPOT_LIGHT_NUM > 0)) +\n #if ((MAX_DIRECTIONAL_LIGHT_NUM > 0) || (MAX_POINT_LIGHT_NUM > 0) || (MAX_SPOT_LIGHT_NUM > 0))\n v_normal = CC_NormalMatrix * a_normal; - #endif -#endif +\n #endif\n +\n#endif\n TextureCoordOut = a_texCoord; TextureCoordOut.y = 1.0 - TextureCoordOut.y; gl_Position = CC_PMatrix * ePosition; } -)"; +); const char* cc3D_SkinPositionNormalTex_vert = R"(