mirror of https://github.com/axmolengine/axmol.git
Merge branch 'fix_spritepolygon2' of https://github.com/Wu-Hao/cocos2d-x into v3_update_spritepolygon
This commit is contained in:
commit
17b1dee363
|
@ -1840,10 +1840,10 @@
|
|||
826294331AAF001C00CB7CF7 /* HttpAsynConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2A1A5349A3004E4C60 /* HttpAsynConnection.m */; };
|
||||
826294341AAF003E00CB7CF7 /* HttpClient-apple.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2B1A5349A3004E4C60 /* HttpClient-apple.mm */; };
|
||||
826294351AAF004C00CB7CF7 /* HttpCookie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52B47A2C1A5349A3004E4C60 /* HttpCookie.cpp */; };
|
||||
8525E3A21B291E42008EE815 /* clipper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 8525E3A11B291E42008EE815 /* clipper.hpp */; };
|
||||
8525E3A31B291E42008EE815 /* clipper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 8525E3A11B291E42008EE815 /* clipper.hpp */; };
|
||||
85B3743A1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; };
|
||||
85B3743B1B204B9400C488D6 /* clipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B374381B204B9400C488D6 /* clipper.cpp */; };
|
||||
85B3743C1B204B9400C488D6 /* clipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 85B374391B204B9400C488D6 /* clipper.h */; };
|
||||
85B3743D1B204B9400C488D6 /* clipper.h in Headers */ = {isa = PBXBuildFile; fileRef = 85B374391B204B9400C488D6 /* clipper.h */; };
|
||||
A07A4CAF1783777C0073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1551A342158F2AB200E66CFE /* Foundation.framework */; };
|
||||
B2165EEA19921124000BE3E6 /* CCPrimitiveCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B257B45E198A353E00D9A687 /* CCPrimitiveCommand.cpp */; };
|
||||
B217703C1977ECB4009EE11B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B217703B1977ECB4009EE11B /* IOKit.framework */; };
|
||||
|
@ -4487,8 +4487,8 @@
|
|||
5E9F61231A3FFE3D0038DE01 /* CCFrustum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFrustum.h; sourceTree = "<group>"; };
|
||||
5E9F61241A3FFE3D0038DE01 /* CCPlane.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPlane.cpp; sourceTree = "<group>"; };
|
||||
5E9F61251A3FFE3D0038DE01 /* CCPlane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlane.h; sourceTree = "<group>"; };
|
||||
8525E3A11B291E42008EE815 /* clipper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = clipper.hpp; sourceTree = "<group>"; };
|
||||
85B374381B204B9400C488D6 /* clipper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipper.cpp; sourceTree = "<group>"; };
|
||||
85B374391B204B9400C488D6 /* clipper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clipper.h; sourceTree = "<group>"; };
|
||||
A07A4D641783777C0073F6A7 /* libcocos2d iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libcocos2d iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B20564AA1A6E5744001C1B6E /* ccShader_PositionColorTextureAsPointsize.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_PositionColorTextureAsPointsize.vert; sourceTree = "<group>"; };
|
||||
B217703B1977ECB4009EE11B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
|
@ -7550,8 +7550,8 @@
|
|||
68B39B391B1C5C670084F72C /* clipper */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8525E3A11B291E42008EE815 /* clipper.hpp */,
|
||||
85B374381B204B9400C488D6 /* clipper.cpp */,
|
||||
85B374391B204B9400C488D6 /* clipper.h */,
|
||||
);
|
||||
name = clipper;
|
||||
path = ../external/clipper;
|
||||
|
@ -8553,7 +8553,6 @@
|
|||
292DB14B19B4574100A80320 /* UIEditBoxImpl-mac.h in Headers */,
|
||||
B6CAB39D1AF9AA1A00B9B856 /* btCharacterControllerInterface.h in Headers */,
|
||||
B29A7E3F19EE1B7700872B35 /* AnimationState.h in Headers */,
|
||||
85B3743C1B204B9400C488D6 /* clipper.h in Headers */,
|
||||
B6CAB50F1AF9AA1A00B9B856 /* btList.h in Headers */,
|
||||
D0FD03591A3B51AA00825BB5 /* CCAllocatorStrategyDefault.h in Headers */,
|
||||
B665E2901AA80A6500DDB1C5 /* CCPUDynamicAttributeTranslator.h in Headers */,
|
||||
|
@ -9221,6 +9220,7 @@
|
|||
15AE183219AAD2F700C27E9E /* CCOBB.h in Headers */,
|
||||
15AE1BE319AAE01E00C27E9E /* CCScrollView.h in Headers */,
|
||||
B665E2941AA80A6500DDB1C5 /* CCPUEmitter.h in Headers */,
|
||||
8525E3A21B291E42008EE815 /* clipper.hpp in Headers */,
|
||||
15FB209D1AE7C57D00C31518 /* sweep_context.h in Headers */,
|
||||
50CB247519D9C5A100687767 /* AudioCache.h in Headers */,
|
||||
3823841C1A2590D2002C4610 /* ComAudioReader.h in Headers */,
|
||||
|
@ -9766,7 +9766,6 @@
|
|||
B6CAB2EC1AF9AA1A00B9B856 /* btStaticPlaneShape.h in Headers */,
|
||||
B6CAB2DC1AF9AA1A00B9B856 /* btPolyhedralConvexShape.h in Headers */,
|
||||
292DB14819B4574100A80320 /* UIEditBoxImpl-ios.h in Headers */,
|
||||
85B3743D1B204B9400C488D6 /* clipper.h in Headers */,
|
||||
B6CAB54A1AF9AA1A00B9B856 /* MiniCLTaskScheduler.h in Headers */,
|
||||
B6CAB3621AF9AA1A00B9B856 /* gim_tri_collision.h in Headers */,
|
||||
3E2BDADE19C030ED0055CDCD /* AudioEngine.h in Headers */,
|
||||
|
@ -9829,6 +9828,7 @@
|
|||
B665E2AD1AA80A6500DDB1C5 /* CCPUFlockCenteringAffector.h in Headers */,
|
||||
15AE196B19AAD35100C27E9E /* DictionaryHelper.h in Headers */,
|
||||
B6CAB4C21AF9AA1A00B9B856 /* SpuLibspe2Support.h in Headers */,
|
||||
8525E3A31B291E42008EE815 /* clipper.hpp in Headers */,
|
||||
B6CAB5021AF9AA1A00B9B856 /* btConvexHullComputer.h in Headers */,
|
||||
B665E2411AA80A6500DDB1C5 /* CCPUCircleEmitterTranslator.h in Headers */,
|
||||
B6CAB2BA1AF9AA1A00B9B856 /* btConvexTriangleMeshShape.h in Headers */,
|
||||
|
|
|
@ -29,13 +29,14 @@ THE SOFTWARE.
|
|||
#include "poly2tri/poly2tri.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "clipper/clipper.h"
|
||||
#include "clipper/clipper.hpp"
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
static unsigned short quadIndices[]={0,1,2, 3,2,1};
|
||||
const static float PRECISION = 10.0f;
|
||||
|
||||
PolygonInfo::PolygonInfo(const PolygonInfo& other):
|
||||
triangles(),
|
||||
|
@ -483,11 +484,11 @@ std::vector<Vec2> AutoPolygon::expand(const std::vector<Vec2>& points, const coc
|
|||
ClipperLib::PolyTree out;
|
||||
for(std::vector<Vec2>::const_iterator it = points.begin(); it<points.end(); it++)
|
||||
{
|
||||
subj << ClipperLib::IntPoint(it->x, it->y);
|
||||
subj << ClipperLib::IntPoint(it-> x* PRECISION, it->y * PRECISION);
|
||||
}
|
||||
ClipperLib::ClipperOffset co;
|
||||
co.AddPath(subj, ClipperLib::jtMiter, ClipperLib::etClosedPolygon);
|
||||
co.Execute(solution, epsilon);
|
||||
co.Execute(solution, epsilon * PRECISION);
|
||||
|
||||
ClipperLib::PolyNode* p = solution.GetFirst();
|
||||
if(!p)
|
||||
|
@ -508,9 +509,9 @@ std::vector<Vec2> AutoPolygon::expand(const std::vector<Vec2>& points, const coc
|
|||
//create the clipping rect
|
||||
ClipperLib::Path clamp;
|
||||
clamp.push_back(ClipperLib::IntPoint(0, 0));
|
||||
clamp.push_back(ClipperLib::IntPoint(rect.size.width/_scaleFactor, 0));
|
||||
clamp.push_back(ClipperLib::IntPoint(rect.size.width/_scaleFactor, rect.size.height/_scaleFactor));
|
||||
clamp.push_back(ClipperLib::IntPoint(0, rect.size.height/_scaleFactor));
|
||||
clamp.push_back(ClipperLib::IntPoint(rect.size.width/_scaleFactor * PRECISION, 0));
|
||||
clamp.push_back(ClipperLib::IntPoint(rect.size.width/_scaleFactor * PRECISION, rect.size.height/_scaleFactor * PRECISION));
|
||||
clamp.push_back(ClipperLib::IntPoint(0, rect.size.height/_scaleFactor * PRECISION));
|
||||
cl.AddPath(clamp, ClipperLib::ptClip, true);
|
||||
cl.Execute(ClipperLib::ctIntersection, out);
|
||||
|
||||
|
@ -522,7 +523,7 @@ std::vector<Vec2> AutoPolygon::expand(const std::vector<Vec2>& points, const coc
|
|||
auto end = p2->Contour.end();
|
||||
for(std::vector<ClipperLib::IntPoint>::const_iterator pt = p2->Contour.begin(); pt < end; pt++)
|
||||
{
|
||||
outPoints.push_back(Vec2(pt->X, pt->Y));
|
||||
outPoints.push_back(Vec2(pt->X/PRECISION, pt->Y/PRECISION));
|
||||
}
|
||||
return outPoints;
|
||||
}
|
||||
|
|
|
@ -445,17 +445,6 @@ void Sprite::debugDraw(bool on)
|
|||
}
|
||||
draw->setVisible(true);
|
||||
draw->clear();
|
||||
//draw all points
|
||||
auto positions = new (std::nothrow) Vec2[_polyInfo.triangles.vertCount];
|
||||
Vec2 *pos = &positions[0];
|
||||
auto verts = _polyInfo.triangles.verts;
|
||||
auto end = &verts[_polyInfo.triangles.vertCount];
|
||||
for(V3F_C4B_T2F *v = verts; v != end; pos++, v++)
|
||||
{
|
||||
pos->x = v->vertices.x;
|
||||
pos->y = v->vertices.y;
|
||||
}
|
||||
draw->drawPoints(positions, (unsigned int)_polyInfo.triangles.vertCount, 8, Color4F(0.0f, 1.0f, 1.0f, 1.0f));
|
||||
//draw lines
|
||||
auto last = _polyInfo.triangles.indexCount/3;
|
||||
auto _indices = _polyInfo.triangles.indices;
|
||||
|
@ -475,7 +464,6 @@ void Sprite::debugDraw(bool on)
|
|||
to = _verts[_indices[i*3]].vertices;
|
||||
draw->drawLine(Vec2(from.x, from.y), Vec2(to.x,to.y), Color4F::GREEN);
|
||||
}
|
||||
CC_SAFE_DELETE_ARRAY(positions);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -896,7 +896,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\..\extensions\Particle3D\PU\CCPUVortexAffectorTranslator.h" />
|
||||
<ClInclude Include="..\..\extensions\physics-nodes\CCPhysicsDebugNode.h" />
|
||||
<ClInclude Include="..\..\extensions\physics-nodes\CCPhysicsSprite.h" />
|
||||
<ClInclude Include="..\..\external\clipper\clipper.h" />
|
||||
<ClInclude Include="..\..\external\clipper\clipper.hpp" />
|
||||
<ClInclude Include="..\..\external\ConvertUTF\ConvertUTF.h" />
|
||||
<ClInclude Include="..\..\external\edtaa3func\edtaa3func.h" />
|
||||
<ClInclude Include="..\..\external\flatbuffers\flatbuffers.h" />
|
||||
|
|
|
@ -3662,7 +3662,7 @@
|
|||
<ClInclude Include="CCAutoPolygon.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\external\clipper\clipper.h">
|
||||
<ClInclude Include="..\..\external\clipper\clipper.hpp">
|
||||
<Filter>external\clipper</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\extensions\Particle3D\PU\CCPUVortexAffectorTranslator.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\extensions\physics-nodes\CCPhysicsDebugNode.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\extensions\physics-nodes\CCPhysicsSprite.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\clipper\clipper.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\clipper\clipper.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\ConvertUTF\ConvertUTF.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\edtaa3func\edtaa3func.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\flatbuffers\flatbuffers.h" />
|
||||
|
|
|
@ -1822,7 +1822,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCAutoPolygon.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\clipper\clipper.h">
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\..\external\clipper\clipper.hpp">
|
||||
<Filter>external\clipper</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version":"v3-deps-63",
|
||||
"version":"v3-deps-64",
|
||||
"zip_file_size":"138162176",
|
||||
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
||||
"repo_parent":"https://github.com/cocos2d/",
|
||||
|
|
Loading…
Reference in New Issue