three.rb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1498e455772b4dfa70e3d46013f571ea9048ddf
4
- data.tar.gz: e6580a03b58f1bff0021d444133f6f916d2f29f8
3
+ metadata.gz: f917c4db993b8513e69a161c747c808029e23489
4
+ data.tar.gz: baf5c59271aa63eeae46b5c451e8838381982d73
5
5
  SHA512:
6
- metadata.gz: f251fdf60e56e3a3379aaa2549f37861691f921556b4f1eaebf346369cb460f47f5c448c07c3699fd8bb44989a2e4914a3b6239a42a56a74deabcb68b06ad004
7
- data.tar.gz: 1e57cff400b00f2025a99929f601dcc3096bdbd30188a1e9e5c1915447082aa2ab021b16ecfcdd746798d5204a07c2b3f8258da1500955d7e2401ee38b2327e1
6
+ metadata.gz: 53c4151905dbf5e79ba358410368365a75f804c965366715d1d28da726d3ae39d1b96e99860029697003584baa101faa989927415f4d4a65bfceb62f481aa6b9
7
+ data.tar.gz: b91526299ee59a8f9b85e5274de782901fd135b98f789a3cbf76f3dba6cfc87d3151169fbb78c3e5d754e66b054ae23d9684ffae22e8591c3b42323a1fd716ca
data/demo/app/main.rb CHANGED
@@ -10,20 +10,19 @@ camera = THREE::PerspectiveCamera.new(field_of_view: 75, aspect_ratio: aspect_ra
10
10
 
11
11
  renderer = THREE::WebGLRenderer.new
12
12
  renderer.set_size($$.innerWidth, $$.innerHeight)
13
- renderer.dom_element.append_to($document.body)
13
+ $document.body << renderer.dom_element.to_n
14
14
 
15
- # THE FOLLOWING CODE IS A WORK-IN-PROGRESS AND WILL BE IMPLEMENTED SOON
16
- # ----------------------------------------------------------------------
17
- #geometry = THREE::BoxGeometry(1, 1, 1)
18
- #material = THREE::MeshBasicMaterial( color: 0x00ff00 )
19
- #cube = THREE::Mesh(geometry, material)
20
- #scene.add(cube)
21
- #
22
- #camera.position.z = 5
23
- #
24
- #render = proc do
25
- # $$.requestAnimationFrame(render)
26
- # cube.rotation.x += 0.1
27
- # cube.rotation.y += 0.1
28
- # renderer.render(scene, camera)
29
- #end
15
+ geometry = THREE::BoxGeometry.new(width: 1, height: 1, depth: 1)
16
+ material = THREE::MeshBasicMaterial.new( color: 0x00ff00 )
17
+ cube = THREE::Mesh.new(geometry, material)
18
+ scene.add(cube)
19
+
20
+ camera.position.z = 5
21
+
22
+ render = proc do
23
+ $$.requestAnimationFrame(render)
24
+ cube.rotation.x += 0.1
25
+ cube.rotation.y += 0.1
26
+ renderer.render(scene, camera)
27
+ end
28
+ render.call
@@ -0,0 +1,13 @@
1
+ module THREE
2
+ class BoxGeometry
3
+ include Native
4
+
5
+ def initialize(arg_hash = {})
6
+ width = arg_hash[:width]
7
+ height = arg_hash[:height]
8
+ depth = arg_hash[:depth]
9
+
10
+ @native = `new THREE.BoxGeometry(width, height, depth)`
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module THREE
2
+ class Mesh
3
+ include Native
4
+
5
+ def initialize(geometry, material)
6
+ @native = `new THREE.Mesh(geometry, material)`
7
+ end
8
+
9
+ alias_native :rotation
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module THREE
2
+ class MeshBasicMaterial
3
+ include Native
4
+
5
+ def initialize(arg_hash = {})
6
+ color = arg_hash[:color]
7
+
8
+ @native = `new THREE.MeshBasicMaterial(color)`
9
+ end
10
+ end
11
+ end
@@ -8,7 +8,9 @@ module THREE
8
8
  near = arg_hash[:near]
9
9
  far = arg_hash[:far]
10
10
 
11
- @native = `new THREE.Scene(field_of_view, aspect_ratio, near, far)`
11
+ @native = `new THREE.PerspectiveCamera(field_of_view, aspect_ratio, near, far)`
12
12
  end
13
+
14
+ alias_native :position
13
15
  end
14
16
  end
@@ -5,5 +5,7 @@ module THREE
5
5
  def initialize
6
6
  @native = `new THREE.Scene()`
7
7
  end
8
+
9
+ alias_native :add
8
10
  end
9
11
  end
@@ -6,6 +6,7 @@ module THREE
6
6
  @native = `new THREE.WebGLRenderer()`
7
7
  end
8
8
 
9
+ alias_native :render
9
10
  alias_native :set_size, :setSize
10
11
  alias_native :dom_element, :domElement
11
12
  end
@@ -2,4 +2,7 @@ require 'native'
2
2
 
3
3
  require 'opal/three/core/scene'
4
4
  require 'opal/three/core/perspective_camera'
5
- require 'opal/three/core/webgl_renderer'
5
+ require 'opal/three/core/webgl_renderer'
6
+ require 'opal/three/core/box_geometry'
7
+ require 'opal/three/core/mesh_basic_material'
8
+ require 'opal/three/core/mesh'
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module THREE
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: three.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Plymale
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-12 00:00:00.000000000 Z
13
+ date: 2015-03-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: opal
@@ -74,6 +74,9 @@ files:
74
74
  - demo/index.html
75
75
  - lib/opal/require_core.rb
76
76
  - lib/opal/three/core.rb
77
+ - lib/opal/three/core/box_geometry.rb
78
+ - lib/opal/three/core/mesh.rb
79
+ - lib/opal/three/core/mesh_basic_material.rb
77
80
  - lib/opal/three/core/perspective_camera.rb
78
81
  - lib/opal/three/core/scene.rb
79
82
  - lib/opal/three/core/webgl_renderer.rb