reflexion 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/application.cpp +5 -5
- data/.doc/ext/reflex/body.cpp +167 -0
- data/.doc/ext/reflex/capture_event.cpp +4 -4
- data/.doc/ext/reflex/draw_event.cpp +4 -4
- data/.doc/ext/reflex/event.cpp +4 -4
- data/.doc/ext/reflex/fixture.cpp +101 -0
- data/.doc/ext/reflex/focus_event.cpp +4 -4
- data/.doc/ext/reflex/frame_event.cpp +4 -4
- data/.doc/ext/reflex/image_view.cpp +22 -5
- data/.doc/ext/reflex/key_event.cpp +4 -4
- data/.doc/ext/reflex/native.cpp +6 -0
- data/.doc/ext/reflex/pointer_event.cpp +4 -4
- data/.doc/ext/reflex/reflex.cpp +2 -3
- data/.doc/ext/reflex/scroll_event.cpp +4 -4
- data/.doc/ext/reflex/selector.cpp +4 -4
- data/.doc/ext/reflex/style.cpp +4 -4
- data/.doc/ext/reflex/style_length.cpp +4 -4
- data/.doc/ext/reflex/style_length2.cpp +4 -4
- data/.doc/ext/reflex/style_length4.cpp +4 -4
- data/.doc/ext/reflex/update_event.cpp +4 -4
- data/.doc/ext/reflex/view.cpp +110 -8
- data/.doc/ext/reflex/wheel_event.cpp +4 -4
- data/.doc/ext/reflex/window.cpp +36 -12
- data/README.md +2 -2
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +8 -8
- data/ext/reflex/body.cpp +181 -0
- data/ext/reflex/capture_event.cpp +4 -4
- data/ext/reflex/draw_event.cpp +4 -4
- data/ext/reflex/event.cpp +4 -4
- data/ext/reflex/fixture.cpp +108 -0
- data/ext/reflex/focus_event.cpp +4 -4
- data/ext/reflex/frame_event.cpp +4 -4
- data/ext/reflex/image_view.cpp +24 -5
- data/ext/reflex/key_event.cpp +4 -4
- data/ext/reflex/native.cpp +6 -0
- data/ext/reflex/pointer_event.cpp +4 -4
- data/ext/reflex/reflex.cpp +2 -3
- data/ext/reflex/scroll_event.cpp +4 -4
- data/ext/reflex/selector.cpp +4 -4
- data/ext/reflex/style.cpp +4 -4
- data/ext/reflex/style_length.cpp +4 -4
- data/ext/reflex/style_length2.cpp +4 -4
- data/ext/reflex/style_length4.cpp +4 -4
- data/ext/reflex/update_event.cpp +4 -4
- data/ext/reflex/view.cpp +126 -12
- data/ext/reflex/wheel_event.cpp +4 -4
- data/ext/reflex/window.cpp +39 -12
- data/include/reflex/bitmap.h +20 -0
- data/include/reflex/body.h +82 -0
- data/include/reflex/bounds.h +20 -0
- data/include/reflex/color.h +20 -0
- data/include/reflex/color_space.h +20 -0
- data/include/reflex/defs.h +5 -1
- data/include/reflex/event.h +16 -25
- data/include/reflex/fixture.h +116 -0
- data/include/reflex/font.h +20 -0
- data/include/reflex/image.h +20 -0
- data/include/reflex/image_view.h +1 -1
- data/include/reflex/matrix.h +20 -0
- data/include/reflex/painter.h +20 -0
- data/include/reflex/point.h +24 -0
- data/include/reflex/ruby/application.h +6 -0
- data/include/reflex/ruby/body.h +41 -0
- data/include/reflex/ruby/event.h +68 -0
- data/include/reflex/ruby/fixture.h +41 -0
- data/include/reflex/ruby/image_view.h +14 -0
- data/include/reflex/ruby/selector.h +14 -0
- data/include/reflex/ruby/style.h +14 -0
- data/include/reflex/ruby/style_length.h +26 -0
- data/include/reflex/ruby/view.h +43 -39
- data/include/reflex/ruby/window.h +27 -21
- data/include/reflex/ruby.h +2 -0
- data/include/reflex/shader.h +20 -0
- data/include/reflex/style.h +2 -3
- data/include/reflex/texture.h +20 -0
- data/include/reflex/view.h +45 -24
- data/include/reflex/window.h +11 -14
- data/include/reflex.h +3 -0
- data/lib/reflex/application.rb +6 -2
- data/lib/reflex/body.rb +17 -0
- data/lib/reflex/fixture.rb +17 -0
- data/lib/reflex/view.rb +16 -1
- data/lib/reflex/window.rb +13 -1
- data/lib/reflex.rb +2 -0
- data/reflex.gemspec +1 -1
- data/samples/bats.rb +4 -3
- data/samples/checker.rb +4 -3
- data/samples/fans.rb +4 -3
- data/samples/fps.rb +5 -3
- data/samples/grid.rb +5 -4
- data/samples/hello.rb +1 -1
- data/samples/image.rb +3 -2
- data/samples/ios/hello/hello/main.cpp +12 -3
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +376 -123
- data/samples/key.rb +5 -4
- data/samples/layout.rb +3 -2
- data/samples/model.rb +3 -2
- data/samples/osx/hello/hello/main.cpp +12 -3
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +375 -120
- data/samples/physics.rb +37 -0
- data/samples/repl.rb +3 -2
- data/samples/shader.rb +4 -4
- data/samples/shapes.rb +4 -4
- data/samples/text.rb +6 -4
- data/samples/tree.rb +5 -4
- data/samples/views.rb +3 -2
- data/samples/visuals.rb +1 -2
- data/src/body.cpp +244 -0
- data/src/event.cpp +18 -18
- data/src/fixture.cpp +108 -0
- data/src/image_view.cpp +1 -1
- data/src/ios/native_window.h +2 -0
- data/src/ios/native_window.mm +18 -1
- data/src/ios/opengl_view.mm +8 -0
- data/src/ios/window.mm +24 -3
- data/src/ios/window_data.h +3 -3
- data/src/osx/native_window.mm +17 -1
- data/src/osx/window.mm +24 -3
- data/src/osx/window_data.h +3 -3
- data/src/physics/Box2D/Box2D.h +68 -0
- data/src/physics/Box2D/Collision/Shapes/b2ChainShape.cpp +193 -0
- data/src/physics/Box2D/Collision/Shapes/b2ChainShape.h +105 -0
- data/src/physics/Box2D/Collision/Shapes/b2CircleShape.cpp +99 -0
- data/src/physics/Box2D/Collision/Shapes/b2CircleShape.h +91 -0
- data/src/physics/Box2D/Collision/Shapes/b2EdgeShape.cpp +138 -0
- data/src/physics/Box2D/Collision/Shapes/b2EdgeShape.h +74 -0
- data/src/physics/Box2D/Collision/Shapes/b2PolygonShape.cpp +467 -0
- data/src/physics/Box2D/Collision/Shapes/b2PolygonShape.h +101 -0
- data/src/physics/Box2D/Collision/Shapes/b2Shape.h +101 -0
- data/src/physics/Box2D/Collision/b2BroadPhase.cpp +119 -0
- data/src/physics/Box2D/Collision/b2BroadPhase.h +257 -0
- data/src/physics/Box2D/Collision/b2CollideCircle.cpp +154 -0
- data/src/physics/Box2D/Collision/b2CollideEdge.cpp +698 -0
- data/src/physics/Box2D/Collision/b2CollidePolygon.cpp +239 -0
- data/src/physics/Box2D/Collision/b2Collision.cpp +252 -0
- data/src/physics/Box2D/Collision/b2Collision.h +277 -0
- data/src/physics/Box2D/Collision/b2Distance.cpp +603 -0
- data/src/physics/Box2D/Collision/b2Distance.h +141 -0
- data/src/physics/Box2D/Collision/b2DynamicTree.cpp +778 -0
- data/src/physics/Box2D/Collision/b2DynamicTree.h +289 -0
- data/src/physics/Box2D/Collision/b2TimeOfImpact.cpp +486 -0
- data/src/physics/Box2D/Collision/b2TimeOfImpact.h +58 -0
- data/src/physics/Box2D/Common/b2BlockAllocator.cpp +215 -0
- data/src/physics/Box2D/Common/b2BlockAllocator.h +62 -0
- data/src/physics/Box2D/Common/b2Draw.cpp +44 -0
- data/src/physics/Box2D/Common/b2Draw.h +86 -0
- data/src/physics/Box2D/Common/b2GrowableStack.h +85 -0
- data/src/physics/Box2D/Common/b2Math.cpp +94 -0
- data/src/physics/Box2D/Common/b2Math.h +720 -0
- data/src/physics/Box2D/Common/b2Settings.cpp +44 -0
- data/src/physics/Box2D/Common/b2Settings.h +151 -0
- data/src/physics/Box2D/Common/b2StackAllocator.cpp +83 -0
- data/src/physics/Box2D/Common/b2StackAllocator.h +60 -0
- data/src/physics/Box2D/Common/b2Timer.cpp +101 -0
- data/src/physics/Box2D/Common/b2Timer.h +50 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp +53 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h +39 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp +53 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h +39 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2CircleContact.cpp +52 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2CircleContact.h +39 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2Contact.cpp +247 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2Contact.h +349 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2ContactSolver.cpp +838 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2ContactSolver.h +95 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp +49 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h +39 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp +49 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h +39 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp +49 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h +38 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonContact.cpp +52 -0
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonContact.h +39 -0
- data/src/physics/Box2D/Dynamics/Joints/b2DistanceJoint.cpp +260 -0
- data/src/physics/Box2D/Dynamics/Joints/b2DistanceJoint.h +169 -0
- data/src/physics/Box2D/Dynamics/Joints/b2FrictionJoint.cpp +251 -0
- data/src/physics/Box2D/Dynamics/Joints/b2FrictionJoint.h +119 -0
- data/src/physics/Box2D/Dynamics/Joints/b2GearJoint.cpp +419 -0
- data/src/physics/Box2D/Dynamics/Joints/b2GearJoint.h +125 -0
- data/src/physics/Box2D/Dynamics/Joints/b2Joint.cpp +211 -0
- data/src/physics/Box2D/Dynamics/Joints/b2Joint.h +226 -0
- data/src/physics/Box2D/Dynamics/Joints/b2MotorJoint.cpp +304 -0
- data/src/physics/Box2D/Dynamics/Joints/b2MotorJoint.h +133 -0
- data/src/physics/Box2D/Dynamics/Joints/b2MouseJoint.cpp +222 -0
- data/src/physics/Box2D/Dynamics/Joints/b2MouseJoint.h +129 -0
- data/src/physics/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp +629 -0
- data/src/physics/Box2D/Dynamics/Joints/b2PrismaticJoint.h +196 -0
- data/src/physics/Box2D/Dynamics/Joints/b2PulleyJoint.cpp +348 -0
- data/src/physics/Box2D/Dynamics/Joints/b2PulleyJoint.h +152 -0
- data/src/physics/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp +502 -0
- data/src/physics/Box2D/Dynamics/Joints/b2RevoluteJoint.h +204 -0
- data/src/physics/Box2D/Dynamics/Joints/b2RopeJoint.cpp +241 -0
- data/src/physics/Box2D/Dynamics/Joints/b2RopeJoint.h +114 -0
- data/src/physics/Box2D/Dynamics/Joints/b2WeldJoint.cpp +344 -0
- data/src/physics/Box2D/Dynamics/Joints/b2WeldJoint.h +126 -0
- data/src/physics/Box2D/Dynamics/Joints/b2WheelJoint.cpp +419 -0
- data/src/physics/Box2D/Dynamics/Joints/b2WheelJoint.h +210 -0
- data/src/physics/Box2D/Dynamics/b2Body.cpp +549 -0
- data/src/physics/Box2D/Dynamics/b2Body.h +860 -0
- data/src/physics/Box2D/Dynamics/b2ContactManager.cpp +296 -0
- data/src/physics/Box2D/Dynamics/b2ContactManager.h +52 -0
- data/src/physics/Box2D/Dynamics/b2Fixture.cpp +303 -0
- data/src/physics/Box2D/Dynamics/b2Fixture.h +345 -0
- data/src/physics/Box2D/Dynamics/b2Island.cpp +539 -0
- data/src/physics/Box2D/Dynamics/b2Island.h +93 -0
- data/src/physics/Box2D/Dynamics/b2TimeStep.h +70 -0
- data/src/physics/Box2D/Dynamics/b2World.cpp +1339 -0
- data/src/physics/Box2D/Dynamics/b2World.h +354 -0
- data/src/physics/Box2D/Dynamics/b2WorldCallbacks.cpp +36 -0
- data/src/physics/Box2D/Dynamics/b2WorldCallbacks.h +155 -0
- data/src/physics/Box2D/Rope/b2Rope.cpp +259 -0
- data/src/physics/Box2D/Rope/b2Rope.h +115 -0
- data/src/style.cpp +2 -2
- data/src/view.cpp +217 -17
- data/src/window.cpp +25 -15
- data/src/world.cpp +206 -0
- data/src/world.h +96 -0
- data/task/box2d.rake +25 -0
- data/test/test_view.rb +5 -5
- metadata +125 -3
@@ -0,0 +1,52 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
|
3
|
+
*
|
4
|
+
* This software is provided 'as-is', without any express or implied
|
5
|
+
* warranty. In no event will the authors be held liable for any damages
|
6
|
+
* arising from the use of this software.
|
7
|
+
* Permission is granted to anyone to use this software for any purpose,
|
8
|
+
* including commercial applications, and to alter it and redistribute it
|
9
|
+
* freely, subject to the following restrictions:
|
10
|
+
* 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
* claim that you wrote the original software. If you use this software
|
12
|
+
* in a product, an acknowledgment in the product documentation would be
|
13
|
+
* appreciated but is not required.
|
14
|
+
* 2. Altered source versions must be plainly marked as such, and must not be
|
15
|
+
* misrepresented as being the original software.
|
16
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <Box2D/Dynamics/Contacts/b2CircleContact.h>
|
20
|
+
#include <Box2D/Dynamics/b2Body.h>
|
21
|
+
#include <Box2D/Dynamics/b2Fixture.h>
|
22
|
+
#include <Box2D/Dynamics/b2WorldCallbacks.h>
|
23
|
+
#include <Box2D/Common/b2BlockAllocator.h>
|
24
|
+
#include <Box2D/Collision/b2TimeOfImpact.h>
|
25
|
+
|
26
|
+
#include <new>
|
27
|
+
|
28
|
+
b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
|
29
|
+
{
|
30
|
+
void* mem = allocator->Allocate(sizeof(b2CircleContact));
|
31
|
+
return new (mem) b2CircleContact(fixtureA, fixtureB);
|
32
|
+
}
|
33
|
+
|
34
|
+
void b2CircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
|
35
|
+
{
|
36
|
+
((b2CircleContact*)contact)->~b2CircleContact();
|
37
|
+
allocator->Free(contact, sizeof(b2CircleContact));
|
38
|
+
}
|
39
|
+
|
40
|
+
b2CircleContact::b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
|
41
|
+
: b2Contact(fixtureA, 0, fixtureB, 0)
|
42
|
+
{
|
43
|
+
b2Assert(m_fixtureA->GetType() == b2Shape::e_circle);
|
44
|
+
b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
|
45
|
+
}
|
46
|
+
|
47
|
+
void b2CircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
|
48
|
+
{
|
49
|
+
b2CollideCircles(manifold,
|
50
|
+
(b2CircleShape*)m_fixtureA->GetShape(), xfA,
|
51
|
+
(b2CircleShape*)m_fixtureB->GetShape(), xfB);
|
52
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
|
3
|
+
*
|
4
|
+
* This software is provided 'as-is', without any express or implied
|
5
|
+
* warranty. In no event will the authors be held liable for any damages
|
6
|
+
* arising from the use of this software.
|
7
|
+
* Permission is granted to anyone to use this software for any purpose,
|
8
|
+
* including commercial applications, and to alter it and redistribute it
|
9
|
+
* freely, subject to the following restrictions:
|
10
|
+
* 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
* claim that you wrote the original software. If you use this software
|
12
|
+
* in a product, an acknowledgment in the product documentation would be
|
13
|
+
* appreciated but is not required.
|
14
|
+
* 2. Altered source versions must be plainly marked as such, and must not be
|
15
|
+
* misrepresented as being the original software.
|
16
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef B2_CIRCLE_CONTACT_H
|
20
|
+
#define B2_CIRCLE_CONTACT_H
|
21
|
+
|
22
|
+
#include <Box2D/Dynamics/Contacts/b2Contact.h>
|
23
|
+
|
24
|
+
class b2BlockAllocator;
|
25
|
+
|
26
|
+
class b2CircleContact : public b2Contact
|
27
|
+
{
|
28
|
+
public:
|
29
|
+
static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
|
30
|
+
b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
|
31
|
+
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
|
32
|
+
|
33
|
+
b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
|
34
|
+
~b2CircleContact() {}
|
35
|
+
|
36
|
+
void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
|
37
|
+
};
|
38
|
+
|
39
|
+
#endif
|
@@ -0,0 +1,247 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
|
3
|
+
*
|
4
|
+
* This software is provided 'as-is', without any express or implied
|
5
|
+
* warranty. In no event will the authors be held liable for any damages
|
6
|
+
* arising from the use of this software.
|
7
|
+
* Permission is granted to anyone to use this software for any purpose,
|
8
|
+
* including commercial applications, and to alter it and redistribute it
|
9
|
+
* freely, subject to the following restrictions:
|
10
|
+
* 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
* claim that you wrote the original software. If you use this software
|
12
|
+
* in a product, an acknowledgment in the product documentation would be
|
13
|
+
* appreciated but is not required.
|
14
|
+
* 2. Altered source versions must be plainly marked as such, and must not be
|
15
|
+
* misrepresented as being the original software.
|
16
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <Box2D/Dynamics/Contacts/b2Contact.h>
|
20
|
+
#include <Box2D/Dynamics/Contacts/b2CircleContact.h>
|
21
|
+
#include <Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h>
|
22
|
+
#include <Box2D/Dynamics/Contacts/b2PolygonContact.h>
|
23
|
+
#include <Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h>
|
24
|
+
#include <Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h>
|
25
|
+
#include <Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h>
|
26
|
+
#include <Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h>
|
27
|
+
#include <Box2D/Dynamics/Contacts/b2ContactSolver.h>
|
28
|
+
|
29
|
+
#include <Box2D/Collision/b2Collision.h>
|
30
|
+
#include <Box2D/Collision/b2TimeOfImpact.h>
|
31
|
+
#include <Box2D/Collision/Shapes/b2Shape.h>
|
32
|
+
#include <Box2D/Common/b2BlockAllocator.h>
|
33
|
+
#include <Box2D/Dynamics/b2Body.h>
|
34
|
+
#include <Box2D/Dynamics/b2Fixture.h>
|
35
|
+
#include <Box2D/Dynamics/b2World.h>
|
36
|
+
|
37
|
+
b2ContactRegister b2Contact::s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount];
|
38
|
+
bool b2Contact::s_initialized = false;
|
39
|
+
|
40
|
+
void b2Contact::InitializeRegisters()
|
41
|
+
{
|
42
|
+
AddType(b2CircleContact::Create, b2CircleContact::Destroy, b2Shape::e_circle, b2Shape::e_circle);
|
43
|
+
AddType(b2PolygonAndCircleContact::Create, b2PolygonAndCircleContact::Destroy, b2Shape::e_polygon, b2Shape::e_circle);
|
44
|
+
AddType(b2PolygonContact::Create, b2PolygonContact::Destroy, b2Shape::e_polygon, b2Shape::e_polygon);
|
45
|
+
AddType(b2EdgeAndCircleContact::Create, b2EdgeAndCircleContact::Destroy, b2Shape::e_edge, b2Shape::e_circle);
|
46
|
+
AddType(b2EdgeAndPolygonContact::Create, b2EdgeAndPolygonContact::Destroy, b2Shape::e_edge, b2Shape::e_polygon);
|
47
|
+
AddType(b2ChainAndCircleContact::Create, b2ChainAndCircleContact::Destroy, b2Shape::e_chain, b2Shape::e_circle);
|
48
|
+
AddType(b2ChainAndPolygonContact::Create, b2ChainAndPolygonContact::Destroy, b2Shape::e_chain, b2Shape::e_polygon);
|
49
|
+
}
|
50
|
+
|
51
|
+
void b2Contact::AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destoryFcn,
|
52
|
+
b2Shape::Type type1, b2Shape::Type type2)
|
53
|
+
{
|
54
|
+
b2Assert(0 <= type1 && type1 < b2Shape::e_typeCount);
|
55
|
+
b2Assert(0 <= type2 && type2 < b2Shape::e_typeCount);
|
56
|
+
|
57
|
+
s_registers[type1][type2].createFcn = createFcn;
|
58
|
+
s_registers[type1][type2].destroyFcn = destoryFcn;
|
59
|
+
s_registers[type1][type2].primary = true;
|
60
|
+
|
61
|
+
if (type1 != type2)
|
62
|
+
{
|
63
|
+
s_registers[type2][type1].createFcn = createFcn;
|
64
|
+
s_registers[type2][type1].destroyFcn = destoryFcn;
|
65
|
+
s_registers[type2][type1].primary = false;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
b2Contact* b2Contact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator)
|
70
|
+
{
|
71
|
+
if (s_initialized == false)
|
72
|
+
{
|
73
|
+
InitializeRegisters();
|
74
|
+
s_initialized = true;
|
75
|
+
}
|
76
|
+
|
77
|
+
b2Shape::Type type1 = fixtureA->GetType();
|
78
|
+
b2Shape::Type type2 = fixtureB->GetType();
|
79
|
+
|
80
|
+
b2Assert(0 <= type1 && type1 < b2Shape::e_typeCount);
|
81
|
+
b2Assert(0 <= type2 && type2 < b2Shape::e_typeCount);
|
82
|
+
|
83
|
+
b2ContactCreateFcn* createFcn = s_registers[type1][type2].createFcn;
|
84
|
+
if (createFcn)
|
85
|
+
{
|
86
|
+
if (s_registers[type1][type2].primary)
|
87
|
+
{
|
88
|
+
return createFcn(fixtureA, indexA, fixtureB, indexB, allocator);
|
89
|
+
}
|
90
|
+
else
|
91
|
+
{
|
92
|
+
return createFcn(fixtureB, indexB, fixtureA, indexA, allocator);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
else
|
96
|
+
{
|
97
|
+
return NULL;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
void b2Contact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
|
102
|
+
{
|
103
|
+
b2Assert(s_initialized == true);
|
104
|
+
|
105
|
+
b2Fixture* fixtureA = contact->m_fixtureA;
|
106
|
+
b2Fixture* fixtureB = contact->m_fixtureB;
|
107
|
+
|
108
|
+
if (contact->m_manifold.pointCount > 0 &&
|
109
|
+
fixtureA->IsSensor() == false &&
|
110
|
+
fixtureB->IsSensor() == false)
|
111
|
+
{
|
112
|
+
fixtureA->GetBody()->SetAwake(true);
|
113
|
+
fixtureB->GetBody()->SetAwake(true);
|
114
|
+
}
|
115
|
+
|
116
|
+
b2Shape::Type typeA = fixtureA->GetType();
|
117
|
+
b2Shape::Type typeB = fixtureB->GetType();
|
118
|
+
|
119
|
+
b2Assert(0 <= typeA && typeB < b2Shape::e_typeCount);
|
120
|
+
b2Assert(0 <= typeA && typeB < b2Shape::e_typeCount);
|
121
|
+
|
122
|
+
b2ContactDestroyFcn* destroyFcn = s_registers[typeA][typeB].destroyFcn;
|
123
|
+
destroyFcn(contact, allocator);
|
124
|
+
}
|
125
|
+
|
126
|
+
b2Contact::b2Contact(b2Fixture* fA, int32 indexA, b2Fixture* fB, int32 indexB)
|
127
|
+
{
|
128
|
+
m_flags = e_enabledFlag;
|
129
|
+
|
130
|
+
m_fixtureA = fA;
|
131
|
+
m_fixtureB = fB;
|
132
|
+
|
133
|
+
m_indexA = indexA;
|
134
|
+
m_indexB = indexB;
|
135
|
+
|
136
|
+
m_manifold.pointCount = 0;
|
137
|
+
|
138
|
+
m_prev = NULL;
|
139
|
+
m_next = NULL;
|
140
|
+
|
141
|
+
m_nodeA.contact = NULL;
|
142
|
+
m_nodeA.prev = NULL;
|
143
|
+
m_nodeA.next = NULL;
|
144
|
+
m_nodeA.other = NULL;
|
145
|
+
|
146
|
+
m_nodeB.contact = NULL;
|
147
|
+
m_nodeB.prev = NULL;
|
148
|
+
m_nodeB.next = NULL;
|
149
|
+
m_nodeB.other = NULL;
|
150
|
+
|
151
|
+
m_toiCount = 0;
|
152
|
+
|
153
|
+
m_friction = b2MixFriction(m_fixtureA->m_friction, m_fixtureB->m_friction);
|
154
|
+
m_restitution = b2MixRestitution(m_fixtureA->m_restitution, m_fixtureB->m_restitution);
|
155
|
+
|
156
|
+
m_tangentSpeed = 0.0f;
|
157
|
+
}
|
158
|
+
|
159
|
+
// Update the contact manifold and touching status.
|
160
|
+
// Note: do not assume the fixture AABBs are overlapping or are valid.
|
161
|
+
void b2Contact::Update(b2ContactListener* listener)
|
162
|
+
{
|
163
|
+
b2Manifold oldManifold = m_manifold;
|
164
|
+
|
165
|
+
// Re-enable this contact.
|
166
|
+
m_flags |= e_enabledFlag;
|
167
|
+
|
168
|
+
bool touching = false;
|
169
|
+
bool wasTouching = (m_flags & e_touchingFlag) == e_touchingFlag;
|
170
|
+
|
171
|
+
bool sensorA = m_fixtureA->IsSensor();
|
172
|
+
bool sensorB = m_fixtureB->IsSensor();
|
173
|
+
bool sensor = sensorA || sensorB;
|
174
|
+
|
175
|
+
b2Body* bodyA = m_fixtureA->GetBody();
|
176
|
+
b2Body* bodyB = m_fixtureB->GetBody();
|
177
|
+
const b2Transform& xfA = bodyA->GetTransform();
|
178
|
+
const b2Transform& xfB = bodyB->GetTransform();
|
179
|
+
|
180
|
+
// Is this contact a sensor?
|
181
|
+
if (sensor)
|
182
|
+
{
|
183
|
+
const b2Shape* shapeA = m_fixtureA->GetShape();
|
184
|
+
const b2Shape* shapeB = m_fixtureB->GetShape();
|
185
|
+
touching = b2TestOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);
|
186
|
+
|
187
|
+
// Sensors don't generate manifolds.
|
188
|
+
m_manifold.pointCount = 0;
|
189
|
+
}
|
190
|
+
else
|
191
|
+
{
|
192
|
+
Evaluate(&m_manifold, xfA, xfB);
|
193
|
+
touching = m_manifold.pointCount > 0;
|
194
|
+
|
195
|
+
// Match old contact ids to new contact ids and copy the
|
196
|
+
// stored impulses to warm start the solver.
|
197
|
+
for (int32 i = 0; i < m_manifold.pointCount; ++i)
|
198
|
+
{
|
199
|
+
b2ManifoldPoint* mp2 = m_manifold.points + i;
|
200
|
+
mp2->normalImpulse = 0.0f;
|
201
|
+
mp2->tangentImpulse = 0.0f;
|
202
|
+
b2ContactID id2 = mp2->id;
|
203
|
+
|
204
|
+
for (int32 j = 0; j < oldManifold.pointCount; ++j)
|
205
|
+
{
|
206
|
+
b2ManifoldPoint* mp1 = oldManifold.points + j;
|
207
|
+
|
208
|
+
if (mp1->id.key == id2.key)
|
209
|
+
{
|
210
|
+
mp2->normalImpulse = mp1->normalImpulse;
|
211
|
+
mp2->tangentImpulse = mp1->tangentImpulse;
|
212
|
+
break;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
if (touching != wasTouching)
|
218
|
+
{
|
219
|
+
bodyA->SetAwake(true);
|
220
|
+
bodyB->SetAwake(true);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
if (touching)
|
225
|
+
{
|
226
|
+
m_flags |= e_touchingFlag;
|
227
|
+
}
|
228
|
+
else
|
229
|
+
{
|
230
|
+
m_flags &= ~e_touchingFlag;
|
231
|
+
}
|
232
|
+
|
233
|
+
if (wasTouching == false && touching == true && listener)
|
234
|
+
{
|
235
|
+
listener->BeginContact(this);
|
236
|
+
}
|
237
|
+
|
238
|
+
if (wasTouching == true && touching == false && listener)
|
239
|
+
{
|
240
|
+
listener->EndContact(this);
|
241
|
+
}
|
242
|
+
|
243
|
+
if (sensor == false && touching && listener)
|
244
|
+
{
|
245
|
+
listener->PreSolve(this, &oldManifold);
|
246
|
+
}
|
247
|
+
}
|
@@ -0,0 +1,349 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
|
3
|
+
*
|
4
|
+
* This software is provided 'as-is', without any express or implied
|
5
|
+
* warranty. In no event will the authors be held liable for any damages
|
6
|
+
* arising from the use of this software.
|
7
|
+
* Permission is granted to anyone to use this software for any purpose,
|
8
|
+
* including commercial applications, and to alter it and redistribute it
|
9
|
+
* freely, subject to the following restrictions:
|
10
|
+
* 1. The origin of this software must not be misrepresented; you must not
|
11
|
+
* claim that you wrote the original software. If you use this software
|
12
|
+
* in a product, an acknowledgment in the product documentation would be
|
13
|
+
* appreciated but is not required.
|
14
|
+
* 2. Altered source versions must be plainly marked as such, and must not be
|
15
|
+
* misrepresented as being the original software.
|
16
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef B2_CONTACT_H
|
20
|
+
#define B2_CONTACT_H
|
21
|
+
|
22
|
+
#include <Box2D/Common/b2Math.h>
|
23
|
+
#include <Box2D/Collision/b2Collision.h>
|
24
|
+
#include <Box2D/Collision/Shapes/b2Shape.h>
|
25
|
+
#include <Box2D/Dynamics/b2Fixture.h>
|
26
|
+
|
27
|
+
class b2Body;
|
28
|
+
class b2Contact;
|
29
|
+
class b2Fixture;
|
30
|
+
class b2World;
|
31
|
+
class b2BlockAllocator;
|
32
|
+
class b2StackAllocator;
|
33
|
+
class b2ContactListener;
|
34
|
+
|
35
|
+
/// Friction mixing law. The idea is to allow either fixture to drive the restitution to zero.
|
36
|
+
/// For example, anything slides on ice.
|
37
|
+
inline float32 b2MixFriction(float32 friction1, float32 friction2)
|
38
|
+
{
|
39
|
+
return b2Sqrt(friction1 * friction2);
|
40
|
+
}
|
41
|
+
|
42
|
+
/// Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface.
|
43
|
+
/// For example, a superball bounces on anything.
|
44
|
+
inline float32 b2MixRestitution(float32 restitution1, float32 restitution2)
|
45
|
+
{
|
46
|
+
return restitution1 > restitution2 ? restitution1 : restitution2;
|
47
|
+
}
|
48
|
+
|
49
|
+
typedef b2Contact* b2ContactCreateFcn( b2Fixture* fixtureA, int32 indexA,
|
50
|
+
b2Fixture* fixtureB, int32 indexB,
|
51
|
+
b2BlockAllocator* allocator);
|
52
|
+
typedef void b2ContactDestroyFcn(b2Contact* contact, b2BlockAllocator* allocator);
|
53
|
+
|
54
|
+
struct b2ContactRegister
|
55
|
+
{
|
56
|
+
b2ContactCreateFcn* createFcn;
|
57
|
+
b2ContactDestroyFcn* destroyFcn;
|
58
|
+
bool primary;
|
59
|
+
};
|
60
|
+
|
61
|
+
/// A contact edge is used to connect bodies and contacts together
|
62
|
+
/// in a contact graph where each body is a node and each contact
|
63
|
+
/// is an edge. A contact edge belongs to a doubly linked list
|
64
|
+
/// maintained in each attached body. Each contact has two contact
|
65
|
+
/// nodes, one for each attached body.
|
66
|
+
struct b2ContactEdge
|
67
|
+
{
|
68
|
+
b2Body* other; ///< provides quick access to the other body attached.
|
69
|
+
b2Contact* contact; ///< the contact
|
70
|
+
b2ContactEdge* prev; ///< the previous contact edge in the body's contact list
|
71
|
+
b2ContactEdge* next; ///< the next contact edge in the body's contact list
|
72
|
+
};
|
73
|
+
|
74
|
+
/// The class manages contact between two shapes. A contact exists for each overlapping
|
75
|
+
/// AABB in the broad-phase (except if filtered). Therefore a contact object may exist
|
76
|
+
/// that has no contact points.
|
77
|
+
class b2Contact
|
78
|
+
{
|
79
|
+
public:
|
80
|
+
|
81
|
+
/// Get the contact manifold. Do not modify the manifold unless you understand the
|
82
|
+
/// internals of Box2D.
|
83
|
+
b2Manifold* GetManifold();
|
84
|
+
const b2Manifold* GetManifold() const;
|
85
|
+
|
86
|
+
/// Get the world manifold.
|
87
|
+
void GetWorldManifold(b2WorldManifold* worldManifold) const;
|
88
|
+
|
89
|
+
/// Is this contact touching?
|
90
|
+
bool IsTouching() const;
|
91
|
+
|
92
|
+
/// Enable/disable this contact. This can be used inside the pre-solve
|
93
|
+
/// contact listener. The contact is only disabled for the current
|
94
|
+
/// time step (or sub-step in continuous collisions).
|
95
|
+
void SetEnabled(bool flag);
|
96
|
+
|
97
|
+
/// Has this contact been disabled?
|
98
|
+
bool IsEnabled() const;
|
99
|
+
|
100
|
+
/// Get the next contact in the world's contact list.
|
101
|
+
b2Contact* GetNext();
|
102
|
+
const b2Contact* GetNext() const;
|
103
|
+
|
104
|
+
/// Get fixture A in this contact.
|
105
|
+
b2Fixture* GetFixtureA();
|
106
|
+
const b2Fixture* GetFixtureA() const;
|
107
|
+
|
108
|
+
/// Get the child primitive index for fixture A.
|
109
|
+
int32 GetChildIndexA() const;
|
110
|
+
|
111
|
+
/// Get fixture B in this contact.
|
112
|
+
b2Fixture* GetFixtureB();
|
113
|
+
const b2Fixture* GetFixtureB() const;
|
114
|
+
|
115
|
+
/// Get the child primitive index for fixture B.
|
116
|
+
int32 GetChildIndexB() const;
|
117
|
+
|
118
|
+
/// Override the default friction mixture. You can call this in b2ContactListener::PreSolve.
|
119
|
+
/// This value persists until set or reset.
|
120
|
+
void SetFriction(float32 friction);
|
121
|
+
|
122
|
+
/// Get the friction.
|
123
|
+
float32 GetFriction() const;
|
124
|
+
|
125
|
+
/// Reset the friction mixture to the default value.
|
126
|
+
void ResetFriction();
|
127
|
+
|
128
|
+
/// Override the default restitution mixture. You can call this in b2ContactListener::PreSolve.
|
129
|
+
/// The value persists until you set or reset.
|
130
|
+
void SetRestitution(float32 restitution);
|
131
|
+
|
132
|
+
/// Get the restitution.
|
133
|
+
float32 GetRestitution() const;
|
134
|
+
|
135
|
+
/// Reset the restitution to the default value.
|
136
|
+
void ResetRestitution();
|
137
|
+
|
138
|
+
/// Set the desired tangent speed for a conveyor belt behavior. In meters per second.
|
139
|
+
void SetTangentSpeed(float32 speed);
|
140
|
+
|
141
|
+
/// Get the desired tangent speed. In meters per second.
|
142
|
+
float32 GetTangentSpeed() const;
|
143
|
+
|
144
|
+
/// Evaluate this contact with your own manifold and transforms.
|
145
|
+
virtual void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) = 0;
|
146
|
+
|
147
|
+
protected:
|
148
|
+
friend class b2ContactManager;
|
149
|
+
friend class b2World;
|
150
|
+
friend class b2ContactSolver;
|
151
|
+
friend class b2Body;
|
152
|
+
friend class b2Fixture;
|
153
|
+
|
154
|
+
// Flags stored in m_flags
|
155
|
+
enum
|
156
|
+
{
|
157
|
+
// Used when crawling contact graph when forming islands.
|
158
|
+
e_islandFlag = 0x0001,
|
159
|
+
|
160
|
+
// Set when the shapes are touching.
|
161
|
+
e_touchingFlag = 0x0002,
|
162
|
+
|
163
|
+
// This contact can be disabled (by user)
|
164
|
+
e_enabledFlag = 0x0004,
|
165
|
+
|
166
|
+
// This contact needs filtering because a fixture filter was changed.
|
167
|
+
e_filterFlag = 0x0008,
|
168
|
+
|
169
|
+
// This bullet contact had a TOI event
|
170
|
+
e_bulletHitFlag = 0x0010,
|
171
|
+
|
172
|
+
// This contact has a valid TOI in m_toi
|
173
|
+
e_toiFlag = 0x0020
|
174
|
+
};
|
175
|
+
|
176
|
+
/// Flag this contact for filtering. Filtering will occur the next time step.
|
177
|
+
void FlagForFiltering();
|
178
|
+
|
179
|
+
static void AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destroyFcn,
|
180
|
+
b2Shape::Type typeA, b2Shape::Type typeB);
|
181
|
+
static void InitializeRegisters();
|
182
|
+
static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
|
183
|
+
static void Destroy(b2Contact* contact, b2Shape::Type typeA, b2Shape::Type typeB, b2BlockAllocator* allocator);
|
184
|
+
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
|
185
|
+
|
186
|
+
b2Contact() : m_fixtureA(NULL), m_fixtureB(NULL) {}
|
187
|
+
b2Contact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB);
|
188
|
+
virtual ~b2Contact() {}
|
189
|
+
|
190
|
+
void Update(b2ContactListener* listener);
|
191
|
+
|
192
|
+
static b2ContactRegister s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount];
|
193
|
+
static bool s_initialized;
|
194
|
+
|
195
|
+
uint32 m_flags;
|
196
|
+
|
197
|
+
// World pool and list pointers.
|
198
|
+
b2Contact* m_prev;
|
199
|
+
b2Contact* m_next;
|
200
|
+
|
201
|
+
// Nodes for connecting bodies.
|
202
|
+
b2ContactEdge m_nodeA;
|
203
|
+
b2ContactEdge m_nodeB;
|
204
|
+
|
205
|
+
b2Fixture* m_fixtureA;
|
206
|
+
b2Fixture* m_fixtureB;
|
207
|
+
|
208
|
+
int32 m_indexA;
|
209
|
+
int32 m_indexB;
|
210
|
+
|
211
|
+
b2Manifold m_manifold;
|
212
|
+
|
213
|
+
int32 m_toiCount;
|
214
|
+
float32 m_toi;
|
215
|
+
|
216
|
+
float32 m_friction;
|
217
|
+
float32 m_restitution;
|
218
|
+
|
219
|
+
float32 m_tangentSpeed;
|
220
|
+
};
|
221
|
+
|
222
|
+
inline b2Manifold* b2Contact::GetManifold()
|
223
|
+
{
|
224
|
+
return &m_manifold;
|
225
|
+
}
|
226
|
+
|
227
|
+
inline const b2Manifold* b2Contact::GetManifold() const
|
228
|
+
{
|
229
|
+
return &m_manifold;
|
230
|
+
}
|
231
|
+
|
232
|
+
inline void b2Contact::GetWorldManifold(b2WorldManifold* worldManifold) const
|
233
|
+
{
|
234
|
+
const b2Body* bodyA = m_fixtureA->GetBody();
|
235
|
+
const b2Body* bodyB = m_fixtureB->GetBody();
|
236
|
+
const b2Shape* shapeA = m_fixtureA->GetShape();
|
237
|
+
const b2Shape* shapeB = m_fixtureB->GetShape();
|
238
|
+
|
239
|
+
worldManifold->Initialize(&m_manifold, bodyA->GetTransform(), shapeA->m_radius, bodyB->GetTransform(), shapeB->m_radius);
|
240
|
+
}
|
241
|
+
|
242
|
+
inline void b2Contact::SetEnabled(bool flag)
|
243
|
+
{
|
244
|
+
if (flag)
|
245
|
+
{
|
246
|
+
m_flags |= e_enabledFlag;
|
247
|
+
}
|
248
|
+
else
|
249
|
+
{
|
250
|
+
m_flags &= ~e_enabledFlag;
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
inline bool b2Contact::IsEnabled() const
|
255
|
+
{
|
256
|
+
return (m_flags & e_enabledFlag) == e_enabledFlag;
|
257
|
+
}
|
258
|
+
|
259
|
+
inline bool b2Contact::IsTouching() const
|
260
|
+
{
|
261
|
+
return (m_flags & e_touchingFlag) == e_touchingFlag;
|
262
|
+
}
|
263
|
+
|
264
|
+
inline b2Contact* b2Contact::GetNext()
|
265
|
+
{
|
266
|
+
return m_next;
|
267
|
+
}
|
268
|
+
|
269
|
+
inline const b2Contact* b2Contact::GetNext() const
|
270
|
+
{
|
271
|
+
return m_next;
|
272
|
+
}
|
273
|
+
|
274
|
+
inline b2Fixture* b2Contact::GetFixtureA()
|
275
|
+
{
|
276
|
+
return m_fixtureA;
|
277
|
+
}
|
278
|
+
|
279
|
+
inline const b2Fixture* b2Contact::GetFixtureA() const
|
280
|
+
{
|
281
|
+
return m_fixtureA;
|
282
|
+
}
|
283
|
+
|
284
|
+
inline b2Fixture* b2Contact::GetFixtureB()
|
285
|
+
{
|
286
|
+
return m_fixtureB;
|
287
|
+
}
|
288
|
+
|
289
|
+
inline int32 b2Contact::GetChildIndexA() const
|
290
|
+
{
|
291
|
+
return m_indexA;
|
292
|
+
}
|
293
|
+
|
294
|
+
inline const b2Fixture* b2Contact::GetFixtureB() const
|
295
|
+
{
|
296
|
+
return m_fixtureB;
|
297
|
+
}
|
298
|
+
|
299
|
+
inline int32 b2Contact::GetChildIndexB() const
|
300
|
+
{
|
301
|
+
return m_indexB;
|
302
|
+
}
|
303
|
+
|
304
|
+
inline void b2Contact::FlagForFiltering()
|
305
|
+
{
|
306
|
+
m_flags |= e_filterFlag;
|
307
|
+
}
|
308
|
+
|
309
|
+
inline void b2Contact::SetFriction(float32 friction)
|
310
|
+
{
|
311
|
+
m_friction = friction;
|
312
|
+
}
|
313
|
+
|
314
|
+
inline float32 b2Contact::GetFriction() const
|
315
|
+
{
|
316
|
+
return m_friction;
|
317
|
+
}
|
318
|
+
|
319
|
+
inline void b2Contact::ResetFriction()
|
320
|
+
{
|
321
|
+
m_friction = b2MixFriction(m_fixtureA->m_friction, m_fixtureB->m_friction);
|
322
|
+
}
|
323
|
+
|
324
|
+
inline void b2Contact::SetRestitution(float32 restitution)
|
325
|
+
{
|
326
|
+
m_restitution = restitution;
|
327
|
+
}
|
328
|
+
|
329
|
+
inline float32 b2Contact::GetRestitution() const
|
330
|
+
{
|
331
|
+
return m_restitution;
|
332
|
+
}
|
333
|
+
|
334
|
+
inline void b2Contact::ResetRestitution()
|
335
|
+
{
|
336
|
+
m_restitution = b2MixRestitution(m_fixtureA->m_restitution, m_fixtureB->m_restitution);
|
337
|
+
}
|
338
|
+
|
339
|
+
inline void b2Contact::SetTangentSpeed(float32 speed)
|
340
|
+
{
|
341
|
+
m_tangentSpeed = speed;
|
342
|
+
}
|
343
|
+
|
344
|
+
inline float32 b2Contact::GetTangentSpeed() const
|
345
|
+
{
|
346
|
+
return m_tangentSpeed;
|
347
|
+
}
|
348
|
+
|
349
|
+
#endif
|