Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
ab06347a
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,发现更多精彩内容 >>
提交
ab06347a
编写于
4月 12, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more wokr
上级
00ba03bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
165 addition
and
4 deletion
+165
-4
TODO.md
TODO.md
+3
-3
three.js/examples/basic.html
three.js/examples/basic.html
+160
-0
three.js/threex-artoolkitcontext.js
three.js/threex-artoolkitcontext.js
+2
-1
未找到文件。
TODO.md
浏览文件 @
ab06347a
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
-
work on the stereo thing - make the webvr stuff
-
work on the stereo thing - make the webvr stuff
-
suddently your demo would work on any webvr device
-
suddently your demo would work on any webvr device
-
DONE do a build file
-
DONE do a build file
build/ar.js
threejs/
build/ar.js
build/ar.min.js
threejs/
build/ar.min.js
-
-
put github as the default location
# Multimarker
# Multimarker
-
park multi marker in its own directory
-
park multi marker in its own directory
...
...
three.js/examples/basic.html
0 → 100644
浏览文件 @
ab06347a
<!DOCTYPE html>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<!-- three.js library -->
<script
src=
'vendor/three.js/build/three.min.js'
></script>
<!-- ar.js -->
<script
src=
"../build/ar.min.js"
></script>
<body
style=
'margin : 0px; overflow: hidden; font-family: Monospace;'
><div
style=
'position: absolute; top: 10px; width:100%; text-align: center; z-index: 1;'
>
<a
href=
"https://github.com/jeromeetienne/AR.js/"
target=
"_blank"
>
AR.js
</a>
- three.js camera transform
<br/>
Contact me any time at
<a
href=
'https://twitter.com/jerome_etienne'
target=
'_blank'
>
@jerome_etienne
</a>
</div><script>
//////////////////////////////////////////////////////////////////////////////////
// Init
//////////////////////////////////////////////////////////////////////////////////
// init renderer
var
renderer
=
new
THREE
.
WebGLRenderer
({
antialias
:
true
,
alpha
:
true
});
renderer
.
setClearColor
(
new
THREE
.
Color
(
'
lightgrey
'
),
0
)
renderer
.
setSize
(
640
,
480
);
renderer
.
domElement
.
style
.
position
=
'
absolute
'
renderer
.
domElement
.
style
.
top
=
'
0px
'
renderer
.
domElement
.
style
.
left
=
'
0px
'
document
.
body
.
appendChild
(
renderer
.
domElement
);
// array of functions for the rendering loop
var
onRenderFcts
=
[];
// init scene and camera
var
scene
=
new
THREE
.
Scene
();
//////////////////////////////////////////////////////////////////////////////////
// Initialize a basic camera
//////////////////////////////////////////////////////////////////////////////////
// Create a camera
var
camera
=
new
THREE
.
Camera
();
scene
.
add
(
camera
);
////////////////////////////////////////////////////////////////////////////////
// handle arToolkitSource
////////////////////////////////////////////////////////////////////////////////
var
arToolkitSource
=
new
THREEx
.
ArToolkitSource
({
// to read from the webcam
sourceType
:
'
webcam
'
,
// to read from an image
sourceType
:
'
image
'
,
sourceUrl
:
'
../../data/images/img.jpg
'
,
// to read from a video
// sourceType : 'video',
// sourceUrl : '../../data/videos/headtracking.mp4',
})
arToolkitSource
.
init
(
function
onReady
(){
// handle resize of renderer
arToolkitSource
.
onResize
(
renderer
.
domElement
)
})
// handle resize
window
.
addEventListener
(
'
resize
'
,
function
(){
// handle arToolkitSource resize
arToolkitSource
.
onResize
(
renderer
.
domElement
)
})
////////////////////////////////////////////////////////////////////////////////
// initialize arToolkitContext
////////////////////////////////////////////////////////////////////////////////
// create atToolkitContext
var
arToolkitContext
=
new
THREEx
.
ArToolkitContext
({
cameraParametersUrl
:
'
../../data/data/camera_para.dat
'
,
detectionMode
:
'
mono
'
,
})
// initialize it
arToolkitContext
.
init
(
function
onCompleted
(){
// copy projection matrix to camera
camera
.
projectionMatrix
.
copy
(
arToolkitContext
.
getProjectionMatrix
()
);
})
// update artoolkit on every frame
onRenderFcts
.
push
(
function
(){
if
(
arToolkitSource
.
ready
===
false
)
return
arToolkitContext
.
update
(
arToolkitSource
.
domElement
)
// update scene.visible if the marker is seen
scene
.
visible
=
camera
.
visible
})
////////////////////////////////////////////////////////////////////////////////
// Create a ArMarkerControls
////////////////////////////////////////////////////////////////////////////////
// init controls for camera
var
markerControls
=
new
THREEx
.
ArMarkerControls
(
arToolkitContext
,
camera
,
{
type
:
'
pattern
'
,
patternUrl
:
'
../../data/data/patt.hiro
'
,
// patternUrl : '../../data/data/patt.kanji',
// as we controls the camera, set changeMatrixMode: 'cameraTransformMatrix'
changeMatrixMode
:
'
cameraTransformMatrix
'
})
// as we do changeMatrixMode: 'cameraTransformMatrix', start with invisible scene
scene
.
visible
=
false
//////////////////////////////////////////////////////////////////////////////////
// add an object in the scene
//////////////////////////////////////////////////////////////////////////////////
// add a torus knot
var
geometry
=
new
THREE
.
CubeGeometry
(
1
,
1
,
1
);
var
material
=
new
THREE
.
MeshNormalMaterial
({
transparent
:
true
,
opacity
:
0.5
,
side
:
THREE
.
DoubleSide
});
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
y
=
geometry
.
parameters
.
height
/
2
scene
.
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
.
y
=
0.5
scene
.
add
(
mesh
);
onRenderFcts
.
push
(
function
(
delta
){
mesh
.
rotation
.
x
+=
Math
.
PI
*
delta
})
//////////////////////////////////////////////////////////////////////////////////
// render the whole thing on the page
//////////////////////////////////////////////////////////////////////////////////
// render the scene
onRenderFcts
.
push
(
function
(){
renderer
.
render
(
scene
,
camera
);
})
// run the rendering loop
var
lastTimeMsec
=
null
requestAnimationFrame
(
function
animate
(
nowMsec
){
// keep looping
requestAnimationFrame
(
animate
);
// measure time
lastTimeMsec
=
lastTimeMsec
||
nowMsec
-
1000
/
60
var
deltaMsec
=
Math
.
min
(
200
,
nowMsec
-
lastTimeMsec
)
lastTimeMsec
=
nowMsec
// call each update function
onRenderFcts
.
forEach
(
function
(
onRenderFct
){
onRenderFct
(
deltaMsec
/
1000
,
nowMsec
/
1000
)
})
})
</script></body>
three.js/threex-artoolkitcontext.js
浏览文件 @
ab06347a
...
@@ -42,7 +42,8 @@ THREEx.ArToolkitContext = function(parameters){
...
@@ -42,7 +42,8 @@ THREEx.ArToolkitContext = function(parameters){
Object
.
assign
(
THREEx
.
ArToolkitContext
.
prototype
,
THREE
.
EventDispatcher
.
prototype
);
Object
.
assign
(
THREEx
.
ArToolkitContext
.
prototype
,
THREE
.
EventDispatcher
.
prototype
);
// THREEx.ArToolkitContext.baseURL = '../'
// THREEx.ArToolkitContext.baseURL = '../'
THREEx
.
ArToolkitContext
.
baseURL
=
'
https://raw.githubusercontent.com/jeromeetienne/ar.js/master/
'
// default to github page
THREEx
.
ArToolkitContext
.
baseURL
=
'
https://raw.githubusercontent.com/jeromeetienne/ar.js/master/three.js/
'
THREEx
.
ArToolkitContext
.
REVISION
=
'
1.0.1-dev
'
THREEx
.
ArToolkitContext
.
REVISION
=
'
1.0.1-dev
'
/**
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录