summaryrefslogtreecommitdiff
path: root/drivers/convex_decomp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/convex_decomp')
-rw-r--r--drivers/convex_decomp/SCsub7
-rw-r--r--drivers/convex_decomp/b2Glue.h12
-rw-r--r--drivers/convex_decomp/b2Polygon.cpp18
-rw-r--r--drivers/convex_decomp/b2Polygon.h8
-rw-r--r--drivers/convex_decomp/b2d_decompose.cpp30
-rw-r--r--drivers/convex_decomp/b2d_decompose.h28
6 files changed, 83 insertions, 20 deletions
diff --git a/drivers/convex_decomp/SCsub b/drivers/convex_decomp/SCsub
index 6699efef75..ee39fd2631 100644
--- a/drivers/convex_decomp/SCsub
+++ b/drivers/convex_decomp/SCsub
@@ -1,4 +1,7 @@
+#!/usr/bin/env python
+
Import('env')
-Export('env');
-env.add_source_files(env.drivers_sources,"*.cpp")
+env.add_source_files(env.drivers_sources, "*.cpp")
+
+Export('env')
diff --git a/drivers/convex_decomp/b2Glue.h b/drivers/convex_decomp/b2Glue.h
index 7ec6d7f181..425486356e 100644
--- a/drivers/convex_decomp/b2Glue.h
+++ b/drivers/convex_decomp/b2Glue.h
@@ -134,11 +134,13 @@ struct b2Vec2
return length;
}
- ///// Does this vector contain finite coordinates?
- //bool IsValid() const
- //{
- // return b2IsValid(x) && b2IsValid(y);
- //}
+ /*
+ /// Does this vector contain finite coordinates?
+ bool IsValid() const
+ {
+ return b2IsValid(x) && b2IsValid(y);
+ }
+ */
float32 x, y;
};
diff --git a/drivers/convex_decomp/b2Polygon.cpp b/drivers/convex_decomp/b2Polygon.cpp
index 73955d3573..f45d98250a 100644
--- a/drivers/convex_decomp/b2Polygon.cpp
+++ b/drivers/convex_decomp/b2Polygon.cpp
@@ -189,7 +189,7 @@ void b2Polygon::MergeParallelEdges(float32 tolerance) {
x = newx;
y = newy;
nVertices = newNVertices;
-// printf("%d \n", newNVertices);
+ //printf("%d \n", newNVertices);
}
/*
@@ -436,7 +436,6 @@ bool b2Polygon::IsSimple() {
* For internal use.
*/
b2Polygon* b2Polygon::Add(b2Triangle& t) {
-// float32 equalTol = .001f;
// First, find vertices that connect
int32 firstP = -1;
int32 firstT = -1;
@@ -963,7 +962,7 @@ int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys) {
tempP.Set(*p);
ReversePolygon(tempP.x, tempP.y, tempP.nVertices);
nTri = TriangulatePolygon(tempP.x, tempP.y, tempP.nVertices, triangulated);
-// ReversePolygon(p->x, p->y, p->nVertices); //reset orientation
+ //ReversePolygon(p->x, p->y, p->nVertices); //reset orientation
} else {
//printf("It is not ccw \n");
nTri = TriangulatePolygon(p->x, p->y, p->nVertices, triangulated);
@@ -997,7 +996,7 @@ void DecomposeConvexAndAddTo(b2Polygon* p, b2Body* bd, b2FixtureDef* prototype)
if (p->nVertices < 3) return;
b2Polygon* decomposed = new b2Polygon[p->nVertices - 2]; //maximum number of polys
int32 nPolys = DecomposeConvex(p, decomposed, p->nVertices - 2);
-// printf("npolys: %d",nPolys);
+ //printf("npolys: %d",nPolys);
b2FixtureDef* pdarray = new b2FixtureDef[2*p->nVertices];//extra space in case of splits
int32 extra = 0;
for (int32 i = 0; i < nPolys; ++i) {
@@ -1362,14 +1361,15 @@ b2Polygon TraceEdge(b2Polygon* p){
//printf("knode %d on node %d now has %d connections\n",k,j,knode->nConnected);
//printf("Found duplicate point.\n");
}
- //printf("Orphaning node at address %d\n",(int)jnode);
- //for (int32 k=0; k<njConn; ++k) {
- // if (jnode->connected[k]->IsConnectedTo(*jnode)) printf("Problem!!!\n");
- //}
/*
+ printf("Orphaning node at address %d\n",(int)jnode);
+ for (int32 k=0; k<njConn; ++k) {
+ if (jnode->connected[k]->IsConnectedTo(*jnode)) printf("Problem!!!\n");
+ }
for (int32 k=0; k < njConn; ++k){
jnode->RemoveConnectionByIndex(k);
- }*/
+ }
+ */
jnode->nConnected = 0;
}
}
diff --git a/drivers/convex_decomp/b2Polygon.h b/drivers/convex_decomp/b2Polygon.h
index 36af2fd9d0..c466e28f7e 100644
--- a/drivers/convex_decomp/b2Polygon.h
+++ b/drivers/convex_decomp/b2Polygon.h
@@ -74,9 +74,11 @@ public:
void print(){
printFormatted();
-// for (int32 i=0; i<nVertices; ++i){
-// printf("i: %d, x:%f, y:%f\n",i,x[i],y[i]);
-// }
+ /*
+ for (int32 i=0; i<nVertices; ++i){
+ printf("i: %d, x:%f, y:%f\n",i,x[i],y[i]);
+ }
+ */
}
void printFormatted(){
diff --git a/drivers/convex_decomp/b2d_decompose.cpp b/drivers/convex_decomp/b2d_decompose.cpp
index 1567fd0d44..f84faaf586 100644
--- a/drivers/convex_decomp/b2d_decompose.cpp
+++ b/drivers/convex_decomp/b2d_decompose.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* b2d_decompose.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "b2d_decompose.h"
#include "b2Polygon.h"
@@ -116,7 +144,7 @@ static Vector< Vector<Vector2> > _b2d_decompose(const Vector<Vector2>& p_polygon
Skip:
;
}
-// delete[] pdarray;
+ //delete[] pdarray;
delete[] decomposed;
delete p;
return res;// pdarray; //needs to be deleted after body is created
diff --git a/drivers/convex_decomp/b2d_decompose.h b/drivers/convex_decomp/b2d_decompose.h
index 44aa004120..3a35ca140d 100644
--- a/drivers/convex_decomp/b2d_decompose.h
+++ b/drivers/convex_decomp/b2d_decompose.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* b2d_decompose.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 B2D_DECOMPOSE_H
#define B2D_DECOMPOSE_H