From 1fbdbfc8f4581ebdfa420f4710038175a115b977 Mon Sep 17 00:00:00 2001 From: "oleksandr.kuznietsov" Date: Thu, 26 Jun 2014 13:26:41 +0300 Subject: [PATCH 1/9] Updated pull request #7065 due to new changes in current branch - Switched ProgramState from unordered_map to unordered_map for faster uniform search - changed `uniformValue` variable name to more relative --- cocos/renderer/CCGLProgramState.cpp | 111 ++++++++++++++++++++++++++-- cocos/renderer/CCGLProgramState.h | 16 +++- 2 files changed, 119 insertions(+), 8 deletions(-) diff --git a/cocos/renderer/CCGLProgramState.cpp b/cocos/renderer/CCGLProgramState.cpp index a408aac219..4a0b12296c 100644 --- a/cocos/renderer/CCGLProgramState.cpp +++ b/cocos/renderer/CCGLProgramState.cpp @@ -309,7 +309,8 @@ bool GLProgramState::init(GLProgram* glprogram) for(auto &uniform : _glprogram->_userUniforms) { UniformValue value(&uniform.second, _glprogram); - _uniforms[uniform.first] = value; + _uniforms[uniform.second.location] = value; + _uniformsByName[uniform.first] = uniform.second.location; } return true; @@ -329,9 +330,9 @@ void GLProgramState::apply(const Mat4& modelView) CCASSERT(_glprogram, "invalid glprogram"); if(_uniformAttributeValueDirty) { - for(auto& uniformValue : _uniforms) + for(auto& uniformLocation : _uniformsByName) { - uniformValue.second._uniform = _glprogram->getUniform(uniformValue.first); + _uniforms[uniformLocation.second]._uniform = _glprogram->getUniform(uniformLocation.first); } _vertexAttribsFlags = 0; @@ -377,11 +378,19 @@ void GLProgramState::setGLProgram(GLProgram *glprogram) } } +UniformValue* GLProgramState::getUniformValue(GLint uniformLocation) +{ + const auto itr = _uniforms.find(uniformLocation); + if (itr != _uniforms.end()) + return &itr->second; + return nullptr; +} + UniformValue* GLProgramState::getUniformValue(const std::string &name) { - const auto itr = _uniforms.find(name); - if( itr != _uniforms.end()) - return &itr->second; + const auto itr = _uniformsByName.find(name); + if (itr != _uniformsByName.end()) + return &_uniforms[itr->second]; return nullptr; } @@ -431,6 +440,15 @@ void GLProgramState::setUniformCallback(const std::string &uniformName, const st CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformCallback(GLint uniformLocation, const std::function &callback) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setCallback(callback); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); +} + void GLProgramState::setUniformFloat(const std::string &uniformName, float value) { auto v = getUniformValue(uniformName); @@ -440,6 +458,15 @@ void GLProgramState::setUniformFloat(const std::string &uniformName, float value CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformFloat(GLint uniformLocation, float value) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setFloat(value); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); +} + void GLProgramState::setUniformInt(const std::string &uniformName, int value) { auto v = getUniformValue(uniformName); @@ -449,6 +476,16 @@ void GLProgramState::setUniformInt(const std::string &uniformName, int value) CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformInt(GLint uniformLocation, int value) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setInt(value); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); + +} + void GLProgramState::setUniformVec2(const std::string &uniformName, const Vec2& value) { auto v = getUniformValue(uniformName); @@ -458,6 +495,15 @@ void GLProgramState::setUniformVec2(const std::string &uniformName, const Vec2& CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformVec2(GLint uniformLocation, const Vec2& value) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setVec2(value); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); +} + void GLProgramState::setUniformVec3(const std::string &uniformName, const Vec3& value) { auto v = getUniformValue(uniformName); @@ -467,6 +513,15 @@ void GLProgramState::setUniformVec3(const std::string &uniformName, const Vec3& CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformVec3(GLint uniformLocation, const Vec3& value) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setVec3(value); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); +} + void GLProgramState::setUniformVec4(const std::string &uniformName, const Vec4& value) { auto v = getUniformValue(uniformName); @@ -476,6 +531,15 @@ void GLProgramState::setUniformVec4(const std::string &uniformName, const Vec4& CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformVec4(GLint uniformLocation, const Vec4& value) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setVec4(value); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); +} + void GLProgramState::setUniformMat4(const std::string &uniformName, const Mat4& value) { auto v = getUniformValue(uniformName); @@ -485,6 +549,15 @@ void GLProgramState::setUniformMat4(const std::string &uniformName, const Mat4& CCLOG("cocos2d: warning: Uniform not found: %s", uniformName.c_str()); } +void GLProgramState::setUniformMat4(GLint uniformLocation, const Mat4& value) +{ + auto v = getUniformValue(uniformLocation); + if (v) + v->setMat4(value); + else + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); +} + // Textures void GLProgramState::setUniformTexture(const std::string &uniformName, Texture2D *texture) @@ -493,6 +566,12 @@ void GLProgramState::setUniformTexture(const std::string &uniformName, Texture2D setUniformTexture(uniformName, texture->getName()); } +void GLProgramState::setUniformTexture(GLint uniformLocation, Texture2D *texture) +{ + CCASSERT(texture, "Invalid texture"); + setUniformTexture(uniformLocation, texture->getName()); +} + void GLProgramState::setUniformTexture(const std::string &uniformName, GLuint textureId) { auto v = getUniformValue(uniformName); @@ -514,5 +593,25 @@ void GLProgramState::setUniformTexture(const std::string &uniformName, GLuint te } } +void GLProgramState::setUniformTexture(GLint uniformLocation, GLuint textureId) +{ + auto v = getUniformValue(uniformLocation); + if (v) + { + if (_boundTextureUnits.find(v->_uniform->name) != _boundTextureUnits.end()) + { + v->setTexture(textureId, _boundTextureUnits[v->_uniform->name]); + } + else + { + v->setTexture(textureId, _textureUnitIndex); + _boundTextureUnits[v->_uniform->name] = _textureUnitIndex++; + } + } + else + { + CCLOG("cocos2d: warning: Uniform at location not found: %i", uniformLocation); + } +} NS_CC_END diff --git a/cocos/renderer/CCGLProgramState.h b/cocos/renderer/CCGLProgramState.h index fc30ea7900..2b60885042 100644 --- a/cocos/renderer/CCGLProgramState.h +++ b/cocos/renderer/CCGLProgramState.h @@ -179,7 +179,17 @@ public: void setUniformCallback(const std::string &uniformName, const std::function &callback); void setUniformTexture(const std::string &uniformName, Texture2D *texture); void setUniformTexture(const std::string &uniformName, GLuint textureId); - + + void setUniformInt(GLint uniformLocation, int value); + void setUniformFloat(GLint uniformLocation, float value); + void setUniformVec2(GLint uniformLocation, const Vec2& value); + void setUniformVec3(GLint uniformLocation, const Vec3& value); + void setUniformVec4(GLint uniformLocation, const Vec4& value); + void setUniformMat4(GLint uniformLocation, const Mat4& value); + void setUniformCallback(GLint uniformLocation, const std::function &callback); + void setUniformTexture(GLint uniformLocation, Texture2D *texture); + void setUniformTexture(GLint uniformLocation, GLuint textureId); + protected: GLProgramState(); ~GLProgramState(); @@ -187,9 +197,11 @@ protected: void resetGLProgram(); VertexAttribValue* getVertexAttribValue(const std::string &attributeName); UniformValue* getUniformValue(const std::string &uniformName); + UniformValue* getUniformValue(GLint uniformLocation); bool _uniformAttributeValueDirty; - std::unordered_map _uniforms; + std::unordered_map _uniformsByName; + std::unordered_map _uniforms; std::unordered_map _attributes; std::unordered_map _boundTextureUnits; From bd663ac55ec4f0d00c7b6a0444c71217353cf657 Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 27 Jun 2014 15:39:10 +0800 Subject: [PATCH 2/9] fix margin zero --- cocos/ui/UILayoutParameter.cpp | 2 ++ cocos/ui/UILayoutParameter.h | 4 +++- cocos/ui/UIListView.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cocos/ui/UILayoutParameter.cpp b/cocos/ui/UILayoutParameter.cpp index 71f78db93e..c9990491a6 100644 --- a/cocos/ui/UILayoutParameter.cpp +++ b/cocos/ui/UILayoutParameter.cpp @@ -29,6 +29,8 @@ NS_CC_BEGIN namespace ui { +const Margin Margin::ZERO = Margin(0,0,0,0); + Margin::Margin(void) : left(0), top(0), right(0), bottom(0) { } diff --git a/cocos/ui/UILayoutParameter.h b/cocos/ui/UILayoutParameter.h index 29f421cafa..4681c82d3b 100644 --- a/cocos/ui/UILayoutParameter.h +++ b/cocos/ui/UILayoutParameter.h @@ -52,9 +52,11 @@ public: Margin& operator= (const Margin& other); void setMargin(float l, float t, float r, float b); bool equals(const Margin& target) const; + + static const Margin ZERO; + }; -const Margin MarginZero = Margin(); /** * @js NA diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index da6f993446..5689f49be1 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -149,7 +149,7 @@ void ListView::remedyLayoutParameter(Widget *item) } if (getIndex(item) == 0) { - defaultLp->setMargin(MarginZero); + defaultLp->setMargin(Margin::ZERO); } else { @@ -161,7 +161,7 @@ void ListView::remedyLayoutParameter(Widget *item) { if (getIndex(item) == 0) { - llp->setMargin(MarginZero); + llp->setMargin(Margin::ZERO); } else { @@ -204,7 +204,7 @@ void ListView::remedyLayoutParameter(Widget *item) } if (getIndex(item) == 0) { - defaultLp->setMargin(MarginZero); + defaultLp->setMargin(Margin::ZERO); } else { @@ -216,7 +216,7 @@ void ListView::remedyLayoutParameter(Widget *item) { if (getIndex(item) == 0) { - llp->setMargin(MarginZero); + llp->setMargin(Margin::ZERO); } else { From 62e046c0d591ddbb94274e466211951323298102 Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 27 Jun 2014 15:42:00 +0800 Subject: [PATCH 3/9] add deprecated variable --- cocos/ui/UIDeprecated.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/ui/UIDeprecated.h b/cocos/ui/UIDeprecated.h index cef9f51fc2..dcdb3abeeb 100644 --- a/cocos/ui/UIDeprecated.h +++ b/cocos/ui/UIDeprecated.h @@ -147,7 +147,7 @@ CC_DEPRECATED_ATTRIBUTE typedef LoadingBar::Direction LoadingBarType; CC_DEPRECATED_ATTRIBUTE typedef PageView::TouchDirection PVTouchDir; CC_DEPRECATED_ATTRIBUTE typedef RichElement::Type RichElementType; CC_DEPRECATED_ATTRIBUTE typedef ScrollView::Direction SCROLLVIEW_DIR; - +CC_DEPRECATED_ATTRIBUTE const Margin MarginZero = Margin::ZERO ; } From 1eab15ea41489cad0e55ea28b4ed2e705802830a Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 27 Jun 2014 15:56:29 +0800 Subject: [PATCH 4/9] add MarginZero as an external variable --- build/cocos2d_libs.xcodeproj/project.pbxproj | 6 ++++ cocos/ui/UIDeprecated.cpp | 33 ++++++++++++++++++++ cocos/ui/UIDeprecated.h | 8 ++++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 cocos/ui/UIDeprecated.cpp diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index b217e523e1..604f34f217 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -995,6 +995,8 @@ 299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; }; 299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 299754F3193EC95400A54AC3 /* ObjectFactory.h */; }; 299754F7193EC95400A54AC3 /* ObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 299754F3193EC95400A54AC3 /* ObjectFactory.h */; }; + 29BDBA53195D597A003225C9 /* UIDeprecated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29BDBA52195D597A003225C9 /* UIDeprecated.cpp */; }; + 29BDBA54195D597A003225C9 /* UIDeprecated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29BDBA52195D597A003225C9 /* UIDeprecated.cpp */; }; 29CB8F4C1929D1BB00C841D6 /* UILayoutManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */; }; 29CB8F4D1929D1BB00C841D6 /* UILayoutManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */; }; 29CB8F4E1929D1BB00C841D6 /* UILayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */; }; @@ -2311,6 +2313,7 @@ 2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = ""; }; 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = ""; }; 299754F3193EC95400A54AC3 /* ObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactory.h; path = ../base/ObjectFactory.h; sourceTree = ""; }; + 29BDBA52195D597A003225C9 /* UIDeprecated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIDeprecated.cpp; sourceTree = ""; }; 29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutManager.cpp; sourceTree = ""; }; 29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutManager.h; sourceTree = ""; }; 29E99D1C1957BA7000046604 /* CocoLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoLoader.cpp; sourceTree = ""; }; @@ -4030,6 +4033,7 @@ isa = PBXGroup; children = ( 29080DEB191B82CE0066F8DF /* UIDeprecated.h */, + 29BDBA52195D597A003225C9 /* UIDeprecated.cpp */, 2905FA1318CF08D100240AA3 /* UIWidget.cpp */, 2905FA1418CF08D100240AA3 /* UIWidget.h */, 50E6D30C18DADB5D0051CA34 /* CCProtectedNode.cpp */, @@ -6360,6 +6364,7 @@ 503DD8F71926B0DB00CD74DD /* CCIMEDispatcher.cpp in Sources */, 1AD71EB1180E26E600808F54 /* Bone.cpp in Sources */, 1AD71EB5180E26E600808F54 /* BoneData.cpp in Sources */, + 29BDBA53195D597A003225C9 /* UIDeprecated.cpp in Sources */, 1AD71EB9180E26E600808F54 /* CCSkeleton.cpp in Sources */, 50ABBE751925AB6F00A911A9 /* CCEventListenerTouch.cpp in Sources */, 1AD71EBD180E26E600808F54 /* CCSkeletonAnimation.cpp in Sources */, @@ -6855,6 +6860,7 @@ 50ABBD5D1925AB0000A911A9 /* Vec3.cpp in Sources */, 50ABC0121926664800A911A9 /* CCGLViewProtocol.cpp in Sources */, 50ABC0021926664800A911A9 /* CCLock.cpp in Sources */, + 29BDBA54195D597A003225C9 /* UIDeprecated.cpp in Sources */, 50FCEBAC18C72017004AD434 /* PageViewReader.cpp in Sources */, 1A8C598C180E930E00EF57C3 /* CCActionFrame.cpp in Sources */, 1A8C5990180E930E00EF57C3 /* CCActionFrameEasing.cpp in Sources */, diff --git a/cocos/ui/UIDeprecated.cpp b/cocos/ui/UIDeprecated.cpp new file mode 100644 index 0000000000..2a1472daaf --- /dev/null +++ b/cocos/ui/UIDeprecated.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "ui/UIDeprecated.h" + +NS_CC_BEGIN + +namespace ui { + +const Margin MarginZero = Margin::ZERO ; + +}} diff --git a/cocos/ui/UIDeprecated.h b/cocos/ui/UIDeprecated.h index dcdb3abeeb..f5ec082110 100644 --- a/cocos/ui/UIDeprecated.h +++ b/cocos/ui/UIDeprecated.h @@ -26,6 +26,12 @@ #define cocos2d_libs_UIDeprecated_h #include "base/CCPlatformMacros.h" +#include "ui/UIWidget.h" +#include "ui/UILayout.h" +#include "ui/UIListView.h" +#include "ui/UILoadingBar.h" +#include "ui/UIPageView.h" +#include "ui/UIRichText.h" NS_CC_BEGIN @@ -147,7 +153,7 @@ CC_DEPRECATED_ATTRIBUTE typedef LoadingBar::Direction LoadingBarType; CC_DEPRECATED_ATTRIBUTE typedef PageView::TouchDirection PVTouchDir; CC_DEPRECATED_ATTRIBUTE typedef RichElement::Type RichElementType; CC_DEPRECATED_ATTRIBUTE typedef ScrollView::Direction SCROLLVIEW_DIR; -CC_DEPRECATED_ATTRIBUTE const Margin MarginZero = Margin::ZERO ; +CC_DEPRECATED_ATTRIBUTE extern const Margin MarginZero; } From 94e311bebb05a56cfdf6204ded79d0fa8a24df62 Mon Sep 17 00:00:00 2001 From: andyque Date: Fri, 27 Jun 2014 16:11:35 +0800 Subject: [PATCH 5/9] fix platform compile error --- cocos/ui/Android.mk | 3 ++- cocos/ui/CMakeLists.txt | 1 + cocos/ui/proj.win32/libGUI.vcxproj | 2 ++ cocos/ui/proj.win32/libGUI.vcxproj.filters | 8 +++++++- cocos/ui/proj.wp8/libGUI.vcxproj | 4 +++- cocos/ui/proj.wp8/libGUI.vcxproj.filters | 8 +++++++- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 2441258c19..4c6e33334e 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -29,7 +29,8 @@ CCProtectedNode.cpp \ UIHBox.cpp \ UIVBox.cpp \ UIRelativeBox.cpp \ -UIVideoPlayerAndroid.cpp +UIVideoPlayerAndroid.cpp \ +UIDeprecated.cpp \ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/../editor-support diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index 60e83f23ec..cd7066589d 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -22,5 +22,6 @@ set(COCOS_UI_SRC ui/UITextField.cpp ui/UIVBox.cpp ui/UIWidget.cpp + ui/UIDeprecated.cpp ) diff --git a/cocos/ui/proj.win32/libGUI.vcxproj b/cocos/ui/proj.win32/libGUI.vcxproj index 8ef4105661..2483ce7005 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj +++ b/cocos/ui/proj.win32/libGUI.vcxproj @@ -15,6 +15,7 @@ + @@ -40,6 +41,7 @@ + diff --git a/cocos/ui/proj.win32/libGUI.vcxproj.filters b/cocos/ui/proj.win32/libGUI.vcxproj.filters index a82d945c9f..66f11c6cdd 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj.filters +++ b/cocos/ui/proj.win32/libGUI.vcxproj.filters @@ -87,6 +87,9 @@ Layouts + + System + @@ -158,5 +161,8 @@ Layouts + + System + - + \ No newline at end of file diff --git a/cocos/ui/proj.wp8/libGUI.vcxproj b/cocos/ui/proj.wp8/libGUI.vcxproj index c58030f74b..461ca405b9 100644 --- a/cocos/ui/proj.wp8/libGUI.vcxproj +++ b/cocos/ui/proj.wp8/libGUI.vcxproj @@ -184,6 +184,7 @@ + @@ -209,8 +210,9 @@ + - + \ No newline at end of file diff --git a/cocos/ui/proj.wp8/libGUI.vcxproj.filters b/cocos/ui/proj.wp8/libGUI.vcxproj.filters index 475c39565d..0513dc6afb 100644 --- a/cocos/ui/proj.wp8/libGUI.vcxproj.filters +++ b/cocos/ui/proj.wp8/libGUI.vcxproj.filters @@ -84,6 +84,9 @@ Layouts + + System + @@ -155,5 +158,8 @@ Layouts + + System + - + \ No newline at end of file From 7c18824adf4d873a3caec6354c892e5fd25244b3 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 27 Jun 2014 16:27:09 +0800 Subject: [PATCH 6/9] [ci skip] --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index bd5246b7b0..5ca95070e5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -903,6 +903,9 @@ Developers: billtt Fixed a bug that Node::setScale(float) may not work properly + + Teivaz + Custom uniform search optimization Retired Core Developers: WenSheng Yang From 9393777c227cc3d2e76dc29787f7b4ffa3214a65 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 27 Jun 2014 08:31:17 +0000 Subject: [PATCH 7/9] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/GLProgramState.lua | 56 +++- .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 294 ++++++++++++------ 2 files changed, 240 insertions(+), 110 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua b/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua index cb9c253e0e..09df2af043 100644 --- a/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua +++ b/cocos/scripting/lua-bindings/auto/api/GLProgramState.lua @@ -9,62 +9,90 @@ -- -- overload function: setUniformTexture(string, cc.Texture2D) -- +-- overload function: setUniformTexture(int, cc.Texture2D) +-- +-- overload function: setUniformTexture(int, unsigned int) +-- -- @function [parent=#GLProgramState] setUniformTexture -- @param self --- @param #string str --- @param #cc.Texture2D texture2d +-- @param #int int +-- @param #unsigned int int -------------------------------- --- @function [parent=#GLProgramState] setUniformMat4 +-- overload function: setUniformMat4(int, mat4_table) +-- +-- overload function: setUniformMat4(string, mat4_table) +-- +-- @function [parent=#GLProgramState] setUniformMat4 -- @param self -- @param #string str -- @param #mat4_table mat4 - + -------------------------------- -- @function [parent=#GLProgramState] getUniformCount -- @param self -- @return long#long ret (return value: long) -------------------------------- --- @function [parent=#GLProgramState] setUniformFloat +-- overload function: setUniformFloat(int, float) +-- +-- overload function: setUniformFloat(string, float) +-- +-- @function [parent=#GLProgramState] setUniformFloat -- @param self -- @param #string str -- @param #float float - + -------------------------------- --- @function [parent=#GLProgramState] setUniformVec3 +-- overload function: setUniformVec3(int, vec3_table) +-- +-- overload function: setUniformVec3(string, vec3_table) +-- +-- @function [parent=#GLProgramState] setUniformVec3 -- @param self -- @param #string str -- @param #vec3_table vec3 - + -------------------------------- -- @function [parent=#GLProgramState] setGLProgram -- @param self -- @param #cc.GLProgram glprogram -------------------------------- --- @function [parent=#GLProgramState] setUniformVec4 +-- overload function: setUniformVec4(int, vec4_table) +-- +-- overload function: setUniformVec4(string, vec4_table) +-- +-- @function [parent=#GLProgramState] setUniformVec4 -- @param self -- @param #string str -- @param #vec4_table vec4 - + -------------------------------- -- @function [parent=#GLProgramState] getVertexAttribCount -- @param self -- @return long#long ret (return value: long) -------------------------------- --- @function [parent=#GLProgramState] setUniformInt +-- overload function: setUniformInt(int, int) +-- +-- overload function: setUniformInt(string, int) +-- +-- @function [parent=#GLProgramState] setUniformInt -- @param self -- @param #string str -- @param #int int - + -------------------------------- --- @function [parent=#GLProgramState] setUniformVec2 +-- overload function: setUniformVec2(int, vec2_table) +-- +-- overload function: setUniformVec2(string, vec2_table) +-- +-- @function [parent=#GLProgramState] setUniformVec2 -- @param self -- @param #string str -- @param #vec2_table vec2 - + -------------------------------- -- @function [parent=#GLProgramState] getVertexAttribsFlags -- @param self diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index ab816c52e4..04406ad37a 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -9783,6 +9783,36 @@ int lua_cocos2dx_GLProgramState_setUniformTexture(lua_State* tolua_S) } }while(0); ok = true; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + + if (!ok) { break; } + cocos2d::Texture2D* arg1; + ok &= luaval_to_object(tolua_S, 3, "cc.Texture2D",&arg1); + + if (!ok) { break; } + cobj->setUniformTexture(arg0, arg1); + return 0; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); + + if (!ok) { break; } + unsigned int arg1; + ok &= luaval_to_uint32(tolua_S, 3,&arg1); + + if (!ok) { break; } + cobj->setUniformTexture(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformTexture",argc, 2); return 0; @@ -9798,40 +9828,52 @@ int lua_cocos2dx_GLProgramState_setUniformMat4(lua_State* tolua_S) int argc = 0; cocos2d::GLProgramState* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformMat4'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - cocos2d::Mat4 arg1; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + cocos2d::Mat4 arg1; + ok &= luaval_to_mat4(tolua_S, 3, &arg1); - ok &= luaval_to_mat4(tolua_S, 3, &arg1); - if(!ok) + if (!ok) { break; } + cobj->setUniformMat4(arg0, arg1); return 0; - cobj->setUniformMat4(arg0, arg1); - return 0; - } + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + cocos2d::Mat4 arg1; + ok &= luaval_to_mat4(tolua_S, 3, &arg1); + + if (!ok) { break; } + cobj->setUniformMat4(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformMat4",argc, 2); return 0; @@ -9891,40 +9933,52 @@ int lua_cocos2dx_GLProgramState_setUniformFloat(lua_State* tolua_S) int argc = 0; cocos2d::GLProgramState* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformFloat'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - double arg1; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + double arg1; + ok &= luaval_to_number(tolua_S, 3,&arg1); - ok &= luaval_to_number(tolua_S, 3,&arg1); - if(!ok) + if (!ok) { break; } + cobj->setUniformFloat(arg0, arg1); return 0; - cobj->setUniformFloat(arg0, arg1); - return 0; - } + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + double arg1; + ok &= luaval_to_number(tolua_S, 3,&arg1); + + if (!ok) { break; } + cobj->setUniformFloat(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformFloat",argc, 2); return 0; @@ -9940,40 +9994,52 @@ int lua_cocos2dx_GLProgramState_setUniformVec3(lua_State* tolua_S) int argc = 0; cocos2d::GLProgramState* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformVec3'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - cocos2d::Vec3 arg1; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + cocos2d::Vec3 arg1; + ok &= luaval_to_vec3(tolua_S, 3, &arg1); - ok &= luaval_to_vec3(tolua_S, 3, &arg1); - if(!ok) + if (!ok) { break; } + cobj->setUniformVec3(arg0, arg1); return 0; - cobj->setUniformVec3(arg0, arg1); - return 0; - } + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + cocos2d::Vec3 arg1; + ok &= luaval_to_vec3(tolua_S, 3, &arg1); + + if (!ok) { break; } + cobj->setUniformVec3(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformVec3",argc, 2); return 0; @@ -10035,40 +10101,52 @@ int lua_cocos2dx_GLProgramState_setUniformVec4(lua_State* tolua_S) int argc = 0; cocos2d::GLProgramState* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformVec4'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - cocos2d::Vec4 arg1; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + cocos2d::Vec4 arg1; + ok &= luaval_to_vec4(tolua_S, 3, &arg1); - ok &= luaval_to_vec4(tolua_S, 3, &arg1); - if(!ok) + if (!ok) { break; } + cobj->setUniformVec4(arg0, arg1); return 0; - cobj->setUniformVec4(arg0, arg1); - return 0; - } + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + cocos2d::Vec4 arg1; + ok &= luaval_to_vec4(tolua_S, 3, &arg1); + + if (!ok) { break; } + cobj->setUniformVec4(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformVec4",argc, 2); return 0; @@ -10128,40 +10206,52 @@ int lua_cocos2dx_GLProgramState_setUniformInt(lua_State* tolua_S) int argc = 0; cocos2d::GLProgramState* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformInt'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - int arg1; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + int arg1; + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1); - ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1); - if(!ok) + if (!ok) { break; } + cobj->setUniformInt(arg0, arg1); return 0; - cobj->setUniformInt(arg0, arg1); - return 0; - } + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + int arg1; + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1); + + if (!ok) { break; } + cobj->setUniformInt(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformInt",argc, 2); return 0; @@ -10177,40 +10267,52 @@ int lua_cocos2dx_GLProgramState_setUniformVec2(lua_State* tolua_S) int argc = 0; cocos2d::GLProgramState* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.GLProgramState",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::GLProgramState*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLProgramState_setUniformVec2'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - cocos2d::Vec2 arg1; + do{ + if (argc == 2) { + int arg0; + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0); - ok &= luaval_to_std_string(tolua_S, 2,&arg0); + if (!ok) { break; } + cocos2d::Vec2 arg1; + ok &= luaval_to_vec2(tolua_S, 3, &arg1); - ok &= luaval_to_vec2(tolua_S, 3, &arg1); - if(!ok) + if (!ok) { break; } + cobj->setUniformVec2(arg0, arg1); return 0; - cobj->setUniformVec2(arg0, arg1); - return 0; - } + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0); + + if (!ok) { break; } + cocos2d::Vec2 arg1; + ok &= luaval_to_vec2(tolua_S, 3, &arg1); + + if (!ok) { break; } + cobj->setUniformVec2(arg0, arg1); + return 0; + } + }while(0); + ok = true; CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setUniformVec2",argc, 2); return 0; From 054f8c5d11f2850dc5751227d59a5f0ee60fa441 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 27 Jun 2014 08:38:35 +0000 Subject: [PATCH 8/9] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 269c472f7b..e73ae80c98 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -957,6 +957,7 @@ "cocos/ui/UIButton.h", "cocos/ui/UICheckBox.cpp", "cocos/ui/UICheckBox.h", + "cocos/ui/UIDeprecated.cpp", "cocos/ui/UIDeprecated.h", "cocos/ui/UIHBox.cpp", "cocos/ui/UIHBox.h", From 145ae387c90addd0bc97692e08f14e7c594e7aa3 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 27 Jun 2014 16:38:41 +0800 Subject: [PATCH 9/9] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 8bce3fb465..76c1dd5fb8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ cocos2d-x-3.2 ??? + [NEW] GLProgramState: can use uniform location to get/set uniform values [NEW] HttpClient: added sendImmediate() [NEW] Label: support setting line height and additional kerning of label that not using system font [NEW] Lua-binding: Animation3D supported