Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
b8412d0c
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
b8412d0c
编写于
4月 21, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
I don't think we need an example just for this.
上级
b0ed250e
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
814 deletion
+0
-814
examples/obj/blendergroups/dinnerset.blend
examples/obj/blendergroups/dinnerset.blend
+0
-0
examples/obj/blendergroups/table.blend
examples/obj/blendergroups/table.blend
+0
-0
examples/obj/blendergroups/table.js
examples/obj/blendergroups/table.js
+0
-366
examples/webgl_loader_scenegroup_blender.html
examples/webgl_loader_scenegroup_blender.html
+0
-448
未找到文件。
examples/obj/blendergroups/dinnerset.blend
已删除
100644 → 0
浏览文件 @
b0ed250e
文件已删除
examples/obj/blendergroups/table.blend
已删除
100644 → 0
浏览文件 @
b0ed250e
文件已删除
examples/obj/blendergroups/table.js
已删除
100644 → 0
浏览文件 @
b0ed250e
此差异已折叠。
点击以展开。
examples/webgl_loader_scenegroup_blender.html
已删除
100644 → 0
浏览文件 @
b0ed250e
<!doctype html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - io - scene group loader [blender]
</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
{
background
:
#000
;
color
:
#fff
;
padding
:
0
;
margin
:
0
;
overflow
:
hidden
;
font-family
:
georgia
;
text-align
:
center
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
padding
:
5px
;
font-family
:
Monospace
;
font-size
:
13px
;
text-align
:
center
;
z-index
:
100
;
}
#progress
{
color
:
red
;
top
:
7em
;
width
:
100%
;
font-size
:
3em
;
font-variant
:
small-caps
;
font-weight
:
bold
;
position
:
absolute
;
z-index
:
100
;
text-align
:
center
;
text-shadow
:
#000
0px
0px
10px
;
display
:
none
;
}
#start
{
color
:
#fff
;
text-shadow
:
#000
0px
0px
2px
;
padding
:
0.1em
0.3em
;
width
:
3em
;
text-align
:
center
;
display
:
none
;
}
.shadow
{
-moz-box-shadow
:
0px
0px
5px
#000
;
-webkit-box-shadow
:
0px
0px
5px
#000
;
box-shadow
:
0px
0px
5px
#000
;
}
#progressbar
{
text-align
:
center
;
background
:
white
;
width
:
250px
;
height
:
10px
;
}
#bar
{
background
:
#d00
;
width
:
50px
;
height
:
10px
;
}
.enabled
{
color
:
lime
!important
;
cursor
:
pointer
;
}
.enabled
:hover
{
text-shadow
:
#0f0
0px
0px
5px
!important
;
}
.disabled
{
background
:
gray
;
cursor
:
default
;
}
a
{
color
:
red
}
canvas
{
pointer-events
:
none
;
z-index
:
10
;
}
#scene_explorer
{
background
:
transparent
;
color
:
#fff
;
width
:
200px
;
position
:
absolute
;
text-align
:
left
;
top
:
0px
;
z-index
:
200
;
overflow
:
auto
;
}
#section_exp
{
background
:
rgba
(
0
,
0
,
50
,
0.5
);
padding
:
0.5em
0
;
display
:
none
;
}
#scene_explorer
h3
{
font-size
:
1em
;
padding
:
0
;
margin
:
0
;
color
:
orange
;
}
#scene_explorer
a
{
color
:
#555
;
font-weight
:
bold
;
text-decoration
:
none
;
font-size
:
1.2em
;
font-family
:
Monospace
;
}
#scene_explorer
a
:hover
{
background
:
#555
;
color
:
rgba
(
0
,
0
,
50
,
1
);
}
.part
{
display
:
none
;
padding
:
0
0
0.5em
2em
;
}
</style>
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://github.com/mrdoob/three.js"
>
three.js
</a>
- scene group loader test [blender]
</div>
<div
id=
"scene_explorer"
>
<a
id=
"plus_exp"
href=
"#"
>
[+]
</a>
<div
id=
"section_exp"
></div>
</div>
<div
id=
"progress"
>
<span
id=
"message"
>
Loading ...
</span>
<center>
<div
id=
"progressbar"
class=
"shadow"
><div
id=
"bar"
class=
"shadow"
></div></div>
<div
id=
"start"
class=
"disabled"
></div>
</center>
</div>
<script
src=
"../build/Three.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/Stats.js"
></script>
<script>
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
SCREEN_WIDTH
=
window
.
innerWidth
;
var
SCREEN_HEIGHT
=
window
.
innerHeight
;
var
container
,
stats
;
var
camera
,
scene
,
loaded
;
var
renderer
;
var
mesh
,
zmesh
,
geometry
;
var
mouseX
=
0
,
mouseY
=
0
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
init
();
animate
();
function
$
(
id
)
{
return
document
.
getElementById
(
id
);
}
function
handle_update
(
result
,
pieces
)
{
refreshSceneView
(
result
);
//renderer.initWebGLObjects( result.scene );
var
m
,
material
,
count
=
0
;
for
(
m
in
result
.
materials
)
{
material
=
result
.
materials
[
m
];
if
(
!
(
material
instanceof
THREE
.
MeshFaceMaterial
)
)
{
if
(
!
material
.
program
)
{
console
.
log
(
m
);
renderer
.
initMaterial
(
material
,
result
.
scene
.
__lights
,
result
.
scene
.
fog
);
count
+=
1
;
if
(
count
>
pieces
)
{
//console.log("xxxxxxxxx");
break
;
}
}
}
}
}
function
init
()
{
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
var
loadScene
=
createLoadScene
();
scene
=
loadScene
.
scene
;
camera
=
loadScene
.
camera
;
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
renderer
.
domElement
.
style
.
position
=
"
relative
"
;
container
.
appendChild
(
renderer
.
domElement
);
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
stats
.
domElement
.
style
.
right
=
'
0px
'
;
stats
.
domElement
.
style
.
zIndex
=
100
;
container
.
appendChild
(
stats
.
domElement
);
$
(
"
start
"
).
addEventListener
(
'
click
'
,
onStartClick
,
false
);
var
callbackProgress
=
function
(
progress
,
result
)
{
var
bar
=
250
,
total
=
progress
.
total_models
+
progress
.
total_textures
,
loaded
=
progress
.
loaded_models
+
progress
.
loaded_textures
;
if
(
total
)
bar
=
Math
.
floor
(
bar
*
loaded
/
total
);
$
(
"
bar
"
).
style
.
width
=
bar
+
"
px
"
;
count
=
0
;
for
(
var
m
in
result
.
materials
)
count
++
;
handle_update
(
result
,
Math
.
floor
(
count
/
total
)
);
}
var
callbackFinished
=
function
(
result
)
{
loaded
=
result
;
scene
=
loaded
.
scene
;
//camera = loaded.currentCamera;
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setClearColor
(
loaded
.
bgColor
,
loaded
.
bgAlpha
);
$
(
"
message
"
).
style
.
display
=
"
none
"
;
$
(
"
progressbar
"
).
style
.
display
=
"
none
"
;
$
(
"
start
"
).
style
.
display
=
"
block
"
;
$
(
"
start
"
).
className
=
"
enabled
"
;
handle_update
(
result
,
1
);
}
$
(
"
progress
"
).
style
.
display
=
"
block
"
;
var
loader
=
new
THREE
.
SceneLoader
();
loader
.
callbackProgress
=
callbackProgress
;
loader
.
load
(
"
obj/blendergroups/table.js
"
,
callbackFinished
);
$
(
"
plus_exp
"
).
addEventListener
(
'
click
'
,
createToggle
(
"
exp
"
),
false
);
}
function
setButtonActive
(
id
)
{
$
(
"
start
"
).
style
.
backgroundColor
=
"
green
"
;
}
function
onStartClick
()
{
$
(
"
progress
"
).
style
.
display
=
"
none
"
;
scene
=
loaded
.
scene
;
camera
=
loaded
.
currentCamera
;
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setClearColor
(
loaded
.
bgColor
,
loaded
.
bgAlpha
);
}
function
onDocumentMouseMove
(
event
)
{
mouseX
=
(
event
.
clientX
-
windowHalfX
);
mouseY
=
(
event
.
clientY
-
windowHalfY
);
}
function
createLoadScene
()
{
var
result
=
{
scene
:
new
THREE
.
Scene
(),
camera
:
new
THREE
.
PerspectiveCamera
(
65
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1000
)
};
result
.
camera
.
position
.
x
=
10
;
result
.
camera
.
position
.
y
=
10
;
result
.
camera
.
position
.
z
=
10
;
var
object
,
geometry
,
material
,
light
,
count
=
500
,
range
=
200
;
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
}
);
geometry
=
new
THREE
.
CubeGeometry
(
5
,
5
,
5
);
result
.
scene
.
matrixAutoUpdate
=
false
;
light
=
new
THREE
.
PointLight
(
0xffffff
);
result
.
scene
.
add
(
light
);
light
=
new
THREE
.
DirectionalLight
(
0x111111
);
light
.
position
.
x
=
1
;
result
.
scene
.
add
(
light
);
return
result
;
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
stats
.
update
();
}
function
render
()
{
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
.
0001
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
.
0001
;
camera
.
lookAt
(
scene
.
position
);
renderer
.
render
(
scene
,
camera
);
}
// Scene explorer user interface
function
toggle
(
id
)
{
var
scn
=
$
(
"
section_
"
+
id
).
style
,
btn
=
$
(
"
plus_
"
+
id
);
if
(
scn
.
display
==
"
block
"
)
{
scn
.
display
=
"
none
"
;
btn
.
innerHTML
=
"
[+]
"
;
}
else
{
scn
.
display
=
"
block
"
;
btn
.
innerHTML
=
"
[-]
"
;
}
}
function
createToggle
(
label
)
{
return
function
()
{
toggle
(
label
)
}
};
function
refreshSceneView
(
result
)
{
$
(
"
section_exp
"
).
innerHTML
=
generateSceneView
(
result
);
var
config
=
[
"
obj
"
,
"
geo
"
,
"
mat
"
,
"
tex
"
,
"
lit
"
,
"
cam
"
];
for
(
var
i
=
0
;
i
<
config
.
length
;
i
++
)
$
(
"
plus_
"
+
config
[
i
]
).
addEventListener
(
'
click
'
,
createToggle
(
config
[
i
]
),
false
);
}
function
generateSection
(
label
,
id
,
objects
)
{
var
html
=
""
;
html
+=
"
<h3><a id='plus_
"
+
id
+
"
' href='#'>[+]</a>
"
+
label
+
"
</h3>
"
;
html
+=
"
<div id='section_
"
+
id
+
"
' class='part'>
"
;
for
(
var
o
in
objects
)
{
html
+=
o
+
"
<br/>
"
;
}
html
+=
"
</div>
"
;
return
html
;
}
function
generateSceneView
(
result
)
{
var
config
=
[
[
"
Objects
"
,
"
obj
"
,
result
.
objects
],
[
"
Geometries
"
,
"
geo
"
,
result
.
geometries
],
[
"
Materials
"
,
"
mat
"
,
result
.
materials
],
[
"
Textures
"
,
"
tex
"
,
result
.
textures
],
[
"
Lights
"
,
"
lit
"
,
result
.
lights
],
[
"
Cameras
"
,
"
cam
"
,
result
.
cameras
]
];
var
html
=
""
;
for
(
var
i
=
0
;
i
<
config
.
length
;
i
++
)
html
+=
generateSection
(
config
[
i
][
0
],
config
[
i
][
1
],
config
[
i
][
2
]
);
return
html
;
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录