ogre.rb 0.1-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/README +79 -0
  2. data/Rakefile +291 -0
  3. data/doc_src/ogre.rb +246 -0
  4. data/doc_src/ois.rb +67 -0
  5. data/lib/application.rb +146 -0
  6. data/lib/application_frame_listener.rb +302 -0
  7. data/lib/application_loading_bar.rb +115 -0
  8. data/lib/constants.rb +51 -0
  9. data/lib/method_fixes.rb +42 -0
  10. data/lib/ogre.dll +0 -0
  11. data/lib/ruby_ois.dll +0 -0
  12. data/ogre.rb +25 -0
  13. data/platform.rb +23 -0
  14. data/samples/Ogre.log +279 -0
  15. data/samples/bsp.rb +76 -0
  16. data/samples/cg.dll +0 -0
  17. data/samples/grass.rb +325 -0
  18. data/samples/js3250.dll +0 -0
  19. data/samples/lighting.rb +138 -0
  20. data/samples/media/materials/programs/Grass.cg +30 -0
  21. data/samples/media/materials/programs/OffsetMapping.cg +97 -0
  22. data/samples/media/materials/programs/OffsetMapping.hlsl +135 -0
  23. data/samples/media/materials/programs/OffsetMappingFp.glsl +69 -0
  24. data/samples/media/materials/programs/OffsetMappingVp.glsl +54 -0
  25. data/samples/media/materials/programs/OffsetMapping_specular.asm +44 -0
  26. data/samples/media/materials/scripts/CloudySky.material +17 -0
  27. data/samples/media/materials/scripts/CubeMapping.material +34 -0
  28. data/samples/media/materials/scripts/Flare.material +17 -0
  29. data/samples/media/materials/scripts/Grass.material +63 -0
  30. data/samples/media/materials/scripts/Knot.material +14 -0
  31. data/samples/media/materials/scripts/MorningSkyBox.material +17 -0
  32. data/samples/media/materials/scripts/Offset.material +124 -0
  33. data/samples/media/materials/scripts/Ogre.material +119 -0
  34. data/samples/media/materials/scripts/RZR-002.material +15 -0
  35. data/samples/media/materials/scripts/Razor.material +14 -0
  36. data/samples/media/materials/scripts/Ribbon.material +19 -0
  37. data/samples/media/materials/scripts/RustySteel.material +14 -0
  38. data/samples/media/materials/scripts/SpaceSkyBox.material +17 -0
  39. data/samples/media/materials/scripts/SpaceSkyPlane.material +17 -0
  40. data/samples/media/materials/scripts/TextureEffects.material +15 -0
  41. data/samples/media/materials/scripts/dragon.material +42 -0
  42. data/samples/media/materials/scripts/smoke.material +18 -0
  43. data/samples/media/materials/textures/GreenSkin.jpg +0 -0
  44. data/samples/media/materials/textures/MtlPlat2.jpg +0 -0
  45. data/samples/media/materials/textures/RZR-002.png +0 -0
  46. data/samples/media/materials/textures/RustedMetal.jpg +0 -0
  47. data/samples/media/materials/textures/RustySteel.jpg +0 -0
  48. data/samples/media/materials/textures/Thumbs.db +0 -0
  49. data/samples/media/materials/textures/Water02.jpg +0 -0
  50. data/samples/media/materials/textures/WeirdEye.png +0 -0
  51. data/samples/media/materials/textures/clouds.jpg +0 -0
  52. data/samples/media/materials/textures/cursor.png +0 -0
  53. data/samples/media/materials/textures/dirt01.jpg +0 -0
  54. data/samples/media/materials/textures/flare.png +0 -0
  55. data/samples/media/materials/textures/gras_02.png +0 -0
  56. data/samples/media/materials/textures/grass_1024.jpg +0 -0
  57. data/samples/media/materials/textures/ogreborder.png +0 -0
  58. data/samples/media/materials/textures/ogreborderUp.png +0 -0
  59. data/samples/media/materials/textures/ribbonband.png +0 -0
  60. data/samples/media/materials/textures/rockwall.tga +0 -0
  61. data/samples/media/materials/textures/rockwall_NH.tga +0 -0
  62. data/samples/media/materials/textures/smoke.png +0 -0
  63. data/samples/media/materials/textures/smokecolors.png +0 -0
  64. data/samples/media/materials/textures/spacesky.jpg +0 -0
  65. data/samples/media/materials/textures/spheremap.png +0 -0
  66. data/samples/media/materials/textures/texmap2.jpg +0 -0
  67. data/samples/media/models/RZR-002.mesh +0 -0
  68. data/samples/media/models/geosphere4500.mesh +0 -0
  69. data/samples/media/models/geosphere8000.mesh +0 -0
  70. data/samples/media/models/knot.mesh +0 -0
  71. data/samples/media/models/ogrehead.mesh +0 -0
  72. data/samples/media/models/razor.mesh +0 -0
  73. data/samples/media/models/sphere.mesh +0 -0
  74. data/samples/media/overlays/CubeMapping.overlay +139 -0
  75. data/samples/media/packs/OgreCore.zip +0 -0
  76. data/samples/media/packs/chiropteraDM.pk3 +0 -0
  77. data/samples/media/packs/chiropteraDM.txt +99 -0
  78. data/samples/media/packs/cubemap.zip +0 -0
  79. data/samples/media/packs/cubemapsJS.zip +0 -0
  80. data/samples/media/packs/dragon.zip +0 -0
  81. data/samples/media/packs/skybox.zip +0 -0
  82. data/samples/media/particles/smoke.particle +43 -0
  83. data/samples/media.cfg +22 -0
  84. data/samples/ogre.cfg +19 -0
  85. data/samples/plugins.cfg +12 -0
  86. data/samples/quake3settings.cfg +2 -0
  87. data/samples/render_to_texture.rb +161 -0
  88. data/samples/resources.cfg +16 -0
  89. data/samples/sky_box.rb +107 -0
  90. data/samples/sky_dome.rb +86 -0
  91. data/samples/sky_plane.rb +27 -0
  92. data/samples/smoke.rb +23 -0
  93. data/samples/work/cube_mapping.rb +686 -0
  94. metadata +149 -0
data/README ADDED
@@ -0,0 +1,79 @@
1
+ = Ogre.rb : Ruby wrapper around Ogre
2
+
3
+ Welcome to Ogre.rb, the Ruby wrapper around the Ogre rendering engine. This currently is only
4
+ known to build and run correctly on Linux, though I expect this will work just fine on Mac as well.
5
+ Windows support will come later.
6
+
7
+ Ogre.rb is currently built for Ruby 1.8.5+ and Ogre 1.4.x (Eihort)
8
+
9
+ == Usage
10
+
11
+ Assuming Ogre.rb and OIS.rb are compiled, you are free to copy lib/ogre.so and lib/OIS.so into your project
12
+ as needed. You will need to either place the extensions next to the Ogre and OIS libraries or have your
13
+ environment set up to know where these libraries are located. Then, using Ogre.rb is as easy as:
14
+
15
+ require 'ogre'
16
+ require 'ruby_ois'
17
+
18
+ and optionally
19
+
20
+ require 'navi' (note that navi is only supported in Windows using Direct3D at the moment)
21
+
22
+ The samples/ directory is a direct port of the Ogre sample programs.
23
+
24
+ == Contributing
25
+
26
+ Please post patches, feature requests, bug fixes to the rubyforge website at http://rubyforge.org/projects/ogrerb.
27
+ As I'm not sure exactly how to unit test such a wrapper, it will be greatly appreciated if changes are proven as
28
+ part of a sample application.
29
+
30
+ == Build Requirements
31
+
32
+ * rake
33
+ * Ogre 1.4.x (Eihort)
34
+ * OIS
35
+ * swig 1.3.31+ (uses -autorename)
36
+ * pkg-config (Linux)
37
+
38
+ == Build Steps
39
+
40
+ === Linux
41
+
42
+ rake build_all
43
+
44
+ The resulting files can be found in ogrerb/lib.
45
+
46
+ === Mac
47
+
48
+ TODO
49
+
50
+ === Windows
51
+
52
+ ==== Setup your environment
53
+
54
+ 1. Install Ruby One-Click Installer: http://rubyforge.org/projects/rubyinstaller/
55
+ 1. Install Visual Studio Express 2005: http://msdn.microsoft.com/vstudio/express/ (Be sure to register environment variables)
56
+ 1. You'll need to remove the following 3 lines of the [ruby install dir]/lib/ruby/1.8/i386-mswin32/config.h file:
57
+ #if _MSC_VER != 1200
58
+ #error MSC version unmatch
59
+ #endif
60
+ 1. You need the MS platform SDK available here(ish): http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en.
61
+ 1. Be sure to register environment variables in the setup.
62
+ 1. Download and install the Ogre SDK and the precompiled VC dependencies: http://www.ogre3d.org
63
+ 1. Set the environment variable OGRE_HOME to where the the Ogre SDK is installed
64
+ 1. Open "Visual Studio 2005 Command Prompt" and navigate to where you have Ogre.rb checked out and run the following rake tasks
65
+
66
+ ==== Build
67
+
68
+ 1. rake ogre:swig
69
+ 1. rake ogre:compile
70
+ 1. rake ois:swig
71
+ 1. rake ois:compile
72
+
73
+ You cannot run rake ogre:build or ois:build due to a Windows file permission problem.
74
+
75
+ The resulting files can be found in ogrerb/lib.
76
+
77
+ == Running Ogre.rb programs
78
+
79
+ You'll either have to copy the OgreMain dll to the ogrerb/lib folder, or you'll need to set the PATH (on Windows) or LD_LIBRARY_PATH (on Linux) environment variable to point to where this file is ([OgreSDK]/bin/release for prebuilt). Then, it's simply <code>require 'ogre'</code> and off you go.
data/Rakefile ADDED
@@ -0,0 +1,291 @@
1
+ require 'rake/testtask'
2
+ require 'rake/rdoctask'
3
+ require 'rake/contrib/sshpublisher'
4
+ require 'rake/gempackagetask'
5
+
6
+ require 'platform'
7
+
8
+ task :default => :build_all
9
+
10
+ OGRE_RB_VERSION = "0.1"
11
+
12
+ ###########################
13
+ # Project Managment tasks #
14
+ ###########################
15
+
16
+ RDOC_INCLUDES = %w(
17
+ README
18
+ doc_src/**/*.rb
19
+ lib/application.rb
20
+ lib/application_frame_listener.rb
21
+ lib/application_loading_bar.rb
22
+ lib/constants.rb
23
+ lib/method_fixes.rb
24
+ )
25
+
26
+ RDOC_OPTIONS = ['-S', '-t Ogre.rb Documentation']
27
+
28
+ Rake::RDocTask.new do |t|
29
+ t.main = "README"
30
+ t.rdoc_files.include(RDOC_INCLUDES)
31
+ t.options += RDOC_OPTIONS
32
+ end
33
+
34
+ RUBYFORGE_USERNAME = "jameskilton"
35
+ PROJECT_WEB_PATH = "/var/www/gforge-projects/ogrerb"
36
+
37
+ desc "Update the website"
38
+ task :upload_web => :rdoc do |t|
39
+ unless File.directory?("publish")
40
+ mkdir "publish"
41
+ mkdir "publish/docs"
42
+ end
43
+ sh "svn export --force website publish/"
44
+ sh "cp -r html/* publish/docs/"
45
+ Rake::SshDirPublisher.new("#{RUBYFORGE_USERNAME}@rubyforge.org", PROJECT_WEB_PATH, "publish").upload
46
+ rm_rf "publish"
47
+ end
48
+
49
+ ## Gem Compilation ##
50
+ ogre_rb_spec = Gem::Specification.new do |s|
51
+
52
+ s.platform = Gem::Platform::CURRENT
53
+
54
+ lib_files = ""
55
+ if Platform.windows?
56
+ lib_files = %w(lib/ogre.dll lib/ruby_ois.dll)
57
+ elsif Platform.mac?
58
+ else # Posix environment
59
+ lib_files = %w(lib/ogre.so lib/ruby_ois.so)
60
+ end
61
+
62
+ s.name = 'ogre.rb'
63
+ s.version = OGRE_RB_VERSION
64
+ s.summary = "Ruby wrapper for Ogre 3D"
65
+ s.description = %q{Ogre.rb is a SWIG wrapper to allow access to the Ogre 3D API from Ruby.}
66
+
67
+ s.author = "Jason Roelofs"
68
+ s.email = "jameskilton@gmail.com"
69
+ s.rubyforge_project = 'ogrerb'
70
+ s.homepage = 'http://ogrerb.rubyforge.org'
71
+
72
+ s.require_path = '.'
73
+
74
+ s.required_ruby_version = '>= 1.8.4'
75
+
76
+ # Inform of the need to have Ogre installed and OGRE_HOME set
77
+ s.requirements << "Ogre Einhort (1.4)"
78
+ s.requirements << "Environment variable OGRE_HOME set"
79
+
80
+ #s.has_rdoc = false
81
+ #s.extra_rdoc_files += RDOC_INCLUDES
82
+ #s.rdoc_options += RDOC_OPTIONS
83
+
84
+ files = FileList.new %w(
85
+ README
86
+ platform.rb
87
+ ogre.rb
88
+ Rakefile
89
+ lib/*.rb
90
+ samples/**/*
91
+ doc_src/**/*
92
+ ) do |fl|
93
+ fl.exclude(/navi/)
94
+ end
95
+
96
+ files += lib_files
97
+
98
+ s.files = files
99
+ end
100
+
101
+ desc 'Package as gem & zip'
102
+ Rake::GemPackageTask.new(ogre_rb_spec) do |p|
103
+ p.gem_spec = ogre_rb_spec
104
+ #p.need_tar = true
105
+ p.need_zip = true
106
+ end
107
+
108
+ #############################
109
+ # Project compilation tasks #
110
+ #############################
111
+
112
+ desc "Rebuild the OGRE and OIS wrappers. Does not work on Windows."
113
+ task :build_all => ["ogre:build", "ois:build"]
114
+
115
+ desc "Clean everything"
116
+ task :clean_all => ["ogre:clean", "ois:clean"]
117
+
118
+ namespace :ois do
119
+ desc "Rebuild all of the OIS wrapper. Does not work on Windows."
120
+ task :build => [:swig, :compile]
121
+
122
+ desc "Run swig on the interface files"
123
+ task :swig do
124
+ includes = %w(-I./src_headers/OIS -I./src_headers/wrappers)
125
+ sh "swig -ruby -minherit -c++ -autorename #{includes.join(' ')} -o build/ois/ois_wrap.cpp ois/ois.i"
126
+ if Platform.windows?
127
+ insert_headers("build/ois/ois_wrap.cpp") do
128
+ <<-EOF
129
+ #include "OIS.h"
130
+ EOF
131
+ end
132
+ end
133
+ end
134
+
135
+ desc "Compile the extension and move the resulting library into lib/"
136
+ task :compile do
137
+ resulting_file = "ruby_ois.so"
138
+ build_file = resulting_file
139
+ cd "build/ois" do
140
+ ruby "extconf.rb"
141
+ if Platform.linux?
142
+ sh "make all"
143
+ elsif Platform.windows?
144
+ sh "nmake"
145
+ # Create our manifest (see http://www.codeproject.com/cpp/vcredists_x86.asp)
146
+ sh "mt.exe /manifest #{resulting_file}.manifest /outputresource:#{resulting_file};#2"
147
+ resulting_file = "ruby_ois.dll"
148
+ build_file = "ruby_ois.so"
149
+ else
150
+ raise "Error: Unsupported platform " + PLATFORM
151
+ end
152
+ cp build_file, File.join("..", "..", "lib", resulting_file)
153
+ end
154
+ end
155
+
156
+ desc "Clean up the build environment"
157
+ task :clean do
158
+ cd "build/ois" do
159
+ ruby "extconf.rb"
160
+ sh "make clean"
161
+ rm "mkmf.log" rescue nil
162
+ end
163
+ end
164
+ end
165
+
166
+ namespace :ogre do
167
+
168
+ desc "Rebuild all of ogre.rb. Does not work on Windows."
169
+ task :build => [:swig, :compile]
170
+
171
+ desc "Run swig on the interface files"
172
+ task :swig do
173
+ includes = %w(-I./src_headers/OGRE -I./src_headers/ExampleApplication -I./src_headers/wrappers -I./src_headers/OIS)
174
+ sh "swig -ruby -minherit -c++ -autorename #{includes.join(' ')} -o build/ogre/ogre_rb_wrap.cpp ogre/ogre_rb.i"
175
+ if Platform.windows?
176
+ # compensate for windows stl. Uses wrong version when ruby is first.
177
+ insert_headers("build/ogre/ogre_rb_wrap.cpp") do
178
+ <<-EOF
179
+ #include "Ogre.h"
180
+ #{Platform.windows? ? "#include <winsock.h>" : ""}
181
+ EOF
182
+ end
183
+ end
184
+ end
185
+
186
+ desc "Compile the extension and move the resulting library into lib/"
187
+ task :compile do
188
+ resulting_file = "ogre.so"
189
+ cd "build/ogre" do
190
+ ruby "extconf.rb"
191
+ if Platform.linux?
192
+ sh "make clean all"
193
+ elsif Platform.windows?
194
+ sh "nmake"
195
+ # Create our manifest (see http://www.codeproject.com/cpp/vcredists_x86.asp)
196
+ sh "mt.exe /manifest ogre.so.manifest /outputresource:ogre.so;#2"
197
+ resulting_file = "ogre.dll"
198
+ else
199
+ raise "Error: Unsupported platform " + PLATFORM
200
+ end
201
+ cp "ogre.so", File.join("..", "..", "lib", resulting_file)
202
+ end
203
+ end
204
+
205
+ desc "Clean up the build environment"
206
+ task :clean do
207
+ cd "build/ogre" do
208
+ ruby "extconf.rb"
209
+ sh "make clean"
210
+ rm "mkmf.log" rescue nil
211
+ end
212
+ end
213
+
214
+ desc "Copy over the ogre header files from an ogre installation. Expects OGRE_HOME to be set."
215
+ task :update_headers do
216
+ raise "Unable to find Ogre headers, please set OGRE_HOME to the distribution path" if ENV['OGRE_HOME'].nil?
217
+
218
+ File.cp_r "#{ENV['OGRE_HOME']}/include/OGRE/", "#{File.dirname(__FILE__)}/src_headers"
219
+ end
220
+
221
+ desc "Create default interface files for each of the ogre headers"
222
+ task :create_interfaces do
223
+ headers_match = File.join("src_headers", "OGRE", "Ogre*.h")
224
+ ogre_headers = Dir[headers_match]
225
+
226
+ ogre_headers.each do |header|
227
+ filename = File.basename(header, ".h")
228
+ interface_file_name = File.join("ogre", File.basename(header, ".h") + ".i")
229
+ raise "Interface file for #{filename} already exists" if File.exists?(interface_file_name)
230
+
231
+ File.open(interface_file_name, "w+") do |file|
232
+ file.write <<END
233
+ %{
234
+ #include "#{filename}.h"
235
+ %}
236
+
237
+ %include "#{filename}.h"
238
+ END
239
+ end
240
+ end
241
+ end
242
+ end
243
+
244
+
245
+ namespace :navi do
246
+
247
+ desc "Rebuild all of navi.rb"
248
+ task :build => [:swig, :compile]
249
+
250
+ desc "Run swig on the interface files"
251
+ task :swig do
252
+ includes = %w(-I./src_headers/navi -I./src_headers/wrappers)
253
+ sh "swig -autorename -ruby -minherit -c++ #{includes.join(' ')} -o build/navi/navi_rb_wrap.cpp navi/navi_rb.i"
254
+ if Platform.windows?
255
+ # compensate for windows stl. Uses wrong version when ruby is first.
256
+
257
+ insert_headers("build/navi/navi_rb_wrap.cpp") do
258
+ <<-EOF
259
+ #include "Ogre.h"
260
+ #{Platform.windows? ? "#include <winsock.h>" : ""}
261
+ EOF
262
+ end
263
+ end
264
+ end
265
+
266
+ desc "Compile the extension and move the resulting library into lib/"
267
+ task :compile do
268
+ resulting_file = "navi.dll"
269
+ cd "build/navi" do
270
+ ruby "extconf.rb"
271
+ if Platform.windows?
272
+ sh "nmake"
273
+ # Create our manifest (see http://www.codeproject.com/cpp/vcredists_x86.asp)
274
+ sh "mt.exe /manifest navi.so.manifest /outputresource:navi.so;#2"
275
+ else
276
+ raise "Error: Unsupported platform " + PLATFORM
277
+ end
278
+ cp "navi.so", File.join("..", "..", "lib", resulting_file)
279
+ end
280
+ end
281
+
282
+ desc "Clean up the build environment"
283
+ task :clean do
284
+ cd "build" do
285
+ ruby "extconf.rb"
286
+ sh "make clean"
287
+ rm "mkmf.log" rescue nil
288
+ end
289
+ end
290
+
291
+ end
data/doc_src/ogre.rb ADDED
@@ -0,0 +1,246 @@
1
+ #
2
+ # = Naming Conventions
3
+ #
4
+ # Ogre.rb is using the <tt>--autorename</tt> flag available in SWIG-Ruby. This automatically
5
+ # renames constants, methods, and attributes to follow the Ruby Way. Mainly, this means that
6
+ # method names are the same as Ogre's, but follow this style:
7
+ #
8
+ # ClassName.method_name(param1, param2, ...)
9
+ # var.method_name? # for methods who return boolean results
10
+ #
11
+ # Because there are setter methods in Ogre that can take multiple parameters
12
+ # (e.g. SceneManager::setSkyBox), we've decided to not turn set/get methods into the typical
13
+ # attr_accessor names of Ruby. So, this method would be used in Ogre.rb as such:
14
+ #
15
+ # scene_manager.set_sky_box(true, "CloudySky")
16
+ #
17
+ # This documentation will try to cover every method rename that differs from straight undercasing of Ogre method names,
18
+ # though please post a patch if some are missed.
19
+ #
20
+ module Ogre
21
+ # This class is here to define a few things that were difficult / not
22
+ # working correctly just through SWIG. These methods are defined so as not to be any different
23
+ # from calling the constants straight from Ogre (Vector3.ZERO).
24
+ #
25
+ # See OgreVector3.i for an example, but basically we need to define these manually
26
+ # because Ruby always passes references, which causes annoying problems such as:
27
+ #
28
+ # vec1 = Ogre::Vector3.ZERO
29
+ # vec1.x = 10
30
+ # vec2 = Ogre::Vector3.ZERO
31
+ # vec2.x #=> 10 (when it should be 0)
32
+ #
33
+ # Current classes with constants redefined as methods in lib/constants.rb:
34
+ #
35
+ # Vector3
36
+ # Vector4
37
+ # Quaternion
38
+ #
39
+ module Constants
40
+ end
41
+
42
+ class FrameEvent
43
+ # Function wrapper for the timeSinceLastFrame variable
44
+ def time_since_last_frame
45
+ end
46
+
47
+ # Function wrapper for the timeSinceLastEvent variable
48
+ def time_since_last_event
49
+ end
50
+ end
51
+
52
+ # As it stands, all classes with internal Listener classes (aka Resource) have been neutered to not
53
+ # allow access to these inner classes. As Ruby is perfectly fine with inner classes, this may need
54
+ # to be a change to the ruby SWIG driver. So for now, these classes and the related functions
55
+ # are unavailable through Ogre.rb.
56
+ class Listeners
57
+ end
58
+
59
+ # MovableObject is used extensively in Ogre, but very rarely is an instance of the class created through
60
+ # the typical "new MovableObject();" syntax. Given this, there is no immedate way of knowing what subclass
61
+ # of MovableObject was actually created, in say, Ogre::SceneManager::createMovableObject:
62
+ #
63
+ # virtual MovableObject* createMovableObject(const String& name, const String& typeName, const NameValuePairList* params = 0);
64
+ #
65
+ # Left alone, every call to this function will return a MovableObject instance instead of the appropriate
66
+ # subclass, completely destroying expected type information. Thankfully Ogre makes this very easy to
67
+ # solve: getMovableType. Every MovableObject has this method which returns the string representation
68
+ # of the class name it is. Using this string, we can find out what class was actually created and have
69
+ # SWIG generate the appropriate class type. Thus, we can do the following:
70
+ #
71
+ # trail = scene_manager.create_movable_object("RibbonTrail1", "RibbonTrail", {"numberOfChains" => "2", "maxElements" => "80"})
72
+ # trail.set_material_name("LightRibbonTrail")
73
+ # trail.set_trail_length(400)
74
+ #
75
+ # As <tt>trail</tt> is a <tt>#<Ogre::RibbonTrail:0xb6edf718></tt>.
76
+ #
77
+ class MovableObject
78
+ end
79
+
80
+ # Any method call that takes an Ogre::NameValuePairList argument should be given a normal Ruby
81
+ # hash of "key" => "value". Example usage is found in the sample lighting.rb.
82
+ #
83
+ # Ogre's SceneManager::createMovableObject is defined as:
84
+ #
85
+ # virtual MovableObject* createMovableObject(const String& name, const String& typeName, const NameValuePairList* params = 0);
86
+ #
87
+ # and can be used in Ogre.rb as:
88
+ #
89
+ # trail = scene_manager.create_movable_object("RibbonTrail1", "RibbonTrail", {"numberOfChains" => "2", "maxElements" => "80"})
90
+ #
91
+ class NameValuePairList
92
+ end
93
+
94
+ class RenderWindow
95
+ # Renamed: isClosed
96
+ def closed?
97
+ end
98
+ end
99
+
100
+ class Singleton
101
+ # Renamed: getSingleton
102
+ #
103
+ # In following the Ruby-way, singletons are to be accessed as such:
104
+ #
105
+ # MeshManager.instance.create_mesh
106
+ #
107
+ def self.instance
108
+ end
109
+ end
110
+
111
+ class SceneManager
112
+ # Renamed: getRootSceneNode
113
+ def root_scene_node
114
+ end
115
+ end
116
+
117
+ class TextureManager
118
+ # There is currently an issue with create_manual in that if you try to use the
119
+ # method version that does not include the depth parameter (such as in Ogre's
120
+ # RenderToTexture demo), SWIG still chooses this
121
+ # one, sending in the render_type parameter as the pixel_format. If you run into an unexpected
122
+ # assert failure in PixelFormat, make sure that you're method call
123
+ # signature matches this method's parameter list.
124
+ #
125
+ # num_mip_maps can be -1 to use the system's default number of mip maps
126
+ #
127
+ # depth must be >= 1 or the method will never return
128
+ #
129
+ # Ogre's docs for this class are here: http://www.ogre3d.org/docs/api/html/classOgre_1_1TextureManager.html
130
+ def create_manual(name, group_name, tex_type, width, height, depth, num_mip_maps, pixel_format, render_type, manual_loader = nil)
131
+ end
132
+ end
133
+
134
+ # There is a problem, possibly unsolvable, with trying to send Ruby subclasses of C++ classes
135
+ # back into C++ methods. This came up in situations like registering a custom FrameListener.
136
+ # It basically doesn't work, and ends up causing all sorts of issues from random SegFaults at
137
+ # runtime to ObjectPreviouslyDeleted errors at the method's invocation. To get around this
138
+ # problem, these proxy classes have been defined. They are simple C++ subclasses that take
139
+ # care of whatever registering needs to happen inside of their constructor.
140
+ #
141
+ # Also please note: <b>This Proxies namespace does not exist in Ogre.rb</b>. The classes are grouped
142
+ # this way for documentation purposes.
143
+ module Proxies
144
+ # FrameListenerProxy constructor takes the Root object, with which it registers itself as a system
145
+ # frame listener.
146
+ class FrameListenerProxy
147
+ def initialize(root)
148
+ end
149
+ end
150
+
151
+ # This proxy isn't quite done yet, as it's registering command,
152
+ # WindowEventUtilities::addWindowEventListener, takes both the Listener and a RenderWindow.
153
+ # It's the RenderWindow that is causing problems but I think this one is easily solvable.
154
+ class WindowEventListenerProxy
155
+ def initialize(render_window)
156
+ end
157
+ end
158
+ end
159
+
160
+ # Hardware buffers are an especially interesting problem when it comes to duplicating functionality in Ruby.
161
+ # Buffers like Vertex and Index buffers are meant to be directly accessible and in a contiguous memory location.
162
+ # This allows the Ogre C++ code to populate these buffers as such
163
+ #
164
+ # // position
165
+ # *pReal++ = -vec.x;
166
+ # *pReal++ = GRASS_HEIGHT;
167
+ # *pReal++ = -vec.z;
168
+ # // normal
169
+ # *pReal++ = 0;
170
+ # *pReal++ = 1;
171
+ # *pReal++ = 0;
172
+ # // uv
173
+ # *pReal++ = 0;
174
+ # *pReal++ = 0;
175
+ #
176
+ # Now we obviously can't do this in Ruby, so Vertex and Index Buffer proxy classes have been put together to
177
+ # allow the above code to become this following in Ruby
178
+ #
179
+ # x = i * 32
180
+ # # Position
181
+ # reals[x + 0] = -vec.x
182
+ # reals[x + 1] = GRASS_HEIGHT
183
+ # reals[x + 2] = -vec.z
184
+ # # Normal
185
+ # reals[x + 3] = 0
186
+ # reals[x + 4] = 1
187
+ # reals[x + 5] = 0
188
+ # # UV
189
+ # reals[x + 6] = 0
190
+ # reals[x + 7] = 0
191
+ #
192
+ # Compare the Ogre Grass demo with the Ogre.rb Grass demo to see the full code
193
+ class HardwareBuffer
194
+ end
195
+
196
+ # See HardwareBuffer
197
+ class HardwareVertexBuffer < HardwareBuffer
198
+ # For now this should be the only lock method used. It returns a VertexBufferProxy which
199
+ # allows the array-like access
200
+ def lock(lock_options)
201
+ end
202
+ end
203
+
204
+ # See HardwareBuffer
205
+ class HardwareIndexBuffer < HardwareBuffer
206
+ # For now this should be the only lock method used. It returns an IndexBufferProxy which
207
+ # allows the array-like access
208
+ def lock(lock_options)
209
+ end
210
+ end
211
+
212
+
213
+ # The StaticGeometry class contains a lot of nested classes to deal with all of the parts that could possible
214
+ # be in a piece of static geometry. This of course poses a serious problem with wrapping as SWIG cannot handle
215
+ # nested classes. The solution here is to create proxy classes for all of the nested classes and use those instead.
216
+ # The normal API of using StaticGeometry has not changed, just the names of the classes that will be dealt with.
217
+ #
218
+ # This proxy code was taken from OgreDotNet and still needs some work to make it fit nicely into the Ruby way of
219
+ # doing things. If something isn't quite right, please look at OgreStaticGeometry.i and StaticGeometryProxies.h
220
+ # to see what methods are available.
221
+ #
222
+ # See the Grass demo for example usage.
223
+ class StaticGeometry
224
+ # Proxy for the StaticGeometry::GeometryBucket class
225
+ class SGGeometryBucket
226
+ # Returns the underlying GeometryBucket class as a Renderable object
227
+ def as_renderable
228
+ end
229
+ end
230
+
231
+ # Proxy for the StaticGeometry::MaterialBucket class
232
+ class SGMaterialBucket
233
+ end
234
+
235
+ # Proxy for the StaticGeometry::LODBucket class
236
+ class SGLODBucket
237
+ end
238
+
239
+ # Proxy for the StaticGeometry::Region class
240
+ class SGRegion
241
+ # Returns the underlying Region class as a MovableObject
242
+ def as_movable_object
243
+ end
244
+ end
245
+ end
246
+ end
data/doc_src/ois.rb ADDED
@@ -0,0 +1,67 @@
1
+ # OIS has been completely wrapped into Ruby. Any of OIS's classes documented here are to describe
2
+ # special cases or functionality changes required to make this work for Ruby.
3
+ module OIS
4
+
5
+ class InputManager
6
+ # As with Ogre::MovableObject and Ogre::Resource, the usage of <tt>create_input_object</tt> will automatically
7
+ # return the proper type of OIS::Object whether it be a Mouse, Keyboard, or JoyStick.
8
+ #
9
+ # See Ogre::ApplicationFrameListener for an example of where this is used.
10
+ def create_input_object(obj_type, is_buffered)
11
+ end
12
+
13
+ # See OIS::ParamList
14
+ def create_input_system(param_list)
15
+ end
16
+ end
17
+
18
+ class Keyboard
19
+ # Renamed: isKeyDown
20
+ def key_down?(key)
21
+ end
22
+ end
23
+
24
+ class Mouse
25
+ # Renamed: getMouseState
26
+ def mouse_state
27
+ end
28
+ end
29
+
30
+ class MouseState
31
+ # Renamed: buttonDown
32
+ def button_down?(button)
33
+ end
34
+ end
35
+
36
+ # Any OIS function that uses a ParamList as a parameter type will now require a simple Ruby
37
+ # hash construct. For example, <tt>InputManager.createInputSystem</tt> is now used as such:
38
+ #
39
+ # windowHnd = @window.get_custom_attribute_unsigned_long("WINDOW")
40
+ # InputManager.create_input_system( { "WINDOW" => "#{windowHnd}" } )
41
+ #
42
+ # With <tt>create_input_system</tt>, the version that simply takes a size_t has been disabled because it
43
+ # was causing problems.
44
+ class ParamList
45
+ end
46
+
47
+ # See Ogre::Proxies for an explaination of the existance of these classes. See src_headers/wrappers/OISProxies.h.
48
+ #
49
+ # Also please note: <b>This Proxies namespace does not exist in Ogre.rb</b>. The classes are grouped this way
50
+ # for documentation purposes.
51
+ module Proxies
52
+ class KeyListenerProxy
53
+ def initialize(keyboard)
54
+ end
55
+ end
56
+
57
+ class MouseListenerProxy
58
+ def initialize(mouse)
59
+ end
60
+ end
61
+
62
+ class JoyStickListenerProxy
63
+ def initialize(joy_stick)
64
+ end
65
+ end
66
+ end
67
+ end