ruby-bullet 0.0.2-x86-linux → 0.0.3-x86-linux
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.
- data/README.md +1 -1
- data/Rakefile +7 -5
- data/bindings/bullet/interface/Rakefile +22 -0
- data/bindings/bullet/interface/bullet.i +1 -1
- data/bindings/bullet/interface/bullet_wrap.cpp +11677 -11618
- data/bindings/bullet/interface/bullet_wrap.h +9 -9
- data/bindings/bullet/interface/bullet_wrap.o +0 -0
- data/lib/{Bullet.so → bullet.so} +0 -0
- data/lib/bullet_config.rb +28 -0
- data/lib/{Version.rb → version.rb} +1 -1
- data/sample/hello_bullet/{HelloBullet.rb → hello_bullet.rb} +25 -24
- metadata +7 -7
- data/bindings/bullet/interface/Makefile +0 -19
- data/lib/BulletConfig.rb +0 -28
@@ -16,31 +16,31 @@ namespace Swig {
|
|
16
16
|
}
|
17
17
|
|
18
18
|
|
19
|
-
class
|
19
|
+
class SwigDirector_BtMotionState : public btMotionState, public Swig::Director {
|
20
20
|
|
21
21
|
public:
|
22
|
-
|
23
|
-
virtual ~
|
22
|
+
SwigDirector_BtMotionState(VALUE self);
|
23
|
+
virtual ~SwigDirector_BtMotionState();
|
24
24
|
virtual void getWorldTransform(btTransform &worldTrans) const;
|
25
25
|
virtual void setWorldTransform(btTransform const &worldTrans);
|
26
26
|
};
|
27
27
|
|
28
28
|
|
29
|
-
struct
|
29
|
+
struct SwigDirector_BtDefaultMotionState : public btDefaultMotionState, public Swig::Director {
|
30
30
|
|
31
31
|
public:
|
32
|
-
|
33
|
-
virtual ~
|
32
|
+
SwigDirector_BtDefaultMotionState(VALUE self, btTransform const &startTrans = btTransform::getIdentity(), btTransform const ¢erOfMassOffset = btTransform::getIdentity());
|
33
|
+
virtual ~SwigDirector_BtDefaultMotionState();
|
34
34
|
virtual void getWorldTransform(btTransform ¢erOfMassWorldTrans) const;
|
35
35
|
virtual void setWorldTransform(btTransform const ¢erOfMassWorldTrans);
|
36
36
|
};
|
37
37
|
|
38
38
|
|
39
|
-
class
|
39
|
+
class SwigDirector_BtIDebugDraw : public btIDebugDraw, public Swig::Director {
|
40
40
|
|
41
41
|
public:
|
42
|
-
|
43
|
-
virtual ~
|
42
|
+
SwigDirector_BtIDebugDraw(VALUE self);
|
43
|
+
virtual ~SwigDirector_BtIDebugDraw();
|
44
44
|
virtual void drawLine(btVector3 const &from, btVector3 const &to, btVector3 const &color);
|
45
45
|
virtual void drawLine(btVector3 const &from, btVector3 const &to, btVector3 const &fromColor, btVector3 const &toColor);
|
46
46
|
virtual void drawSphere(btScalar radius, btTransform const &transform, btVector3 const &color);
|
Binary file
|
data/lib/{Bullet.so → bullet.so}
RENAMED
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class BulletConfig
|
2
|
+
def self.get_top_dir
|
3
|
+
File.dirname(File.dirname(File.expand_path(__FILE__)))
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.get_deps_lib_path
|
7
|
+
"#{get_top_dir()}/deps/lib"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_deps_inc_path
|
11
|
+
"#{get_top_dir()}/deps/include/bullet/"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_inc_flags
|
15
|
+
" -I#{get_top_dir()}/deps/include/bullet/ " +
|
16
|
+
" -I#{get_top_dir()}/deps/include/bullet/LinearMath/ " +
|
17
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletCollision/CollisionDispatch/ " +
|
18
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletCollision/BroadphaseCollision/ " +
|
19
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletCollision/NarrowPhaseCollision/ " +
|
20
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletCollision/CollisionShapes/ " +
|
21
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletCollision/Gimpact/ " +
|
22
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletDynamics/ConstraintSolver/ " +
|
23
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletDynamics/Dynamics/ " +
|
24
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletDynamics/Vehicle/ " +
|
25
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletDynamics/Character/ " +
|
26
|
+
" -I#{get_top_dir()}/deps/include/bullet/BulletSoftBody/ "
|
27
|
+
end
|
28
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.push(File.dirname(File.expand_path(__FILE__)) + "/../../lib")
|
2
|
+
|
2
3
|
require 'gtk2'
|
3
4
|
require 'cairo'
|
4
|
-
require "
|
5
|
+
require "bullet.so"
|
5
6
|
|
6
7
|
class Physics
|
7
8
|
attr_accessor :context
|
@@ -21,16 +22,16 @@ class Physics
|
|
21
22
|
@dynamicsWorld = Bullet::BtDiscreteDynamicsWorld.new(@collisionDispatcher, @gardenAabbCache,
|
22
23
|
@solver, @collisionConfig)
|
23
24
|
gravity = Bullet::BtVector3.new(0.0, 9.8, 0.0)
|
24
|
-
@dynamicsWorld.
|
25
|
+
@dynamicsWorld.set_gravity(gravity)
|
25
26
|
|
26
27
|
@objects = []
|
27
28
|
|
28
29
|
@lastTime = -1
|
29
30
|
end
|
30
31
|
|
31
|
-
def
|
32
|
+
def add_object(obj)
|
32
33
|
@objects.push(obj)
|
33
|
-
@dynamicsWorld.
|
34
|
+
@dynamicsWorld.add_rigid_body(obj.rigidBody)
|
34
35
|
end
|
35
36
|
|
36
37
|
def update(context)
|
@@ -42,7 +43,7 @@ class Physics
|
|
42
43
|
@lastTime = nowTime
|
43
44
|
|
44
45
|
# step
|
45
|
-
@dynamicsWorld.
|
46
|
+
@dynamicsWorld.step_simulation(delta)
|
46
47
|
|
47
48
|
@objects.each {|obj|
|
48
49
|
obj.draw(context)
|
@@ -65,38 +66,38 @@ class Box < Bullet::BtMotionState
|
|
65
66
|
|
66
67
|
# position/rotation
|
67
68
|
@transform = Bullet::BtTransform.new()
|
68
|
-
@transform.
|
69
|
+
@transform.set_identity()
|
69
70
|
|
70
71
|
# create a physics object.
|
71
72
|
@colObj = Bullet::BtBoxShape.new(Bullet::BtVector3.new(width / 2, height / 2, width / 2))
|
72
73
|
inertia = Bullet::BtVector3.new()
|
73
|
-
@colObj.
|
74
|
+
@colObj.calculate_local_inertia(mass, inertia)
|
74
75
|
|
75
76
|
@rigidBody = Bullet::BtRigidBody.new(mass, self, @colObj, inertia)
|
76
|
-
@rigidBody.
|
77
|
+
@rigidBody.set_angular_factor(Bullet::BtVector3.new(0, 0, 1)) # rotate around z-axis only becase of 2D.
|
77
78
|
end
|
78
79
|
|
79
|
-
def
|
80
|
+
def set_world_transform(worldTrans)
|
80
81
|
@transform = Bullet::BtTransform.new(worldTrans)
|
81
82
|
end
|
82
83
|
|
83
|
-
def
|
84
|
+
def get_world_transform(worldTrans)
|
84
85
|
end
|
85
86
|
|
86
|
-
def
|
87
|
-
@transform.
|
88
|
-
@rigidBody.
|
87
|
+
def set_position(x, y)
|
88
|
+
@transform.set_origin(Bullet::BtVector3.new(x, y, 0.0))
|
89
|
+
@rigidBody.set_center_of_mass_transform(@transform)
|
89
90
|
end
|
90
91
|
|
91
92
|
def draw(context)
|
92
|
-
newPos = @transform.
|
93
|
-
newRot = @transform.
|
93
|
+
newPos = @transform.get_origin()
|
94
|
+
newRot = @transform.get_rotation()
|
94
95
|
|
95
96
|
lt = Bullet::BtVector3.new(-@width / 2, -@height / 2, 0)
|
96
97
|
lb = Bullet::BtVector3.new(-@width / 2, @height / 2 , 0)
|
97
98
|
|
98
|
-
lt = Bullet::
|
99
|
-
lb = Bullet::
|
99
|
+
lt = Bullet::quat_rotate(newRot, lt)
|
100
|
+
lb = Bullet::quat_rotate(newRot, lb)
|
100
101
|
rb = -lt
|
101
102
|
rt = -lb
|
102
103
|
|
@@ -121,15 +122,15 @@ id = 0
|
|
121
122
|
11.times {|x|
|
122
123
|
5.times {|y|
|
123
124
|
box = Box.new(physics, 1.0, 10, 10, 'sky blue')
|
124
|
-
box.
|
125
|
-
physics.
|
125
|
+
box.set_position(100 + 10 * x, 50 - 10 * y)
|
126
|
+
physics.add_object(box)
|
126
127
|
}
|
127
128
|
}
|
128
129
|
|
129
130
|
# floor
|
130
131
|
floor = Box.new(physics, 0, 100, 5, 'gray')
|
131
|
-
floor.
|
132
|
-
physics.
|
132
|
+
floor.set_position(150, 200)
|
133
|
+
physics.add_object(floor)
|
133
134
|
|
134
135
|
|
135
136
|
## create a drawing window.
|
@@ -150,8 +151,8 @@ drawing_area.signal_connect("expose-event") do |widget, event|
|
|
150
151
|
# create a new box per 3sec.
|
151
152
|
if (delta > 3.0)
|
152
153
|
box = Box.new(physics, 1.0, 10, 10, 'orange')
|
153
|
-
box.
|
154
|
-
physics.
|
154
|
+
box.set_position(125 + (physics.objects.length % 10) * 5, 0)
|
155
|
+
physics.add_object(box)
|
155
156
|
delta = 0
|
156
157
|
end
|
157
158
|
true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: x86-linux
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This is a binary package of the ruby wrapper of Bullet.
|
15
15
|
email:
|
@@ -197,13 +197,13 @@ files:
|
|
197
197
|
- bindings/bullet/interface/BulletCollision/CollisionShapes/btCollisionShape.i
|
198
198
|
- bindings/bullet/interface/BulletCollision/CollisionShapes/btMaterial.i
|
199
199
|
- bindings/bullet/interface/BulletCollision/CollisionShapes/btConvexInternalShape.i
|
200
|
-
- bindings/bullet/interface/
|
200
|
+
- bindings/bullet/interface/Rakefile
|
201
201
|
- bindings/bullet/interface/bullet_all.i
|
202
202
|
- bindings/bullet/src/TickListener.h
|
203
|
-
- lib/
|
204
|
-
- lib/
|
205
|
-
- lib/
|
206
|
-
- sample/hello_bullet/
|
203
|
+
- lib/bullet_config.rb
|
204
|
+
- lib/version.rb
|
205
|
+
- lib/bullet.so
|
206
|
+
- sample/hello_bullet/hello_bullet.rb
|
207
207
|
- deps/lib/libBulletMultiThreaded.a
|
208
208
|
- deps/lib/libBulletSoftBody.a
|
209
209
|
- deps/lib/libBulletCollision.a
|
@@ -1,19 +0,0 @@
|
|
1
|
-
.PHONY: clean
|
2
|
-
|
3
|
-
SWIG = swig
|
4
|
-
DEPS_DIR = ../../../deps/
|
5
|
-
|
6
|
-
include ../../../deps/env.mk
|
7
|
-
|
8
|
-
SWIGFLAGS = -ruby -c++ -w801 $(BULLET_INC) -I../src
|
9
|
-
RUBY = ruby
|
10
|
-
|
11
|
-
TARGET = bullet_wrap.cpp
|
12
|
-
|
13
|
-
all: $(TARGET)
|
14
|
-
|
15
|
-
$(TARGET): bullet.i
|
16
|
-
$(SWIG) $(SWIGFLAGS) -o $@ $<
|
17
|
-
|
18
|
-
clean:
|
19
|
-
@rm -f $(TARGET)
|
data/lib/BulletConfig.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
class BulletConfig
|
2
|
-
def self.getTopDir
|
3
|
-
File.dirname(File.dirname(File.expand_path(__FILE__)))
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.getDepsLibPath
|
7
|
-
"#{getTopDir()}/deps/lib"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.getDepsIncPath
|
11
|
-
"#{getTopDir()}/deps/include/bullet/"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.getIncFlags
|
15
|
-
" -I#{getTopDir()}/deps/include/bullet/ " +
|
16
|
-
" -I#{getTopDir()}/deps/include/bullet/LinearMath/ " +
|
17
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletCollision/CollisionDispatch/ " +
|
18
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletCollision/BroadphaseCollision/ " +
|
19
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletCollision/NarrowPhaseCollision/ " +
|
20
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletCollision/CollisionShapes/ " +
|
21
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletCollision/Gimpact/ " +
|
22
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletDynamics/ConstraintSolver/ " +
|
23
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletDynamics/Dynamics/ " +
|
24
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletDynamics/Vehicle/ " +
|
25
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletDynamics/Character/ " +
|
26
|
-
" -I#{getTopDir()}/deps/include/bullet/BulletSoftBody/ "
|
27
|
-
end
|
28
|
-
end
|