4
4
5
5
void handleResult (const c2Manifold&, Manifold&);
6
6
void handleResult (const c2Raycast&, const c2Ray&, Raycast&);
7
- c2AABB shapeToc2 (const Aabb&, const sf::Transform );
8
- c2Circle shapeToc2 (const Circle&, const sf::Transform );
9
- c2Ray rayToc2 (const Ray&, const sf::Transform );
7
+ c2AABB shapeToc2 (const Aabb&, const sf::Vector2f );
8
+ c2Circle shapeToc2 (const Circle&, const sf::Vector2f );
9
+ c2Ray rayToc2 (const Ray&, const sf::Vector2f );
10
10
c2v toc2v (const sf::Vector2f&);
11
11
sf::Vector2f tosfv (const c2v&);
12
12
@@ -110,11 +110,11 @@ Manifold::Manifold()
110
110
{
111
111
}
112
112
113
- void Manifold::solve (const Shape& a, const sf::Transform transformA ,
114
- const Shape& b, const sf::Transform transformB )
113
+ void Manifold::solve (const Shape& a, const sf::Vector2f positionA ,
114
+ const Shape& b, const sf::Vector2f positionB )
115
115
{
116
- mTransformA = transformA ;
117
- mTransformB = transformB ;
116
+ mPositionA = positionA ;
117
+ mPositionB = positionB ;
118
118
119
119
dispatch (a, b);
120
120
}
@@ -155,8 +155,8 @@ void Manifold::dispatch(const Shape& a, const Shape& b)
155
155
156
156
void Manifold::collide (const Aabb& a, const Aabb& b)
157
157
{
158
- c2AABB shapeA = shapeToc2 (a, mTransformA );
159
- c2AABB shapeB = shapeToc2 (b, mTransformB );
158
+ c2AABB shapeA = shapeToc2 (a, mPositionA );
159
+ c2AABB shapeB = shapeToc2 (b, mPositionB );
160
160
c2Manifold m;
161
161
c2AABBtoAABBManifold (shapeA, shapeB, &m);
162
162
@@ -165,8 +165,8 @@ void Manifold::collide(const Aabb& a, const Aabb& b)
165
165
166
166
void Manifold::collide (const Circle& a, const Circle& b)
167
167
{
168
- c2Circle shapeA = shapeToc2 (a, mTransformA );
169
- c2Circle shapeB = shapeToc2 (b, mTransformB );
168
+ c2Circle shapeA = shapeToc2 (a, mPositionA );
169
+ c2Circle shapeB = shapeToc2 (b, mPositionB );
170
170
c2Manifold m;
171
171
c2CircletoCircleManifold (shapeA, shapeB, &m);
172
172
@@ -181,8 +181,8 @@ void Manifold::collide(const Aabb& a, const Circle& b)
181
181
182
182
void Manifold::collide (const Circle& a, const Aabb& b)
183
183
{
184
- c2Circle shapeA = shapeToc2 (a, mTransformA );
185
- c2AABB shapeB = shapeToc2 (b, mTransformB );
184
+ c2Circle shapeA = shapeToc2 (a, mPositionA );
185
+ c2AABB shapeB = shapeToc2 (b, mPositionB );
186
186
c2Manifold m;
187
187
c2CircletoAABBManifold (shapeA, shapeB, &m);
188
188
@@ -196,11 +196,11 @@ Raycast::Raycast()
196
196
{
197
197
}
198
198
199
- void Raycast::solve (const Ray& a, const sf::Transform transformA ,
200
- const Shape& b, const sf::Transform transformB )
199
+ void Raycast::solve (const Ray& a, const sf::Vector2f positionA ,
200
+ const Shape& b, const sf::Vector2f positionB )
201
201
{
202
- mTransformA = transformA ;
203
- mTransformB = transformB ;
202
+ mPositionA = positionA ;
203
+ mPositionB = positionB ;
204
204
205
205
dispatch (a, b);
206
206
}
@@ -221,8 +221,8 @@ void Raycast::dispatch(const Ray& a, const Shape& b)
221
221
222
222
void Raycast::calculate (const Ray& a, const Aabb& b)
223
223
{
224
- c2Ray ray = rayToc2 (a, mTransformA );
225
- c2AABB shape = shapeToc2 (b, mTransformB );
224
+ c2Ray ray = rayToc2 (a, mPositionA );
225
+ c2AABB shape = shapeToc2 (b, mPositionB );
226
226
c2Raycast r;
227
227
hit = false ;
228
228
@@ -232,8 +232,8 @@ void Raycast::calculate(const Ray& a, const Aabb& b)
232
232
233
233
void Raycast::calculate (const Ray& a, const Circle& b)
234
234
{
235
- c2Ray ray = rayToc2 (a, mTransformA );
236
- c2Circle shape = shapeToc2 (b, mTransformB );
235
+ c2Ray ray = rayToc2 (a, mPositionA );
236
+ c2Circle shape = shapeToc2 (b, mPositionB );
237
237
c2Raycast r;
238
238
hit = false ;
239
239
@@ -260,27 +260,24 @@ void handleResult(const c2Raycast& raycast, const c2Ray& ray, Raycast& r)
260
260
r.t = raycast.t ;
261
261
}
262
262
263
- c2AABB shapeToc2 (const Aabb& aabb, const sf::Transform transform )
263
+ c2AABB shapeToc2 (const Aabb& aabb, const sf::Vector2f position )
264
264
{
265
- sf::Vector2f position = transform.transformPoint (0 .0f , 0 .0f );
266
265
c2AABB tmp;
267
266
tmp.min = toc2v (position);
268
267
tmp.max = toc2v (position + aabb.getSize ());
269
268
return tmp;
270
269
}
271
270
272
- c2Circle shapeToc2 (const Circle& circle, const sf::Transform transform )
271
+ c2Circle shapeToc2 (const Circle& circle, const sf::Vector2f position )
273
272
{
274
- sf::Vector2f position = transform.transformPoint (0 .0f , 0 .0f );
275
273
c2Circle tmp;
276
274
tmp.p = toc2v (position);
277
275
tmp.r = circle.getRadius ();
278
276
return tmp;
279
277
}
280
278
281
- c2Ray rayToc2 (const Ray& ray, const sf::Transform transform )
279
+ c2Ray rayToc2 (const Ray& ray, const sf::Vector2f position )
282
280
{
283
- sf::Vector2f position = transform.transformPoint (0 .0f , 0 .0f );
284
281
c2Ray tmp;
285
282
tmp.p = toc2v (position);
286
283
tmp.d = toc2v (ray.getDirection ());
0 commit comments