Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
b6dd768d
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,发现更多精彩内容 >>
提交
b6dd768d
编写于
7月 05, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make it work again! :)
上级
83f8ace6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
38 deletion
+31
-38
three.js/examples/multi-markers/examples/threex-screenasportal/examples/screenAsPortal.html
...amples/threex-screenasportal/examples/screenAsPortal.html
+31
-38
未找到文件。
three.js/examples/multi-markers/examples/threex-screenasportal/examples/screenAsPortal.html
浏览文件 @
b6dd768d
...
...
@@ -43,7 +43,7 @@
Directly inspired of the
<a
href=
'https://www.youtube.com/watch?v=Jd3-eiid-Uw'
>
cult demo
</a>
by
<a
href=
'https://www.youtube.com/user/jcl5m/videos'
>
johnny lee
</a>
</div>
<div
style=
'position: fixed; bottom: 10px; width:100%; text-align: center;z-index:1; color: grey;'
;
>
<a
href=
'javascript:void(0)'
onclick=
'toggleMarkerHelper()'
>
marker helper :
<span
id=
'markerHelpersStatus'
>
</span></a>
<a
id=
'markerHelpersButton'
href=
'javascript:void(0)'
>
marker helper :
<span>
hidden
</span></a>
</div>
<div
style=
'position: fixed; bottom: 16px; right: 16px; z-index:1'
;
>
<img
id=
'recordButton'
src=
"../../../../multi-markers/examples/images/record-start.png"
width=
'64px'
height=
'64px'
>
...
...
@@ -133,9 +133,6 @@
// initialize arToolkitContext
////////////////////////////////////////////////////////////////////////////////
// honor urlOptions.trackingBackend
artoolkitProfile
.
contextParameters
.
trackingBackend
=
urlOptions
.
trackingBackend
// create atToolkitContext
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
(
artoolkitProfile
.
contextParameters
)
// initialize it
...
...
@@ -152,25 +149,20 @@
arToolkitContext
.
update
(
arToolkitSource
.
domElement
)
})
//////////////////////////////////////////////////////////////////////////////
// init learnerParameters and markersControlsParameters
//////////////////////////////////////////////////////////////////////////////
// build a multiMarkerControls
var
multiMarkerControls
=
THREEx
.
ArMultiMarkerControls
.
fromJSON
(
arToolkitContext
,
scene
,
markerRoot
,
multiMarkerFile
)
//////////////////////////////////////////////////////////////////////////////
// get multiMarkerFile
//////////////////////////////////////////////////////////////////////////////
// if no localStorage.ARjsMultiMarkerFile, then write one with default marker
if
(
localStorage
.
getItem
(
'
ARjsMultiMarkerFile
'
)
===
null
){
THREEx
.
ArMultiMarker
Contro
ls
.
storeDefaultMultiMarkerFile
(
urlOptions
.
trackingBackend
)
THREEx
.
ArMultiMarker
Uti
ls
.
storeDefaultMultiMarkerFile
(
urlOptions
.
trackingBackend
)
}
// get multiMarkerFile from localStorage
// get multiMarkerFile from localStorage
console
.
assert
(
localStorage
.
getItem
(
'
ARjsMultiMarkerFile
'
)
!==
null
)
var
multiMarkerFile
=
localStorage
.
getItem
(
'
ARjsMultiMarkerFile
'
)
//////////////////////////////////////////////////////////////////////////////
// Create ArMultiMarkerControls
...
...
@@ -182,15 +174,6 @@
// build a multiMarkerControls
var
multiMarkerControls
=
THREEx
.
ArMultiMarkerControls
.
fromJSON
(
arToolkitContext
,
scene
,
markerRoot
,
multiMarkerFile
)
// add an THREEx.ArMarkerHelper to visuable each sub-marker
var
markerHelpers
=
[]
multiMarkerControls
.
subMarkersControls
.
forEach
(
function
(
subMarkerControls
){
var
markerHelper
=
new
THREEx
.
ArMarkerHelper
(
subMarkerControls
)
subMarkerControls
.
object3d
.
add
(
markerHelper
.
object3d
)
markerHelpers
.
push
(
markerHelper
)
})
// build a smoothedControls
var
smoothedRoot
=
new
THREE
.
Group
()
scene
.
add
(
smoothedRoot
)
...
...
@@ -214,31 +197,41 @@
var
averageMatrix
=
THREEx
.
ArMultiMarkerControls
.
computeCenter
(
multiMarkerFile
)
averageMatrix
.
decompose
(
arWorldRoot
.
position
,
arWorldRoot
.
quaternion
,
arWorldRoot
.
scale
)
smoothedRoot
.
add
(
arWorldRoot
)
//////////////////////////////////////////////////////////////////////////////
//
toggle marker UI
//
markerHelpers
//////////////////////////////////////////////////////////////////////////////
document
.
querySelector
(
'
#recordButton
'
).
addEventListener
(
'
click
'
,
function
(){
var
learnerURL
=
THREEx
.
ArToolkitContext
.
baseURL
+
'
examples/multi-markers/examples/learner.html
'
THREEx
.
ArMultiMarkerUtils
.
navigateToLearnerPage
(
learnerURL
,
urlOptions
.
trackingBackend
)
// display THREEx.ArMarkerHelper if needed - useful to debug
var
markerHelpers
=
[]
multiMarkerControls
.
subMarkersControls
.
forEach
(
function
(
subMarkerControls
){
// add an helper to visuable each sub-marker
var
markerHelper
=
new
THREEx
.
ArMarkerHelper
(
subMarkerControls
)
markerHelpers
.
push
(
markerHelper
)
subMarkerControls
.
object3d
.
add
(
markerHelper
.
object3d
)
})
window
.
toggleMarkerHelper
=
toggleMarkerHelper
function
toggleMarkerHelper
(){
var
wasVisible
=
markerHelpers
[
0
].
object3d
.
visible
;
document
.
querySelector
(
'
#markerHelpersStatus
'
).
innerHTML
=
wasVisible
===
false
?
'
visible
'
:
'
hidden
'
function
markerHelpersToggleVisibility
(){
var
wasVisible
=
markerHelpers
[
0
].
object3d
.
visible
markerHelpers
.
forEach
(
function
(
markerHelper
){
markerHelper
.
object3d
.
visible
=
wasVisible
?
false
:
true
markerHelper
.
object3d
.
visible
=
wasVisible
?
false
:
true
})
// update visibility status
document
.
querySelector
(
'
#markerHelpersButton span
'
).
innerHTML
=
wasVisible
?
'
hidden
'
:
'
visible
'
}
toggleMarkerHelper
()
//////////////////////////////////////////////////////////////////////////////
// toggle marker UI
//////////////////////////////////////////////////////////////////////////////
document
.
querySelector
(
'
#recordButton
'
).
addEventListener
(
'
click
'
,
function
(){
var
learnerURL
=
THREEx
.
ArToolkitContext
.
baseURL
+
'
examples/multi-markers/examples/learner.html
'
THREEx
.
ArMultiMarkerUtils
.
navigateToLearnerPage
(
learnerURL
,
urlOptions
.
trackingBackend
)
})
document
.
querySelector
(
'
#markerHelpersButton
'
).
addEventListener
(
'
click
'
,
function
(){
markerHelpersToggleVisibility
()
})
markerHelpersToggleVisibility
()
//////////////////////////////////////////////////////////////////////////////////
// Add simple object on smoothedRoot
//////////////////////////////////////////////////////////////////////////////////
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录