disp3D 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.6.4"
11
+ gem "gmath3D"
12
+ gem "ruby-opengl", "0.60.1"
13
+ gem "qtbindings", "4.6.3.4"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,25 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ gmath3D (0.2.0)
6
+ jeweler (1.6.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ mkrf (0.2.3)
11
+ qtbindings (4.6.3.4)
12
+ rake (0.9.2)
13
+ ruby-opengl (0.60.1)
14
+ mkrf (>= 0.2.0)
15
+ rake
16
+
17
+ PLATFORMS
18
+ ruby
19
+
20
+ DEPENDENCIES
21
+ bundler (~> 1.0.0)
22
+ gmath3D
23
+ jeweler (~> 1.6.4)
24
+ qtbindings (= 4.6.3.4)
25
+ ruby-opengl (= 0.60.1)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Toshiyasu Shimizu
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,9 @@
1
+ = disp3D
2
+
3
+ This library provide 3D GUI framework.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2011 Toshiyasu Shimizu. See LICENSE.txt for
8
+ further details.
9
+
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "disp3D"
18
+ gem.homepage = "http://github.com/toshi0328/disp3D"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{disp3D provide 3D GUI framework.}
21
+ gem.description = %Q{disp3D provide 3D GUI framework}
22
+ gem.email = "toshi0328@gmail.com"
23
+ gem.authors = ["Toshiyasu Shimizu"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ task :default => :test
36
+
37
+ require 'rake/rdoctask'
38
+ Rake::RDocTask.new do |rdoc|
39
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = "disp3D #{version}"
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/lib/camera.rb ADDED
@@ -0,0 +1,57 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class Camera
5
+ attr_accessor :rotX
6
+ attr_accessor :rotY
7
+
8
+ LIGHT_POSITION = [0.25, 1.0, 0.25, 0.0]
9
+ LIGHT_DIFFUSE = [1.0, 1.0, 1.0]
10
+ LIGHT_AMBIENT = [0.25, 0.25, 0.25]
11
+ LIGHT_SPECULAR = [1.0, 1.0, 1.0]
12
+
13
+ MAT_DIFFUSE = [0.0, 0.0, 0.0]
14
+ MAT_AMBIENT = [0.25, 0.25, 0.25]
15
+ MAT_SPECULAR = [1.0, 1.0, 1.0]
16
+ MAT_SHININESS = [32.0]
17
+
18
+ def reshape(w,h)
19
+ GL.Viewport(0,0,w,h)
20
+
21
+ GL.MatrixMode(GL::GL_PROJECTION)
22
+ GL.LoadIdentity()
23
+ GLU.Perspective(45.0, w.to_f()/h.to_f(), 0.1, 100.0)
24
+ # GL.Ortho(-1,1,-1,1,2,4)
25
+ end
26
+
27
+ def display()
28
+ GL.MatrixMode(GL::GL_MODELVIEW)
29
+ GL.LoadIdentity()
30
+ GLU.LookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
31
+
32
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_POSITION, LIGHT_POSITION)
33
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_DIFFUSE, LIGHT_DIFFUSE)
34
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_AMBIENT, LIGHT_AMBIENT)
35
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_SPECULAR, LIGHT_SPECULAR)
36
+
37
+ GL.Materialfv(GL::GL_FRONT, GL::GL_DIFFUSE, MAT_DIFFUSE)
38
+ GL.Materialfv(GL::GL_FRONT, GL::GL_AMBIENT, MAT_AMBIENT)
39
+ GL.Materialfv(GL::GL_FRONT, GL::GL_SPECULAR, MAT_SPECULAR)
40
+ GL.Materialfv(GL::GL_FRONT, GL::GL_SHININESS, MAT_SHININESS)
41
+
42
+ GL.Clear(GL::GL_COLOR_BUFFER_BIT | GL::GL_DEPTH_BUFFER_BIT)
43
+
44
+ GL.Rotate(@rotX, 1, 0, 0)
45
+ GL.Rotate(@rotY, 0, 1, 0)
46
+ end
47
+
48
+ def initialize()
49
+ @rotY = 0
50
+ @rotX = 0
51
+ GL.Enable(GL::GL_LIGHTING)
52
+ GL.Enable(GL::GL_LIGHT0)
53
+
54
+ GLUT.ReshapeFunc(method(:reshape).to_proc())
55
+ end
56
+ end
57
+ end
data/lib/disp3D.rb ADDED
@@ -0,0 +1,18 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+
3
+ require 'gmath3D'
4
+
5
+ require 'opengl'
6
+ require 'glut'
7
+
8
+ require 'view'
9
+ require 'camera'
10
+ require 'manipulator'
11
+ require 'scene_graph'
12
+ require 'node'
13
+ require 'node_collection'
14
+
15
+ require 'node_tea_pod'
16
+ require 'node_lines'
17
+ require 'node_points'
18
+
data/lib/helloworld.rb ADDED
@@ -0,0 +1,112 @@
1
+ require "rubygems"
2
+ require "opengl"
3
+ require "glut"
4
+
5
+ class Teapot
6
+ LIGHT_POSITION = [0.25, 1.0, 0.25, 0.0]
7
+ LIGHT_DIFFUSE = [1.0, 1.0, 1.0]
8
+ LIGHT_AMBIENT = [0.25, 0.25, 0.25]
9
+ LIGHT_SPECULAR = [1.0, 1.0, 1.0]
10
+
11
+ MAT_DIFFUSE = [1.0, 0.0, 0.0]
12
+ MAT_AMBIENT = [0.25, 0.25, 0.25]
13
+ MAT_SPECULAR = [1.0, 1.0, 1.0]
14
+ MAT_SHININESS = [32.0]
15
+
16
+ def reshape(w,h)
17
+ GL.Viewport(0,0,w,h)
18
+
19
+ GL.MatrixMode(GL::GL_PROJECTION)
20
+ GL.LoadIdentity()
21
+ GLU.Perspective(45.0, w.to_f()/h.to_f(), 0.1, 100.0)
22
+ # GL.Ortho(-1,1,-1,1,2,4)
23
+ end
24
+
25
+ def display()
26
+ GL.MatrixMode(GL::GL_MODELVIEW)
27
+ GL.LoadIdentity()
28
+ GLU.LookAt(0.5, 1.5, 2.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
29
+
30
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_POSITION, LIGHT_POSITION)
31
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_DIFFUSE, LIGHT_DIFFUSE)
32
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_AMBIENT, LIGHT_AMBIENT)
33
+ GL.Lightfv(GL::GL_LIGHT0, GL::GL_SPECULAR, LIGHT_SPECULAR)
34
+
35
+ GL.Materialfv(GL::GL_FRONT, GL::GL_DIFFUSE, MAT_DIFFUSE)
36
+ GL.Materialfv(GL::GL_FRONT, GL::GL_AMBIENT, MAT_AMBIENT)
37
+ GL.Materialfv(GL::GL_FRONT, GL::GL_SPECULAR, MAT_SPECULAR)
38
+ GL.Materialfv(GL::GL_FRONT, GL::GL_SHININESS, MAT_SHININESS)
39
+
40
+ GL.ClearColor(0.0, 0.0, 0.0, 1.0)
41
+ GL.Clear(GL::GL_COLOR_BUFFER_BIT | GL::GL_DEPTH_BUFFER_BIT)
42
+
43
+ GL.Rotate(@rotX, 1, 0, 0)
44
+ GL.Rotate(@rotY, 0, 1, 0)
45
+ GLUT.SolidTeapot(0.5)
46
+
47
+ GLUT.SwapBuffers()
48
+ end
49
+
50
+ def mouse(button,state,x,y)
51
+ if button == GLUT::GLUT_LEFT_BUTTON && state == GLUT::GLUT_DOWN then
52
+ @start_x = x
53
+ @start_y = y
54
+ @drag_flg = true
55
+ elsif state == GLUT::GLUT_UP then
56
+ @drag_flg = false
57
+ end
58
+ end
59
+
60
+ def motion(x,y)
61
+ if @drag_flg then
62
+ dx = x - @start_x
63
+ dy = y - @start_y
64
+
65
+ @rotY += dx
66
+ @rotY = @rotY % 360
67
+
68
+ @rotX += dy
69
+ @rotX = @rotX % 360
70
+ end
71
+ @start_x = x
72
+ @start_y = y
73
+ GLUT.PostRedisplay()
74
+ end
75
+
76
+ def initialize()
77
+ @start_x = 0
78
+ @start_y = 0
79
+ @rotY = 0
80
+ @rotX = 0
81
+ @drag_flg = false
82
+ GLUT.InitWindowPosition(100, 100)
83
+ GLUT.InitWindowSize(300,300)
84
+ GLUT.Init
85
+ GLUT.InitDisplayMode(GLUT::GLUT_DOUBLE | GLUT::GLUT_RGB | GLUT::GLUT_DEPTH)
86
+ GLUT.CreateWindow("Ruby de OpenGL")
87
+
88
+ GL.Enable(GL::GL_DEPTH_TEST)
89
+ GL.Enable(GL::GL_LIGHTING)
90
+ GL.Enable(GL::GL_LIGHT0)
91
+
92
+ GL.FrontFace(GL::GL_CW)
93
+ GL.Enable(GL::GL_AUTO_NORMAL)
94
+ GL.Enable(GL::GL_NORMALIZE)
95
+ GL.Enable(GL::GL_DEPTH_TEST)
96
+ GL.DepthFunc(GL::GL_LESS)
97
+
98
+ GL.ShadeModel(GL::SMOOTH)
99
+
100
+ GLUT.ReshapeFunc(method(:reshape).to_proc())
101
+ GLUT.DisplayFunc(method(:display).to_proc())
102
+ GLUT.MouseFunc(method(:mouse).to_proc())
103
+ GLUT.MotionFunc(method(:motion).to_proc())
104
+ end
105
+
106
+ def start()
107
+ GLUT.MainLoop()
108
+ end
109
+ end
110
+
111
+ Teapot.new().start()
112
+
@@ -0,0 +1,41 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class Manipulator
5
+ def mouse(button,state,x,y)
6
+ if button == GLUT::GLUT_LEFT_BUTTON && state == GLUT::GLUT_DOWN then
7
+ @start_x = x
8
+ @start_y = y
9
+ @drag_flg = true
10
+ elsif state == GLUT::GLUT_UP then
11
+ @drag_flg = false
12
+ end
13
+ end
14
+
15
+ def motion(x,y)
16
+ if @drag_flg then
17
+ dx = x - @start_x
18
+ dy = y - @start_y
19
+
20
+ @camera.rotY += dx
21
+ @camera.rotY = @camera.rotY % 360
22
+
23
+ @camera.rotX += dy
24
+ @camera.rotX = @camera.rotX % 360
25
+ end
26
+ @start_x = x
27
+ @start_y = y
28
+ GLUT.PostRedisplay()
29
+ end
30
+
31
+ def initialize(camera)
32
+ @camera = camera
33
+ @start_x = 0
34
+ @start_y = 0
35
+ @drag_flg = false
36
+
37
+ GLUT.MouseFunc(method(:mouse).to_proc())
38
+ GLUT.MotionFunc(method(:motion).to_proc())
39
+ end
40
+ end
41
+ end
data/lib/node.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class Node
5
+ attr_accessor :geom
6
+
7
+ attr_accessor :translate
8
+
9
+ attr_accessor :color
10
+
11
+ def pre_draw
12
+ GL.Color(@color[0], @color[1], @color[2]) if(@color && @color.size == 3)
13
+ GL.Color(@color[0], @color[1], @color[2], @color[3]) if(@color && @color.size == 4)
14
+
15
+ GL.PushMatrix()
16
+ GL.Translate(translate[0], translate[1], translate[2]) if(@translate)
17
+ end
18
+
19
+ def post_draw
20
+ GL.PopMatrix()
21
+ end
22
+
23
+ def initialize(geometry)
24
+ @geom = geometry
25
+ @color = [1.0, 1.0, 1.0]
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class NodeCollection < Node
5
+ def add(node)
6
+ # TODO if ancestor Node is added then cancel...
7
+ # add parents and check
8
+ if(node.kind_of?(Array))
9
+ node.each do |item|
10
+
11
+ @children.push(item)
12
+ end
13
+ else
14
+ @children.push(node)
15
+ end
16
+ end
17
+
18
+ def draw
19
+ @children.each do |child|
20
+ child.draw
21
+ end
22
+ end
23
+
24
+ def initialize()
25
+ @children = []
26
+ end
27
+ end
28
+ end
data/lib/node_lines.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class NodeLines < Node
5
+ attr_accessor :width
6
+
7
+ def draw
8
+ pre_draw()
9
+
10
+ if(@geom)
11
+ GL.LineWidth(@width) if(@width)
12
+
13
+ GL.Begin(GL::LINES)
14
+ if(@geom.kind_of?(GMath3D::FiniteLine))
15
+ GL.Vertex( @geom.start_point.x, @geom.start_point.y, @geom.start_point.z )
16
+ GL.Vertex( @geom.end_point.x, @geom.end_point.y, @geom.end_point.z )
17
+ elsif(@geom.kind_of?(Array))
18
+ @geom.each do |line|
19
+ GL.Vertex( line.start_point.x, line.start_point.y, line.start_point.z )
20
+ GL.Vertex( line.end_point.x, line.end_point.y, line.end_point.z )
21
+ end
22
+ end
23
+ GL.End()
24
+
25
+ post_draw()
26
+ end
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class NodePoints < Node
5
+ attr_accessor :size
6
+
7
+ def draw
8
+ pre_draw()
9
+ if(@geom)
10
+ GL.PointSize(@size)
11
+
12
+ GL.Begin(GL::POINTS)
13
+
14
+ if(@geom.kind_of?(GMath3D::Vector3))
15
+ GL.Vertex( @geom.x, @geom.y, @geom.z )
16
+ elsif(@geom.kind_of?(Array))
17
+ @geom.each do |point|
18
+ GL.Vertex( point.x, point.y, point.z )
19
+ end
20
+ else
21
+ #TODO error message
22
+ end
23
+
24
+ GL.End()
25
+ end
26
+ post_draw()
27
+ end
28
+
29
+ def initialize(geom)
30
+ super(geom)
31
+ @size = 3.0;
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,9 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class NodeTeaPod
5
+ def draw
6
+ GLUT.SolidTeapot(0.5)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class SceneGraph
5
+ attr_accessor :root_node
6
+
7
+ def initialize()
8
+ @root_node = NodeCollection.new()
9
+ end
10
+
11
+ def display()
12
+ @root_node.draw()
13
+ end
14
+
15
+ def add(node)
16
+ @root_node.add(node)
17
+ end
18
+ end
19
+ end
data/lib/view.rb ADDED
@@ -0,0 +1,47 @@
1
+ require 'disp3D'
2
+
3
+ module Disp3D
4
+ class View
5
+ attr_accessor :world_scene_graph
6
+ attr_accessor :camera
7
+
8
+ attr_accessor :bk_color
9
+
10
+ def display()
11
+ GL.ClearColor(@bk_color[0],@bk_color[1],@bk_color[2],@bk_color[3])
12
+
13
+ @camera.display() if(@camera)
14
+ @world_scene_graph.display() if(@world_scene_graph)
15
+ GLUT.SwapBuffers()
16
+ end
17
+
18
+ def initialize(x,y,width,height)
19
+ GLUT.InitWindowPosition(x, y)
20
+ GLUT.InitWindowSize(width, height)
21
+ GLUT.Init
22
+ GLUT.InitDisplayMode(GLUT::GLUT_DOUBLE | GLUT::GLUT_RGB | GLUT::GLUT_DEPTH)
23
+ GLUT.CreateWindow("Disp3D view test")
24
+
25
+ GL.Enable(GL::GL_DEPTH_TEST)
26
+
27
+ GL.FrontFace(GL::GL_CW)
28
+ GL.Enable(GL::GL_AUTO_NORMAL)
29
+ GL.Enable(GL::GL_NORMALIZE)
30
+ GL.Enable(GL::GL_DEPTH_TEST)
31
+ GL.DepthFunc(GL::GL_LESS)
32
+ GL.ShadeModel(GL::SMOOTH)
33
+
34
+ GLUT.DisplayFunc(method(:display).to_proc())
35
+
36
+ @camera = Camera.new()
37
+ @manipulator = Manipulator.new(@camera)
38
+ @world_scene_graph = SceneGraph.new()
39
+
40
+ @bk_color = [0.5,0.5,0.5,0]
41
+ end
42
+
43
+ def start
44
+ GLUT.MainLoop()
45
+ end
46
+ end
47
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'disp3D'
4
+ require 'gmath3D'
5
+
data/test/test_line.rb ADDED
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'helper'
3
+
4
+ main_view = Disp3D::View.new(100,100,200,200)
5
+ line_geom = GMath3D::FiniteLine.new()
6
+ line_node = Disp3D::NodeLines.new(line_geom)
7
+ main_view.world_scene_graph.add(line_node)
8
+ main_view.start
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'helper'
3
+
4
+ include GMath3D
5
+
6
+ main_view = Disp3D::View.new(100,100,200,200)
7
+
8
+ nodes = []
9
+
10
+ geoms = [FiniteLine.new(),
11
+ FiniteLine.new(Vector3.new(), Vector3.new(Math::sqrt(2)/2, Math::sqrt(2)/2, 0)),
12
+ FiniteLine.new(Vector3.new(), Vector3.new(0,1,0))]
13
+ nodes.push( Disp3D::NodeLines.new(geoms) )
14
+
15
+ main_view.world_scene_graph.add(nodes)
16
+
17
+ main_view.start
@@ -0,0 +1,25 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'helper'
3
+
4
+ main_view = Disp3D::View.new(100,100,200,200)
5
+
6
+ geom1 = GMath3D::Vector3.new(-1,0,0)
7
+ node1 = Disp3D::NodePoints.new(geom1)
8
+ node1.color = [1,1,1]
9
+ main_view.world_scene_graph.add(node1)
10
+
11
+ geom2 = GMath3D::Vector3.new(0,0,0)
12
+ node2 = Disp3D::NodePoints.new(geom2)
13
+ node2.color = [0,1,1]
14
+ node2.size = 6
15
+ main_view.world_scene_graph.add(node2)
16
+
17
+ geom3 = GMath3D::Vector3.new(1,0,0)
18
+ node3 = Disp3D::NodePoints.new(geom3)
19
+ node3.color = [1,0,0]
20
+ node3.size = 9
21
+ main_view.world_scene_graph.add(node3)
22
+
23
+
24
+
25
+ main_view.start
@@ -0,0 +1,27 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'helper'
3
+
4
+ main_view = Disp3D::View.new(100,100,200,200)
5
+
6
+ nodes = []
7
+
8
+ geom1 = [GMath3D::Vector3.new(-1,0,0),
9
+ GMath3D::Vector3.new( 0,0,0),
10
+ GMath3D::Vector3.new( 1,0,0)]
11
+ nodes.push( Disp3D::NodePoints.new(geom1) )
12
+
13
+ geom2 = GMath3D::Vector3.new(1,0,0)
14
+ node1 = Disp3D::NodePoints.new(geom2)
15
+ node2 = Disp3D::NodePoints.new(geom2)
16
+ node3 = Disp3D::NodePoints.new(geom2)
17
+
18
+ node1.translate = [ 0,0.5,0]
19
+ node2.translate = [-1,0.5,0]
20
+ node3.translate = [-2,0.5,0]
21
+ nodes.push( node1 )
22
+ nodes.push( node2 )
23
+ nodes.push( node3 )
24
+
25
+ main_view.world_scene_graph.add(nodes)
26
+
27
+ main_view.start
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ require 'helper'
3
+
4
+ main_view = Disp3D::View.new(100,100,200,200)
5
+ main_view.world_scene_graph.add(Disp3D::NodeTeaPod.new())
6
+ main_view.start
7
+
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: disp3D
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Toshiyasu Shimizu
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-19 00:00:00.000000000 +09:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: &2151931760 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *2151931760
26
+ - !ruby/object:Gem::Dependency
27
+ name: jeweler
28
+ requirement: &2151930840 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.4
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *2151930840
37
+ - !ruby/object:Gem::Dependency
38
+ name: gmath3D
39
+ requirement: &2151929800 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *2151929800
48
+ - !ruby/object:Gem::Dependency
49
+ name: ruby-opengl
50
+ requirement: &2151928860 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - =
54
+ - !ruby/object:Gem::Version
55
+ version: 0.60.1
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *2151928860
59
+ - !ruby/object:Gem::Dependency
60
+ name: qtbindings
61
+ requirement: &2151927380 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - =
65
+ - !ruby/object:Gem::Version
66
+ version: 4.6.3.4
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *2151927380
70
+ description: disp3D provide 3D GUI framework
71
+ email: toshi0328@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.rdoc
77
+ files:
78
+ - .document
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.rdoc
83
+ - Rakefile
84
+ - VERSION
85
+ - lib/camera.rb
86
+ - lib/disp3D.rb
87
+ - lib/helloworld.rb
88
+ - lib/manipulator.rb
89
+ - lib/node.rb
90
+ - lib/node_collection.rb
91
+ - lib/node_lines.rb
92
+ - lib/node_points.rb
93
+ - lib/node_tea_pod.rb
94
+ - lib/scene_graph.rb
95
+ - lib/view.rb
96
+ - test/helper.rb
97
+ - test/test_line.rb
98
+ - test/test_lines.rb
99
+ - test/test_point.rb
100
+ - test/test_points.rb
101
+ - test/test_tea_pod.rb
102
+ has_rdoc: true
103
+ homepage: http://github.com/toshi0328/disp3D
104
+ licenses:
105
+ - MIT
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ segments:
117
+ - 0
118
+ hash: -2105497599991202075
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 1.6.2
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: disp3D provide 3D GUI framework.
131
+ test_files: []