Merge branch 'newcode' into improved_glprogram

This commit is contained in:
yangxiao 2014-05-09 16:05:42 -07:00
commit 1be6ba961c
6 changed files with 182 additions and 68 deletions

View File

@ -7,7 +7,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(EngineRoot)cocos;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath;$(EngineRoot)cocos\2d\platform\win32;$(EngineRoot)cocos\2d\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)cocos;$(EngineRoot)cocos\2d\platform\win32;$(EngineRoot)cocos\2d\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_VARIADIC_MAX=10;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

View File

@ -270,10 +270,16 @@
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
<ClCompile Include="..\renderer\CCBatchCommand.cpp" />
<ClCompile Include="..\renderer\CCCustomCommand.cpp" />
<ClCompile Include="..\renderer\CCGLProgram.cpp" />
<ClCompile Include="..\renderer\CCGLProgramState.cpp" />
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp" />
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderer.cpp" />
<ClCompile Include="..\renderer\CCShaderCache.cpp" />
<ClCompile Include="..\renderer\ccShaders.cpp" />
<ClCompile Include="CCAction.cpp" />
<ClCompile Include="CCActionCamera.cpp" />
<ClCompile Include="CCActionCatmullRom.cpp" />
@ -320,8 +326,6 @@
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="CCGLProgram.cpp" />
<ClCompile Include="ccGLStateCache.cpp" />
<ClCompile Include="CCGrabber.cpp" />
<ClCompile Include="CCGrid.cpp" />
<ClCompile Include="CCNodeGrid.cpp" />
@ -345,8 +349,6 @@
<ClCompile Include="CCRenderTexture.cpp" />
<ClCompile Include="CCScene.cpp" />
<ClCompile Include="CCScriptSupport.cpp" />
<ClCompile Include="CCShaderCache.cpp" />
<ClCompile Include="ccShaders.cpp" />
<ClCompile Include="CCSprite.cpp" />
<ClCompile Include="CCSpriteBatchNode.cpp" />
<ClCompile Include="CCSpriteFrame.cpp" />
@ -494,11 +496,39 @@
<ClInclude Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.h" />
<ClInclude Include="..\renderer\CCBatchCommand.h" />
<ClInclude Include="..\renderer\CCCustomCommand.h" />
<ClInclude Include="..\renderer\CCGLProgram.h" />
<ClInclude Include="..\renderer\CCGLProgramState.h" />
<ClInclude Include="..\renderer\CCGLProgramStateCache.h" />
<ClInclude Include="..\renderer\ccGLStateCache.h" />
<ClInclude Include="..\renderer\CCGroupCommand.h" />
<ClInclude Include="..\renderer\CCQuadCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
<ClInclude Include="..\renderer\CCRenderer.h" />
<ClInclude Include="..\renderer\CCShaderCache.h" />
<ClInclude Include="..\renderer\ccShaders.h" />
<ClInclude Include="..\renderer\ccShader_Label_frag_df.h" />
<ClInclude Include="..\renderer\ccShader_Label_frag_df_glow.h" />
<ClInclude Include="..\renderer\ccShader_Label_frag_normal.h" />
<ClInclude Include="..\renderer\ccShader_Label_frag_outline.h" />
<ClInclude Include="..\renderer\ccShader_Label_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionColorLengthTexture_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionColorLengthTexture_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionColor_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionColor_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureA8Color_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureA8Color_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureColorAlphaTest_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_noMVP_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_noMVP_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionTexture_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionTexture_uColor_frag.h" />
<ClInclude Include="..\renderer\ccShader_PositionTexture_uColor_vert.h" />
<ClInclude Include="..\renderer\ccShader_PositionTexture_vert.h" />
<ClInclude Include="..\renderer\ccShader_Position_uColor_frag.h" />
<ClInclude Include="..\renderer\ccShader_Position_uColor_vert.h" />
<ClInclude Include="CCAction.h" />
<ClInclude Include="CCActionCamera.h" />
<ClInclude Include="CCActionCatmullRom.h" />
@ -530,8 +560,6 @@
<ClInclude Include="CCFontFNT.h" />
<ClInclude Include="CCFontFreeType.h" />
<ClInclude Include="ccFPSImages.h" />
<ClInclude Include="CCGLProgram.h" />
<ClInclude Include="ccGLStateCache.h" />
<ClInclude Include="CCGrabber.h" />
<ClInclude Include="CCGrid.h" />
<ClInclude Include="CCNodeGrid.h" />
@ -558,8 +586,6 @@
<ClInclude Include="CCRenderTexture.h" />
<ClInclude Include="CCScene.h" />
<ClInclude Include="CCScriptSupport.h" />
<ClInclude Include="CCShaderCache.h" />
<ClInclude Include="ccShaders.h" />
<ClInclude Include="CCSprite.h" />
<ClInclude Include="CCSpriteBatchNode.h" />
<ClInclude Include="CCSpriteFrame.h" />

View File

@ -58,9 +58,6 @@
<Filter Include="script_support">
<UniqueIdentifier>{5b082c5c-d396-43ca-b3b1-997d0f6247d0}</UniqueIdentifier>
</Filter>
<Filter Include="shaders">
<UniqueIdentifier>{163895ae-8a8e-46bf-bdf2-98bb2c1347fc}</UniqueIdentifier>
</Filter>
<Filter Include="draw_nodes">
<UniqueIdentifier>{1179d205-d065-49f0-8457-bc4c3f1d0cb3}</UniqueIdentifier>
</Filter>
@ -103,6 +100,9 @@
<Filter Include="math">
<UniqueIdentifier>{9bbf7050-757b-41b1-ab15-418db52c2023}</UniqueIdentifier>
</Filter>
<Filter Include="renderer\Shaders">
<UniqueIdentifier>{3237780d-1154-4049-bf53-151c421f26e9}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
@ -276,18 +276,6 @@
<ClCompile Include="..\base\s3tc.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="CCGLProgram.cpp">
<Filter>shaders</Filter>
</ClCompile>
<ClCompile Include="ccGLStateCache.cpp">
<Filter>shaders</Filter>
</ClCompile>
<ClCompile Include="CCShaderCache.cpp">
<Filter>shaders</Filter>
</ClCompile>
<ClCompile Include="ccShaders.cpp">
<Filter>shaders</Filter>
</ClCompile>
<ClCompile Include="CCSpriteBatchNode.cpp">
<Filter>sprite_nodes</Filter>
</ClCompile>
@ -600,6 +588,24 @@
<ClCompile Include="..\base\CCEventListenerFocus.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCGLProgram.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCGLProgramState.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\ccGLStateCache.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCShaderCache.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\ccShaders.cpp">
<Filter>renderer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -809,18 +815,6 @@
<ClInclude Include="..\base\s3tc.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="CCGLProgram.h">
<Filter>shaders</Filter>
</ClInclude>
<ClInclude Include="ccGLStateCache.h">
<Filter>shaders</Filter>
</ClInclude>
<ClInclude Include="CCShaderCache.h">
<Filter>shaders</Filter>
</ClInclude>
<ClInclude Include="ccShaders.h">
<Filter>shaders</Filter>
</ClInclude>
<ClInclude Include="CCSpriteBatchNode.h">
<Filter>sprite_nodes</Filter>
</ClInclude>
@ -1186,6 +1180,90 @@
<ClInclude Include="..\base\CCEventListenerFocus.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCGLProgram.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCGLProgramState.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCGLProgramStateCache.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccGLStateCache.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCShaderCache.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShaders.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Label_frag_df.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Label_frag_df_glow.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Label_frag_normal.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Label_frag_outline.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Label_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Position_uColor_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_Position_uColor_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionColor_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionColor_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionColorLengthTexture_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionColorLengthTexture_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTexture_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTexture_uColor_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTexture_uColor_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTexture_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureA8Color_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureA8Color_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_noMVP_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_noMVP_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureColor_vert.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
<ClInclude Include="..\renderer\ccShader_PositionTextureColorAlphaTest_frag.h">
<Filter>renderer\Shaders</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\MathUtil.inl">

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
****************************************************************************/
#include "CCPrecompiledShaders.h"
#include "CCWinRTUtils.h"
#include "CCGLProgram.h"
#include "renderer/CCGLProgram.h"
#include "sha1.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)

View File

@ -103,8 +103,6 @@
"cocos/2d/CCFontFreeType.h",
"cocos/2d/CCGLBufferedNode.cpp",
"cocos/2d/CCGLBufferedNode.h",
"cocos/2d/CCGLProgram.cpp",
"cocos/2d/CCGLProgram.h",
"cocos/2d/CCGrabber.cpp",
"cocos/2d/CCGrabber.h",
"cocos/2d/CCGrid.cpp",
@ -153,8 +151,6 @@
"cocos/2d/CCScene.h",
"cocos/2d/CCScriptSupport.cpp",
"cocos/2d/CCScriptSupport.h",
"cocos/2d/CCShaderCache.cpp",
"cocos/2d/CCShaderCache.h",
"cocos/2d/CCSprite.cpp",
"cocos/2d/CCSprite.h",
"cocos/2d/CCSpriteBatchNode.cpp",
@ -202,32 +198,6 @@
"cocos/2d/ccCArray.h",
"cocos/2d/ccFPSImages.c",
"cocos/2d/ccFPSImages.h",
"cocos/2d/ccGLStateCache.cpp",
"cocos/2d/ccGLStateCache.h",
"cocos/2d/ccShader_Label_frag_df.h",
"cocos/2d/ccShader_Label_frag_df_glow.h",
"cocos/2d/ccShader_Label_frag_normal.h",
"cocos/2d/ccShader_Label_frag_outline.h",
"cocos/2d/ccShader_Label_vert.h",
"cocos/2d/ccShader_PositionColorLengthTexture_frag.h",
"cocos/2d/ccShader_PositionColorLengthTexture_vert.h",
"cocos/2d/ccShader_PositionColor_frag.h",
"cocos/2d/ccShader_PositionColor_vert.h",
"cocos/2d/ccShader_PositionTextureA8Color_frag.h",
"cocos/2d/ccShader_PositionTextureA8Color_vert.h",
"cocos/2d/ccShader_PositionTextureColorAlphaTest_frag.h",
"cocos/2d/ccShader_PositionTextureColor_frag.h",
"cocos/2d/ccShader_PositionTextureColor_noMVP_frag.h",
"cocos/2d/ccShader_PositionTextureColor_noMVP_vert.h",
"cocos/2d/ccShader_PositionTextureColor_vert.h",
"cocos/2d/ccShader_PositionTexture_frag.h",
"cocos/2d/ccShader_PositionTexture_uColor_frag.h",
"cocos/2d/ccShader_PositionTexture_uColor_vert.h",
"cocos/2d/ccShader_PositionTexture_vert.h",
"cocos/2d/ccShader_Position_uColor_frag.h",
"cocos/2d/ccShader_Position_uColor_vert.h",
"cocos/2d/ccShaders.cpp",
"cocos/2d/ccShaders.h",
"cocos/2d/ccUTF8.cpp",
"cocos/2d/ccUTF8.h",
"cocos/2d/ccUtils.cpp",
@ -880,6 +850,12 @@
"cocos/renderer/CCBatchCommand.h",
"cocos/renderer/CCCustomCommand.cpp",
"cocos/renderer/CCCustomCommand.h",
"cocos/renderer/CCGLProgram.cpp",
"cocos/renderer/CCGLProgram.h",
"cocos/renderer/CCGLProgramState.cpp",
"cocos/renderer/CCGLProgramState.h",
"cocos/renderer/CCGLProgramStateCache.cpp",
"cocos/renderer/CCGLProgramStateCache.h",
"cocos/renderer/CCGroupCommand.cpp",
"cocos/renderer/CCGroupCommand.h",
"cocos/renderer/CCQuadCommand.cpp",
@ -889,7 +865,35 @@
"cocos/renderer/CCRenderCommandPool.h",
"cocos/renderer/CCRenderer.cpp",
"cocos/renderer/CCRenderer.h",
"cocos/renderer/CCShaderCache.cpp",
"cocos/renderer/CCShaderCache.h",
"cocos/renderer/CMakeLists.txt",
"cocos/renderer/ccGLStateCache.cpp",
"cocos/renderer/ccGLStateCache.h",
"cocos/renderer/ccShader_Label_frag_df.h",
"cocos/renderer/ccShader_Label_frag_df_glow.h",
"cocos/renderer/ccShader_Label_frag_normal.h",
"cocos/renderer/ccShader_Label_frag_outline.h",
"cocos/renderer/ccShader_Label_vert.h",
"cocos/renderer/ccShader_PositionColorLengthTexture_frag.h",
"cocos/renderer/ccShader_PositionColorLengthTexture_vert.h",
"cocos/renderer/ccShader_PositionColor_frag.h",
"cocos/renderer/ccShader_PositionColor_vert.h",
"cocos/renderer/ccShader_PositionTextureA8Color_frag.h",
"cocos/renderer/ccShader_PositionTextureA8Color_vert.h",
"cocos/renderer/ccShader_PositionTextureColorAlphaTest_frag.h",
"cocos/renderer/ccShader_PositionTextureColor_frag.h",
"cocos/renderer/ccShader_PositionTextureColor_noMVP_frag.h",
"cocos/renderer/ccShader_PositionTextureColor_noMVP_vert.h",
"cocos/renderer/ccShader_PositionTextureColor_vert.h",
"cocos/renderer/ccShader_PositionTexture_frag.h",
"cocos/renderer/ccShader_PositionTexture_uColor_frag.h",
"cocos/renderer/ccShader_PositionTexture_uColor_vert.h",
"cocos/renderer/ccShader_PositionTexture_vert.h",
"cocos/renderer/ccShader_Position_uColor_frag.h",
"cocos/renderer/ccShader_Position_uColor_vert.h",
"cocos/renderer/ccShaders.cpp",
"cocos/renderer/ccShaders.h",
"cocos/storage/CMakeLists.txt",
"cocos/storage/local-storage/Android.mk",
"cocos/storage/local-storage/LocalStorage.cpp",
@ -1126,8 +1130,10 @@
"external/Box2D/Rope/b2Rope.h",
"external/Box2D/proj.win32/Box2D.vcxproj",
"external/Box2D/proj.win32/Box2D.vcxproj.filters",
"external/Box2D/proj.win32/Box2D.vcxproj.user",
"external/Box2D/proj.wp8/Box2D.vcxproj",
"external/Box2D/proj.wp8/Box2D.vcxproj.filters",
"external/Box2D/proj.wp8/Box2D.vcxproj.user",
"external/chipmunk/Android.mk",
"external/chipmunk/LICENSE.txt",
"external/chipmunk/README.txt",
@ -1159,10 +1165,12 @@
"external/chipmunk/include/chipmunk/cpVect.h",
"external/chipmunk/proj.win32/chipmunk.vcxproj",
"external/chipmunk/proj.win32/chipmunk.vcxproj.filters",
"external/chipmunk/proj.win32/chipmunk.vcxproj.user",
"external/chipmunk/proj.winrt/chipmunk.vcxproj",
"external/chipmunk/proj.winrt/chipmunk.vcxproj.filters",
"external/chipmunk/proj.wp8/chipmunk.vcxproj",
"external/chipmunk/proj.wp8/chipmunk.vcxproj.filters",
"external/chipmunk/proj.wp8/chipmunk.vcxproj.user",
"external/chipmunk/src/CMakeLists.txt",
"external/chipmunk/src/chipmunk.c",
"external/chipmunk/src/constraints/cpConstraint.c",
@ -2034,7 +2042,7 @@
"external/unzip/ioapi.h",
"external/unzip/unzip.cpp",
"external/unzip/unzip.h",
"external/version.json",
"external/version.txt",
"external/webp/include/android/decode.h",
"external/webp/include/android/encode.h",
"external/webp/include/android/types.h",

View File

@ -723,6 +723,8 @@ bool UniformShaderNode::initWithVertex(const char *vert, const char *frag)
_vertFileName = vert;
_fragFileName = frag;
return true;
}
void UniformShaderNode::loadShaderVertex(const char *vert, const char *frag)