ruby-ogre 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.
Files changed (44) hide show
  1. data/README.md +80 -5
  2. data/Rakefile +26 -19
  3. data/bindings/ogre/interface/Rakefile +22 -0
  4. data/bindings/ogre/interface/ogre.i +3 -1
  5. data/bindings/ogre/interface/ogre_wrap.cpp +99671 -17485
  6. data/bindings/ogre/interface/ogre_wrap.o +0 -0
  7. data/bindings/ogrebites/interface/Rakefile +22 -0
  8. data/bindings/ogrebites/interface/ogrebites.i +1 -1
  9. data/bindings/ogrebites/interface/ogrebites_wrap.cpp +728 -728
  10. data/bindings/ogrebites/interface/ogrebites_wrap.h +2 -2
  11. data/bindings/ogrebites/interface/ogrebites_wrap.o +0 -0
  12. data/bindings/ois/interface/Rakefile +22 -0
  13. data/bindings/ois/interface/ois.i +1 -1
  14. data/bindings/ois/interface/ois_wrap.cpp +553 -553
  15. data/bindings/ois/interface/ois_wrap.h +2 -2
  16. data/bindings/ois/interface/ois_wrap.o +0 -0
  17. data/bindings/procedural/interface/Rakefile +22 -0
  18. data/bindings/procedural/interface/procedural.i +1 -1
  19. data/bindings/procedural/interface/procedural_wrap.cpp +1247 -1247
  20. data/bindings/procedural/interface/procedural_wrap.o +0 -0
  21. data/lib/{Ogre.so → ogre.so} +0 -0
  22. data/lib/ogre_config.rb +37 -0
  23. data/lib/ogrebites.so +0 -0
  24. data/lib/{OIS.so → ois.so} +0 -0
  25. data/lib/{Procedural.so → procedural.so} +0 -0
  26. data/lib/{Version.rb → version.rb} +1 -1
  27. data/sample/charactor/camera_mover.rb +184 -0
  28. data/sample/{Charactor → charactor}/plugins.cfg +0 -0
  29. data/sample/{Charactor → charactor}/resources.cfg +0 -0
  30. data/sample/{Charactor → charactor}/sinbad +1 -1
  31. data/sample/charactor/sinbad.rb +246 -0
  32. data/sample/{Charactor → charactor}/sinbad.win +1 -1
  33. data/sample/{Charactor/SinbadCharacter.rb → charactor/sinbad_character.rb} +125 -125
  34. data/sample/charactor/ui_listener.rb +65 -0
  35. metadata +22 -21
  36. data/bindings/ogre/interface/Makefile +0 -19
  37. data/bindings/ogrebites/interface/Makefile +0 -19
  38. data/bindings/ois/interface/Makefile +0 -19
  39. data/bindings/procedural/interface/Makefile +0 -19
  40. data/lib/OgreBites.so +0 -0
  41. data/lib/OgreConfig.rb +0 -37
  42. data/sample/Charactor/CameraMover.rb +0 -184
  43. data/sample/Charactor/Sinbad.rb +0 -246
  44. data/sample/Charactor/UiListener.rb +0 -65
@@ -1,246 +0,0 @@
1
-
2
- $LOAD_PATH.push(File.dirname(File.expand_path(__FILE__)) + "../../lib")
3
-
4
- require "Ogre"
5
- require "OIS"
6
- require "OgreBites"
7
- require "OgreConfig"
8
- require_relative "UiListener"
9
- require_relative "CameraMover"
10
- require_relative "SinbadCharacter"
11
-
12
- class Sinbad < Ogre::FrameListener
13
- def initialize()
14
- super # initialize Ogre::FrameListener.
15
- @root = nil
16
- @window = nil
17
- @camera = nil
18
- @sceneMgr = nil
19
- @inputManager = nil
20
- @mouse = nil
21
- @keyboard = nil
22
- @trayMgr = nil
23
-
24
- @quit = false
25
-
26
- @Info = {}
27
- @Info["Help"] =
28
- "Use the WASD keys to move Sinbad, and the space bar to jump. \n" +
29
- " Use mouse to look around and mouse wheel to zoom.\n" +
30
- " Press Q to take out or put back Sinbad's swords. With the swords equipped, " +
31
- "you can left click to slice vertically or right click to slice horizontally.\n" +
32
- " When the swords are not equipped, press E to start/stop a silly dance routine."
33
-
34
- $filePath = File.dirname(File.expand_path(__FILE__))
35
- end
36
-
37
- def run
38
- initRoot()
39
- initResources()
40
- initManagers()
41
- initListeners()
42
- initCamera()
43
-
44
- # load "General" group resources into ResourceGroupManager.
45
- @trayMgr.showLoadingBar(1, 0)
46
- Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General")
47
- @trayMgr.hideLoadingBar()
48
- Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5)
49
-
50
- @trayMgr.showFrameStats(OgreBites::TL_BOTTOMLEFT)
51
- @trayMgr.showLogo(OgreBites::TL_BOTTOMRIGHT)
52
- @trayMgr.hideCursor()
53
-
54
- setupContent()
55
-
56
- @root.startRendering()
57
- end
58
-
59
- def initRoot()
60
- @root = Ogre::Root.new("")
61
- loadPlugins()
62
-
63
- return false unless @root.showConfigDialog()
64
- @window = @root.initialise(true, "Sinbad")
65
- @root.addFrameListener(self)
66
- end
67
-
68
- def loadPlugins()
69
- cfg = Ogre::ConfigFile.new
70
- cfg.load("#{$filePath}/plugins.cfg")
71
-
72
- pluginDir = cfg.getSetting("PluginFolder")
73
- pluginDir += "/" if (pluginDir.length > 0) && (pluginDir[-1] != '/')
74
-
75
- cfg.each_Settings {|secName, keyName, valueName|
76
- fullPath = pluginDir + valueName
77
- fullPath.sub!("<SystemPluginFolder>", OgreConfig::getPluginFolder)
78
- @root.loadPlugin(fullPath) if (keyName == "Plugin")
79
- }
80
- end
81
-
82
- def initResources()
83
- # Load resource paths from config file
84
- cfg = Ogre::ConfigFile.new
85
- cfg.load("#{$filePath}/resources.cfg")
86
-
87
- resourceDir = cfg.getSetting("ResourceFolder")
88
- resourceDir += "/" if (resourceDir.length > 0) && (resourceDir[-1] != '/')
89
-
90
- cfg.each_Settings {|secName, keyName, valueName|
91
- next if (keyName == "ResourceFolder")
92
-
93
- fullPath = resourceDir + valueName
94
- fullPath.sub!("<SystemResourceFolder>", OgreConfig::getResourceFolder)
95
- Ogre::ResourceGroupManager::getSingleton().addResourceLocation(fullPath,
96
- keyName,
97
- secName)
98
- }
99
- end
100
-
101
- def initManagers()
102
- # initialize InputManager
103
- windowHnd = Ogre::Intp.new
104
- @window.getCustomAttribute("WINDOW", windowHnd)
105
- windowHndStr = sprintf("%d", windowHnd.value())
106
- pl = OIS::ParamList.new
107
- pl["WINDOW"] = windowHndStr
108
- @inputManager = OIS::InputManager::createInputSystem(pl)
109
- @keyboard = @inputManager.createInputObject(OIS::OISKeyboard, true).toKeyboard()
110
- @mouse = @inputManager.createInputObject(OIS::OISMouse, true).toMouse()
111
-
112
- # initialize trayManager
113
- Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Essential")
114
- @trayMgr = OgreBites::SdkTrayManager.new("Base", @window, @mouse);
115
- ms = @mouse.getMouseState()
116
- ms.width = @window.getWidth()
117
- ms.height = @window.getHeight()
118
-
119
- # initialize sceneMgr
120
- @sceneMgr = @root.createSceneManager(Ogre::ST_GENERIC)
121
- @sceneMgr.setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE)
122
-
123
- end
124
-
125
- def initListeners()
126
- @keyListener = KeyListener.new(self)
127
- @keyboard.setEventCallback(@keyListener)
128
-
129
- @mouseListener = MouseListener.new(self)
130
- @mouse.setEventCallback(@mouseListener)
131
-
132
- @trayListener = TrayListener.new(self)
133
- @trayMgr.setListener(@trayListener)
134
- end
135
-
136
- def initCamera()
137
- # initialize camera
138
- @camera = @sceneMgr.createCamera("FixCamera")
139
-
140
- # Create one viewport, entire window
141
- @vp = @window.addViewport(@camera);
142
- @vp.setBackgroundColour(Ogre::ColourValue.new(0, 0, 0))
143
- # Alter the camera aspect ratio to match the viewport
144
- @camera.setAspectRatio(Float(@vp.getActualWidth()) / Float(@vp.getActualHeight()))
145
- end
146
-
147
- def setupContent()
148
- # set background and some fog
149
- @vp.setBackgroundColour(Ogre::ColourValue.new(1.0, 1.0, 0.8))
150
- @sceneMgr.setFog(Ogre::FOG_LINEAR, Ogre::ColourValue.new(1.0, 1.0, 0.8), 0, 15, 100)
151
-
152
- # set shadow properties
153
- @sceneMgr.setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE)
154
- @sceneMgr.setShadowColour(Ogre::ColourValue.new(0.5, 0.5, 0.5))
155
- @sceneMgr.setShadowTextureSize(1024)
156
- @sceneMgr.setShadowTextureCount(1)
157
-
158
- # use a small amount of ambient lighting
159
- @sceneMgr.setAmbientLight(Ogre::ColourValue.new(0.3, 0.3, 0.3))
160
-
161
- # add a bright light above the scene
162
- @light = @sceneMgr.createLight()
163
- @light.setType(Ogre::Light::LT_POINT)
164
- @light.setPosition(-10, 40, 20)
165
- @light.setSpecularColour(Ogre::ColourValue.White)
166
-
167
- # create a floor mesh resource
168
- Ogre::MeshManager::getSingleton().createPlane("floor",
169
- Ogre::ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
170
- Ogre::Plane.new(Ogre::Vector3.UNIT_Y, 0),
171
- 100, 100, 10, 10, true, 1, 10, 10,
172
- Ogre::Vector3.UNIT_Z)
173
-
174
- # create a floor entity, give it a material, and place it at the origin
175
- @floor = @sceneMgr.createEntity("Floor", "floor")
176
- @floor.setMaterialName("Examples/Rockwall")
177
- @floor.setCastShadows(false)
178
- @sceneMgr.getRootSceneNode().attachObject(@floor)
179
-
180
- @cameraMover = CameraMover.new(@camera)
181
- @cameraMover.setPosition(Ogre::Vector3.new(10, 10, 10))
182
- @cameraMover.lookAt(Ogre::Vector3.new(0, 0, 0))
183
-
184
- @char = SinbadCharacter.new(@sceneMgr, @cameraMover)
185
-
186
- items = []
187
- items.push("Help")
188
- @help = @trayMgr.createParamsPanel(OgreBites::TL_TOPLEFT, "HelpMessage", 100, items)
189
- @help.setParamValue(Ogre::UTFString.new("Help"), Ogre::UTFString.new("H / F1"))
190
- end
191
-
192
- def frameRenderingQueued(evt)
193
- @keyboard.capture()
194
- @mouse.capture()
195
- @trayMgr.frameRenderingQueued(evt)
196
-
197
- @char.addTime(evt.timeSinceLastFrame)
198
- @cameraMover.update(evt.timeSinceLastFrame)
199
-
200
- return !@quit
201
- end
202
-
203
- def keyPressed(keyEvent)
204
- @char.injectKeyDown(keyEvent)
205
-
206
- case keyEvent.key
207
- when OIS::KC_ESCAPE
208
- @quit =true
209
- when OIS::KC_H, OIS::KC_F1
210
- if (!@trayMgr.isDialogVisible() && @Info["Help"] != "")
211
- @trayMgr.showOkDialog(Ogre::UTFString.new("Help"), Ogre::UTFString.new(@Info["Help"]))
212
- else
213
- @trayMgr.closeDialog()
214
- end
215
- end
216
-
217
- return true
218
- end
219
-
220
- def keyReleased(keyEvent)
221
- @char.injectKeyUp(keyEvent)
222
- return true
223
- end
224
-
225
- def mouseMoved(mouseEvent)
226
- return true if @trayMgr.injectMouseMove(mouseEvent)
227
- @cameraMover.mouseMoved(mouseEvent)
228
- return true
229
- end
230
-
231
- def mousePressed(mouseEvent, mouseButtonID)
232
- return true if @trayMgr.injectMouseDown(mouseEvent, mouseButtonID)
233
- @cameraMover.mousePressed(mouseEvent, mouseButtonID)
234
- @char.injectMouseDown(mouseEvent, mouseButtonID)
235
- return true
236
- end
237
-
238
- def mouseReleased(mouseEvent, mouseButtonID)
239
- return true if @trayMgr.injectMouseUp(mouseEvent, mouseButtonID)
240
- @cameraMover.mouseReleased(mouseEvent, mouseButtonID)
241
- return true
242
- end
243
- end
244
-
245
- sinbad = Sinbad.new
246
- sinbad.run
@@ -1,65 +0,0 @@
1
- #
2
- # Key Listener
3
- #
4
- class KeyListener < OIS::KeyListener
5
- def initialize(listener)
6
- super()
7
- @listener = listener
8
- end
9
-
10
- def keyPressed(keyEvent)
11
- return @listener.keyPressed(keyEvent)
12
- end
13
-
14
- def keyReleased(keyEvent)
15
- return @listener.keyReleased(keyEvent)
16
- end
17
- end
18
-
19
- #
20
- # Mouse Listener
21
- #
22
- class MouseListener < OIS::MouseListener
23
- def initialize(listener)
24
- super()
25
- @listener = listener
26
- end
27
-
28
- def mouseMoved(evt)
29
- return @listener.mouseMoved(evt)
30
- end
31
-
32
- def mousePressed(mouseEvent, mouseButtonID)
33
- return @listener.mousePressed(mouseEvent, mouseButtonID)
34
- end
35
-
36
- def mouseReleased(mouseEvent, mouseButtonID)
37
- return @listener.mouseReleased(mouseEvent, mouseButtonID)
38
- end
39
- end
40
-
41
- #
42
- # Tray Listener
43
- #
44
- class TrayListener < OgreBites::SdkTrayListener
45
- def initialize(listener)
46
- super()
47
- @listener = listener
48
- end
49
-
50
- def buttonHit(button)
51
- @listener.buttonHit(button)
52
- end
53
-
54
- def itemSelected(menu)
55
- @listener.itemSelected(menu)
56
- end
57
-
58
- def yesNoDialogClosed(name, bl)
59
- @listener.yesNoDialogClosed(name, bl)
60
- end
61
-
62
- def okDialogClosed(name)
63
- @listener.okDialogClosed(name)
64
- end
65
- end