mittsu 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +18 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +1158 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +2 -1
  7. data/LICENSE.txt +1 -1
  8. data/README.md +173 -7
  9. data/circle.yml +20 -0
  10. data/install-glfw-3.1.2.sh +14 -0
  11. data/lib/mittsu.rb +0 -2
  12. data/lib/mittsu/extras/image_utils.rb +59 -55
  13. data/lib/mittsu/renderers/glfw_window.rb +17 -2
  14. data/lib/mittsu/renderers/opengl_renderer.rb +1 -1
  15. data/lib/mittsu/renderers/shaders/shader_lib.rb +4 -4
  16. data/lib/mittsu/version.rb +1 -1
  17. data/mittsu.gemspec +11 -5
  18. metadata +53 -71
  19. data/.travis.yml +0 -3
  20. data/examples/01_-_Default1noCulling.png +0 -0
  21. data/examples/01_scene_example.rb +0 -14
  22. data/examples/02_box_mesh_example.rb +0 -30
  23. data/examples/02_sphere_mesh_example.rb +0 -30
  24. data/examples/03_complex_object_example.rb +0 -52
  25. data/examples/04_ambient_light_example.rb +0 -33
  26. data/examples/04_dir_light_example.rb +0 -36
  27. data/examples/04_hemi_light_example.rb +0 -30
  28. data/examples/04_point_light_example.rb +0 -50
  29. data/examples/04_spot_light_example.rb +0 -44
  30. data/examples/05_earth_example.rb +0 -42
  31. data/examples/05_earth_moon_example.rb +0 -46
  32. data/examples/05_texture_example.rb +0 -32
  33. data/examples/06_cube_texture_example.rb +0 -36
  34. data/examples/06_skybox_example.rb +0 -60
  35. data/examples/07_earth_normal_example.rb +0 -36
  36. data/examples/08_shadow_example.rb +0 -87
  37. data/examples/09_line_example.rb +0 -52
  38. data/examples/10_obj_loader_example.rb +0 -68
  39. data/examples/11_character_input_example.rb +0 -18
  40. data/examples/11_continuous_keyboard_input_example.rb +0 -35
  41. data/examples/11_keyboard_input_example.rb +0 -43
  42. data/examples/12_mouse_click_example.rb +0 -38
  43. data/examples/12_mouse_motion_example.rb +0 -35
  44. data/examples/12_mouse_scroll_example.rb +0 -36
  45. data/examples/12_orbit_zoom_example.rb +0 -68
  46. data/examples/13_joystick_example.rb +0 -80
  47. data/examples/cubemap/tron_bk.png +0 -0
  48. data/examples/cubemap/tron_dn.png +0 -0
  49. data/examples/cubemap/tron_ft.png +0 -0
  50. data/examples/cubemap/tron_lf.png +0 -0
  51. data/examples/cubemap/tron_rt.png +0 -0
  52. data/examples/cubemap/tron_up.png +0 -0
  53. data/examples/earth.png +0 -0
  54. data/examples/earth_normal.png +0 -0
  55. data/examples/example_helper.rb +0 -2
  56. data/examples/male-02-1noCulling.png +0 -0
  57. data/examples/male02.mtl +0 -54
  58. data/examples/male02.obj +0 -13888
  59. data/examples/moon.png +0 -0
  60. data/examples/orig_02_-_Defaul1noCulling.png +0 -0
  61. data/examples/texture.png +0 -0
@@ -5,10 +5,10 @@ require 'mittsu/renderers/shaders/shader_chunk'
5
5
  module Mittsu
6
6
  class ShaderLib_Instance
7
7
  attr_accessor :uniforms, :vertex_shader, :fragment_shader
8
- def initialize(uniforms:, vertex_shader:, fragment_shader:)
9
- @uniforms = uniforms
10
- @vertex_shader = vertex_shader
11
- @fragment_shader = fragment_shader
8
+ def initialize(options = {})
9
+ @uniforms = options.fetch(:uniforms)
10
+ @vertex_shader = options.fetch(:vertex_shader)
11
+ @fragment_shader = options.fetch(:fragment_shader)
12
12
  end
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
1
  module Mittsu
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  REVISION = "71"
4
4
  end
@@ -9,16 +9,21 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Daniel Smith"]
10
10
  spec.email = ["jellymann@gmail.com"]
11
11
 
12
- spec.summary = %q{THREE.js for Ruby}
13
- spec.description = %q{A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL}
12
+ spec.summary = %q{3D Graphics Library for Ruby}
13
+ spec.description = %q{Mittsu makes 3D graphics easier by providing an abstraction over OpenGL, and is based heavily off of THREE.js. No more weird pointers and wondering about the difference between a VAO and a VBO (besides the letter). Simply think of something awesome and make it!}
14
14
  spec.homepage = "https://github.com/jellymann/mittsu"
15
15
  spec.license = "MIT"
16
+ spec.metadata = {
17
+ "bug_tracker" => "https://github.com/jellymann/mittsu/issues"
18
+ }
16
19
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|examples)/}) }
20
21
  spec.require_paths = ["lib"]
21
22
 
23
+ spec.required_ruby_version = '>= 2.0.0'
24
+ spec.requirements << 'ImageMagick 6.4.9 or later'
25
+ spec.requirements << 'OpenGL 3.3+ capable hardware and drivers'
26
+
22
27
  spec.add_runtime_dependency 'opengl-bindings', "~> 1.5"
23
28
  spec.add_runtime_dependency 'ffi', "~> 1.9"
24
29
  spec.add_runtime_dependency 'rmagick', "~> 2.15"
@@ -26,6 +31,7 @@ Gem::Specification.new do |spec|
26
31
  spec.add_development_dependency "bundler", "~> 1.9"
27
32
  spec.add_development_dependency "rake", "~> 10.0"
28
33
  spec.add_development_dependency 'minitest', '~> 5.7'
34
+ spec.add_development_dependency 'minitest-reporters', '~> 1.1'
29
35
  spec.add_development_dependency 'pry', '~> 0.10'
30
36
  spec.add_development_dependency 'benchmark-ips', '~> 2.3'
31
37
  end
metadata CHANGED
@@ -1,136 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mittsu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Smith
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-05 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opengl-bindings
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ffi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rmagick
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.15'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '10.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '5.7'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '5.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-reporters
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '1.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '1.1'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: pry
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ~>
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0.10'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ~>
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0.10'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: benchmark-ips
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - "~>"
129
+ - - ~>
116
130
  - !ruby/object:Gem::Version
117
131
  version: '2.3'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - "~>"
136
+ - - ~>
123
137
  - !ruby/object:Gem::Version
124
138
  version: '2.3'
125
- description: A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
139
+ description: Mittsu makes 3D graphics easier by providing an abstraction over OpenGL,
140
+ and is based heavily off of THREE.js. No more weird pointers and wondering about
141
+ the difference between a VAO and a VBO (besides the letter). Simply think of something
142
+ awesome and make it!
126
143
  email:
127
144
  - jellymann@gmail.com
128
145
  executables: []
129
146
  extensions: []
130
147
  extra_rdoc_files: []
131
148
  files:
132
- - ".gitignore"
133
- - ".travis.yml"
149
+ - .codeclimate.yml
150
+ - .gitignore
151
+ - .rubocop.yml
152
+ - .ruby-version
134
153
  - CODE_OF_CONDUCT.md
135
154
  - Gemfile
136
155
  - LICENSE.txt
@@ -138,48 +157,8 @@ files:
138
157
  - Rakefile
139
158
  - bin/console
140
159
  - bin/setup
141
- - examples/01_-_Default1noCulling.png
142
- - examples/01_scene_example.rb
143
- - examples/02_box_mesh_example.rb
144
- - examples/02_sphere_mesh_example.rb
145
- - examples/03_complex_object_example.rb
146
- - examples/04_ambient_light_example.rb
147
- - examples/04_dir_light_example.rb
148
- - examples/04_hemi_light_example.rb
149
- - examples/04_point_light_example.rb
150
- - examples/04_spot_light_example.rb
151
- - examples/05_earth_example.rb
152
- - examples/05_earth_moon_example.rb
153
- - examples/05_texture_example.rb
154
- - examples/06_cube_texture_example.rb
155
- - examples/06_skybox_example.rb
156
- - examples/07_earth_normal_example.rb
157
- - examples/08_shadow_example.rb
158
- - examples/09_line_example.rb
159
- - examples/10_obj_loader_example.rb
160
- - examples/11_character_input_example.rb
161
- - examples/11_continuous_keyboard_input_example.rb
162
- - examples/11_keyboard_input_example.rb
163
- - examples/12_mouse_click_example.rb
164
- - examples/12_mouse_motion_example.rb
165
- - examples/12_mouse_scroll_example.rb
166
- - examples/12_orbit_zoom_example.rb
167
- - examples/13_joystick_example.rb
168
- - examples/cubemap/tron_bk.png
169
- - examples/cubemap/tron_dn.png
170
- - examples/cubemap/tron_ft.png
171
- - examples/cubemap/tron_lf.png
172
- - examples/cubemap/tron_rt.png
173
- - examples/cubemap/tron_up.png
174
- - examples/earth.png
175
- - examples/earth_normal.png
176
- - examples/example_helper.rb
177
- - examples/male-02-1noCulling.png
178
- - examples/male02.mtl
179
- - examples/male02.obj
180
- - examples/moon.png
181
- - examples/orig_02_-_Defaul1noCulling.png
182
- - examples/texture.png
160
+ - circle.yml
161
+ - install-glfw-3.1.2.sh
183
162
  - lib/mittsu.rb
184
163
  - lib/mittsu/cameras.rb
185
164
  - lib/mittsu/cameras/camera.rb
@@ -333,25 +312,28 @@ files:
333
312
  homepage: https://github.com/jellymann/mittsu
334
313
  licenses:
335
314
  - MIT
336
- metadata: {}
315
+ metadata:
316
+ bug_tracker: https://github.com/jellymann/mittsu/issues
337
317
  post_install_message:
338
318
  rdoc_options: []
339
319
  require_paths:
340
320
  - lib
341
321
  required_ruby_version: !ruby/object:Gem::Requirement
342
322
  requirements:
343
- - - ">="
323
+ - - '>='
344
324
  - !ruby/object:Gem::Version
345
- version: '0'
325
+ version: 2.0.0
346
326
  required_rubygems_version: !ruby/object:Gem::Requirement
347
327
  requirements:
348
- - - ">="
328
+ - - '>='
349
329
  - !ruby/object:Gem::Version
350
330
  version: '0'
351
- requirements: []
331
+ requirements:
332
+ - ImageMagick 6.4.9 or later
333
+ - OpenGL 3.3+ capable hardware and drivers
352
334
  rubyforge_project:
353
- rubygems_version: 2.5.1
335
+ rubygems_version: 2.0.14
354
336
  signing_key:
355
337
  specification_version: 4
356
- summary: THREE.js for Ruby
338
+ summary: 3D Graphics Library for Ruby
357
339
  test_files: []
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.2
@@ -1,14 +0,0 @@
1
- require_relative './example_helper'
2
-
3
- SCREEN_WIDTH = 800
4
- SCREEN_HEIGHT = 600
5
- ASPECT = SCREEN_WIDTH.to_f / SCREEN_HEIGHT.to_f
6
-
7
- scene = Mittsu::Scene.new
8
- camera = Mittsu::PerspectiveCamera.new(75.0, ASPECT, 0.1, 1000.0)
9
-
10
- renderer = Mittsu::OpenGLRenderer.new width: SCREEN_WIDTH, height: SCREEN_HEIGHT, title: '01 Scene Example'
11
-
12
- renderer.window.run do
13
- renderer.render(scene, camera)
14
- end
@@ -1,30 +0,0 @@
1
- require_relative './example_helper'
2
-
3
- SCREEN_WIDTH = 800
4
- SCREEN_HEIGHT = 600
5
- ASPECT = SCREEN_WIDTH.to_f / SCREEN_HEIGHT.to_f
6
-
7
- scene = Mittsu::Scene.new
8
- camera = Mittsu::PerspectiveCamera.new(75.0, ASPECT, 0.1, 1000.0)
9
-
10
- renderer = Mittsu::OpenGLRenderer.new width: SCREEN_WIDTH, height: SCREEN_HEIGHT, title: '02 Box Mesh Example'
11
-
12
- geometry = Mittsu::BoxGeometry.new(1.0, 1.0, 1.0)
13
- material = Mittsu::MeshBasicMaterial.new(color: 0x00ff00)
14
- cube = Mittsu::Mesh.new(geometry, material)
15
- scene.add(cube)
16
-
17
- camera.position.z = 5.0
18
-
19
- renderer.window.on_resize do |width, height|
20
- renderer.set_viewport(0, 0, width, height)
21
- camera.aspect = width.to_f / height.to_f
22
- camera.update_projection_matrix
23
- end
24
-
25
- renderer.window.run do
26
- cube.rotation.x += 0.1
27
- cube.rotation.y += 0.1
28
-
29
- renderer.render(scene, camera)
30
- end
@@ -1,30 +0,0 @@
1
- require_relative './example_helper'
2
-
3
- SCREEN_WIDTH = 800
4
- SCREEN_HEIGHT = 600
5
- ASPECT = SCREEN_WIDTH.to_f / SCREEN_HEIGHT.to_f
6
-
7
- scene = Mittsu::Scene.new
8
- camera = Mittsu::PerspectiveCamera.new(75.0, ASPECT, 0.1, 1000.0)
9
-
10
- renderer = Mittsu::OpenGLRenderer.new width: SCREEN_WIDTH, height: SCREEN_HEIGHT, title: '02 Sphere Mesh Example'
11
-
12
- geometry = Mittsu::SphereGeometry.new(1.0)
13
- material = Mittsu::MeshBasicMaterial.new(color: 0x00ff00)
14
- cube = Mittsu::Mesh.new(geometry, material)
15
- scene.add(cube)
16
-
17
- camera.position.z = 5.0
18
-
19
- renderer.window.on_resize do |width, height|
20
- renderer.set_viewport(0, 0, width, height)
21
- camera.aspect = width.to_f / height.to_f
22
- camera.update_projection_matrix
23
- end
24
-
25
- renderer.window.run do
26
- cube.rotation.x += 0.1
27
- cube.rotation.y += 0.1
28
-
29
- renderer.render(scene, camera)
30
- end
@@ -1,52 +0,0 @@
1
- require_relative './example_helper'
2
-
3
- SCREEN_WIDTH = 800
4
- SCREEN_HEIGHT = 600
5
- ASPECT = SCREEN_WIDTH.to_f / SCREEN_HEIGHT.to_f
6
-
7
- scene = Mittsu::Scene.new
8
- scene.name = 'Root Scene'
9
- camera = Mittsu::PerspectiveCamera.new(75.0, ASPECT, 0.1, 1000.0)
10
-
11
- renderer = Mittsu::OpenGLRenderer.new width: SCREEN_WIDTH, height: SCREEN_HEIGHT, title: '03 Complex Object Example'
12
-
13
- objects = 3.times.map do |i|
14
- sphere_geometry = Mittsu::SphereGeometry.new(1.0)
15
- box_geometry = Mittsu::BoxGeometry.new(1.0, 1.0, 1.0)
16
- green_material = Mittsu::MeshBasicMaterial.new(color: 0x00ff00)
17
- blue_material = Mittsu::MeshBasicMaterial.new(color: 0x0000ff)
18
- cube = Mittsu::Mesh.new(box_geometry, green_material)
19
- cube.name = 'Green Cube'
20
- sphere = Mittsu::Mesh.new(sphere_geometry, blue_material)
21
- sphere.name = 'Blue Ball'
22
-
23
- cube.position.set(0.5, 0.0, 0.0)
24
- sphere.position.set(-0.5, 0.0, 0.0)
25
-
26
- Mittsu::Object3D.new.tap do |o|
27
- o.add(cube)
28
- o.add(sphere)
29
- o.position.x = -3.0 + (i.to_f * 3.0)
30
-
31
- scene.add(o)
32
- end
33
- end
34
-
35
- scene.print_tree
36
-
37
- camera.position.z = 5.0
38
-
39
- renderer.window.on_resize do |width, height|
40
- renderer.set_viewport(0, 0, width, height)
41
- camera.aspect = width.to_f / height.to_f
42
- camera.update_projection_matrix
43
- end
44
-
45
- renderer.window.run do
46
- objects.each do |object|
47
- object.rotation.x += 0.1
48
- object.rotation.y += 0.1
49
- end
50
-
51
- renderer.render(scene, camera)
52
- end