Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
9d2151b6
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9d2151b6
编写于
7月 24, 2014
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simple JSON loader example for importing Clara.io JSON exports.
上级
2c02b6df
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
137 addition
and
0 deletion
+137
-0
examples/index.html
examples/index.html
+1
-0
examples/models/json/teapot-claraio.json
examples/models/json/teapot-claraio.json
+1
-0
examples/webgl_loader_json_claraio.html
examples/webgl_loader_json_claraio.html
+135
-0
未找到文件。
examples/index.html
浏览文件 @
9d2151b6
...
...
@@ -181,6 +181,7 @@
"
webgl_loader_ctm_materials
"
,
"
webgl_loader_gltf
"
,
"
webgl_loader_json_blender
"
,
"
webgl_loader_json_claraio
"
,
"
webgl_loader_json_objconverter
"
,
"
webgl_loader_msgpack
"
,
"
webgl_loader_obj
"
,
...
...
examples/models/json/teapot-claraio.json
0 → 100644
浏览文件 @
9d2151b6
此差异已折叠。
点击以展开。
examples/webgl_loader_json_claraio.html
0 → 100644
浏览文件 @
9d2151b6
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - loaders - Clara.io JSON loader
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
body
{
font-family
:
Monospace
;
background-color
:
#000
;
color
:
#fff
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
color
:
#fff
;
position
:
absolute
;
top
:
10px
;
width
:
100%
;
text-align
:
center
;
z-index
:
100
;
display
:
block
;
}
#info
a
,
.button
{
color
:
#f00
;
font-weight
:
bold
;
text-decoration
:
underline
;
cursor
:
pointer
}
</style>
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
>
three.js
</a>
-
<a
href=
"https://clara.io"
target=
"_blank"
>
Clara.io
</a>
JSON Scene/Object Load Test
<br/>
More Information:
<a
href=
"https://clara.io/learn/user-guide/data_exchange/threejs_export"
target=
"_blank"
>
Clara.io ThreeJS Export Documentation
</a>
</div>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script>
var
container
,
stats
;
var
camera
,
scene
,
renderer
;
var
mouseX
=
0
,
mouseY
=
0
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
init
();
animate
();
function
init
()
{
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
z
=
4
;
// scene
scene
=
new
THREE
.
Scene
();
var
ambient
=
new
THREE
.
AmbientLight
(
0x444444
);
scene
.
add
(
ambient
);
var
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffeedd
);
directionalLight
.
position
.
set
(
0
,
0
,
1
).
normalize
();
scene
.
add
(
directionalLight
);
// BEGIN Clara.io JSON loader code
var
objectLoader
=
new
THREE
.
ObjectLoader
();
objectLoader
.
load
(
"
models/json/teapot-claraio.json
"
,
function
(
obj
)
{
scene
.
add
(
obj
);
}
);
// END Clara.io JSON loader code
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
;
windowHalfY
=
window
.
innerHeight
/
2
;
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
onDocumentMouseMove
(
event
)
{
mouseX
=
(
event
.
clientX
-
windowHalfX
)
/
2
;
mouseY
=
(
event
.
clientY
-
windowHalfY
)
/
2
;
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
}
function
render
()
{
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
.
05
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
.
05
;
camera
.
lookAt
(
scene
.
position
);
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录