teien 0.0.3 → 0.1.0

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.
Files changed (103) hide show
  1. data/README.md +7 -5
  2. data/bin/teien +36 -37
  3. data/lib/teien/{smooth_mover.rb → action_model/smooth_moving.rb} +19 -3
  4. data/lib/teien/actor/actor.rb +21 -0
  5. data/{sample/actor/app/helpers/user_event.rb → lib/teien/actor/actor_event.rb} +41 -32
  6. data/lib/teien/actor/actor_factory.rb +20 -0
  7. data/lib/teien/actor/actor_info.rb +7 -0
  8. data/lib/teien/actor/actor_manager.rb +31 -0
  9. data/lib/teien/actor/actor_manager_proxy.rb +72 -0
  10. data/lib/teien/addon/addon.rb +25 -0
  11. data/lib/teien/{animation.rb → animation/animation.rb} +1 -0
  12. data/lib/teien/animation/animation_event.rb +17 -0
  13. data/lib/teien/animation/animation_manager.rb +23 -0
  14. data/lib/teien/animation/animation_manager_proxy.rb +27 -0
  15. data/lib/teien/application/application.rb +43 -0
  16. data/lib/teien/base_object/attachment_info.rb +15 -0
  17. data/lib/teien/{garden_object.rb → base_object/base_object.rb} +43 -52
  18. data/lib/teien/{event.rb → base_object/base_object_event.rb} +9 -12
  19. data/lib/teien/base_object/base_object_manager.rb +57 -0
  20. data/lib/teien/{garden_base.rb → base_object/base_object_manager_base.rb} +22 -31
  21. data/lib/teien/{proxy_garden.rb → base_object/base_object_manager_proxy.rb} +20 -62
  22. data/lib/teien/base_object/object_info.rb +21 -0
  23. data/lib/teien/{physics.rb → base_object/physics.rb} +4 -5
  24. data/lib/teien/{physics_info.rb → base_object/physics_info.rb} +1 -0
  25. data/lib/teien/base_object/physics_object_factory.rb +23 -0
  26. data/lib/teien/base_object/std_objects/box_object_info.rb +42 -0
  27. data/lib/teien/base_object/std_objects/capsule_object_info.rb +44 -0
  28. data/lib/teien/base_object/std_objects/cone_object_info.rb +41 -0
  29. data/lib/teien/base_object/std_objects/cylinder_object_info.rb +44 -0
  30. data/lib/teien/base_object/std_objects/floor_object_info.rb +45 -0
  31. data/lib/teien/base_object/std_objects/light_object_info.rb +40 -0
  32. data/lib/teien/base_object/std_objects/mesh_bb_object_info.rb +42 -0
  33. data/lib/teien/base_object/std_objects/mesh_object_info.rb +62 -0
  34. data/lib/teien/base_object/std_objects/sphere_object_info.rb +38 -0
  35. data/lib/teien/commands/browser_command.rb +46 -0
  36. data/lib/teien/commands/local_command.rb +21 -0
  37. data/lib/teien/commands/server_command.rb +39 -0
  38. data/lib/teien/commands/std_command.rb +71 -0
  39. data/lib/teien/core/client_network.rb +26 -0
  40. data/lib/teien/core/component_manager.rb +11 -0
  41. data/lib/teien/core/core_event.rb +7 -0
  42. data/lib/teien/core/dispatcher.rb +30 -0
  43. data/lib/teien/core/event_router.rb +116 -0
  44. data/lib/teien/core/launcher.rb +31 -0
  45. data/lib/teien/core/network.rb +28 -0
  46. data/lib/teien/{remote_info.rb → core/remote_info.rb} +6 -1
  47. data/lib/teien/core/server_network.rb +23 -0
  48. data/lib/teien/{tools.rb → core/tools.rb} +2 -2
  49. data/lib/teien/{camera.rb → ui/camera.rb} +1 -1
  50. data/lib/teien/{camera_mover.rb → ui/camera_mover.rb} +1 -2
  51. data/lib/teien/ui/std_objects/box_object_info.rb +29 -0
  52. data/lib/teien/ui/std_objects/capsule_object_info.rb +28 -0
  53. data/lib/teien/ui/std_objects/cone_object_info.rb +25 -0
  54. data/lib/teien/ui/std_objects/cylinder_object_info.rb +26 -0
  55. data/lib/teien/ui/std_objects/floor_object_info.rb +34 -0
  56. data/lib/teien/ui/std_objects/light_object_info.rb +23 -0
  57. data/lib/teien/ui/std_objects/mesh_bb_object_info.rb +24 -0
  58. data/lib/teien/ui/std_objects/mesh_object_info.rb +24 -0
  59. data/lib/teien/ui/std_objects/sphere_object_info.rb +26 -0
  60. data/lib/teien/{user_interface.rb → ui/user_interface.rb} +18 -13
  61. data/lib/teien/{view.rb → ui/view.rb} +42 -20
  62. data/lib/teien/ui/view_object.rb +142 -0
  63. data/lib/teien/ui/view_object_factory.rb +23 -0
  64. data/lib/teien/version.rb +1 -1
  65. data/lib/teien.rb +3 -78
  66. data/mods/actor/addons/sinbad/lib/sinbad/sinbad_info.rb +16 -0
  67. data/{sample/actor/app/helpers → mods/actor/addons/sinbad/lib}/sinbad/sinbad_state.rb +14 -39
  68. data/mods/actor/addons/sinbad/lib/sinbad.rb +180 -0
  69. data/mods/actor/apps/browser/browser_application.rb +185 -0
  70. data/mods/actor/apps/common/browser_event.rb +68 -0
  71. data/mods/actor/apps/server/server_application.rb +101 -0
  72. data/{sample/actor/app/ais → mods/actor/commands/ai}/actor_ai.rb +8 -3
  73. data/mods/actor/commands/ai_command.rb +20 -0
  74. data/{sample/actor/config → mods/actor/configs}/plugins.cfg +4 -4
  75. data/{sample/hello_garden/app/controllers/hello_garden_controller.rb → mods/hello_garden/apps/browser/browser_application.rb} +48 -25
  76. data/mods/hello_garden/apps/common/browser_event.rb +58 -0
  77. data/{sample/hello_garden/app/models/hello_garden_model.rb → mods/hello_garden/apps/server/server_application.rb} +35 -26
  78. data/teien.gemspec +3 -1
  79. metadata +114 -55
  80. data/lib/teien/ai.rb +0 -27
  81. data/lib/teien/controller.rb +0 -30
  82. data/lib/teien/dispatcher.rb +0 -22
  83. data/lib/teien/event_router.rb +0 -118
  84. data/lib/teien/garden.rb +0 -91
  85. data/lib/teien/model.rb +0 -34
  86. data/lib/teien/network.rb +0 -108
  87. data/lib/teien/object_info.rb +0 -192
  88. data/lib/teien/physics_object_factory.rb +0 -170
  89. data/lib/teien/synchronizer.rb +0 -26
  90. data/lib/teien/view_object.rb +0 -67
  91. data/lib/teien/view_object_factory.rb +0 -210
  92. data/sample/actor/app/controllers/actor_controller.rb +0 -182
  93. data/sample/actor/app/helpers/sinbad/sinbad.rb +0 -176
  94. data/sample/actor/app/models/actor_model.rb +0 -108
  95. data/sample/hello_garden/app/helpers/user_event.rb +0 -12
  96. /data/lib/teien/{animation_operator.rb → animation/animation_operator.rb} +0 -0
  97. /data/lib/teien/{physics_object.rb → base_object/physics_object.rb} +0 -0
  98. /data/lib/teien/{sky_dome.rb → base_object/sky_dome.rb} +0 -0
  99. /data/lib/teien/{ui_listener.rb → ui/ui_listener.rb} +0 -0
  100. /data/{sample/actor/config → mods/actor/configs}/resources.cfg +0 -0
  101. /data/{sample/hello_garden/config → mods/hello_garden/configs}/plugins.cfg +0 -0
  102. /data/{sample/hello_garden/config → mods/hello_garden/configs}/resources.cfg +0 -0
  103. /data/{sample → mods}/hello_garden/run +0 -0
data/README.md CHANGED
@@ -15,20 +15,22 @@ And then execute:
15
15
  Or install it yourself as:
16
16
 
17
17
  $ gem install eventmachine
18
+ $ gem install ruby-ois
18
19
  $ gem install ruby-ogre
20
+ $ gem install ruby-procedural
19
21
  $ gem install ruby-bullet
20
22
  $ gem install teienlib
21
- $ rake build
22
- $ gem install pkg/teien-<version>.gem
23
+ $ gem build teine.gemspec
24
+ $ gem install teien-<version>.gem
23
25
 
24
26
  ## Usage
25
27
 
26
28
  Run a sample application.
27
29
 
28
30
  $ mkdir mywork/
29
- $ cp -r <gems>/teien-<version>/sample/ mywork/
30
- $ cd mywork/sample/hello_garden/
31
- $ ./run
31
+ $ cp -r <gems>/teien-<version>/mods/ mywork/
32
+ $ cd mywork/mods/hello_garden/
33
+ $ teien local
32
34
 
33
35
  ## Contributing
34
36
 
data/bin/teien CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # This script is a environment setting helper on the startup.
3
+ #!/usr/bin/env ./rprof
4
+
5
+ # This script is an environment setting helper on the startup.
4
6
  # 1. set a LD_LIBRARY_PATH(or PATH) value for dynamic libraries.
5
7
  # 2. restart with above value.
6
8
  # 3. set a LOAD_PATH value for ruby libraries.
@@ -10,54 +12,51 @@ if (ARGV[0] == "-h" || ARGV[0] == "--help")
10
12
  exit
11
13
  end
12
14
 
13
- #
14
- # require this file directly at first line, unless you set
15
- # RUBYLIB and LD_LIBRARY_PATH. (check sample code)
16
- #
17
15
  require 'rbconfig'
18
- require 'ogre_config'
16
+ require 'ruby-ois'
17
+ require 'ruby-ogre'
18
+ require 'ruby-procedural'
19
19
 
20
- $topDir = File.dirname(File.dirname(File.expand_path(__FILE__)))
21
- libPath = $topDir + "/lib"
22
- extPath = OgreConfig::get_deps_lib_path
20
+ top_dir = File.dirname(File.dirname(File.expand_path(__FILE__)))
21
+ lib_path = top_dir + "/lib"
22
+ ois_ext_path = Ruby::Ois::get_deps_lib_path
23
+ ogre_ext_path = Ruby::Ogre::get_deps_lib_path
24
+ pro_ext_path = Ruby::Procedural::get_deps_lib_path
23
25
 
24
- # needed by dynamic library.
26
+ # needed by dynamic libraries.
25
27
  if (/mingw/ =~ RUBY_PLATFORM)
26
- ldLibPath = extPath + ";" + OgreConfig::get_lib + ";" + libPath
28
+ ld_lib_path = ois_ext_path + ";" + ogre_ext_path + ";" + pro_ext_path + ";" + Ruby::Ogre::get_lib_path + ";" + lib_path
27
29
  if (ENV["PATH"] == nil)
28
- ENV["PATH"] = ldLibPath
30
+ ENV["PATH"] = ld_lib_path
29
31
  exec("ruby #{$0} #{ARGV.join(" ")}")
30
- elsif (!ENV["PATH"].include?(ldLibPath))
31
- ENV["PATH"] = ldLibPath + ";" +ENV["PATH"]
32
+ elsif (!ENV["PATH"].include?(ld_lib_path))
33
+ ENV["PATH"] = ld_lib_path + ";" +ENV["PATH"]
32
34
  exec("ruby #{$0} #{ARGV.join(" ")}")
33
35
  end
34
36
  else
35
- ldLibPath = extPath + ":" + libPath
37
+ ld_lib_path = ois_ext_path + ":" + ogre_ext_path + ":" + pro_ext_path + ":" + lib_path
36
38
  if (ENV["LD_LIBRARY_PATH"] == nil)
37
- ENV["LD_LIBRARY_PATH"] = ldLibPath
39
+ ENV["LD_LIBRARY_PATH"] = ld_lib_path
38
40
  exec($0, *ARGV)
39
- elsif(!ENV["LD_LIBRARY_PATH"].include?(ldLibPath))
40
- ENV["LD_LIBRARY_PATH"] = ldLibPath + ":" + ENV["LD_LIBRARY_PATH"]
41
+ elsif(!ENV["LD_LIBRARY_PATH"].include?(ld_lib_path))
42
+ ENV["LD_LIBRARY_PATH"] = ld_lib_path + ":" + ENV["LD_LIBRARY_PATH"]
41
43
  exec($0, *ARGV)
42
44
  end
43
45
  end
44
46
 
45
- $LOAD_PATH.push(libPath)
46
- $LOAD_PATH.push("./")
47
-
48
- require 'teien'
49
-
50
- case ARGV[0]
51
- when "server"
52
- Teien::start_server_garden("0.0.0.0", 11922)
53
- when "client"
54
- ip = ARGV[1] ? ARGV[1] : "0.0.0.0"
55
- port = ARGV[2] ? ARGV[2].to_i : 11922
56
- Teien::start_client_garden(ip, port)
57
- when "ai"
58
- ip = ARGV[1] ? ARGV[1] : "0.0.0.0"
59
- port = ARGV[2] ? ARGV[2].to_i : 11922
60
- Teien::start_ai_garden(ip, port)
61
- when "local"
62
- Teien::start_local_garden()
63
- end
47
+ $LOAD_PATH.push(lib_path)
48
+
49
+ require "teien/core/launcher.rb"
50
+
51
+ # include standard commands.
52
+ require "teien/commands/browser_command"
53
+ require "teien/commands/server_command"
54
+ require "teien/commands/local_command"
55
+
56
+ # include user commands.
57
+ Dir.glob("#{Dir.getwd}/commands/*.rb") {|file|
58
+ require "#{file}"
59
+ }
60
+
61
+ Teien::Launcher::launch(ARGV)
62
+
@@ -1,13 +1,17 @@
1
- class SmoothMover
1
+ module Teien
2
+
3
+ class SmoothMoving
2
4
  ACCELERATION = 5.0
3
5
  TURN_SPEED = 500.0
4
6
 
7
+ attr_accessor :target_object_name
5
8
  attr_accessor :acceleration
6
9
  attr_accessor :turn_speed
7
10
  attr_accessor :movable
8
11
 
9
- def initialize(target_object)
10
- @target_object = target_object
12
+ def initialize(target_object_name)
13
+ @target_object_name = target_object_name
14
+ @target_object = Teien::get_component("base_object_manager").objects[target_object_name]
11
15
  @acceleration = ACCELERATION
12
16
  @turn_speed = TURN_SPEED
13
17
  @move_dir = Ogre::Vector3.new(0, 0, 0)
@@ -15,6 +19,8 @@ class SmoothMover
15
19
  @zero_vector = Vector3D.new(0, 0, 0)
16
20
  clear_action()
17
21
  @movable = true
22
+
23
+ @event_router = Teien::get_component("event_router")
18
24
  end
19
25
 
20
26
  def clear_action()
@@ -28,6 +34,14 @@ class SmoothMover
28
34
  return (@forward || @backward || @left || @right)
29
35
  end
30
36
 
37
+ def set_acceleration(accel)
38
+ @acceleration = accel
39
+ end
40
+
41
+ def set_turn_speed(turn_speed)
42
+ @turn_speed = turn_speed
43
+ end
44
+
31
45
  #
32
46
  # This direction is the forward.
33
47
  #
@@ -95,3 +109,5 @@ class SmoothMover
95
109
  @target_object.yaw(Ogre::Degree.new(yawToGoal).value_radians())
96
110
  end
97
111
  end
112
+
113
+ end
@@ -0,0 +1,21 @@
1
+ module Teien
2
+
3
+ class Actor
4
+ attr_accessor :name
5
+
6
+ def initialize(name)
7
+ @name = name
8
+ end
9
+
10
+ ##
11
+ # handlers of ActorManager
12
+ #
13
+
14
+ def update(delta)
15
+ end
16
+
17
+ def receive_event(event, from)
18
+ end
19
+ end
20
+
21
+ end
@@ -1,38 +1,12 @@
1
- require 'teien/event.rb'
2
-
1
+ module Teien
3
2
  module Event
4
- class RequestControllable
5
- def initialize()
6
- end
7
- end
8
-
9
- class ControllableObject
10
- attr_accessor :actor_name
11
- attr_accessor :object_name
12
-
13
- def initialize(actor_name, object_name)
14
- @actor_name = actor_name
15
- @object_name = object_name
16
- end
17
- end
18
-
19
- class SyncSinbad
20
- attr_accessor :actor_name
21
- attr_accessor :object_name
3
+ module Actor
22
4
 
23
- def initialize(actor)
24
- @actor_name = actor.name
25
- @object_name = actor.object.name
26
- end
27
- end
28
-
29
- class SetForwardDirection
30
- attr_accessor :actor_name
31
- attr_accessor :dir
5
+ class SyncActor
6
+ attr_accessor :actor_info
32
7
 
33
- def initialize(name, dir)
34
- @actor_name = name
35
- @dir = dir
8
+ def initialize(actor_info)
9
+ @actor_info = actor_info
36
10
  end
37
11
  end
38
12
 
@@ -52,6 +26,15 @@ module Event
52
26
  @jump = false
53
27
  end
54
28
 
29
+ def copy(event)
30
+ @actor_name = event.actor_name
31
+ @forward = event.forward
32
+ @backward = event.backward
33
+ @left = event.left
34
+ @right = event.right
35
+ @jump = event.jump
36
+ end
37
+
55
38
  end
56
39
 
57
40
  class EnableAction
@@ -72,4 +55,30 @@ module Event
72
55
  end
73
56
  end
74
57
 
58
+ class SetForwardDirection
59
+ attr_accessor :actor_name
60
+ attr_accessor :dir
61
+
62
+ def initialize(name = nil, dir = nil)
63
+ @actor_name = name
64
+ @dir = dir
65
+ end
66
+
67
+ def copy(event)
68
+ @actor_name = event.actor_name
69
+ @dir = event.dir
70
+ end
71
+ end
72
+
73
+ class RequestEnableAction < EnableAction
74
+ end
75
+
76
+ class RequestDisableAction < DisableAction
77
+ end
78
+
79
+ class RequestSetForwardDirection < SetForwardDirection
80
+ end
81
+
82
+ end
83
+ end
75
84
  end
@@ -0,0 +1,20 @@
1
+ module Teien
2
+
3
+ class ActorFactory
4
+ @creators = Hash.new
5
+
6
+ def self.register_creator(info_klass, creator)
7
+ @creators[info_klass] = creator
8
+ end
9
+
10
+ def self.create_actor(actor_info)
11
+ if @creators[actor_info.class] != nil
12
+ return @creators[actor_info.class].call(actor_info)
13
+ else
14
+ puts "No such creator registered for the class: #{actor_info.class}"
15
+ return nil
16
+ end
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,7 @@
1
+ module Teien
2
+
3
+ class ActorInfo
4
+ attr_accessor :actor_name
5
+ end
6
+
7
+ end
@@ -0,0 +1,31 @@
1
+ require_relative "actor_factory"
2
+ require_relative "actor_event"
3
+ require_relative "actor"
4
+ require_relative "actor_info"
5
+
6
+ module Teien
7
+
8
+ class ActorManager
9
+ attr_accessor :actors
10
+
11
+ def initialize()
12
+ @actors = Hash.new
13
+ @event_router = Teien::get_component("event_router")
14
+ @event_router.register_receiver(self)
15
+ end
16
+
17
+ def create_actor(actor_info)
18
+ actor = ActorFactory::create_actor(actor_info)
19
+ @actors[actor_info.actor_name] = actor
20
+ actor
21
+ end
22
+
23
+ def update(delta)
24
+ @actors.each_value {|actor|
25
+ actor.update(delta)
26
+ }
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,72 @@
1
+ require_relative "actor_factory"
2
+ require_relative "actor_event"
3
+ require_relative "actor"
4
+ require_relative "actor_info"
5
+
6
+ module Teien
7
+
8
+ class ActorManagerProxy
9
+ attr_accessor :actors
10
+
11
+ def initialize()
12
+ @actors = Hash.new
13
+ @event_router = Teien::get_component("event_router")
14
+ @event_router.register_receiver(self)
15
+ end
16
+
17
+ def create_actor(actor_info)
18
+ actor = ActorFactory::create_actor(actor_info)
19
+ @actors[actor_info.actor_name] = actor
20
+ actor
21
+ end
22
+
23
+ def update(delta)
24
+ @actors.each_value {|actor|
25
+ actor.update(delta)
26
+ }
27
+ end
28
+
29
+ def receive_event(event, from)
30
+ case event
31
+ when Teien::Event::Actor::SyncActor
32
+ if @actors[event.actor_info.actor_name]
33
+ # sync some stuff. (ex. state)
34
+ @actors[event.actor_info.actor_name].receive_event(event, from)
35
+ else
36
+ @actors[event.actor_info.actor_name] = create_actor(event.actor_info)
37
+ end
38
+ when Teien::Event::Actor::SetForwardDirection
39
+ if @actors[event.actor_name]
40
+ @actors[event.actor_name].set_forward_direction(event.dir)
41
+ else
42
+ puts "no actor_name"
43
+ end
44
+ when Teien::Event::Actor::EnableAction
45
+ if event.forward
46
+ @actors[event.actor_name].move_forward(true)
47
+ elsif event.backward
48
+ @actors[event.actor_name].move_backward(true)
49
+ elsif event.left
50
+ @actors[event.actor_name].move_left(true)
51
+ elsif event.right
52
+ @actors[event.actor_name].move_right(true)
53
+ elsif event.jump
54
+ @actors[event.actor_name].jump(true)
55
+ end
56
+ when Teien::Event::Actor::DisableAction
57
+ if event.forward
58
+ @actors[event.actor_name].move_forward(false)
59
+ elsif event.backward
60
+ @actors[event.actor_name].move_backward(false)
61
+ elsif event.left
62
+ @actors[event.actor_name].move_left(false)
63
+ elsif event.right
64
+ @actors[event.actor_name].move_right(false)
65
+ elsif event.jump
66
+ @actors[event.actor_name].jump(false)
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ end
@@ -0,0 +1,25 @@
1
+ require 'teien'
2
+
3
+ module Teien
4
+
5
+ class Addon
6
+ @@addons = Array.new
7
+ @@loaded_addons = Array.new
8
+
9
+ def self.inherited(klass)
10
+ @@addons.push(klass)
11
+ end
12
+
13
+ def self.load()
14
+ require 'teien/addon/addon'
15
+ Dir.glob("#{Dir.getwd}/addons/**/lib/*.rb") {|file| require "#{file}" }
16
+ end
17
+
18
+ def self.instantiate()
19
+ @@addons.each {|addon|
20
+ @@loaded_addons.push(addon.new())
21
+ }
22
+ end
23
+ end
24
+
25
+ end
@@ -29,6 +29,7 @@ class Animation
29
29
  end
30
30
  return @operators[operator_name]
31
31
  end
32
+
32
33
  end
33
34
 
34
35
  end
@@ -0,0 +1,17 @@
1
+ module Teien
2
+ module Event
3
+ module Animation
4
+
5
+ class SyncAnimation
6
+ attr_accessor :object_name
7
+ attr_accessor :animation
8
+
9
+ def initialize(object_name, animation)
10
+ @object_name = object_name
11
+ @animation = animation
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ require "teien/animation/animation"
2
+ require "teien/animation/animation_event"
3
+
4
+ module Teien
5
+
6
+ class AnimationManager
7
+ attr_accessor :animations
8
+
9
+ def initialize(event_router)
10
+ @animations = Hash.new
11
+ @event_router = event_router
12
+ @event_router.register_receiver(self)
13
+ end
14
+
15
+ def create_animation(object_name)
16
+ @animations[object_name] = Animation.new
17
+ end
18
+
19
+ def update(delta)
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,27 @@
1
+ require "teien/animation/animation"
2
+ require "teien/animation/animation_event"
3
+
4
+ module Teien
5
+
6
+ class AnimationManagerProxy
7
+ attr_accessor :animations
8
+
9
+ def initialize(event_router)
10
+ @animations = Hash.new
11
+ @event_router = event_router
12
+ @event_router.register_receiver(self)
13
+ end
14
+
15
+ def create_animation(object_name)
16
+ @animations[object_name] = Animation.new
17
+ end
18
+
19
+ def receive_event(event, from)
20
+ case event
21
+ when Teien::Event::Animation::SyncAnimation
22
+ @animations[event.object_name] = event.animation
23
+ end
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,43 @@
1
+ require 'teien'
2
+
3
+ module Teien
4
+
5
+ class Application
6
+ @@apps = Array.new
7
+ @@loaded_apps = Array.new
8
+
9
+ def initialize()
10
+ @event_router = Teien::get_component("event_router")
11
+ @event_router.register_receiver(self)
12
+ @base_object_manager = Teien::get_component("base_object_manager")
13
+ @base_object_manager.register_receiver(self)
14
+
15
+ =begin
16
+ # set config files.
17
+ fileDir = File.dirname(File.expand_path(__FILE__))
18
+ @base_object_manager.plugins_cfg = "#{fileDir}/plugins.cfg"
19
+ @base_object_manager.resources_cfg = "#{fileDir}/resources.cfg"
20
+ =end
21
+ end
22
+
23
+ def self.inherited(klass)
24
+ @@apps.push(klass)
25
+ end
26
+
27
+ def self.load(command)
28
+ require "teien/application/application"
29
+ Dir.glob("#{Dir.getwd}/apps/#{command}/*.rb") {|file| require "#{file}" }
30
+ end
31
+
32
+ def self.instantiate()
33
+ @@apps.each {|app|
34
+ @@loaded_apps.push(app.new())
35
+ }
36
+ end
37
+
38
+ def self.loaded_apps
39
+ return @@loaded_apps
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,15 @@
1
+ class AttachmentInfo
2
+ attr_accessor :bone_name
3
+ attr_accessor :object_name
4
+ attr_accessor :offset_quaternion
5
+ attr_accessor :offset_position
6
+
7
+ def initialize(bone_name, object_name,
8
+ offset_quaternion = Quaternion.new(1, 0, 0, 0),
9
+ offset_position = Vector3D.new(0, 0, 0))
10
+ @bone_name = bone_name
11
+ @object_name = object_name
12
+ @offset_quaternion = offset_quaternion
13
+ @offset_position = offset_position
14
+ end
15
+ end