Skip to content

Commit 03cfc42

Browse files
committed
initial commit
0 parents  commit 03cfc42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+18213
-0
lines changed

JSARToolKit.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
======================================================================
2+
JSARToolKit License
3+
======================================================================
4+
JSARToolKit
5+
Copyright (C)2010-2011 Ilmari Heikkinen
6+
7+
Based on FLARToolKit (C)2008-2010 Saqoosha, Ryo Iizuka
8+
9+
This program is free software: you can redistribute it and/or modify
10+
it under the terms of the GNU General Public License as published by
11+
the Free Software Foundation, either version 3 of the License, or
12+
(at your option) any later version.
13+
14+
This program is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU General Public License for more details.
18+
19+
You should have received a copy of the GNU General Public License
20+
along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
22+
23+
FLARToolKit
24+
Copyright (C)2008-2010 Saqoosha, Ryo Iizuka
25+
26+
このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア
27+
財団によって発行されたGNU 一般公衆利用許諾書(バージョン3か、それ以降のバー
28+
ジョンのうちどれか)が定める条件の下で再頒布または改変 することができます。
29+
30+
このプログラムは有用であることを願って頒布されますが、*全くの無保証 *です。
31+
商業可能性の保証や特定目的への適合性は、言外に示されたものも 含め、全く存
32+
在しません。詳しくはGNU 一般公衆利用許諾書をご覧ください。
33+
34+
あなたはこのプログラムと共に、GNU 一般公衆利用許諾書のコピーを一部受け取って
35+
いるはずです。もし受け取っていなければ、<http://www.gnu.org/licenses/> を
36+
ご覧ください。

README

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
JSARToolkit
2+
--------------------------------------------------------------------------------
3+
4+
This is a JavaScript port of FLARToolKit, operating on canvas images and
5+
video element contents. And hopefully one day on device elements with webcam
6+
input.
7+
8+
The license is GPL 3 as was the original library.
9+
10+
All the hard work was done by the ARToolKit/NyARToolKit/FLARToolKit people,
11+
a huge thank you to them. This port was quite mechanical, though it has some
12+
major JS optimizations and a tracking robustness hack or two. And some
13+
uninformed bogus hacks in FLARParam to sort-of make it work on 16:9 video.
14+
15+
See demos/AR_simple_webgl.html for an example of integrating JSARToolKit
16+
output with a WebGL program.
17+
18+
I've only tested the ID markers and square detection paths, so you may
19+
encounter problems working with custom markers. In which case, filing a bug
20+
report on GitHub would be very much appreciated.
21+
22+
23+
- Ilmari Heikkinen
24+
25+
--------------------------------------------------------------------------------
26+
This work is based on the original ARToolKit developed by
27+
Hirokazu Kato
28+
Mark Billinghurst
29+
HITLab, University of Washington, Seattle
30+
http://www.hitl.washington.edu/artoolkit/
31+
32+
And the NyARToolkitAS3 ARToolKit class library.
33+
Copyright (C)2010 Ryo Iizuka
34+
35+
The FLARToolKit is ActionScript 3.0 version ARToolkit class library.
36+
Copyright (C)2008 Saqoosha
37+
38+
JSARToolkit is a JavaScript port of NyARToolkitAS3 and FLARToolKit.
39+
Copyright (C)2011 Ilmari Heikkinen

bundle.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
cat \
3+
src/NyAs3Utils.js \
4+
src/FLARArrayUtil.js \
5+
src/FLARException.js \
6+
src/FLARMat.js \
7+
src/FLARRgbPixelReader.js \
8+
src/NyARHistogramAnalyzer.js \
9+
src/NyARPca2d.js \
10+
src/NyARRasterReader.js \
11+
src/NyARTypes.js \
12+
src/FLARRasterFilter.js \
13+
src/FLARTypes.js \
14+
src/NyARLabel.js \
15+
src/FLARLabeling.js \
16+
src/NyARParam.js \
17+
src/FLARParam.js \
18+
src/NyARRaster.js \
19+
src/FLARRaster.js \
20+
src/NyARCode.js \
21+
src/FLARCode.js \
22+
src/NyARMatch.js \
23+
src/NyARRasterAnalyzer.js \
24+
src/FLARRasterAnalyzer.js \
25+
src/NyARRasterFilter.js \
26+
src/NyARSquareDetect.js \
27+
src/FLARSquareDetect.js \
28+
src/NyARTransMat.js \
29+
src/FLARTransMat.js \
30+
src/NyARUtils.js \
31+
src/NyARIdMarker.js \
32+
src/NyARPickup.js \
33+
src/FLARProcessor.js \
34+
src/NyARDetector.js \
35+
src/FLARDetector.js \
36+
src/FLARIdMarkerDetector.js \
37+
src/NyARSingleMarkerProcesser.js \
38+
src/NyUtils.js \
39+
> JSARToolKit.js

conversion_scripts/create_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
s=`ruby parse_order.rb`
2+
File.open("test.html", 'w'){|f|
3+
f.write("<html><head>#{s}</head></html>")
4+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
license = <<ENDL
2+
/*
3+
* PROJECT: NyARToolkitAS3
4+
* --------------------------------------------------------------------------------
5+
* This work is based on the original ARToolKit developed by
6+
* Hirokazu Kato
7+
* Mark Billinghurst
8+
* HITLab, University of Washington, Seattle
9+
* http://www.hitl.washington.edu/artoolkit/
10+
*
11+
* The NyARToolkitAS3 is AS3 edition ARToolKit class library.
12+
* Copyright (C)2010 Ryo Iizuka
13+
*
14+
* This program is free software: you can redistribute it and/or modify
15+
* it under the terms of the GNU General Public License as published by
16+
* the Free Software Foundation, either version 3 of the License, or
17+
* (at your option) any later version.
18+
*
19+
* This program is distributed in the hope that it will be useful,
20+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
* GNU General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU General Public License
25+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26+
*
27+
* For further information please contact.
28+
* http://nyatla.jp/nyatoolkit/
29+
* <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
30+
*
31+
*/
32+
ENDL
33+
license.strip!
34+
new_license = <<ENDL
35+
/*
36+
* JSARToolkit
37+
* --------------------------------------------------------------------------------
38+
* This work is based on the original ARToolKit developed by
39+
* Hirokazu Kato
40+
* Mark Billinghurst
41+
* HITLab, University of Washington, Seattle
42+
* http://www.hitl.washington.edu/artoolkit/
43+
*
44+
* And the NyARToolkitAS3 ARToolKit class library.
45+
* Copyright (C)2010 Ryo Iizuka
46+
*
47+
* JSARToolkit is a JavaScript port of NyARToolkitAS3.
48+
* Copyright (C)2010 Ilmari Heikkinen
49+
*
50+
* This program is free software: you can redistribute it and/or modify
51+
* it under the terms of the GNU General Public License as published by
52+
* the Free Software Foundation, either version 3 of the License, or
53+
* (at your option) any later version.
54+
*
55+
* This program is distributed in the hope that it will be useful,
56+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
57+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+
* GNU General Public License for more details.
59+
*
60+
* You should have received a copy of the GNU General Public License
61+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
62+
*
63+
* For further information please contact.
64+
* ilmari.heikkinen@gmail.com
65+
*
66+
*/
67+
ENDL
68+
new_license.strip!
69+
70+
Dir["*.as"].each do |fn|
71+
s = File.read(fn)
72+
s.gsub!(/\s+$/, "")
73+
s.gsub!(/\t/, " ")
74+
s.sub!(license, new_license)
75+
s.gsub!(license, "")
76+
s.gsub!(/^\{/, "")
77+
s.gsub!(/^\}/, "")
78+
s.gsub!(/^\s*package .*/, "")
79+
s.gsub!(/^ /, "")
80+
s.gsub!(/^\}/, "})")
81+
s.gsub!(/^\s*import .*/, "")
82+
s.gsub!(/^\s*(final )?(public |private |protected )?(static )?(internal ?)(class|interface) (\S+)/, "\\5 = ASKlass('\\5',")
83+
s.gsub!(/^\s*import .*/, "")
84+
s.gsub!(/ extends\s+(\S+)/, " \\1,")
85+
s.gsub!(/ implements\s+(\S+)/, "")
86+
s.gsub!(/(final )?(public|private|protected) (final )?(static )?(var|const) ([^;]+);/){|m|
87+
k = $6
88+
if k.include?("=")
89+
name,value = k.strip.split(/\s*=\s*/,2)
90+
",#{name} : #{value}"
91+
elsif k =~ /:(Number|int|float|[dD]ouble)$/
92+
",#{k} : 0"
93+
else
94+
",#{k} : null"
95+
end
96+
}
97+
s.gsub!(/([a-zA-Z0-9_\[\]\(\)]+):[a-zA-Z0-9_\.<>]+/, "\\1")
98+
s.gsub!(/((final )?(public|private|protected) (final )?(override )?(static )?)?function ([^\(]+)/, ",\\7 : function")
99+
s.gsub!(/\bVector\.<Vector.<[^>]+>>/, "Array")
100+
s.gsub!(/\bVector\.<Number>/, "FloatVector")
101+
s.gsub!(/\bVector\.<int>/, "IntVector")
102+
s.gsub!(/\bVector\.<[^>]+>/, "Array")
103+
s.gsub!(/(function\s*\([^\)]*\))\s*;/, "\\1{},")
104+
s.gsub!(/,(\s*(\/\/[^\n]*\n|\/\*([^*]*\*[^\/])+[^*]*\*\/)*\s*),/m, ",\\1")
105+
s.gsub!(/\{(\s*(\/\/[^\n]*\n|\/\*([^*]*\*[^\/])+[^*]*\*\/)*\s*),/m, "{\\1")
106+
s.gsub!(/\,(\s*(\/\/[^\n]*\n|\/\*([^*]*\*[^\/])+[^*]*\*\/)*\s*)\}/m, "\\1}")
107+
s.gsub!(/\[(\s*(\/\/[^\n]*\n|\/\*([^*]*\*[^\/])+[^*]*\*\/)*\s*),/m, "[\\1")
108+
s.gsub!(/\,(\s*(\/\/[^\n]*\n|\/\*([^*]*\*[^\/])+[^*]*\*\/)*\s*)\]/m, "\\1]")
109+
File.open(fn.sub(/as$/,"js"), "w"){|f| f.write s }
110+
end
111+

conversion_scripts/parse_order.rb

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
files = [];
2+
3+
Dir["src/*.js"].sort.each{|js|
4+
lines = File.readlines(js)
5+
class_lines = lines.grep(/Klass| [A-Z][^\.\(;\s]+[\.\(;]|^\}\)$/).reject{|f| f =~ /\s*\*/}
6+
objs = []
7+
cobj = nil
8+
class_lines.each{|cl|
9+
cl.gsub!(/"[^"]+"/, "")
10+
if cl =~ /^\}\)/
11+
objs.push(cobj) if cobj
12+
cobj = nil
13+
elsif cl =~ /^\S+ =/
14+
cname,rest = cl.split(" ",2)
15+
objs.push(cobj) if cobj
16+
cobj = [cname, rest.scan(/\b[A-Z][a-zA-Z0-9_]+/)]
17+
elsif cobj
18+
cobj[1].push(*cl.scan(/\b[A-Z][a-zA-Z0-9_]+/))
19+
else
20+
cobj = [nil, cl.scan(/\b[A-Z][a-zA-Z0-9_]+/)]
21+
end
22+
}
23+
objs.push(cobj) if cobj
24+
objs.each{|c| c[1].uniq! }
25+
classes = objs.map{|c| c[0] }.compact.uniq.sort
26+
constructors = classes.map{|c| lines.grep(/#{c} : function/) }.flatten.compact
27+
constructors.map!{|c| c.gsub(/^\s*\*?\s*,?| : function/,'') }.reject{|c|c =~ /^[a-z]/ }
28+
files.push({
29+
:file => js,
30+
:deps => objs.map{|c| c[1] }.flatten.sort.uniq - classes,
31+
:provides => classes,
32+
:constructors => constructors,
33+
:class_deps => objs
34+
})
35+
}
36+
def compare_files(a,b)
37+
return 0 if a == b
38+
b_needs_a = (b[:deps] - a[:provides]).length < b[:deps].length
39+
a_needs_b = (a[:deps] - b[:provides]).length < a[:deps].length
40+
if b_needs_a and a_needs_b
41+
puts "Conflict between #{a[:file]} and #{b[:file]}"
42+
0
43+
elsif a_needs_b
44+
1
45+
elsif b_needs_a
46+
-1
47+
else
48+
0
49+
end
50+
end
51+
def sort_by_deps(files)
52+
sfiles = []
53+
while files.length > 0
54+
m = files.find{|f| files.all?{|g| compare_files(f,g) < 1 } }
55+
raise "no find" unless m
56+
files.delete(m)
57+
sfiles.push(m)
58+
end
59+
sfiles
60+
end
61+
files = sort_by_deps(files)
62+
63+
puts( files.map{|f| "<script src=\"#{f[:file]}\"></script>" } )
64+
puts("<script>\n#{files.map{|f| f[:constructors].map{|c| "new #{c}"} }.flatten.sort.uniq.join("")}</script>")

0 commit comments

Comments
 (0)