three.rb 0.0.0 → 0.0.1
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.
- checksums.yaml +4 -4
- data/README.md +1 -12
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/demo/Gemfile +5 -0
- data/demo/app/main.rb +29 -0
- data/demo/config.ru +19 -0
- data/demo/index.html +12 -0
- data/lib/opal/require_core.rb +8 -0
- data/lib/opal/three/core.rb +5 -0
- data/lib/opal/three/core/perspective_camera.rb +14 -0
- data/lib/opal/three/core/scene.rb +9 -0
- data/lib/opal/three/core/webgl_renderer.rb +12 -0
- data/lib/opal/three/version.rb +5 -0
- data/lib/three.rb +1 -0
- data/three.rb.gemspec +3 -5
- metadata +13 -4
- data/lib/three.rb.rb +0 -5
- data/lib/three.rb/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1498e455772b4dfa70e3d46013f571ea9048ddf
|
4
|
+
data.tar.gz: e6580a03b58f1bff0021d444133f6f916d2f29f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f251fdf60e56e3a3379aaa2549f37861691f921556b4f1eaebf346369cb460f47f5c448c07c3699fd8bb44989a2e4914a3b6239a42a56a74deabcb68b06ad004
|
7
|
+
data.tar.gz: 1e57cff400b00f2025a99929f601dcc3096bdbd30188a1e9e5c1915447082aa2ab021b16ecfcdd746798d5204a07c2b3f8258da1500955d7e2401ee38b2327e1
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Three.rb
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
[Three.js](http://threejs.org) for Ruby via Opal.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -20,15 +18,6 @@ Or install it yourself as:
|
|
20
18
|
|
21
19
|
$ gem install three.rb
|
22
20
|
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
21
|
|
33
22
|
## Contributing
|
34
23
|
|
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/demo/Gemfile
ADDED
data/demo/app/main.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'opal'
|
2
|
+
require 'browser'
|
3
|
+
require 'three'
|
4
|
+
require 'pp'
|
5
|
+
|
6
|
+
aspect_ratio = $$.innerWidth / $$.innerHeight
|
7
|
+
|
8
|
+
scene = THREE::Scene.new
|
9
|
+
camera = THREE::PerspectiveCamera.new(field_of_view: 75, aspect_ratio: aspect_ratio, near: 0.1, far: 1000)
|
10
|
+
|
11
|
+
renderer = THREE::WebGLRenderer.new
|
12
|
+
renderer.set_size($$.innerWidth, $$.innerHeight)
|
13
|
+
renderer.dom_element.append_to($document.body)
|
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
|
data/demo/config.ru
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require
|
3
|
+
|
4
|
+
opal = Opal::Server.new { |s|
|
5
|
+
s.append_path 'app'
|
6
|
+
s.append_path 'assets'
|
7
|
+
|
8
|
+
s.main = 'main'
|
9
|
+
}
|
10
|
+
|
11
|
+
map '/assets' do
|
12
|
+
run opal.sprockets
|
13
|
+
end
|
14
|
+
|
15
|
+
get '/' do
|
16
|
+
send_file 'index.html'
|
17
|
+
end
|
18
|
+
|
19
|
+
run Sinatra::Application
|
data/demo/index.html
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset= "utf-8" />
|
5
|
+
<title>Three.rb in action</title>
|
6
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/r70/three.js"></script>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<script src="/assets/main.js"></script>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module THREE
|
2
|
+
class PerspectiveCamera
|
3
|
+
include Native
|
4
|
+
|
5
|
+
def initialize (arg_hash = {})
|
6
|
+
field_of_view = arg_hash[:field_of_view]
|
7
|
+
aspect_ratio = arg_hash[:aspect_ratio]
|
8
|
+
near = arg_hash[:near]
|
9
|
+
far = arg_hash[:far]
|
10
|
+
|
11
|
+
@native = `new THREE.Scene(field_of_view, aspect_ratio, near, far)`
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/three.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'opal/require_core.rb'
|
data/three.rb.gemspec
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'three.rb/version'
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/opal/three/version', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
5
|
s.name = "three.rb"
|
8
|
-
s.version =
|
6
|
+
s.version = Opal::THREE::VERSION
|
9
7
|
s.authors = ["George Plymale", "Gabriel Rios", "George D. Plymale II"]
|
10
8
|
s.email = ["george@orbitalimpact.com"]
|
11
9
|
s.homepage = "https://github.com/orbitalimpact/three.rb"
|
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.
|
4
|
+
version: 0.0.1
|
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-
|
13
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: opal
|
@@ -68,8 +68,17 @@ files:
|
|
68
68
|
- Rakefile
|
69
69
|
- bin/console
|
70
70
|
- bin/setup
|
71
|
-
-
|
72
|
-
-
|
71
|
+
- demo/Gemfile
|
72
|
+
- demo/app/main.rb
|
73
|
+
- demo/config.ru
|
74
|
+
- demo/index.html
|
75
|
+
- lib/opal/require_core.rb
|
76
|
+
- lib/opal/three/core.rb
|
77
|
+
- lib/opal/three/core/perspective_camera.rb
|
78
|
+
- lib/opal/three/core/scene.rb
|
79
|
+
- lib/opal/three/core/webgl_renderer.rb
|
80
|
+
- lib/opal/three/version.rb
|
81
|
+
- lib/three.rb
|
73
82
|
- three.rb.gemspec
|
74
83
|
homepage: https://github.com/orbitalimpact/three.rb
|
75
84
|
licenses: []
|
data/lib/three.rb.rb
DELETED
data/lib/three.rb/version.rb
DELETED