Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cqiang1993
AR.js
提交
1546ba0e
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,发现更多精彩内容 >>
提交
1546ba0e
编写于
3月 11, 2017
作者:
J
Jerome Etienne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
1f23e132
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
42 addition
and
38 deletion
+42
-38
three.js/examples/markercache.html
three.js/examples/markercache.html
+42
-38
未找到文件。
three.js/examples/markercache.html
浏览文件 @
1546ba0e
...
@@ -155,7 +155,7 @@
...
@@ -155,7 +155,7 @@
var
orthoMesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
var
orthoMesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
orthoScene
.
add
(
orthoMesh
);
orthoScene
.
add
(
orthoMesh
);
var
geometry
=
new
THREE
.
PlaneGeometry
(
1.3
,
1.85
);
var
geometry
=
new
THREE
.
PlaneGeometry
(
1.3
,
1.85
,
1
,
8
);
var
material
=
new
THREE
.
MeshBasicMaterial
({
var
material
=
new
THREE
.
MeshBasicMaterial
({
// transparent : true,
// transparent : true,
// opacity: 0.5,
// opacity: 0.5,
...
@@ -205,22 +205,29 @@ window.cacheMesh = cacheMesh
...
@@ -205,22 +205,29 @@ window.cacheMesh = cacheMesh
orthoMesh
.
geometry
.
verticesNeedUpdate
=
true
orthoMesh
.
geometry
.
verticesNeedUpdate
=
true
// change cacheMesh UVs
// change cacheMesh UVs
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
0
][
0
].
copy
(
buildUvs
(
0
,
1
)
)
for
(
var
i
=
0
;
i
<
cacheMesh
.
geometry
.
parameters
.
heightSegments
/
2
;
i
++
){
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
0
][
1
].
copy
(
buildUvs
(
0
,
0
)
)
// normale orientation
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
0
][
2
].
copy
(
buildUvs
(
1
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
0
][
0
].
copy
(
convertUvs
(
0
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
0
][
1
].
copy
(
convertUvs
(
0
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
1
][
0
].
copy
(
buildUvs
(
0
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
0
][
2
].
copy
(
convertUvs
(
1
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
1
][
1
].
copy
(
buildUvs
(
1
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
1
][
2
].
copy
(
buildUvs
(
1
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
1
][
0
].
copy
(
convertUvs
(
0
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
1
][
1
].
copy
(
convertUvs
(
1
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
1
][
2
].
copy
(
convertUvs
(
1
,
1
)
)
// swapy orientation
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
2
][
0
].
copy
(
convertUvs
(
0
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
2
][
1
].
copy
(
convertUvs
(
0
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
2
][
2
].
copy
(
convertUvs
(
1
,
0
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
3
][
0
].
copy
(
convertUvs
(
0
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
3
][
1
].
copy
(
convertUvs
(
1
,
1
)
)
cacheMesh
.
geometry
.
faceVertexUvs
[
0
][
i
*
4
+
3
][
2
].
copy
(
convertUvs
(
1
,
0
)
)
}
cacheMesh
.
geometry
.
uvsNeedUpdate
=
true
cacheMesh
.
geometry
.
uvsNeedUpdate
=
true
function
buildUvs
(
x
,
y
){
var
Uv
=
new
THREE
.
Vector2
()
// originalUvs.push( new THREE.Vector3(xMin, yMax, 0))
// originalUvs.push( new THREE.Vector3(xMax, yMax, 0))
// originalUvs.push( new THREE.Vector3(xMin, yMin, 0))
// originalUvs.push( new THREE.Vector3(xMax, yMin, 0))
function
convertUvs
(
x
,
y
){
if
(
x
===
0
&&
y
===
0
){
if
(
x
===
0
&&
y
===
0
){
var
transformedUv
=
transformedUvs
[
2
]
var
transformedUv
=
transformedUvs
[
2
]
}
else
if
(
x
===
0
&&
y
===
1
){
}
else
if
(
x
===
0
&&
y
===
1
){
...
@@ -237,8 +244,6 @@ window.cacheMesh = cacheMesh
...
@@ -237,8 +244,6 @@ window.cacheMesh = cacheMesh
Uv
.
x
=
transformedUv
.
x
/
2
+
0.5
Uv
.
x
=
transformedUv
.
x
/
2
+
0.5
Uv
.
y
=
transformedUv
.
y
/
2
+
0.5
Uv
.
y
=
transformedUv
.
y
/
2
+
0.5
// Uv.y *= 5
return
Uv
return
Uv
}
}
})
})
...
@@ -248,26 +253,26 @@ window.cacheMesh = cacheMesh
...
@@ -248,26 +253,26 @@ window.cacheMesh = cacheMesh
// add an object in the scene
// add an object in the scene
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// add a torus knot
//
//
add a torus knot
var
geometry
=
new
THREE
.
CubeGeometry
(
1
,
1
,
1
);
//
var geometry = new THREE.CubeGeometry(1,1,1);
var
material
=
new
THREE
.
MeshNormalMaterial
({
//
var material = new THREE.MeshNormalMaterial({
transparent
:
true
,
//
transparent : true,
opacity
:
0.5
,
//
opacity: 0.5,
side
:
THREE
.
DoubleSide
//
side: THREE.DoubleSide
});
//
});
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
//
var mesh = new THREE.Mesh( geometry, material );
mesh
.
position
.
z
=
geometry
.
parameters
.
height
/
2
//
mesh.position.z = geometry.parameters.height/2
markerRoot
.
add
(
mesh
);
//
markerRoot.add( mesh );
//
var
geometry
=
new
THREE
.
TorusKnotGeometry
(
0.3
,
0.1
,
32
,
32
);
//
var geometry = new THREE.TorusKnotGeometry(0.3,0.1,32,32);
var
material
=
new
THREE
.
MeshNormalMaterial
();
//
var material = new THREE.MeshNormalMaterial();
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
//
var mesh = new THREE.Mesh( geometry, material );
mesh
.
position
.
z
=
0.5
//
mesh.position.z = 0.5
markerRoot
.
add
(
mesh
);
//
markerRoot.add( mesh );
//
onRenderFcts
.
push
(
function
(){
//
onRenderFcts.push(function(){
mesh
.
rotation
.
x
+=
0.1
//
mesh.rotation.x += 0.1
})
//
})
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// render the whole thing on the page
// render the whole thing on the page
...
@@ -281,8 +286,7 @@ window.cacheMesh = cacheMesh
...
@@ -281,8 +286,7 @@ window.cacheMesh = cacheMesh
renderer
.
render
(
scene
,
camera
);
renderer
.
render
(
scene
,
camera
);
// renderer.render( orthoScene, camera );
// renderer.render( orthoScene, orthoCamera );
renderer
.
render
(
orthoScene
,
orthoCamera
);
stats
.
update
();
stats
.
update
();
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录