Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
2a1907a1
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,发现更多精彩内容 >>
提交
2a1907a1
编写于
5月 22, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
a0df3438
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
39 deletion
+38
-39
three.js/examples/webar-playground/TODO.md
three.js/examples/webar-playground/TODO.md
+0
-1
three.js/examples/webar-playground/demo.html
three.js/examples/webar-playground/demo.html
+38
-38
未找到文件。
three.js/examples/webar-playground/TODO.md
浏览文件 @
2a1907a1
...
...
@@ -5,7 +5,6 @@
-
what about a simple demo-scenes/vendor where i copy all the files from elsewhere in the repo
-
refraction/threex.minecraft/hole-in-the-wall/holographic-message
# Demo.html
-
make it possible to save/load scene from json - put json in url - thus shareable
...
...
three.js/examples/webar-playground/demo.html
浏览文件 @
2a1907a1
...
...
@@ -17,6 +17,7 @@
<script
src=
'../../../../three.js/threex-artoolkitprofile.js'
></script>
<script
src=
'../../../../three.js/threex-arbasecontrols.js'
></script>
<script
src=
'../../../../three.js/threex-armarkercontrols.js'
></script>
<script
src=
'../../../../three.js/threex-armarkerhelper.js'
></script>
<script
src=
'../../../../three.js/threex-arsmoothedcontrols.js'
></script>
<script>
THREEx
.
ArToolkitContext
.
baseURL
=
'
../../../../three.js/
'
</script>
...
...
@@ -83,7 +84,7 @@
Area source:
<a
href=
'javascript:void(0)'
onclick=
'urlOptions.areaSource = "localStorage"; reload()'
>
localStorage
</a>
/
<a
href=
'javascript:void(0)'
onclick=
'urlOptions.areaSource = "
onlyHiro"; reload()'
>
only
Hiro
</a>
<a
href=
'javascript:void(0)'
onclick=
'urlOptions.areaSource = "
hardcodedHiro"; reload()'
>
hardcoded
Hiro
</a>
<br>
Marker helpers:
<a
href=
'javascript:void(0)'
onclick=
'urlOptions.markerHelpers = true; reload()'
>
yes
</a>
...
...
@@ -228,37 +229,31 @@
}
location
.
href
=
THREEx
.
ArToolkitContext
.
baseURL
+
'
examples/multi-markers/examples/learner.html#
'
+
JSON
.
stringify
(
learnerParameters
)
})
window
.
fullSceneToJSON
=
fullSceneToJSON
var
updateUrlTimer
=
null
function
markerScenesUpdated
(){
urlOptions
.
fullScene
=
fullSceneToJSON
()
clearTimeout
(
updateUrlTimer
)
updateUrlTimer
=
setTimeout
(
function
(){
updateUrlTimer
=
null
urlOptionsUpdate
()
},
0.1
*
1000
)
}
function
fullSceneToJSON
(){
scene
.
updateMatrix
(
true
)
scene
.
updateMatrixWorld
(
true
)
var
jsonData
=
{
markerScenes
:
[]
}
markerScenes
.
forEach
(
function
(
markerScene
){
markerScene
.
updateMatrix
()
var
parentObject3D
=
markerScene
.
parent
jsonData
.
markerScenes
.
push
({
type
:
markerScene
.
userData
.
sceneType
,
position
:
{
x
:
parentObject3D
.
position
.
x
,
y
:
parentObject3D
.
position
.
y
,
z
:
parentObject3D
.
position
.
z
,
},
quaternion
:
{
x
:
parentObject3D
.
quaternion
.
x
,
y
:
parentObject3D
.
quaternion
.
y
,
z
:
parentObject3D
.
quaternion
.
z
,
w
:
parentObject3D
.
quaternion
.
w
,
},
scale
:
{
x
:
parentObject3D
.
scale
.
x
,
y
:
parentObject3D
.
scale
.
y
,
z
:
parentObject3D
.
scale
.
z
,
},
poseMatrix
:
parentObject3D
.
matrix
.
toArray
()
})
})
...
...
@@ -270,19 +265,11 @@ window.fullSceneToJSON = fullSceneToJSON
createScene
(
item
.
type
)
var
parentObject3D
=
selectedMarkerScene
.
parent
parentObject3D
.
position
.
x
=
item
.
position
.
x
parentObject3D
.
position
.
y
=
item
.
position
.
y
parentObject3D
.
position
.
z
=
item
.
position
.
z
parentObject3D
.
quaternion
.
x
=
item
.
quaternion
.
x
parentObject3D
.
quaternion
.
y
=
item
.
quaternion
.
y
parentObject3D
.
quaternion
.
z
=
item
.
quaternion
.
z
parentObject3D
.
quaternion
.
w
=
item
.
quaternion
.
w
parentObject3D
.
scale
.
x
=
item
.
scale
.
x
parentObject3D
.
scale
.
y
=
item
.
scale
.
y
parentObject3D
.
scale
.
z
=
item
.
scale
.
z
var
poseMatrix
=
new
THREE
.
Matrix4
().
fromArray
(
item
.
poseMatrix
)
parentObject3D
.
matrix
.
copy
(
poseMatrix
)
parentObject3D
.
matrix
.
decompose
(
parentObject3D
.
position
,
parentObject3D
.
quaternion
,
parentObject3D
.
scale
)
})
}
...
...
@@ -297,7 +284,14 @@ window.fullSceneToJSON = fullSceneToJSON
var
urlOptions
=
{
areaSource
:
'
localStorage
'
,
markerHelpers
:
false
,
sceneName
:
'
torus
'
,
fullScene
:
{
markerScenes
:
[
{
type
:
'
torus
'
,
poseMatrix
:
new
THREE
.
Matrix4
().
makeTranslation
(
0
,
0
,
0
).
toArray
()
},
]
},
}
}
window
.
urlOptions
=
urlOptions
...
...
@@ -312,7 +306,7 @@ window.fullSceneToJSON = fullSceneToJSON
if
(
urlOptions
.
areaSource
===
'
localStorage
'
&&
localStorage
.
getItem
(
'
ARjsMultiMarkerFile
'
)
===
null
){
alert
(
'
No area has been learned on this device!
\n
Using only hiro.
'
)
urlOptions
.
areaSource
===
'
only
Hiro
'
urlOptions
.
areaSource
===
'
hardcoded
Hiro
'
urlOptionsUpdate
()
}
...
...
@@ -323,7 +317,7 @@ window.fullSceneToJSON = fullSceneToJSON
if
(
urlOptions
.
areaSource
===
'
localStorage
'
){
console
.
assert
(
localStorage
.
getItem
(
'
ARjsMultiMarkerFile
'
)
!==
null
)
var
multiMarkerFile
=
localStorage
.
getItem
(
'
ARjsMultiMarkerFile
'
)
}
else
if
(
urlOptions
.
areaSource
===
'
only
Hiro
'
){
}
else
if
(
urlOptions
.
areaSource
===
'
hardcoded
Hiro
'
){
var
multiMarkerFile
=
JSON
.
stringify
({
subMarkersControls
:
[
{
...
...
@@ -386,7 +380,8 @@ window.fullSceneToJSON = fullSceneToJSON
var
markerScenes
=
[]
var
selectedMarkerScene
=
null
createScene
(
urlOptions
.
sceneName
)
fullSceneFromJSON
(
urlOptions
.
fullScene
)
// createScene(urlOptions.sceneName)
// function to dynamically switch demoScenes
window
.
createScene
=
createScene
...
...
@@ -416,8 +411,7 @@ window.fullSceneToJSON = fullSceneToJSON
})
// update urlOptions.sceneName
urlOptions
.
sceneName
=
newSceneName
urlOptionsUpdate
()
markerScenesUpdated
()
// actually select this scene
selectScene
(
markerScene
)
...
...
@@ -472,6 +466,8 @@ window.fullSceneToJSON = fullSceneToJSON
var
delta
=
event
.
velocityX
/
window
.
innerWidth
*
60
var
demoRoot
=
selectedMarkerScene
.
parent
demoRoot
.
rotation
.
y
+=
delta
markerScenesUpdated
()
});
hammertime
.
on
(
'
pan
'
,
function
(
event
)
{
if
(
event
.
additionalEvent
!==
'
panup
'
&&
event
.
additionalEvent
!==
'
pandown
'
)
return
...
...
@@ -484,6 +480,8 @@ window.fullSceneToJSON = fullSceneToJSON
var
scale
=
demoRoot
.
scale
.
x
*
(
1
+
delta
)
scale
=
THREE
.
Math
.
clamp
(
scale
,
0.2
,
10
)
demoRoot
.
scale
.
set
(
scale
,
scale
,
scale
)
markerScenesUpdated
()
});
...
...
@@ -534,6 +532,8 @@ window.fullSceneToJSON = fullSceneToJSON
var
demoRoot
=
selectedMarkerScene
.
parent
var
newPosition
=
demoRoot
.
parent
.
worldToLocal
(
intersects
[
0
].
point
.
clone
()
)
demoRoot
.
position
.
copy
(
newPosition
)
markerScenesUpdated
()
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录