forked from jwagner/box2d2-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changes.patch
195 lines (191 loc) · 5.84 KB
/
changes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
diff -r 91f57f867c94 Box2D/Collision/Features.js
--- a/Box2D/Collision/Features.js Sun Apr 18 20:55:05 2010 +0200
+++ b/Box2D/Collision/Features.js Sun Apr 18 21:00:19 2010 +0200
@@ -2,6 +2,36 @@
this.__varz();
this.__constructor.apply(this, arguments);
}
+Features.prototype = {
+ get referenceEdge() {
+ return this._referenceEdge;
+ },
+ set referenceEdge(value) {
+ this._referenceEdge = value;
+ this._m_id._key = (this._m_id._key & 0xffffff00) | (this._referenceEdge & 0x000000ff);
+ },
+ get incidentEdge() {
+ return this._incidentEdge;
+ },
+ set incidentEdge(value) {
+ this._incidentEdge = value;
+ this._m_id._key = (this._m_id._key & 0xffff00ff) | ((this._incidentEdge << 8) & 0x0000ff00);
+ },
+ set incidentVertex(value) {
+ this._incidentVertex = value;
+ this._m_id._key = (this._m_id._key & 0xff00ffff) | ((this._incidentVertex << 16) & 0x00ff0000);
+ },
+ get incidentVertex() {
+ return this._incidentVertex;
+ },
+ set flip(value) {
+ this._flip = value;
+ this._m_id._key = (this._m_id._key & 0x00ffffff) | ((this._flip << 24) & 0xff000000);
+ },
+ get flip() {
+ return this._flip;
+ }
+}
Features.prototype.__constructor = function(){}
Features.prototype.__varz = function(){
}
@@ -13,32 +43,3 @@
Features.prototype._incidentVertex = 0;
Features.prototype._flip = 0;
Features.prototype._m_id = null;
-// methods
-Features.prototype.set = function (value) {
- this._referenceEdge = value;
- this._m_id._key = (this._m_id._key & 0xffffff00) | (this._referenceEdge & 0x000000ff);
- }
-Features.prototype.get = function () {
- return this._referenceEdge;
- }
-Features.prototype.set = function (value) {
- this._incidentEdge = value;
- this._m_id._key = (this._m_id._key & 0xffff00ff) | ((this._incidentEdge << 8) & 0x0000ff00);
- }
-Features.prototype.get = function () {
- return this._incidentEdge;
- }
-Features.prototype.set = function (value) {
- this._incidentVertex = value;
- this._m_id._key = (this._m_id._key & 0xff00ffff) | ((this._incidentVertex << 16) & 0x00ff0000);
- }
-Features.prototype.get = function () {
- return this._incidentVertex;
- }
-Features.prototype.set = function (value) {
- this._flip = value;
- this._m_id._key = (this._m_id._key & 0x00ffffff) | ((this._flip << 24) & 0xff000000);
- }
-Features.prototype.get = function () {
- return this._flip;
- }
\ No newline at end of file
diff -r 91f57f867c94 Box2D/Collision/Shapes/b2PolygonShape.js
--- a/Box2D/Collision/Shapes/b2PolygonShape.js Sun Apr 18 20:55:05 2010 +0200
+++ b/Box2D/Collision/Shapes/b2PolygonShape.js Sun Apr 18 21:00:19 2010 +0200
@@ -102,7 +102,6 @@
b2PolygonShape.ComputeCentroid = function (vs, count) {
-
var c = new b2Vec2();
var area = 0.0;
@@ -574,4 +573,4 @@
if (dX > this.m_sweepRadius) this.m_sweepRadius = dX;
}
- }
\ No newline at end of file
+ }
diff -r 91f57f867c94 Box2D/Collision/b2ContactID.js
--- a/Box2D/Collision/b2ContactID.js Sun Apr 18 20:55:05 2010 +0200
+++ b/Box2D/Collision/b2ContactID.js Sun Apr 18 21:00:19 2010 +0200
@@ -2,12 +2,23 @@
this.__varz();
this.__constructor.apply(this, arguments);
}
+b2ContactID.prototype = {
+ get key() {
+ return this._key;
+ },
+ set key(value) {
+ this._key = value;
+ this.features._referenceEdge = this._key & 0x000000ff;
+ this.features._incidentEdge = ((this._key & 0x0000ff00) >> 8) & 0x000000ff;
+ this.features._incidentVertex = ((this._key & 0x00ff0000) >> 16) & 0x000000ff;
+ this.features._flip = ((this._key & 0xff000000) >> 24) & 0x000000ff;
+ }
+}
b2ContactID.prototype.__constructor = function () {
this.features._m_id = this;
-
- }
+}
b2ContactID.prototype.__varz = function(){
-this.features = new Features();
+ this.features = new Features();
}
// static attributes
// static methods
@@ -16,20 +27,10 @@
b2ContactID.prototype._key = 0;
// methods
b2ContactID.prototype.Set = function (id) {
- key = id._key;
- }
+ this.key = id._key;
+}
b2ContactID.prototype.Copy = function () {
- var id = new b2ContactID();
- id.key = key;
- return id;
- }
-b2ContactID.prototype.get = function () {
- return this._key;
- }
-b2ContactID.prototype.set = function (value) {
- this._key = value;
- this.features._referenceEdge = this._key & 0x000000ff;
- this.features._incidentEdge = ((this._key & 0x0000ff00) >> 8) & 0x000000ff;
- this.features._incidentVertex = ((this._key & 0x00ff0000) >> 16) & 0x000000ff;
- this.features._flip = ((this._key & 0xff000000) >> 24) & 0x000000ff;
- }
\ No newline at end of file
+ var id = new b2ContactID();
+ id.key = this._key;
+ return id;
+}
diff -r 91f57f867c94 Box2D/Common/Math/b2Vec2.js
--- a/Box2D/Common/Math/b2Vec2.js Sun Apr 18 20:55:05 2010 +0200
+++ b/Box2D/Common/Math/b2Vec2.js Sun Apr 18 21:00:19 2010 +0200
@@ -1,9 +1,7 @@
-var b2Vec2 = function() {
-this.__varz();
-this.__constructor.apply(this, arguments);
-}
-b2Vec2.prototype.__constructor = function (x_, y_) {this.x=x_; this.y=y_;}
-b2Vec2.prototype.__varz = function(){
+var b2Vec2 = function(x_, y_) {
+ if(arguments.length == 2) {
+ this.x=x_; this.y=y_;
+ }
}
// static attributes
// static methods
@@ -11,8 +9,8 @@
return new b2Vec2(x_, y_);
}
// attributes
-b2Vec2.prototype.x = null;
-b2Vec2.prototype.y = null;
+b2Vec2.prototype.x = 0;
+b2Vec2.prototype.y = 0;
// methods
b2Vec2.prototype.SetZero = function () { this.x = 0.0; this.y = 0.0; }
b2Vec2.prototype.Set = function (x_, y_) {this.x=x_; this.y=y_;}
@@ -82,4 +80,4 @@
}
b2Vec2.prototype.IsValid = function () {
return b2Math.b2IsValid(this.x) && b2Math.b2IsValid(this.y);
- }
\ No newline at end of file
+ }
diff -r 91f57f867c94 Box2D/Common/b2Settings.js
--- a/Box2D/Common/b2Settings.js Sun Apr 18 20:55:05 2010 +0200
+++ b/Box2D/Common/b2Settings.js Sun Apr 18 21:00:19 2010 +0200
@@ -35,4 +35,4 @@
}
}
// attributes
-// methods
\ No newline at end of file
+// methods