shattered_ogrerb 0.5.0.1 → 0.5.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/lib/shattered_ogrerb/mesh_instance.rb +9 -0
  2. data/vendor/Navi/js3250.dll +0 -0
  3. data/vendor/Navi/nspr4.dll +0 -0
  4. data/vendor/Navi/plc4.dll +0 -0
  5. data/vendor/Navi/plds4.dll +0 -0
  6. data/vendor/Navi/xpcom.dll +0 -0
  7. data/vendor/Navi/xul.dll +0 -0
  8. data/vendor/ogrerb/CHANGELOG +7 -0
  9. data/vendor/ogrerb/README +7 -2
  10. data/vendor/ogrerb/Rakefile +98 -10
  11. data/vendor/ogrerb/build/ogre/extconf.rb +6 -0
  12. data/vendor/ogrerb/build/ois/extconf.rb +8 -1
  13. data/vendor/ogrerb/doc_src/ogre.rb +97 -3
  14. data/vendor/ogrerb/lib/OIS.so +0 -0
  15. data/vendor/ogrerb/{samples → lib}/application.rb +0 -0
  16. data/vendor/ogrerb/{samples → lib}/application_frame_listener.rb +1 -1
  17. data/vendor/ogrerb/{samples → lib}/application_loading_bar.rb +12 -12
  18. data/vendor/ogrerb/lib/constants.rb +16 -0
  19. data/vendor/ogrerb/lib/method_fixes.rb +42 -0
  20. data/vendor/ogrerb/lib/navi.dll +0 -0
  21. data/vendor/ogrerb/lib/ogre.dll +0 -0
  22. data/vendor/ogrerb/lib/ogre.so +0 -0
  23. data/vendor/ogrerb/lib/ruby_ois.dll +0 -0
  24. data/vendor/ogrerb/lib/ruby_ois.so +0 -0
  25. data/vendor/ogrerb/ogre/OgreAxisAlignedBox.i +6 -0
  26. data/vendor/ogrerb/ogre/OgreHardwareIndexBuffer.i +14 -0
  27. data/vendor/ogrerb/ogre/OgreHardwareVertexBuffer.i +33 -1
  28. data/vendor/ogrerb/ogre/OgreMaterialManager.i +1 -1
  29. data/vendor/ogrerb/ogre/OgreMesh.i +32 -0
  30. data/vendor/ogrerb/ogre/OgreQuaternion.i +5 -0
  31. data/vendor/ogrerb/ogre/OgreRenderSystemCapabilities.i +4 -0
  32. data/vendor/ogrerb/ogre/OgreShadowTextureManager.i +6 -1
  33. data/vendor/ogrerb/ogre/OgreStaticGeometry.i +272 -0
  34. data/vendor/ogrerb/ogre/OgreStringVector.i +20 -0
  35. data/vendor/ogrerb/ogre/OgreSubMesh.i +4 -0
  36. data/vendor/ogrerb/ogre/OgreTextureUnitState.i +3 -0
  37. data/vendor/ogrerb/ogre/OgreVector4.i +4 -0
  38. data/vendor/ogrerb/ogre/ogre_rb.i +26 -18
  39. data/vendor/ogrerb/ogre.rb +5 -3
  40. data/vendor/ogrerb/samples/bsp.rb +2 -0
  41. data/vendor/ogrerb/samples/cel_shading.rb +85 -0
  42. data/vendor/ogrerb/samples/grass.rb +325 -0
  43. data/vendor/ogrerb/samples/lighting.rb +2 -0
  44. data/vendor/ogrerb/samples/media/materials/programs/CelShading.cg +63 -0
  45. data/vendor/ogrerb/samples/media/materials/programs/Grass.cg +30 -0
  46. data/vendor/ogrerb/samples/media/materials/programs/OffsetMapping.cg +97 -0
  47. data/vendor/ogrerb/samples/media/materials/programs/OffsetMapping.hlsl +135 -0
  48. data/vendor/ogrerb/samples/media/materials/programs/OffsetMappingFp.glsl +69 -0
  49. data/vendor/ogrerb/samples/media/materials/programs/OffsetMappingVp.glsl +54 -0
  50. data/vendor/ogrerb/samples/media/materials/programs/OffsetMapping_specular.asm +44 -0
  51. data/vendor/ogrerb/samples/media/materials/scripts/CelShading.material +68 -0
  52. data/vendor/ogrerb/samples/media/materials/scripts/CubeMapping.material +34 -0
  53. data/vendor/ogrerb/samples/media/materials/scripts/Grass.material +63 -0
  54. data/vendor/ogrerb/samples/media/materials/scripts/Offset.material +124 -0
  55. data/vendor/ogrerb/samples/media/materials/scripts/RZR-002.material +15 -0
  56. data/vendor/ogrerb/samples/media/materials/textures/RZR-002.png +0 -0
  57. data/vendor/ogrerb/samples/media/materials/textures/cel_shading_diffuse.png +0 -0
  58. data/vendor/ogrerb/samples/media/materials/textures/cel_shading_edge.png +0 -0
  59. data/vendor/ogrerb/samples/media/materials/textures/cel_shading_specular.png +0 -0
  60. data/vendor/ogrerb/samples/media/materials/textures/gras_02.png +0 -0
  61. data/vendor/ogrerb/samples/media/materials/textures/grass_1024.jpg +0 -0
  62. data/vendor/ogrerb/samples/media/materials/textures/rockwall.tga +0 -0
  63. data/vendor/ogrerb/samples/media/materials/textures/rockwall_NH.tga +0 -0
  64. data/vendor/ogrerb/samples/media/models/RZR-002.mesh +0 -0
  65. data/vendor/ogrerb/samples/media/models/geosphere4500.mesh +0 -0
  66. data/vendor/ogrerb/samples/media/models/geosphere8000.mesh +0 -0
  67. data/vendor/ogrerb/samples/media/models/sphere.mesh +0 -0
  68. data/vendor/ogrerb/samples/media/overlays/CubeMapping.overlay +139 -0
  69. data/vendor/ogrerb/samples/media.cfg +22 -0
  70. data/vendor/ogrerb/samples/plugins.cfg +1 -0
  71. data/vendor/ogrerb/samples/render_to_texture.rb +2 -0
  72. data/vendor/ogrerb/samples/resources.cfg +2 -0
  73. data/vendor/ogrerb/samples/sky_box.rb +2 -0
  74. data/vendor/ogrerb/samples/sky_dome.rb +2 -0
  75. data/vendor/ogrerb/samples/sky_plane.rb +3 -0
  76. data/vendor/ogrerb/samples/smoke.rb +2 -0
  77. data/vendor/ogrerb/samples/work/cube_mapping.rb +686 -0
  78. data/vendor/ogrerb/src_headers/wrappers/IndexBufferProxy.h +49 -0
  79. data/vendor/ogrerb/src_headers/wrappers/StaticGeometryProxies.h +867 -0
  80. data/vendor/ogrerb/src_headers/wrappers/VertexBufferProxy.h +245 -0
  81. data/vendor/ogrerb/website/index.html +9 -0
  82. metadata +54 -6
@@ -88,5 +88,14 @@ module Ogre
88
88
  entity.is_visible
89
89
  end
90
90
 
91
+ # Set a material on a mesh. You can set rmaterials or names of Ogre materials.
92
+ def material=(material)
93
+ if(material.is_a? String)
94
+ self.set_material_name(material)
95
+ else
96
+ self.set_material_name(material.get_name)
97
+ end
98
+ end
99
+
91
100
  end
92
101
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ * Cel-Shading demo ported, added support for SubEntities.
2
+
3
+ * Mac compilation support!
4
+
5
+ == 0.1
6
+
7
+ * Initial release!
data/vendor/ogrerb/README CHANGED
@@ -32,7 +32,7 @@ part of a sample application.
32
32
  * rake
33
33
  * Ogre 1.4.x (Eihort)
34
34
  * OIS
35
- * swig 1.3.17+
35
+ * swig 1.3.31+ (uses -autorename)
36
36
  * pkg-config (Linux)
37
37
 
38
38
  == Build Steps
@@ -45,7 +45,12 @@ The resulting files can be found in ogrerb/lib.
45
45
 
46
46
  === Mac
47
47
 
48
- TODO
48
+ rake build_all
49
+
50
+ The resulting frameworks will be located in ogrerb/lib.
51
+
52
+ You will need to run the build_mac_rubyw Rake task, which creates a rubyw executable that's fit for opening
53
+ up windows in the foreground. See http://rubyforge.org/forum/forum.php?thread_id=15371&forum_id=14174 for details.
49
54
 
50
55
  === Windows
51
56
 
@@ -1,21 +1,34 @@
1
1
  require 'rake/testtask'
2
2
  require 'rake/rdoctask'
3
3
  require 'rake/contrib/sshpublisher'
4
+ require 'rake/gempackagetask'
4
5
 
5
6
  require 'platform'
6
7
 
7
8
  task :default => :build_all
8
9
 
10
+ OGRE_RB_VERSION = "0.1"
11
+
9
12
  ###########################
10
13
  # Project Managment tasks #
11
14
  ###########################
12
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
+
13
28
  Rake::RDocTask.new do |t|
14
29
  t.main = "README"
15
- t.rdoc_files.include("README", "doc_src/**/*.rb")
16
- # Exclude for now, not going to delete. We may come back to this.
17
- t.rdoc_files.exclude("doc_src/application.rb", "doc_src/application_frame_listener.rb")
18
- t.rdoc_files.include("samples/application.rb", "samples/application_frame_listener.rb")
30
+ t.rdoc_files.include(RDOC_INCLUDES)
31
+ t.options += RDOC_OPTIONS
19
32
  end
20
33
 
21
34
  RUBYFORGE_USERNAME = "jameskilton"
@@ -33,19 +46,85 @@ task :upload_web => :rdoc do |t|
33
46
  rm_rf "publish"
34
47
  end
35
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
+ lib_files = %w(lib/ogre.bundle lib/ruby_ois.bundle)
59
+ else # Posix environment
60
+ lib_files = %w(lib/ogre.so lib/ruby_ois.so)
61
+ end
62
+
63
+ s.name = 'ogre.rb'
64
+ s.version = OGRE_RB_VERSION
65
+ s.summary = "Ruby wrapper for Ogre 3D"
66
+ s.description = %q{Ogre.rb is a SWIG wrapper to allow access to the Ogre 3D API from Ruby.}
67
+
68
+ s.author = "Jason Roelofs"
69
+ s.email = "jameskilton@gmail.com"
70
+ s.rubyforge_project = 'ogrerb'
71
+ s.homepage = 'http://ogrerb.rubyforge.org'
72
+
73
+ s.require_path = '.'
74
+
75
+ s.required_ruby_version = '>= 1.8.4'
76
+
77
+ # Inform of the need to have Ogre installed and OGRE_HOME set
78
+ s.requirements << "Ogre Einhort (1.4)"
79
+ s.requirements << "Environment variable OGRE_HOME set"
80
+
81
+ #s.has_rdoc = false
82
+ #s.extra_rdoc_files += RDOC_INCLUDES
83
+ #s.rdoc_options += RDOC_OPTIONS
84
+
85
+ files = FileList.new %w(
86
+ README
87
+ platform.rb
88
+ ogre.rb
89
+ Rakefile
90
+ lib/*.rb
91
+ samples/**/*
92
+ doc_src/**/*
93
+ ) do |fl|
94
+ fl.exclude(/navi/)
95
+ end
96
+
97
+ files += lib_files
98
+
99
+ s.files = files
100
+ end
101
+
102
+ desc 'Package as gem & zip'
103
+ Rake::GemPackageTask.new(ogre_rb_spec) do |p|
104
+ p.gem_spec = ogre_rb_spec
105
+ end
36
106
 
37
107
  #############################
38
108
  # Project compilation tasks #
39
109
  #############################
40
110
 
41
- desc "Rebuild the OGRE and OIS wrappers"
111
+ desc "Rebuild the OGRE and OIS wrappers. Does not work on Windows."
42
112
  task :build_all => ["ogre:build", "ois:build"]
43
113
 
44
114
  desc "Clean everything"
45
115
  task :clean_all => ["ogre:clean", "ois:clean"]
46
116
 
117
+ desc "Build rubyw on the mac platform, needed for ogrerb to run properly."
118
+ task :build_mac_rubyw do
119
+ if Platform.mac?
120
+ sh "ruby=`which ruby`; rubyw=${ruby}w; sudo cp $ruby $rubyw; sudo /Developer/Tools/Rez -t APPL Carbon.r -o $rubyw"
121
+ else
122
+ puts "This is only to be run on Mac OS X"
123
+ end
124
+ end
125
+
47
126
  namespace :ois do
48
- desc "Rebuild all of the OIS wrapper"
127
+ desc "Rebuild all of the OIS wrapper. Does not work on Windows."
49
128
  task :build => [:swig, :compile]
50
129
 
51
130
  desc "Run swig on the interface files"
@@ -75,7 +154,11 @@ namespace :ois do
75
154
  sh "mt.exe /manifest #{resulting_file}.manifest /outputresource:#{resulting_file};#2"
76
155
  resulting_file = "ruby_ois.dll"
77
156
  build_file = "ruby_ois.so"
78
- else
157
+ elsif Platform.mac?
158
+ sh "make all"
159
+ resulting_file = "ruby_ois.bundle"
160
+ build_file = "ruby_ois.bundle"
161
+ else
79
162
  raise "Error: Unsupported platform " + PLATFORM
80
163
  end
81
164
  cp build_file, File.join("..", "..", "lib", resulting_file)
@@ -94,7 +177,7 @@ end
94
177
 
95
178
  namespace :ogre do
96
179
 
97
- desc "Rebuild all of ogre.rb"
180
+ desc "Rebuild all of ogre.rb. Does not work on Windows."
98
181
  task :build => [:swig, :compile]
99
182
 
100
183
  desc "Run swig on the interface files"
@@ -115,6 +198,7 @@ namespace :ogre do
115
198
  desc "Compile the extension and move the resulting library into lib/"
116
199
  task :compile do
117
200
  resulting_file = "ogre.so"
201
+ build_file = resulting_file
118
202
  cd "build/ogre" do
119
203
  ruby "extconf.rb"
120
204
  if Platform.linux?
@@ -124,10 +208,14 @@ namespace :ogre do
124
208
  # Create our manifest (see http://www.codeproject.com/cpp/vcredists_x86.asp)
125
209
  sh "mt.exe /manifest ogre.so.manifest /outputresource:ogre.so;#2"
126
210
  resulting_file = "ogre.dll"
127
- else
211
+ elsif Platform.mac?
212
+ sh "make clean all"
213
+ resulting_file = "ogre.bundle"
214
+ build_file = "ogre.bundle"
215
+ else
128
216
  raise "Error: Unsupported platform " + PLATFORM
129
217
  end
130
- cp "ogre.so", File.join("..", "..", "lib", resulting_file)
218
+ cp build_file, File.join("..", "..", "lib", resulting_file)
131
219
  end
132
220
  end
133
221
 
@@ -43,6 +43,12 @@ elsif Platform.windows?
43
43
 
44
44
  append_ld_flags "-libpath:\"#{ENV["OGRE_HOME"]}/lib\""
45
45
  append_ld_flags "OIS.lib"
46
+ elsif Platform.mac?
47
+ #Ogre Includes from the framework
48
+ append_cpp_flags "-I\"/Library/Frameworks/Ogre.framework/Headers\""
49
+
50
+ #Ogre Framework
51
+ append_ld_flags "-framework Ogre"
46
52
  end
47
53
 
48
54
 
@@ -42,7 +42,14 @@ elsif Platform.windows?
42
42
 
43
43
  append_ld_flags "-libpath:\"#{ENV["OGRE_HOME"]}/lib\""
44
44
  append_ld_flags "OIS.lib"
45
-
45
+
46
+ elsif Platform.mac?
47
+ #OIS Includes from the framework
48
+ append_cpp_flags "-I\"/Library/Frameworks/OIS.framework/Headers\" -DOIS_DYNAMIC_LIB"
49
+
50
+ #OIS Framework
51
+ append_ld_flags "-framework OIS"
52
+
46
53
  end
47
54
 
48
55
  create_makefile('ruby_ois')
@@ -14,8 +14,8 @@
14
14
  #
15
15
  # scene_manager.set_sky_box(true, "CloudySky")
16
16
  #
17
- # I will try to document every method rename that differs from straight undercasing of Ogre method names,
18
- # though please post a patch if I missed one.
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
19
  #
20
20
  module Ogre
21
21
  # This class is here to define a few things that were difficult / not
@@ -24,7 +24,7 @@ module Ogre
24
24
  #
25
25
  # See OgreVector3.i for an example, but basically we need to define these manually
26
26
  # because Ruby always passes references, which causes annoying problems such as:
27
- #
27
+ #
28
28
  # vec1 = Ogre::Vector3.ZERO
29
29
  # vec1.x = 10
30
30
  # vec2 = Ogre::Vector3.ZERO
@@ -33,6 +33,8 @@ module Ogre
33
33
  # Current classes with constants redefined as methods in lib/constants.rb:
34
34
  #
35
35
  # Vector3
36
+ # Vector4
37
+ # Quaternion
36
38
  #
37
39
  module Constants
38
40
  end
@@ -97,6 +99,11 @@ module Ogre
97
99
 
98
100
  class Singleton
99
101
  # Renamed: getSingleton
102
+ #
103
+ # In following the Ruby-way, singletons are to be accessed as such:
104
+ #
105
+ # MeshManager.instance.create_mesh
106
+ #
100
107
  def self.instance
101
108
  end
102
109
  end
@@ -149,4 +156,91 @@ module Ogre
149
156
  end
150
157
  end
151
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
152
246
  end
Binary file
File without changes
@@ -111,7 +111,7 @@ module Ogre
111
111
  # Most likely won't have a joystick here, so just throw away any exceptions
112
112
  @joy_stick = nil
113
113
  begin
114
- @joy_stick = @input_manager.create_input_object( OIS::OISJoyStick, buffered_joy)
114
+ @joy_stick = @input_manager.create_input_object( OIS::OISJoyStick, buffered_joy) unless Platform.mac?
115
115
  rescue
116
116
  end
117
117
 
@@ -2,19 +2,19 @@ module Ogre
2
2
 
3
3
  # From Ogre's ExampleLoadingBar:
4
4
  #
5
- # Defines an example loading progress bar which you can use during
6
- # startup, level changes etc to display loading progress.
5
+ # Defines an example loading progress bar which you can use during
6
+ # startup, level changes etc to display loading progress.
7
7
  #
8
- # Basically you just need to create an instance of this class, call start()
9
- # before loading and finish() afterwards. You may also need to stop areas of
10
- # your scene rendering in between since this method will call
11
- # RenderWindow::update() to update the display of the bar - we advise using
12
- # SceneManager's 'special case render queues' for this, see
13
- # SceneManager::addSpecialCaseRenderQueue for details.
14
- #
15
- # This progress bar relies on you having the OgreCore.zip package already
16
- # added to a resource group called 'Bootstrap' - this provides the basic
17
- # resources required for the progress bar and will be loaded automatically.
8
+ # Basically you just need to create an instance of this class, call start()
9
+ # before loading and finish() afterwards. You may also need to stop areas of
10
+ # your scene rendering in between since this method will call
11
+ # RenderWindow::update() to update the display of the bar - we advise using
12
+ # SceneManager's 'special case render queues' for this, see
13
+ # SceneManager::addSpecialCaseRenderQueue for details.
14
+ #
15
+ # This progress bar relies on you having the OgreCore.zip package already
16
+ # added to a resource group called 'Bootstrap' - this provides the basic
17
+ # resources required for the progress bar and will be loaded automatically.
18
18
  class ApplicationLoadingBar < ResourceGroupListenerProxy
19
19
 
20
20
  def start(window, num_groups_init = 1, num_groups_load = 1, initial_proportion = 0.7)
@@ -32,4 +32,20 @@ module Ogre
32
32
  Vector3.new(1, 1, 1)
33
33
  end
34
34
  end
35
+
36
+ class Vector4
37
+ def self.ZERO
38
+ Vector4.new(0,0,0,0)
39
+ end
40
+ end
41
+
42
+ class Quaternion
43
+ def self.ZERO
44
+ Quaternion.new(0.0,0.0,0.0,0.0)
45
+ end
46
+
47
+ def self.IDENTITY
48
+ Quaternion.new(1.0,0.0,0.0,0.0)
49
+ end
50
+ end
35
51
  end
@@ -0,0 +1,42 @@
1
+ module Ogre
2
+
3
+ class SubMesh
4
+ alias_method :use_shared_vertices?, :useSharedVertices
5
+ alias_method :use_shared_vertices=, :useSharedVertices=
6
+
7
+ alias_method :vertex_data, :vertexData
8
+ alias_method :vertex_data=, :vertexData=
9
+
10
+ alias_method :index_data, :indexData
11
+ alias_method :index_data=, :indexData=
12
+
13
+ # SubMesh is a friend of Mesh, not a subclass...
14
+ #alias_method :shared_vertex_data, :sharedVertexData
15
+ #alias_method :shared_vertex_data=, :sharedVertexData=
16
+ end
17
+
18
+ class VertexData
19
+ alias_method :vertex_declaration, :vertexDeclaration
20
+ alias_method :vertex_declaration=, :vertexDeclaration=
21
+
22
+ alias_method :vertex_buffer_binding, :vertexBufferBinding
23
+ alias_method :vertex_buffer_binding=, :vertexBufferBinding=
24
+
25
+ alias_method :vertex_start, :vertexStart
26
+ alias_method :vertex_start=, :vertexStart=
27
+
28
+ alias_method :vertex_count, :vertexCount
29
+ alias_method :vertex_count=, :vertexCount=
30
+ end
31
+
32
+ class IndexData
33
+ alias_method :index_buffer, :indexBuffer
34
+ alias_method :index_buffer=, :indexBuffer=
35
+
36
+ alias_method :index_start, :indexStart
37
+ alias_method :index_start=, :indexStart=
38
+
39
+ alias_method :index_count, :indexCount
40
+ alias_method :index_count=, :indexCount=
41
+ end
42
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -2,4 +2,10 @@
2
2
  #include "OgreAxisAlignedBox.h"
3
3
  %}
4
4
 
5
+ namespace Ogre {
6
+
7
+ // This was causing a linking error o_O
8
+ %ignore AxisAlignedBox::getCorner;
9
+ }
10
+
5
11
  %include "OgreAxisAlignedBox.h"
@@ -1,9 +1,23 @@
1
1
  %{
2
2
  #include "OgreHardwareIndexBuffer.h"
3
+ #include "IndexBufferProxy.h"
3
4
  %}
4
5
 
5
6
  namespace Ogre {
6
7
  %template(HardwareIndexBufferSharedPtrSWIG) SharedPtr<HardwareIndexBuffer>;
8
+
9
+ /**
10
+ * Taken from pyogre, we need a special proxy object for dealing with locked
11
+ * memory buffers. The normal C++ code has pointer access, and can just increment (++)
12
+ * through memory. As we can't do that in Ruby, we'll proxy off the calls back
13
+ * into C++
14
+ */
15
+ %extend HardwareIndexBuffer {
16
+ IndexBufferProxy lock(HardwareBuffer::LockOptions options) {
17
+ return IndexBufferProxy(self, self->lock(options), self->getNumIndexes());
18
+ }
19
+ }
7
20
  }
8
21
 
9
22
  %include "OgreHardwareIndexBuffer.h"
23
+ %include "IndexBufferProxy.h"
@@ -1,10 +1,42 @@
1
1
  %{
2
2
  #include "OgreHardwareVertexBuffer.h"
3
+ #include "VertexBufferProxy.h"
3
4
  %}
4
5
 
5
6
  namespace Ogre {
6
7
  %template(HardwareVertexBufferSharedPtrSWIG) SharedPtr<HardwareVertexBuffer>;
8
+
9
+ /**
10
+ * Turn lists into normal Ruby arrays
11
+ */
12
+ %typemap(out) const VertexDeclaration::VertexElementList& {
13
+ VALUE arr = rb_ary_new2($1->size());
14
+ VALUE res = Qnil;
15
+
16
+ int size = $1->size();
17
+ std::list<VertexElement>::iterator i = $1->begin();
18
+ for(; i != $1->end(); i++) {
19
+ res = SWIG_NewPointerObj( &(*i), SWIGTYPE_p_Ogre__VertexElement, 0);
20
+ rb_ary_push(arr, res);
21
+ }
22
+
23
+ $result = arr;
24
+ }
25
+
26
+ %ignore HardwareVertexBuffer::lock(LockOptions options);
27
+
28
+ /**
29
+ * Taken from pyogre, we need a special proxy object for dealing with locked
30
+ * memory buffers. The normal C++ code has pointer access, and can just increment (++)
31
+ * through memory. As we can't do that in Ruby, we'll proxy off the calls back
32
+ * into C++
33
+ */
34
+ %extend HardwareVertexBuffer {
35
+ VertexBufferProxy lock(HardwareBuffer::LockOptions options) {
36
+ return VertexBufferProxy(self, self->lock(options));
37
+ }
38
+ }
7
39
  }
8
40
 
9
41
  %include "OgreHardwareVertexBuffer.h"
10
-
42
+ %include "VertexBufferProxy.h"
@@ -17,6 +17,6 @@ namespace Ogre {
17
17
  strcpy(buf, data.c_str());
18
18
  MemoryDataStream *ds = new MemoryDataStream(buf, strlen(buf));
19
19
  DataStreamPtr dsp(ds);
20
- $self->parseScript(dsp, groupName);
20
+ self->parseScript(dsp, groupName);
21
21
  }
22
22
  }
@@ -6,6 +6,38 @@ namespace Ogre {
6
6
  %template(MeshSharedPtr) SharedPtr<Mesh>;
7
7
 
8
8
  %ignore Mesh::getPoseIterator;
9
+
10
+ %rename("shared_vertex_data=") Mesh::set_shared_vertex_data;
11
+
12
+ // These typemaps are supposed to work! but as they don't we'll just wrap
13
+ // the method manually :(
14
+ //
15
+ // Set appropriate OUTPUT parameters
16
+ //%apply unsigned short& OUTPUT { unsigned short &outSourceCoordSet };
17
+ //%apply unsigned short& OUTPUT { unsigned short &outIndex };
18
+ //bool MeshPtr::suggestTangentVectorBuildParams(VertexElementSemantic, unsigned short& OUTPUT, unsigned short &OUTPUT);
19
+
20
+ %extend Mesh {
21
+ VertexData* shared_vertex_data() {
22
+ return self->sharedVertexData;
23
+ }
24
+
25
+ void set_shared_vertex_data(VertexData* vd) {
26
+ self->sharedVertexData = vd;
27
+ }
28
+
29
+ VALUE suggestTangentVectorBuildParams(VertexElementSemantic semantic) {
30
+ VALUE res = rb_ary_new2(3);
31
+ unsigned short sourceCoordSet, outIndex;
32
+ bool result = self-> suggestTangentVectorBuildParams(semantic, sourceCoordSet, outIndex);
33
+ rb_ary_push(res, result ? Qtrue : Qfalse);
34
+ rb_ary_push(res, INT2NUM(sourceCoordSet));
35
+ rb_ary_push(res, INT2NUM(outIndex));
36
+ return res;
37
+ }
38
+ }
9
39
  }
10
40
 
41
+ %ignore Ogre::Mesh::suggestTangentVectorBuildParams(VertexElementSemantic, unsigned short&, unsigned short&);
42
+
11
43
  %include "OgreMesh.h"
@@ -2,4 +2,9 @@
2
2
  #include "OgreQuaternion.h"
3
3
  %}
4
4
 
5
+ namespace Ogre {
6
+ %ignore Quaternion::ZERO;
7
+ %ignore Quaternion::IDENTITY;
8
+ }
9
+
5
10
  %include "OgreQuaternion.h"
@@ -4,4 +4,8 @@
4
4
 
5
5
  %ignore __RenderSystemCapabilities__;
6
6
 
7
+ namespace Ogre {
8
+ %rename("has_capability?") RenderSystemCapabilities::hasCapability;
9
+ }
10
+
7
11
  %include "OgreRenderSystemCapabilities.h"