Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
b96e92ac
A
AR.js
项目概览
cqiang1993
/
AR.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AR.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b96e92ac
编写于
3月 20, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switched to canvasWidth/HEight in Context
上级
32c0ea02
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
87 addition
and
46 deletion
+87
-46
README.md
README.md
+5
-2
aframe/README.md
aframe/README.md
+4
-2
aframe/aframe-ar.js
aframe/aframe-ar.js
+8
-0
aframe/build/aframe-ar.js
aframe/build/aframe-ar.js
+17
-7
aframe/examples/basic.html
aframe/examples/basic.html
+1
-1
aframe/examples/mobile-performance.html
aframe/examples/mobile-performance.html
+25
-0
three.js/README.md
three.js/README.md
+3
-3
three.js/examples/cameratransform.html
three.js/examples/cameratransform.html
+0
-2
three.js/examples/dev.html
three.js/examples/dev.html
+2
-2
three.js/examples/hole-in-the-wall.html
three.js/examples/hole-in-the-wall.html
+2
-2
three.js/examples/holographic-message.html
three.js/examples/holographic-message.html
+3
-5
three.js/examples/markercloak.html
three.js/examples/markercloak.html
+2
-4
three.js/examples/markerroot.html
three.js/examples/markerroot.html
+0
-2
three.js/examples/mobile-performance.html
three.js/examples/mobile-performance.html
+2
-3
three.js/examples/refraction.html
three.js/examples/refraction.html
+2
-2
three.js/examples/shadow.html
three.js/examples/shadow.html
+2
-2
three.js/threex-artoolkitcontext.js
three.js/threex-artoolkitcontext.js
+8
-6
three.js/threex-artoolkitsource.js
three.js/threex-artoolkitsource.js
+1
-1
未找到文件。
README.md
浏览文件 @
b96e92ac
...
...
@@ -166,13 +166,16 @@ a-frame Examples:
-
[
marker-camera
](
https://jeromeetienne.github.io/AR.js/aframe/examples/marker-camera.html
)
:
a-frame example for marker-camera
(
[
source
](
https://github.com/jeromeetienne/AR.js/blob/master/aframe/examples/marker-camera.html
)
)
-
[
multiple-indep
e
ndent-markers
](
https://jeromeetienne.github.io/AR.js/aframe/examples/multiple-independant-markers.html
)
:
a-frame example for multiple-indep
e
ndent-markers
-
[
multiple-indep
a
ndent-markers
](
https://jeromeetienne.github.io/AR.js/aframe/examples/multiple-independant-markers.html
)
:
a-frame example for multiple-indep
a
ndent-markers
(
[
source
](
https://github.com/jeromeetienne/AR.js/blob/master/aframe/examples/multiple-independant-markers.html
)
)
-
[
minimal
](
https://jeromeetienne.github.io/AR.js/aframe/examples/minimal.html
)
:
Want to do Augmented Reality on the web ? You can do it
[
in less than 10 lines of html now
](
https://twitter.com/jerome_etienne/status/842192608256512000
)
:)
minimal.html is the shortest html file you need if you want to do ar.js with a-frame
(
[
source
](
https://github.com/jeromeetienne/AR.js/blob/master/aframe/examples/minimal.html
)
)
-
[
mobile-performance
](
https://jeromeetienne.github.io/AR.js/aframe/examples/mobile-performance.html
)
:
a-frame example for mobile-performance
(
[
source
](
https://github.com/jeromeetienne/AR.js/blob/master/aframe/examples/mobile-performance.html
)
)
WebVR-polyfill Examples:
-
[
aframe
](
https://jeromeetienne.github.io/AR.js/webvr-polyfill/examples/aframe.html
)
:
...
...
aframe/README.md
浏览文件 @
b96e92ac
...
...
@@ -39,10 +39,12 @@ include a hatsune miku or minecraft avatar on the marker
| maxDetectionRate | tune the maximum rate of pose detection in the source image |
| sourceType | type of source - ['webcam', 'image', 'video'] |
| sourceUrl | url of the source - valid if sourceType = image|video |
| sourceWidth | resolution of at which we
detect pose in
the source image |
| sourceHeight | resolution of at which we
detect pose in
the source image |
| sourceWidth | resolution of at which we
initialize
the source image |
| sourceHeight | resolution of at which we
initialize
the source image |
| displayWidth | resolution displayed for the source |
| displayHeight | resolution displayed for the source |
| canvasWidth | resolution of at which we detect pose in the source image |
| canvasHeight | resolution of at which we detect pose in the source image |
# \<a-marker\>
...
...
aframe/aframe-ar.js
浏览文件 @
b96e92ac
...
...
@@ -46,6 +46,14 @@ AFRAME.registerSystem('artoolkit', {
type
:
'
number
'
,
default
:
480
},
canvasWidth
:
{
type
:
'
number
'
,
default
:
640
},
canvasHeight
:
{
type
:
'
number
'
,
default
:
480
},
},
//////////////////////////////////////////////////////////////////////////////
...
...
aframe/build/aframe-ar.js
浏览文件 @
b96e92ac
...
...
@@ -365,14 +365,16 @@ THREEx.ArToolkitContext = function(parameters){
// tune the maximum rate of pose detection in the source image
maxDetectionRate: parameters.maxDetectionRate !== undefined ? parameters.maxDetectionRate : 60,
// resolution of at which we detect pose in the source image
sourceWidth: parameters.sourceWidth !== undefined ? parameters.source
Width : 640,
sourceHeight: parameters.sourceHeight !== undefined ? parameters.source
Height : 480,
canvasWidth: parameters.canvasWidth !== undefined ? parameters.canvas
Width : 640,
canvasHeight: parameters.canvasHeight !== undefined ? parameters.canvas
Height : 480,
// enable image smoothing or not for canvas copy - default to true
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled
imageSmoothingEnabled : parameters.imageSmoothingEnabled !== undefined ? parameters.imageSmoothingEnabled : false,
}
// debugger
this._axistransformMatrix = new THREE.Matrix4()
this._axistransformMatrix.multiply(new THREE.Matrix4().makeRotationY(Math.PI))
this._axistransformMatrix.multiply(new THREE.Matrix4().makeRotationZ(Math.PI))
...
...
@@ -407,13 +409,13 @@ THREEx.ArToolkitContext.prototype.getProjectionMatrix = function(srcElement){
//////////////////////////////////////////////////////////////////////////////
THREEx.ArToolkitContext.prototype.init = function(onCompleted){
var _this = this
var
sourceWidth = this.parameters.source
Width
var
sourceHeight = this.parameters.source
Height
var
canvasWidth = this.parameters.canvas
Width
var
canvasHeight = this.parameters.canvas
Height
// console.log('ArToolkitContext: _onSourceReady width',
sourceWidth, 'height', source
Height)
// console.log('ArToolkitContext: _onSourceReady width',
canvasWidth, 'height', canvas
Height)
_this._cameraParameters = new ARCameraParam(_this.parameters.cameraParametersUrl, function() {
// init controller
var arController = new ARController(
sourceWidth, source
Height, _this._cameraParameters);
var arController = new ARController(
canvasWidth, canvas
Height, _this._cameraParameters);
_this.arController = arController
arController.ctx.mozImageSmoothingEnabled = _this.parameters.imageSmoothingEnabled;
...
...
@@ -664,7 +666,7 @@ THREEx.ArToolkitSource = function(parameters){
// url of the source - valid if sourceType = image|video
sourceUrl : parameters.sourceUrl !== undefined ? parameters.sourceUrl : null,
// resolution of at which we
detect pos
e in the source image
// resolution of at which we
initializ
e in the source image
sourceWidth: parameters.sourceWidth !== undefined ? parameters.sourceWidth : 640,
sourceHeight: parameters.sourceHeight !== undefined ? parameters.sourceHeight : 480,
// resolution displayed for the source
...
...
@@ -942,6 +944,14 @@ AFRAME.registerSystem('artoolkit', {
type: 'number',
default: 480
},
canvasWidth : {
type: 'number',
default: 640
},
canvasHeight : {
type: 'number',
default: 480
},
},
//////////////////////////////////////////////////////////////////////////////
...
...
aframe/examples/basic.html
浏览文件 @
b96e92ac
<!DOCTYPE html>
<!-- include aframe -->
<script
src=
"vendor/aframe.
min.
js"
></script>
<script
src=
"vendor/aframe.js"
></script>
<!-- include aframe-artoolkit -->
<script
src=
"../build/aframe-ar.js"
></script>
...
...
aframe/examples/mobile-performance.html
0 → 100644
浏览文件 @
b96e92ac
<!DOCTYPE html>
<!-- include aframe -->
<script
src=
"vendor/aframe.js"
></script>
<!-- include aframe-artoolkit -->
<script
src=
"../build/aframe-ar.js"
></script>
<body
style=
'margin : 0px; overflow: hidden; font-family: Monospace;'
><div
style=
'position: fixed; top: 10px; width:inherit; text-align: center; z-index: 1;'
>
<a
href=
"https://github.com/jeromeetienne/AR.js/"
target=
"_blank"
>
AR.js
</a>
- mobile performance in a-frame
<br/>
Contact me any time at
<a
href=
'https://twitter.com/jerome_etienne'
target=
'_blank'
>
@jerome_etienne
</a>
</div>
<!-- enable artoolkit on this scene -->
<a-scene
embedded
artoolkit=
'sourceType: webcam; detectionMode: mono; maxDetectionRate: 30; canvasWidth: 240; canvasHeight: 180'
>
<!-- define the object which gonna be put on this marker -->
<a-box
position=
'0 0 0.5'
material=
'opacity: 0.5; side: double'
>
<a-torus-knot
radius=
'0.27'
radius-tubular=
'0.05'
>
<a-animation
attribute=
"rotation"
to=
"360 0 0"
dur=
"5000"
easing=
'linear'
repeat=
"indefinite"
></a-animation>
</a-torus-knot>
</a-box>
<a-marker-camera
preset=
'hiro'
></a-marker-camera>
</a-scene>
</body>
</html>
three.js/README.md
浏览文件 @
b96e92ac
...
...
@@ -50,8 +50,8 @@ var parameters = {
// tune the maximum rate of pose detection in the source image
maxDetectionRate
:
60
,
// resolution of at which we detect pose in the source image
source
Width
:
640
,
source
Height
:
480
,
canvas
Width
:
640
,
canvas
Height
:
480
,
// enable image smoothing or not for canvas copy - default to true
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled
...
...
@@ -68,7 +68,7 @@ var parameters = {
// url of the source - valid if sourceType = image|video
sourceUrl
:
null
,
// resolution of at which we
detect pose in
the source image
// resolution of at which we
initialize
the source image
sourceWidth
:
640
,
sourceHeight
:
480
,
// resolution displayed for the source
...
...
three.js/examples/cameratransform.html
浏览文件 @
b96e92ac
...
...
@@ -80,8 +80,6 @@
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
({
cameraParametersUrl
:
'
../../data/data/camera_para.dat
'
,
detectionMode
:
'
mono
'
,
sourceWidth
:
arToolkitSource
.
parameters
.
sourceWidth
,
sourceHeight
:
arToolkitSource
.
parameters
.
sourceHeight
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/dev.html
浏览文件 @
b96e92ac
...
...
@@ -91,8 +91,8 @@
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
({
cameraParametersUrl
:
'
../../data/data/camera_para.dat
'
,
detectionMode
:
'
mono
'
,
source
Width
:
80
*
3
,
source
Height
:
60
*
3
,
canvas
Width
:
80
*
3
,
canvas
Height
:
60
*
3
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/hole-in-the-wall.html
浏览文件 @
b96e92ac
...
...
@@ -101,8 +101,8 @@
detectionMode
:
'
mono
'
,
imageSmoothingEnabled
:
false
,
maxDetectionRate
:
30
,
source
Width
:
80
*
4
,
source
Height
:
60
*
4
,
canvas
Width
:
80
*
4
,
canvas
Height
:
60
*
4
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/holographic-message.html
浏览文件 @
b96e92ac
...
...
@@ -138,11 +138,9 @@
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
({
cameraParametersUrl
:
'
../../data/data/camera_para.dat
'
,
detectionMode
:
'
mono
'
,
sourceWidth
:
arToolkitSource
.
parameters
.
sourceWidth
,
sourceHeight
:
arToolkitSource
.
parameters
.
sourceHeight
,
maxDetectionRate
:
30
,
source
Width
:
80
*
3
,
source
Height
:
60
*
3
,
canvas
Width
:
80
*
3
,
canvas
Height
:
60
*
3
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
@@ -188,7 +186,7 @@
// video.src = '../../data/videos/headtracking.mp4'
// video.src = '../../data/videos/bird_greenscreen.mp4'
video
.
src
=
'
../../data/videos/Star
\
wars
\
demo
\
Alex.mp4
'
video
.
autoplay
=
true
;
//
video.autoplay = true;
video
.
webkitPlaysinline
=
true
;
video
.
controls
=
false
;
video
.
loop
=
true
;
...
...
three.js/examples/markercloak.html
浏览文件 @
b96e92ac
...
...
@@ -85,8 +85,6 @@
// to read from a video
// sourceType : 'video',
// sourceUrl : '../../data/videos/headtracking.mp4',
// sourceWidth: 80*4,
// sourceHeight: 60*4,
})
arToolkitSource
.
init
(
function
onReady
(){
...
...
@@ -110,8 +108,8 @@
detectionMode
:
'
mono
'
,
imageSmoothingEnabled
:
false
,
maxDetectionRate
:
30
,
source
Width
:
80
*
4
,
source
Height
:
60
*
4
,
canvas
Width
:
80
*
4
,
canvas
Height
:
60
*
4
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/markerroot.html
浏览文件 @
b96e92ac
...
...
@@ -83,8 +83,6 @@
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
({
cameraParametersUrl
:
'
../../data/data/camera_para.dat
'
,
detectionMode
:
'
mono
'
,
sourceWidth
:
arToolkitSource
.
parameters
.
sourceWidth
,
sourceHeight
:
arToolkitSource
.
parameters
.
sourceHeight
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/mobile-performance.html
浏览文件 @
b96e92ac
...
...
@@ -90,10 +90,9 @@
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
({
cameraParametersUrl
:
'
../../data/data/camera_para.dat
'
,
detectionMode
:
'
mono
'
,
imageSmoothingEnabled
:
false
,
maxDetectionRate
:
30
,
source
Width
:
80
*
3
,
source
Height
:
60
*
3
,
canvas
Width
:
80
*
3
,
canvas
Height
:
60
*
3
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/refraction.html
浏览文件 @
b96e92ac
...
...
@@ -134,8 +134,8 @@ void main(void) {
detectionMode
:
'
mono
'
,
imageSmoothingEnabled
:
false
,
maxDetectionRate
:
30
,
source
Width
:
80
*
4
,
source
Height
:
60
*
4
,
canvas
Width
:
80
*
4
,
canvas
Height
:
60
*
4
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/examples/shadow.html
浏览文件 @
b96e92ac
...
...
@@ -106,8 +106,8 @@ renderer.shadowMap.enabled = true;
detectionMode
:
'
mono
'
,
imageSmoothingEnabled
:
false
,
maxDetectionRate
:
30
,
source
Width
:
80
*
3
,
source
Height
:
60
*
3
,
canvas
Width
:
80
*
3
,
canvas
Height
:
60
*
3
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
...
...
three.js/threex-artoolkitcontext.js
浏览文件 @
b96e92ac
...
...
@@ -20,14 +20,16 @@ THREEx.ArToolkitContext = function(parameters){
// tune the maximum rate of pose detection in the source image
maxDetectionRate
:
parameters
.
maxDetectionRate
!==
undefined
?
parameters
.
maxDetectionRate
:
60
,
// resolution of at which we detect pose in the source image
sourceWidth
:
parameters
.
sourceWidth
!==
undefined
?
parameters
.
source
Width
:
640
,
sourceHeight
:
parameters
.
sourceHeight
!==
undefined
?
parameters
.
source
Height
:
480
,
canvasWidth
:
parameters
.
canvasWidth
!==
undefined
?
parameters
.
canvas
Width
:
640
,
canvasHeight
:
parameters
.
canvasHeight
!==
undefined
?
parameters
.
canvas
Height
:
480
,
// enable image smoothing or not for canvas copy - default to true
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled
imageSmoothingEnabled
:
parameters
.
imageSmoothingEnabled
!==
undefined
?
parameters
.
imageSmoothingEnabled
:
false
,
}
// debugger
this
.
_axistransformMatrix
=
new
THREE
.
Matrix4
()
this
.
_axistransformMatrix
.
multiply
(
new
THREE
.
Matrix4
().
makeRotationY
(
Math
.
PI
))
this
.
_axistransformMatrix
.
multiply
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
))
...
...
@@ -62,13 +64,13 @@ THREEx.ArToolkitContext.prototype.getProjectionMatrix = function(srcElement){
//////////////////////////////////////////////////////////////////////////////
THREEx
.
ArToolkitContext
.
prototype
.
init
=
function
(
onCompleted
){
var
_this
=
this
var
sourceWidth
=
this
.
parameters
.
source
Width
var
sourceHeight
=
this
.
parameters
.
source
Height
var
canvasWidth
=
this
.
parameters
.
canvas
Width
var
canvasHeight
=
this
.
parameters
.
canvas
Height
// console.log('ArToolkitContext: _onSourceReady width',
sourceWidth, 'height', source
Height)
// console.log('ArToolkitContext: _onSourceReady width',
canvasWidth, 'height', canvas
Height)
_this
.
_cameraParameters
=
new
ARCameraParam
(
_this
.
parameters
.
cameraParametersUrl
,
function
()
{
// init controller
var
arController
=
new
ARController
(
sourceWidth
,
source
Height
,
_this
.
_cameraParameters
);
var
arController
=
new
ARController
(
canvasWidth
,
canvas
Height
,
_this
.
_cameraParameters
);
_this
.
arController
=
arController
arController
.
ctx
.
mozImageSmoothingEnabled
=
_this
.
parameters
.
imageSmoothingEnabled
;
...
...
three.js/threex-artoolkitsource.js
浏览文件 @
b96e92ac
...
...
@@ -8,7 +8,7 @@ THREEx.ArToolkitSource = function(parameters){
// url of the source - valid if sourceType = image|video
sourceUrl
:
parameters
.
sourceUrl
!==
undefined
?
parameters
.
sourceUrl
:
null
,
// resolution of at which we
detect pos
e in the source image
// resolution of at which we
initializ
e in the source image
sourceWidth
:
parameters
.
sourceWidth
!==
undefined
?
parameters
.
sourceWidth
:
640
,
sourceHeight
:
parameters
.
sourceHeight
!==
undefined
?
parameters
.
sourceHeight
:
480
,
// resolution displayed for the source
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录