mirror of https://github.com/axmolengine/axmol.git
fix Layout and ClippingNode nested rendering issue
This commit is contained in:
parent
dfe4999a06
commit
9c2130e88a
|
@ -1234,6 +1234,11 @@
|
|||
2980F02B1BA9A5550059E678 /* UITextView+CCUITextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 2980F0201BA9A5550059E678 /* UITextView+CCUITextInput.h */; };
|
||||
2980F02C1BA9A5550059E678 /* UITextView+CCUITextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */; };
|
||||
2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; };
|
||||
298C75D51C0465D0006BAE63 /* CCStencilBitsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 298C75D31C0465D0006BAE63 /* CCStencilBitsManager.cpp */; };
|
||||
298C75D61C0465D1006BAE63 /* CCStencilBitsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 298C75D31C0465D0006BAE63 /* CCStencilBitsManager.cpp */; };
|
||||
298C75D71C0465D1006BAE63 /* CCStencilBitsManager.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 298C75D41C0465D0006BAE63 /* CCStencilBitsManager.hpp */; };
|
||||
298C75D81C0465D1006BAE63 /* CCStencilBitsManager.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 298C75D41C0465D0006BAE63 /* CCStencilBitsManager.hpp */; };
|
||||
298C75D91C04681F006BAE63 /* CCStencilBitsManager.hpp in Sources */ = {isa = PBXBuildFile; fileRef = 298C75D41C0465D0006BAE63 /* CCStencilBitsManager.hpp */; };
|
||||
299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
|
||||
299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
|
||||
299754F6193EC95400A54AC3 /* ObjectFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 299754F3193EC95400A54AC3 /* ObjectFactory.h */; };
|
||||
|
@ -2072,10 +2077,10 @@
|
|||
B5668D7E1B3838E4003CBD5E /* UIScrollViewBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5668D7B1B3838E4003CBD5E /* UIScrollViewBar.cpp */; };
|
||||
B5668D7F1B3838E4003CBD5E /* UIScrollViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */; };
|
||||
B5668D801B3838E4003CBD5E /* UIScrollViewBar.h in Headers */ = {isa = PBXBuildFile; fileRef = B5668D7C1B3838E4003CBD5E /* UIScrollViewBar.h */; };
|
||||
B5A738961BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */; settings = {ASSET_TAGS = (); }; };
|
||||
B5A738971BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */; settings = {ASSET_TAGS = (); }; };
|
||||
B5A738981BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */; settings = {ASSET_TAGS = (); }; };
|
||||
B5A738991BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */; settings = {ASSET_TAGS = (); }; };
|
||||
B5A738961BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */; };
|
||||
B5A738971BB0051F00BAAEF8 /* UIPageViewIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A738941BB0051F00BAAEF8 /* UIPageViewIndicator.cpp */; };
|
||||
B5A738981BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */; };
|
||||
B5A738991BB0051F00BAAEF8 /* UIPageViewIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5A738951BB0051F00BAAEF8 /* UIPageViewIndicator.h */; };
|
||||
B5CE6DBE1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */; };
|
||||
B5CE6DBF1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */; };
|
||||
B5CE6DC01B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */; };
|
||||
|
@ -4144,6 +4149,8 @@
|
|||
2980F0211BA9A5550059E678 /* UITextView+CCUITextInput.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UITextView+CCUITextInput.mm"; sourceTree = "<group>"; };
|
||||
2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = "<group>"; };
|
||||
2986667918B1B079000E39CA /* CCTweenFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTweenFunction.h; sourceTree = "<group>"; };
|
||||
298C75D31C0465D0006BAE63 /* CCStencilBitsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCStencilBitsManager.cpp; path = ../base/CCStencilBitsManager.cpp; sourceTree = "<group>"; };
|
||||
298C75D41C0465D0006BAE63 /* CCStencilBitsManager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CCStencilBitsManager.hpp; path = ../base/CCStencilBitsManager.hpp; sourceTree = "<group>"; };
|
||||
299754F2193EC95400A54AC3 /* ObjectFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjectFactory.cpp; path = ../base/ObjectFactory.cpp; sourceTree = "<group>"; };
|
||||
299754F3193EC95400A54AC3 /* ObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactory.h; path = ../base/ObjectFactory.h; sourceTree = "<group>"; };
|
||||
299CF1F919A434BC00C378C1 /* ccRandom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ccRandom.cpp; path = ../base/ccRandom.cpp; sourceTree = "<group>"; };
|
||||
|
@ -6037,6 +6044,8 @@
|
|||
50ABBE1C1925AB6F00A911A9 /* utlist.h */,
|
||||
50ABBE1D1925AB6F00A911A9 /* ZipUtils.cpp */,
|
||||
50ABBE1E1925AB6F00A911A9 /* ZipUtils.h */,
|
||||
298C75D31C0465D0006BAE63 /* CCStencilBitsManager.cpp */,
|
||||
298C75D41C0465D0006BAE63 /* CCStencilBitsManager.hpp */,
|
||||
);
|
||||
name = base;
|
||||
path = ../cocos/2d;
|
||||
|
@ -9229,6 +9238,7 @@
|
|||
15AE182A19AAD2F700C27E9E /* CCMeshSkin.h in Headers */,
|
||||
B276EF5F1988D1D500CD400F /* CCVertexIndexData.h in Headers */,
|
||||
1A57007F180BC5A10088DEC7 /* CCActionInterval.h in Headers */,
|
||||
298C75D71C0465D1006BAE63 /* CCStencilBitsManager.hpp in Headers */,
|
||||
B6DD2FDB1B04825B00E47F5F /* DetourLocalBoundary.h in Headers */,
|
||||
B6CAB3491AF9AA1A00B9B856 /* gim_clip_polygon.h in Headers */,
|
||||
B677B0DB1B18492D006762CB /* CCNavMeshUtils.h in Headers */,
|
||||
|
@ -10669,6 +10679,7 @@
|
|||
85505F051B60E3B2003F2CD4 /* CCBoneNode.h in Headers */,
|
||||
B665E2491AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffectorTranslator.h in Headers */,
|
||||
B6CAB4461AF9AA1A00B9B856 /* btParallelConstraintSolver.h in Headers */,
|
||||
298C75D81C0465D1006BAE63 /* CCStencilBitsManager.hpp in Headers */,
|
||||
15AE18D119AAD33D00C27E9E /* CCNodeLoaderLibrary.h in Headers */,
|
||||
15AE1AC319AAD40300C27E9E /* b2DistanceJoint.h in Headers */,
|
||||
B6CAB5261AF9AA1A00B9B856 /* btQuickprof.h in Headers */,
|
||||
|
@ -11830,6 +11841,7 @@
|
|||
B665E2EE1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */,
|
||||
B6CAB2DD1AF9AA1A00B9B856 /* btScaledBvhTriangleMeshShape.cpp in Sources */,
|
||||
B665E4121AA80A6600DDB1C5 /* CCPUTextureAnimator.cpp in Sources */,
|
||||
298C75D51C0465D0006BAE63 /* CCStencilBitsManager.cpp in Sources */,
|
||||
B665E3D21AA80A6600DDB1C5 /* CCPUScriptLexer.cpp in Sources */,
|
||||
B665E4021AA80A6600DDB1C5 /* CCPUSphereColliderTranslator.cpp in Sources */,
|
||||
15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */,
|
||||
|
@ -11964,6 +11976,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
298C75D91C04681F006BAE63 /* CCStencilBitsManager.hpp in Sources */,
|
||||
D0FD03541A3B51AA00825BB5 /* CCAllocatorGlobalNewDelete.cpp in Sources */,
|
||||
15AE1B9819AADAA100C27E9E /* UIVideoPlayer-ios.mm in Sources */,
|
||||
B665E38F1AA80A6500DDB1C5 /* CCPUPlaneCollider.cpp in Sources */,
|
||||
|
@ -12114,6 +12127,7 @@
|
|||
15AE193C19AAD35100C27E9E /* CCArmatureDefine.cpp in Sources */,
|
||||
B665E35F1AA80A6500DDB1C5 /* CCPUOnRandomObserverTranslator.cpp in Sources */,
|
||||
B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */,
|
||||
298C75D61C0465D1006BAE63 /* CCStencilBitsManager.cpp in Sources */,
|
||||
15AE194B19AAD35100C27E9E /* CCComRender.cpp in Sources */,
|
||||
382384451A25915C002C4610 /* SpriteReader.cpp in Sources */,
|
||||
B6CAB2321AF9AA1A00B9B856 /* btCollisionWorld.cpp in Sources */,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCRenderState.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCStencilBitsManager.hpp"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
|
||||
#define CC_CLIPPING_NODE_OPENGLES 0
|
||||
|
@ -42,10 +43,7 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
static GLint g_sStencilBits = -1;
|
||||
// store the current stencil layer (position in the stencil buffer),
|
||||
// this will allow nesting up to n ClippingNode,
|
||||
// where n is the number of bits of the stencil buffer.
|
||||
static GLint s_layer = -1;
|
||||
|
||||
|
||||
#if CC_CLIPPING_NODE_OPENGLES
|
||||
static void setProgram(Node *n, GLProgram *p)
|
||||
|
@ -398,7 +396,9 @@ void ClippingNode::onBeforeVisit()
|
|||
// INIT
|
||||
|
||||
// increment the current layer
|
||||
auto s_layer = StencilBitsManager::getInstance()->getStencilLayerMask();
|
||||
s_layer++;
|
||||
StencilBitsManager::getInstance()->setStencilLayerMask(s_layer);
|
||||
|
||||
// mask of the current layer (ie: for layer 3: 00000100)
|
||||
GLint mask_layer = 0x1 << s_layer;
|
||||
|
@ -563,7 +563,9 @@ void ClippingNode::onAfterVisit()
|
|||
}
|
||||
|
||||
// we are done using this layer, decrement
|
||||
auto s_layer = StencilBitsManager::getInstance()->getStencilLayerMask();
|
||||
s_layer--;
|
||||
StencilBitsManager::getInstance()->setStencilLayerMask(s_layer);
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
@ -433,6 +433,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\base\ccFPSImages.c" />
|
||||
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="..\base\CCNinePatchImageParser.cpp" />
|
||||
<ClCompile Include="..\base\CCStencilBitsManager.cpp" />
|
||||
<ClCompile Include="..\base\CCNS.cpp" />
|
||||
<ClCompile Include="..\base\CCProfiling.cpp" />
|
||||
<ClCompile Include="..\base\CCProperties.cpp" />
|
||||
|
@ -1015,6 +1016,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\base\ccMacros.h" />
|
||||
<ClInclude Include="..\base\CCMap.h" />
|
||||
<ClInclude Include="..\base\CCNinePatchImageParser.h" />
|
||||
<ClInclude Include="..\base\CCStencilBitsManager.h" />
|
||||
<ClInclude Include="..\base\CCNS.h" />
|
||||
<ClInclude Include="..\base\CCProfiling.h" />
|
||||
<ClInclude Include="..\base\CCProperties.h" />
|
||||
|
@ -1383,4 +1385,4 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="physics">
|
||||
|
@ -1896,6 +1896,9 @@
|
|||
<ClCompile Include="..\base\CCNinePatchImageParser.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\CCStencilBitsManager.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\base\CCNinePatchImageParser.cpp" />
|
||||
<ClCompile Include="..\renderer\CCFrameBuffer.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
|
@ -3728,6 +3731,9 @@
|
|||
<ClInclude Include="..\base\CCNinePatchImageParser.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\base\CCStencilBitsManager.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\base\CCNinePatchImageParser.h" />
|
||||
<ClInclude Include="..\renderer\CCFrameBuffer.h">
|
||||
<Filter>renderer</Filter>
|
||||
|
@ -3807,4 +3813,4 @@
|
|||
<Filter>3d</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
|
@ -286,6 +286,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\ccMacros.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCMap.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNinePatchImageParser.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCStencilBitsManager.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNS.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProfiling.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProperties.h" />
|
||||
|
@ -917,6 +918,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNinePatchImageParser.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCStencilBitsManager.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNS.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProfiling.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProperties.cpp" />
|
||||
|
@ -1286,4 +1288,4 @@
|
|||
<ItemGroup>
|
||||
<Text Include="$(MSBuildThisFileDirectory)..\..\..\..\physics3d\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)targetver.h" />
|
||||
|
@ -1812,6 +1812,9 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNinePatchImageParser.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCStencilBitsManager.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\physics3d\CCPhysics3DConstraint.h">
|
||||
<Filter>physics3d</Filter>
|
||||
</ClInclude>
|
||||
|
@ -3525,6 +3528,9 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNinePatchImageParser.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCStencilBitsManager.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\physics3d\CCPhysics3DDebugDrawer.cpp">
|
||||
<Filter>physics3d</Filter>
|
||||
</ClCompile>
|
||||
|
@ -3979,4 +3985,4 @@
|
|||
<ItemGroup>
|
||||
<Text Include="$(MSBuildThisFileDirectory)..\..\..\..\physics3d\CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
|
@ -415,6 +415,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="..\..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="..\..\base\CCNinePatchImageParser.cpp" />
|
||||
<ClCompile Include="..\..\base\CCStencilBitsManager.cpp" />
|
||||
<ClCompile Include="..\..\base\CCNS.cpp" />
|
||||
<ClCompile Include="..\..\base\CCProfiling.cpp" />
|
||||
<ClCompile Include="..\..\base\CCProperties.cpp" />
|
||||
|
@ -1013,6 +1014,7 @@
|
|||
<ClInclude Include="..\..\base\ccMacros.h" />
|
||||
<ClInclude Include="..\..\base\CCMap.h" />
|
||||
<ClInclude Include="..\..\base\CCNinePatchImageParser.h" />
|
||||
<ClInclude Include="..\..\base\CCStencilBitsManager.h" />
|
||||
<ClInclude Include="..\..\base\CCNS.h" />
|
||||
<ClInclude Include="..\..\base\CCProfiling.h" />
|
||||
<ClInclude Include="..\..\base\CCProperties.h" />
|
||||
|
@ -1673,4 +1675,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Resource Files">
|
||||
|
@ -1767,6 +1767,9 @@
|
|||
<ClCompile Include="..\..\base\CCNinePatchImageParser.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\base\CCStencilBitsManager.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\renderer\CCMaterial.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
|
@ -3635,6 +3638,9 @@
|
|||
<ClInclude Include="..\..\base\CCNinePatchImageParser.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\base\CCStencilBitsManager.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\renderer\CCMaterial.h">
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
|
@ -4017,4 +4023,4 @@
|
|||
<Filter>3d</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -107,6 +107,7 @@ math/Vec2.cpp \
|
|||
math/Vec3.cpp \
|
||||
math/Vec4.cpp \
|
||||
base/CCNinePatchImageParser.cpp \
|
||||
base/CCStencilBitsManager.cpp \
|
||||
base/CCAsyncTaskPool.cpp \
|
||||
base/CCAutoreleasePool.cpp \
|
||||
base/CCConfiguration.cpp \
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
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 "CCStencilBitsManager.hpp"
|
||||
|
||||
StencilBitsManager* StencilBitsManager::_stencilBitsManager = nullptr;
|
||||
|
||||
GLint StencilBitsManager::getStencilLayerMask()const
|
||||
{
|
||||
return _stencilLayerMask;
|
||||
}
|
||||
|
||||
void StencilBitsManager::setStencilLayerMask(GLint stencilLayer)
|
||||
{
|
||||
_stencilLayerMask = stencilLayer;
|
||||
}
|
||||
|
||||
StencilBitsManager::StencilBitsManager()
|
||||
:_stencilLayerMask(-1)
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
Copyright (c) 2013-2015 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.
|
||||
****************************************************************************/
|
||||
#ifndef StencilBitsManager_hpp
|
||||
#define StencilBitsManager_hpp
|
||||
|
||||
class StencilBitsManager
|
||||
{
|
||||
public:
|
||||
static StencilBitsManager* getInstance()
|
||||
{
|
||||
if(nullptr == _stencilBitsManager)
|
||||
{
|
||||
_stencilBitsManager = new StencilBitsManager();
|
||||
}
|
||||
return _stencilBitsManager;
|
||||
}
|
||||
GLint getStencilLayerMask()const;
|
||||
void setStencilLayerMask(GLint stencilLayer);
|
||||
private:
|
||||
static StencilBitsManager* _stencilBitsManager;
|
||||
StencilBitsManager();
|
||||
StencilBitsManager(const StencilBitsManager& other);
|
||||
StencilBitsManager& operator=(const StencilBitsManager& other);
|
||||
GLint _stencilLayerMask;
|
||||
};
|
||||
|
||||
#endif /* StencilBitsManager_hpp */
|
|
@ -45,6 +45,7 @@ set(COCOS_BASE_SRC
|
|||
base/CCUserDefault.cpp
|
||||
base/CCValue.cpp
|
||||
base/ObjectFactory.cpp
|
||||
base/CCStencilBitsManager.cpp
|
||||
base/TGAlib.cpp
|
||||
base/ZipUtils.cpp
|
||||
base/allocator/CCAllocatorDiagnostics.cpp
|
||||
|
|
|
@ -37,7 +37,7 @@ THE SOFTWARE.
|
|||
#include "2d/CCLayer.h"
|
||||
#include "2d/CCSprite.h"
|
||||
#include "base/CCEventFocus.h"
|
||||
|
||||
#include "base/CCStencilBitsManager.hpp"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -47,7 +47,6 @@ static const int BACKGROUNDIMAGE_Z = (-1);
|
|||
static const int BCAKGROUNDCOLORRENDERER_Z = (-2);
|
||||
|
||||
static GLint g_sStencilBits = -1;
|
||||
static GLint s_layer = -1;
|
||||
|
||||
IMPLEMENT_CLASS_GUI_INFO(Layout)
|
||||
|
||||
|
@ -329,7 +328,9 @@ void Layout::stencilClippingVisit(Renderer *renderer, const Mat4& parentTransfor
|
|||
|
||||
void Layout::onBeforeVisitStencil()
|
||||
{
|
||||
auto s_layer = StencilBitsManager::getInstance()->getStencilLayerMask();
|
||||
s_layer++;
|
||||
StencilBitsManager::getInstance()->setStencilLayerMask(s_layer);
|
||||
GLint mask_layer = 0x1 << s_layer;
|
||||
GLint mask_layer_l = mask_layer - 1;
|
||||
_mask_layer_le = mask_layer | mask_layer_l;
|
||||
|
@ -454,7 +455,9 @@ void Layout::onAfterVisitStencil()
|
|||
glDisable(GL_STENCIL_TEST);
|
||||
// RenderState::StateBlock::_defaultState->setStencilTest(false);
|
||||
}
|
||||
auto s_layer = StencilBitsManager::getInstance()->getStencilLayerMask();
|
||||
s_layer--;
|
||||
StencilBitsManager::getInstance()->setStencilLayerMask(s_layer);
|
||||
}
|
||||
|
||||
void Layout::onBeforeVisitScissor()
|
||||
|
|
|
@ -123,6 +123,16 @@ bool UIListViewTest_Vertical::init()
|
|||
custom_item->addChild(custom_button);
|
||||
|
||||
listView->addChild(custom_item);
|
||||
|
||||
auto clippingNode = ClippingNode::create();
|
||||
auto sprite = Sprite::create("cocosui/clippingHead.jpg");
|
||||
clippingNode->addChild(sprite);
|
||||
auto stencil = Sprite::create("cocosui/clippingStencil.jpg");
|
||||
clippingNode->setStencil(stencil);
|
||||
auto custom_item_contentSize = custom_item->getContentSize();
|
||||
clippingNode->setPosition(custom_item_contentSize.width/2, custom_item_contentSize.height/2);
|
||||
clippingNode->setScale(0.5);
|
||||
custom_item->addChild(clippingNode);
|
||||
}
|
||||
// insert custom item
|
||||
Vector<Widget*>& items = listView->getItems();
|
||||
|
|
Loading…
Reference in New Issue