Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
ac752592
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,发现更多精彩内容 >>
提交
ac752592
编写于
8月 01, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work on object3d-glmatrix
上级
c4e0a611
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
110 addition
and
39 deletion
+110
-39
TODO.md
TODO.md
+0
-22
three.js/examples/object3d-glmatrix/README.md
three.js/examples/object3d-glmatrix/README.md
+33
-0
three.js/examples/object3d-glmatrix/arjs-camera.js
three.js/examples/object3d-glmatrix/arjs-camera.js
+10
-0
three.js/examples/object3d-glmatrix/arjs-math.js
three.js/examples/object3d-glmatrix/arjs-math.js
+6
-0
three.js/examples/object3d-glmatrix/arjs-object3d.js
three.js/examples/object3d-glmatrix/arjs-object3d.js
+51
-16
three.js/examples/object3d-glmatrix/examples/basic.html
three.js/examples/object3d-glmatrix/examples/basic.html
+10
-1
未找到文件。
TODO.md
浏览文件 @
ac752592
...
@@ -128,28 +128,6 @@
...
@@ -128,28 +128,6 @@
-
ar-tracking-aruco.js
-
ar-tracking-aruco.js
-
ar-tracking-tango.js
-
ar-tracking-tango.js
## Remove three.js dependancy
-
first remove it externally
-
find all dependancy to three.js in the ar-session API
-
ARjs.Anchor should export a modelViewMatrix
-
ARjs.Session should export a camera projection matrix and a camera transform matrix
-
ARjs.HitTesting Plane is very three.js dependant - use raycasting of three.js
-
ARjs.Session got dependancy on renderer/scene/camera .... quite a lot
-
it needs to be sorted out
-
then remove it internally
-
get ride of three.js dependancy
-
first arjs session API not to use any three.js specific
-
vector3 as array, same for quaternion
-
some matrix as array too - projection matrix, localMatrix
-
as im rewriting the highlevel API, im thinking about removing the three.js
dependancy. aka to make AR.js easily usable by other than three.js
this could be osg.js (sketchfab stuff), this could be babylon.js
this would clean things up and this isnt too hard to do on my side.
Just using another math library and to do some THREE.Object3d emulation
-
use gl-matrix.js - it is good code - it is from somebody rigurous - it is well maintained
-
ARjs.Camera inherit from ARjs.Object3D - projectionMatrix
-
ARjs.Object3D : position, quaternion, scale
---
---
-
put multi-markers in /src/markers-area
-
put multi-markers in /src/markers-area
...
...
three.js/examples/object3d-glmatrix/README.md
浏览文件 @
ac752592
-
https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js
-
http://glmatrix.net/docs/
-
do ARjs.Object3D
-
do ARjs.Object3D
-
handle scene graph with world matrix
-
handle scene graph with world matrix
-
-
---
## Remove three.js dependancy
-
first remove it externally
-
find all dependancy to three.js in the ar-session API
-
ARjs.Anchor should export a modelViewMatrix
-
ARjs.Session should export a camera projection matrix and a camera transform matrix
-
ARjs.HitTesting Plane is very three.js dependant - use raycasting of three.js
-
ARjs.Session got dependancy on renderer/scene/camera .... quite a lot
-
it needs to be sorted out
-
renderer for canvas domElement - anything else ? for resize
-
scene only for my own stuff
-
camera too - for resize
-
ARjs.THREE.onResizeCamera() - ARjs.THREE.onResizeRenderer()
-
use inspector to display from where it is used
-
then remove it internally
-
get ride of three.js dependancy
-
first arjs session API not to use any three.js specific
-
vector3 as array, same for quaternion
-
some matrix as array too - projection matrix, localMatrix
-
as im rewriting the highlevel API, im thinking about removing the three.js
dependancy. aka to make AR.js easily usable by other than three.js
this could be osg.js (sketchfab stuff), this could be babylon.js
this would clean things up and this isnt too hard to do on my side.
Just using another math library and to do some THREE.Object3d emulation
-
use gl-matrix.js - it is good code - it is from somebody rigurous - it is well maintained
-
ARjs.Camera inherit from ARjs.Object3D - projectionMatrix
-
ARjs.Object3D : position, quaternion, scale
three.js/examples/object3d-glmatrix/arjs-camera.js
0 → 100644
浏览文件 @
ac752592
var
ARjs
=
ARjs
||
{}
ARjs
.
Camera
=
function
(){
ARjs
.
Object3D
.
call
(
this
)
this
.
projectionMatrix
=
mat4
.
create
()
}
ARjs
.
Camera
.
prototype
=
Object
.
create
(
ARjs
.
Object3D
.
prototype
);
ARjs
.
Camera
.
prototype
.
constructor
=
ARjs
.
Camera
;
three.js/examples/object3d-glmatrix/arjs-math.js
0 → 100644
浏览文件 @
ac752592
var
ARjs
=
ARjs
||
{}
ARjs
.
Math
=
ARjs
.
Math
||
{}
ARjs
.
Math
.
Vector3
=
vec3
ARjs
.
Math
.
Quaternion
=
quat
ARjs
.
Math
.
Matrix4
=
mat4
three.js/examples/object3d-glmatrix/arjs-object3d.js
浏览文件 @
ac752592
var
ARjs
=
ARjs
||
{}
var
ARjs
=
ARjs
||
{}
// https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js
/**
* Heavily inspired from the great three.js THREE.Object3D
*/
ARjs
.
Object3D
=
function
(){
ARjs
.
Object3D
=
function
(){
this
.
position
=
vec
3
.
create
()
this
.
position
=
ARjs
.
Math
.
Vector
3
.
create
()
this
.
quaternion
=
quat
.
create
()
this
.
quaternion
=
quat
.
create
()
this
.
scale
=
vec
3
.
create
()
this
.
scale
=
ARjs
.
Math
.
Vector
3
.
create
()
vec
3
.
set
(
this
.
scale
,
1
,
1
,
1
)
ARjs
.
Math
.
Vector
3
.
set
(
this
.
scale
,
1
,
1
,
1
)
this
.
matrix
=
mat
4
.
create
()
this
.
matrix
=
ARjs
.
Math
.
Matrix
4
.
create
()
this
.
matrixAutoUpdate
=
true
this
.
matrixAutoUpdate
=
true
this
.
matrixWorld
=
mat
4
.
create
()
this
.
matrixWorld
=
ARjs
.
Math
.
Matrix
4
.
create
()
this
.
matrixWorldNeedsUpdate
=
false
this
.
matrixWorldNeedsUpdate
=
false
// decompose transform matrix
// decompose transform matrix
//
mat
4.getTranslation(this.position, this.matrix)
//
ARjs.Math.Matrix
4.getTranslation(this.position, this.matrix)
//
mat
4.getRotation(this.quaternion, this.matrix)
//
ARjs.Math.Matrix
4.getRotation(this.quaternion, this.matrix)
//
mat
4.getScaling(this.scale, this.matrix)
//
ARjs.Math.Matrix
4.getScaling(this.scale, this.matrix)
this
.
updateMatrix
()
this
.
updateMatrix
()
...
@@ -32,18 +34,51 @@ ARjs.Object3D = function(){
...
@@ -32,18 +34,51 @@ ARjs.Object3D = function(){
ARjs
.
Object3D
.
nextID
=
0
ARjs
.
Object3D
.
nextID
=
0
ARjs
.
Object3D
.
prototype
.
updateMatrix
=
function
()
{
ARjs
.
Object3D
.
prototype
.
decomposeMatrix
=
function
(){
ARjs
.
Math
.
Matrix4
.
getTranslation
(
this
.
position
,
this
.
matrix
)
ARjs
.
Math
.
Matrix4
.
getRotation
(
this
.
quaternion
,
this
.
matrix
)
ARjs
.
Math
.
Matrix4
.
getScaling
(
this
.
scale
,
this
.
matrix
)
}
//////////////////////////////////////////////////////////////////////////////
// .updateMatrix + .updateMatrixWorld
//////////////////////////////////////////////////////////////////////////////
ARjs
.
Object3D
.
prototype
.
updateMatrix
=
function
(){
// compose transform matrix
// compose transform matrix
mat
4
.
fromRotationTranslationScale
(
this
.
matrix
,
this
.
quaternion
,
this
.
position
,
this
.
scale
)
ARjs
.
Math
.
Matrix
4
.
fromRotationTranslationScale
(
this
.
matrix
,
this
.
quaternion
,
this
.
position
,
this
.
scale
)
this
.
matrixWorldNeedsUpdate
=
true
this
.
matrixWorldNeedsUpdate
=
true
}
}
ARjs
.
Object3D
.
prototype
.
updateMatrixWorld
=
function
(
force
)
{
ARjs
.
Object3D
.
prototype
.
updateMatrixWorld
=
function
(
force
){
// not yet implemented
if
(
this
.
matrixAutoUpdate
)
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
force
){
if
(
this
.
parent
===
null
){
ARjs
.
Math
.
Matrix4
.
copy
(
this
.
matrixWorld
,
this
.
matrix
);
}
else
{
// this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
ARjs
.
Math
.
Matrix4
.
multiply
(
this
.
matrixWorld
,
this
.
parent
.
matrixWorld
,
this
.
matrix
);
}
this
.
matrixWorldNeedsUpdate
=
false
;
force
=
true
;
}
// update children
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
){
var
child
=
this
.
children
[
i
]
child
.
updateMatrixWorld
(
force
);
}
}
}
ARjs
.
Object3D
.
prototype
.
add
=
function
(
child
)
{
//////////////////////////////////////////////////////////////////////////////
// .add/.remove
//////////////////////////////////////////////////////////////////////////////
ARjs
.
Object3D
.
prototype
.
add
=
function
(
child
){
if
(
child
.
parent
!==
null
)
child
.
parent
.
remove
(
child
)
if
(
child
.
parent
!==
null
)
child
.
parent
.
remove
(
child
)
child
.
parent
=
this
child
.
parent
=
this
...
@@ -51,10 +86,10 @@ ARjs.Object3D.prototype.add = function (child) {
...
@@ -51,10 +86,10 @@ ARjs.Object3D.prototype.add = function (child) {
this
.
children
.
push
(
child
)
this
.
children
.
push
(
child
)
}
}
ARjs
.
Object3D
.
prototype
.
remove
=
function
(
child
){
ARjs
.
Object3D
.
prototype
.
remove
=
function
(
child
){
var
index
=
this
.
children
.
indexOf
(
child
)
var
index
=
this
.
children
.
indexOf
(
child
)
if
(
index
===
-
1
)
return
if
(
index
===
-
1
)
return
child
.
parent
=
null
;
child
.
parent
=
null
;
...
...
three.js/examples/object3d-glmatrix/examples/basic.html
浏览文件 @
ac752592
<script
src=
'../vendor/gl-matrix.js'
></script>
<script
src=
'../vendor/gl-matrix.js'
></script>
<script
src=
'../arjs-math.js'
></script>
<script
src=
'../arjs-object3d.js'
></script>
<script
src=
'../arjs-object3d.js'
></script>
<script
src=
'../arjs-camera.js'
></script>
<script>
<script>
var
object3d
=
new
ARjs
.
Object3D
()
var
object3d
=
new
ARjs
.
Object3D
()
vec3
.
set
(
object3d
.
position
,
2
,
0
,
0
)
var
aChild
=
new
ARjs
.
Camera
()
vec3
.
set
(
aChild
.
position
,
1
,
0
,
0
)
var
aChild
=
new
ARjs
.
Object3D
()
object3d
.
add
(
aChild
)
object3d
.
add
(
aChild
)
object3d
.
updateMatrixWorld
()
</script>
</script>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录