opengl3 0.0.1.pre3 → 0.0.1.pre4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/glut.rb +5 -1
- data/lib/glut/i386/freeglut.dll.gitkeep +0 -0
- data/lib/glut/x86_64/freeglut.dll.gitkeep +0 -0
- data/lib/opengl/platform/windows.rb +28 -0
- data/lib/opengl/type.rb +14 -1
- data/lib/opengl/type/default.yml +1 -0
- data/lib/opengl/version.rb +1 -1
- metadata +13 -32
- data/.gitignore +0 -21
- data/.yardopts +0 -6
- data/Gemfile +0 -8
- data/LICENSE.txt +0 -22
- data/README.md +0 -92
- data/Rakefile +0 -26
- data/examples/math3d.rb +0 -65
- data/examples/ogl-2_1-basic.rb +0 -115
- data/examples/ogl-3_2-attribute_less.rb +0 -119
- data/examples/ogl-3_2-basic.rb +0 -136
- data/examples/ogl-3_2-cube.rb +0 -204
- data/examples/ogl-3_2-texture.rb +0 -163
- data/examples/ogl-4_0-quad_tessellation.rb +0 -284
- data/examples/ogl-4_0-triangle_tessellation.rb +0 -263
- data/opengl.gemspec +0 -24
- data/spec/spec_helper.rb +0 -8
- data/test/test_helper.rb +0 -8
- data/yard/database.rb +0 -51
- data/yard/dsl_handler.rb +0 -76
- data/yard/wrapper_handler.rb +0 -24
data/opengl.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'opengl/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "opengl3"
|
8
|
-
gem.version = OpenGL::VERSION
|
9
|
-
gem.authors = ["David Lin"]
|
10
|
-
gem.email = ["davll.xc@gmail.com"]
|
11
|
-
gem.description = %q{An OpenGL wrapper library for Ruby (OpenGL 2.1-4.2)}
|
12
|
-
gem.summary = %q{OpenGL}
|
13
|
-
gem.homepage = "https://github.com/davll/ruby-opengl"
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
|
-
|
20
|
-
gem.required_ruby_version = ">= 1.9"
|
21
|
-
gem.add_dependency "ffi", ">= 1.2.0"
|
22
|
-
gem.add_development_dependency "rake", "~> 10.0.0"
|
23
|
-
gem.add_development_dependency "minitest", ">= 4.3.0"
|
24
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/test/test_helper.rb
DELETED
data/yard/database.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Database
|
4
|
-
ROOT = File.expand_path("../../lib/opengl/raw", __FILE__)
|
5
|
-
|
6
|
-
# @private
|
7
|
-
def self.normalize(ext_name)
|
8
|
-
return ext_name.to_s.split('::').last
|
9
|
-
end
|
10
|
-
|
11
|
-
# Lookup a dictionary of entrypoints of the extension
|
12
|
-
def self.[](ext_name)
|
13
|
-
ext_name = normalize(ext_name)
|
14
|
-
db_path = Dir[File.join(ROOT, "**/#{ext_name}.yml")].first
|
15
|
-
return YAML.load(File.read(db_path))
|
16
|
-
end
|
17
|
-
|
18
|
-
# @private
|
19
|
-
def self.map_type(type)
|
20
|
-
case type
|
21
|
-
when /_in\z/, /_out\z/, 'pointer' then 'FFI::Pointer'
|
22
|
-
else type
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Create a method object with default parameters and tags
|
27
|
-
# @note tags are not included in docstring of the method
|
28
|
-
#
|
29
|
-
# @param [ModuleObject] mod
|
30
|
-
# @param [String] name
|
31
|
-
# @param [Hash] info
|
32
|
-
# @return [Array(MethodObject, Array<Tag>, Tag)]
|
33
|
-
#
|
34
|
-
def self.new_method(mod, name, info = nil)
|
35
|
-
info ||= self[mod].fetch(name)
|
36
|
-
method = YARD::CodeObjects::MethodObject.new(mod, name)
|
37
|
-
params = info['parameters'].map(&:split)
|
38
|
-
method.parameters = params.map{|a| a[-1, 1] }
|
39
|
-
in_tags = params.map do |type, name|
|
40
|
-
YARD::Tags::Tag.new(:param, '', Array(map_type(type)), name)
|
41
|
-
end
|
42
|
-
ret_type = Array(map_type(info['return_type']))
|
43
|
-
out_tag = YARD::Tags::Tag.new(:return, '', ret_type)
|
44
|
-
return [method, in_tags, out_tag]
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.new_array_type_tag(tagname, type, text, name)
|
48
|
-
YARD::Tags::Tag.new(tagname, text, ["Array<#{map_type(type)}>"], name)
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
data/yard/dsl_handler.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
require_relative 'database'
|
2
|
-
|
3
|
-
Class.new(YARD::Handlers::Ruby::Base) do
|
4
|
-
handles method_call(:def_glGet)
|
5
|
-
namespace_only
|
6
|
-
|
7
|
-
def process
|
8
|
-
name, ret_type = statement.parameters
|
9
|
-
name = name.jump(:tstring_content, :ident).source
|
10
|
-
ret_type = ret_type.source.sub(':', '')
|
11
|
-
|
12
|
-
method, itags, otag = Database.new_method(namespace, "glGet#{name}v")
|
13
|
-
register method
|
14
|
-
method.dynamic = true
|
15
|
-
method.parameters[-1] = ['count']
|
16
|
-
|
17
|
-
itags[-1] = YARD::Tags::Tag.new(:param, '', ['Integer'], 'count')
|
18
|
-
otag = Database.new_array_type_tag(:return, ret_type, '', '')
|
19
|
-
method.docstring.add_tag(*itags, otag)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Class.new(YARD::Handlers::Ruby::Base) do
|
24
|
-
handles method_call(:def_glSet)
|
25
|
-
namespace_only
|
26
|
-
|
27
|
-
def process
|
28
|
-
name, in_type = statement.parameters
|
29
|
-
name = name.jump(:tstring_content, :ident).source
|
30
|
-
in_type = in_type.source.sub(':', '')
|
31
|
-
|
32
|
-
method, itags, otag = Database.new_method(namespace, "gl#{name}v")
|
33
|
-
register method
|
34
|
-
method.dynamic = true
|
35
|
-
|
36
|
-
itags[-1] = Database.new_array_type_tag(:param, in_type, '', 'params')
|
37
|
-
method.docstring.add_tag(*itags)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
Class.new(YARD::Handlers::Ruby::Base) do
|
42
|
-
handles method_call(:def_glGen)
|
43
|
-
namespace_only
|
44
|
-
|
45
|
-
def process
|
46
|
-
name, in_type = statement.parameters
|
47
|
-
name = name.jump(:tstring_content, :ident).source
|
48
|
-
|
49
|
-
method = Database.new_method(namespace, "glGen#{name}").first
|
50
|
-
register method
|
51
|
-
method.dynamic = true
|
52
|
-
method.parameters = [["count"]]
|
53
|
-
|
54
|
-
itag = YARD::Tags::Tag.new(:param, '', ['Integer'], 'count')
|
55
|
-
otag = Database.new_array_type_tag(:return, 'GLuint', '', '')
|
56
|
-
method.docstring.add_tag(itag, otag)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
Class.new(YARD::Handlers::Ruby::Base) do
|
61
|
-
handles method_call(:def_glDelete)
|
62
|
-
namespace_only
|
63
|
-
|
64
|
-
def process
|
65
|
-
name, in_type = statement.parameters
|
66
|
-
name = name.jump(:tstring_content, :ident).source
|
67
|
-
|
68
|
-
method = Database.new_method(namespace, "glDelete#{name}").first
|
69
|
-
register method
|
70
|
-
method.dynamic = true
|
71
|
-
method.parameters = [["ids"]]
|
72
|
-
|
73
|
-
itag = Database.new_array_type_tag(:param, 'GLuint', '', 'ids')
|
74
|
-
method.docstring.add_tag(itag)
|
75
|
-
end
|
76
|
-
end
|
data/yard/wrapper_handler.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative 'database'
|
2
|
-
|
3
|
-
class WrapperHandler < YARD::Handlers::Ruby::ModuleHandler
|
4
|
-
handles :module
|
5
|
-
|
6
|
-
def process
|
7
|
-
mod = register ModuleObject.new(namespace, statement[0].source)
|
8
|
-
|
9
|
-
if mod.to_s =~ /\AOpenGL::Wrapper::GL_/
|
10
|
-
Database[mod].each do |name, info|
|
11
|
-
unless YARD::Registry.at "#{mod.to_s}##{name}"
|
12
|
-
method, in_tags, out_tag = Database.new_method(mod, name, info)
|
13
|
-
register method
|
14
|
-
method.docstring.add_tag(out_tag, *in_tags)
|
15
|
-
|
16
|
-
note_tag = YARD::Tags::Tag.new(:note, 'C-style function (raw)')
|
17
|
-
method.docstring.add_tag(note_tag)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
parse_block(statement[1], :namespace => mod)
|
23
|
-
end
|
24
|
-
end
|