Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
56bdce7a
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,发现更多精彩内容 >>
提交
56bdce7a
编写于
3月 21, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
changed marker axis
上级
a6af7c0e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
19 deletion
+38
-19
README.md
README.md
+1
-0
TODO.md
TODO.md
+1
-1
aframe/build/aframe-ar.js
aframe/build/aframe-ar.js
+12
-5
three.js/examples/dev.html
three.js/examples/dev.html
+12
-8
three.js/threex-armarkercontrols.js
three.js/threex-armarkercontrols.js
+7
-1
three.js/threex-artoolkitcontext.js
three.js/threex-artoolkitcontext.js
+5
-4
未找到文件。
README.md
浏览文件 @
56bdce7a
...
...
@@ -244,6 +244,7 @@ I exited to see what people will do with AR.js :)
-
have a browser on server to produce high quality 3d - aka pbs and to stream that to a phone
-
so when the phone is moving a lot, we do the local rendering
-
when the phone is stable, we do the server rendering
-
social AR - https://github.com/haydenjameslee/networked-aframe/blob/master/docs/Tutorial:%20Create%20your%20first%20Networked-Aframe%20experience.md
# Ideas
-
AR Gaming - https://www.youtube.com/watch?v=EmGGGzibGok
...
...
TODO.md
浏览文件 @
56bdce7a
-
pack the TODO.md and all, then switch to webvr-polyfill until it works for three.js demo, then for a-frame demo
# star war hologram
-
mvp DONE
...
...
aframe/build/aframe-ar.js
浏览文件 @
56bdce7a
...
...
@@ -314,9 +314,15 @@ THREEx.ArMarkerControls.prototype._postInit = function(){
// data.matrix is the model view matrix
var modelViewMatrix = new THREE.Matrix4().fromArray(event.data.matrix)
// apply context._axisTransformMatrix - change artoolkit axis to match usual webgl one
var tmpMatrix = new THREE.Matrix4().copy(_this.context._
axist
ransformMatrix)
var tmpMatrix = new THREE.Matrix4().copy(_this.context._
projectionAxisT
ransformMatrix)
tmpMatrix.multiply(modelViewMatrix)
// change axis orientation on marker - artoolkit say Z is normal to the marker - ar.js say Y is normal to the marker
var markerAxisTransformMatrix = new THREE.Matrix4().makeRotationX(Math.PI/2)
tmpMatrix.multiply(markerAxisTransformMatrix)
modelViewMatrix.copy(tmpMatrix)
...
...
@@ -375,9 +381,10 @@ THREEx.ArToolkitContext = function(parameters){
// debugger
this._axistransformMatrix = new THREE.Matrix4()
this._axistransformMatrix.multiply(new THREE.Matrix4().makeRotationY(Math.PI))
this._axistransformMatrix.multiply(new THREE.Matrix4().makeRotationZ(Math.PI))
// set this._projectionAxisTransformMatrix to change artoolkit projection matrix axis to match usual webgl one
this._projectionAxisTransformMatrix = new THREE.Matrix4()
this._projectionAxisTransformMatrix.multiply(new THREE.Matrix4().makeRotationY(Math.PI))
this._projectionAxisTransformMatrix.multiply(new THREE.Matrix4().makeRotationZ(Math.PI))
this.arController = null;
...
...
@@ -398,7 +405,7 @@ THREEx.ArToolkitContext.prototype.getProjectionMatrix = function(srcElement){
var projectionMatrix = new THREE.Matrix4().fromArray(projectionMatrixArr)
// apply context._axisTransformMatrix - change artoolkit axis to match usual webgl one
projectionMatrix.multiply(this._
axist
ransformMatrix)
projectionMatrix.multiply(this._
projectionAxisT
ransformMatrix)
// return the result
return projectionMatrix
...
...
three.js/examples/dev.html
浏览文件 @
56bdce7a
...
...
@@ -64,12 +64,12 @@
sourceType
:
'
webcam
'
,
// to read from an image
//
sourceType : 'image',
//
sourceUrl : '../../data/images/img.jpg',
sourceType
:
'
image
'
,
sourceUrl
:
'
../../data/images/img.jpg
'
,
// to read from a video
sourceType
:
'
video
'
,
sourceUrl
:
'
../../data/videos/headtracking.mp4
'
,
//
sourceType : 'video',
//
sourceUrl : '../../data/videos/headtracking.mp4',
})
arToolkitSource
.
init
(
function
onReady
(){
...
...
@@ -116,14 +116,18 @@
scene
.
add
(
markerRoot
)
var
artoolkitMarker
=
new
THREEx
.
ArMarkerControls
(
arToolkitContext
,
markerRoot
,
{
type
:
'
pattern
'
,
//
patternUrl : '../../data/data/patt.hiro',
patternUrl
:
'
../../data/data/patt.kanji
'
,
patternUrl
:
'
../../data/data/patt.hiro
'
,
//
patternUrl : '../../data/data/patt.kanji',
})
//////////////////////////////////////////////////////////////////////////////////
// add an object in the scene
//////////////////////////////////////////////////////////////////////////////////
var
mesh
=
new
THREE
.
AxisHelper
()
markerRoot
.
add
(
mesh
)
// add a torus knot
var
geometry
=
new
THREE
.
CubeGeometry
(
1
,
1
,
1
);
var
material
=
new
THREE
.
MeshNormalMaterial
({
...
...
@@ -133,13 +137,13 @@
});
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
z
=
geometry
.
parameters
.
height
/
2
markerRoot
.
add
(
mesh
);
//
markerRoot.add( mesh );
var
geometry
=
new
THREE
.
TorusKnotGeometry
(
0.3
,
0.1
,
32
,
32
);
var
material
=
new
THREE
.
MeshNormalMaterial
();
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
z
=
0.5
markerRoot
.
add
(
mesh
);
//
markerRoot.add( mesh );
onRenderFcts
.
push
(
function
(){
mesh
.
rotation
.
x
+=
0.1
...
...
three.js/threex-armarkercontrols.js
浏览文件 @
56bdce7a
...
...
@@ -92,9 +92,15 @@ THREEx.ArMarkerControls.prototype._postInit = function(){
// data.matrix is the model view matrix
var
modelViewMatrix
=
new
THREE
.
Matrix4
().
fromArray
(
event
.
data
.
matrix
)
// apply context._axisTransformMatrix - change artoolkit axis to match usual webgl one
var
tmpMatrix
=
new
THREE
.
Matrix4
().
copy
(
_this
.
context
.
_
axist
ransformMatrix
)
var
tmpMatrix
=
new
THREE
.
Matrix4
().
copy
(
_this
.
context
.
_
projectionAxisT
ransformMatrix
)
tmpMatrix
.
multiply
(
modelViewMatrix
)
// change axis orientation on marker - artoolkit say Z is normal to the marker - ar.js say Y is normal to the marker
var
markerAxisTransformMatrix
=
new
THREE
.
Matrix4
().
makeRotationX
(
Math
.
PI
/
2
)
tmpMatrix
.
multiply
(
markerAxisTransformMatrix
)
modelViewMatrix
.
copy
(
tmpMatrix
)
...
...
three.js/threex-artoolkitcontext.js
浏览文件 @
56bdce7a
...
...
@@ -30,9 +30,10 @@ THREEx.ArToolkitContext = function(parameters){
// debugger
this
.
_axistransformMatrix
=
new
THREE
.
Matrix4
()
this
.
_axistransformMatrix
.
multiply
(
new
THREE
.
Matrix4
().
makeRotationY
(
Math
.
PI
))
this
.
_axistransformMatrix
.
multiply
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
))
// set this._projectionAxisTransformMatrix to change artoolkit projection matrix axis to match usual webgl one
this
.
_projectionAxisTransformMatrix
=
new
THREE
.
Matrix4
()
this
.
_projectionAxisTransformMatrix
.
multiply
(
new
THREE
.
Matrix4
().
makeRotationY
(
Math
.
PI
))
this
.
_projectionAxisTransformMatrix
.
multiply
(
new
THREE
.
Matrix4
().
makeRotationZ
(
Math
.
PI
))
this
.
arController
=
null
;
...
...
@@ -53,7 +54,7 @@ THREEx.ArToolkitContext.prototype.getProjectionMatrix = function(srcElement){
var
projectionMatrix
=
new
THREE
.
Matrix4
().
fromArray
(
projectionMatrixArr
)
// apply context._axisTransformMatrix - change artoolkit axis to match usual webgl one
projectionMatrix
.
multiply
(
this
.
_
axist
ransformMatrix
)
projectionMatrix
.
multiply
(
this
.
_
projectionAxisT
ransformMatrix
)
// return the result
return
projectionMatrix
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录