Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
30a5491d
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,体验更适合开发者的 AI 搜索 >>
提交
30a5491d
编写于
11月 06, 2019
作者:
N
nicolo.carpignoli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
trying with gps-camera-ready event
上级
434f2ff6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
42 deletion
+73
-42
aframe/build/aframe-ar.js
aframe/build/aframe-ar.js
+8
-3
aframe/examples/only-html/index.html
aframe/examples/only-html/index.html
+31
-0
aframe/examples/places-name/places.js
aframe/examples/places-name/places.js
+26
-36
aframe/src/location-based/gps-camera.js
aframe/src/location-based/gps-camera.js
+4
-1
aframe/src/location-based/gps-entity-place.js
aframe/src/location-based/gps-entity-place.js
+4
-2
未找到文件。
aframe/build/aframe-ar.js
浏览文件 @
30a5491d
...
...
@@ -8733,7 +8733,7 @@ AFRAME.registerComponent('gps-camera', {
minDistance: {
type: 'int',
default: 0,
}
}
,
},
init: function () {
...
...
@@ -8772,6 +8772,9 @@ AFRAME.registerComponent('gps-camera', {
window.addEventListener(eventName, this._onDeviceOrientation, false);
window.dispatchEvent(new CustomEvent('gps-camera-ready'));
console.debug('gps-camera-ready');
this._watchPositionId = this._initWatchGPS(function (position) {
this.currentCoords = position.coords;
this._updatePosition();
...
...
@@ -9020,6 +9023,10 @@ AFRAME.registerComponent('gps-entity-place', {
},
},
init: function () {
window.addEventListener('gps-camera-ready', () => {
this._updatePosition();
});
this._positionXDebug = 0;
this.debugUIAddedHandler = function () {
...
...
@@ -9041,8 +9048,6 @@ AFRAME.registerComponent('gps-entity-place', {
return;
}
this._updatePosition();
return true;
},
/**
aframe/examples/only-html/index.html
0 → 100644
浏览文件 @
30a5491d
<!DOCTYPE html>
<html>
<head>
<meta
charset=
'utf-8'
>
<meta
http-equiv=
'X-UA-Compatible'
content=
'IE=edge'
>
<title>
GeoAR.js demo
</title>
<script
src=
'https://aframe.io/releases/0.9.2/aframe.min.js'
></script>
<script
src=
'../../build/aframe-ar.js'
></script>
<script>
THREEx
.
ArToolkitContext
.
baseURL
=
'
https://raw.githack.com/jeromeetienne/ar.js/master/three.js/
'
</script>
</head>
<link
rel=
"stylesheet"
href=
"../../src/location-based/stylesheets/index.css"
>
<!-- Dynamically add places from Javascript -->
<script
src=
"./places.js"
></script>
<body
style=
'margin: 0; overflow: hidden;'
>
<a-scene
cursor=
'rayOrigin: mouse; fuse: true; fuseTimeout: 0;'
raycaster=
"objects: [gps-entity-place];"
vr-mode-ui=
"enabled: false"
embedded
arjs=
'sourceType: webcam; sourceWidth:1280; sourceHeight:960; displayWidth: 1280; displayHeight: 960; debugUIEnabled: false;'
>
<a-box
gps-entity-place=
"latitude: 44.496470; longitude: 11.320220;"
></a-box>
<a-camera
gps-camera=
"minDistance: 40;"
rotation-reader
>
</a-camera>
</a-scene>
</body>
aframe/examples/places-name/places.js
浏览文件 @
30a5491d
...
...
@@ -2,36 +2,33 @@
window
.
onload
=
()
=>
{
let
method
=
'
dynamic
'
;
// if you want to statically add places, de-comment following line
// method = 'static';
if
(
method
===
'
static
'
)
{
// setTimeout is a temporary fix
setTimeout
(()
=>
{
window
.
addEventListener
(
'
gps-camera-ready
'
,
()
=>
{
// if you want to statically add places, de-comment following line:
method
=
'
static
'
;
if
(
method
===
'
static
'
)
{
let
places
=
staticLoadPlaces
();
renderPlaces
(
places
);
},
3000
);
}
if
(
method
!==
'
static
'
)
{
return
renderPlaces
(
places
);
}
// first get current user location
return
navigator
.
geolocation
.
getCurrentPosition
(
function
(
position
)
{
if
(
method
!==
'
static
'
)
{
// first get current user location
return
navigator
.
geolocation
.
getCurrentPosition
(
function
(
position
)
{
// than use it to load from remote APIs some places nearby
dynamicLoadPlaces
(
position
.
coords
)
.
then
((
places
)
=>
{
renderPlaces
(
places
);
})
},
(
err
)
=>
console
.
error
(
'
Error in retrieving position
'
,
err
),
{
enableHighAccuracy
:
true
,
maximumAge
:
0
,
timeout
:
27000
,
}
);
}
// than use it to load from remote APIs some places nearby
dynamicLoadPlaces
(
position
.
coords
)
.
then
((
places
)
=>
{
renderPlaces
(
places
);
})
},
(
err
)
=>
console
.
error
(
'
Error in retrieving position
'
,
err
),
{
enableHighAccuracy
:
true
,
maximumAge
:
0
,
timeout
:
27000
,
}
);
}
});
};
function
staticLoadPlaces
()
{
...
...
@@ -39,17 +36,10 @@ function staticLoadPlaces() {
{
name
:
"
Your place name
"
,
location
:
{
lat
:
0
,
// add
here latitude if using static data
lng
:
0
,
// add
here longitude if using static data
lat
:
44.496470
,
// change
here latitude if using static data
lng
:
11.320220
,
// change
here longitude if using static data
}
},
{
name
:
'
Another place name
'
,
location
:
{
lat
:
0
,
lng
:
0
,
}
}
];
}
...
...
aframe/src/location-based/gps-camera.js
浏览文件 @
30a5491d
...
...
@@ -17,7 +17,7 @@ AFRAME.registerComponent('gps-camera', {
minDistance
:
{
type
:
'
int
'
,
default
:
0
,
}
}
,
},
init
:
function
()
{
...
...
@@ -56,6 +56,9 @@ AFRAME.registerComponent('gps-camera', {
window
.
addEventListener
(
eventName
,
this
.
_onDeviceOrientation
,
false
);
window
.
dispatchEvent
(
new
CustomEvent
(
'
gps-camera-ready
'
));
console
.
debug
(
'
gps-camera-ready
'
);
this
.
_watchPositionId
=
this
.
_initWatchGPS
(
function
(
position
)
{
this
.
currentCoords
=
position
.
coords
;
this
.
_updatePosition
();
...
...
aframe/src/location-based/gps-entity-place.js
浏览文件 @
30a5491d
...
...
@@ -11,6 +11,10 @@ AFRAME.registerComponent('gps-entity-place', {
},
},
init
:
function
()
{
window
.
addEventListener
(
'
gps-camera-ready
'
,
()
=>
{
this
.
_updatePosition
();
});
this
.
_positionXDebug
=
0
;
this
.
debugUIAddedHandler
=
function
()
{
...
...
@@ -32,8 +36,6 @@ AFRAME.registerComponent('gps-entity-place', {
return
;
}
this
.
_updatePosition
();
return
true
;
},
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录