Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
51afad97
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
未验证
提交
51afad97
编写于
3月 31, 2021
作者:
M
Michael Herzog
提交者:
GitHub
3月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Examples: Clean up. (#21552)
* Examples: Clean up. * IFCLoader: Fix path to core.
上级
e48fc94d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
49 deletion
+64
-49
examples/jsm/loaders/IFCLoader.js
examples/jsm/loaders/IFCLoader.js
+1
-1
examples/webgl_loader_ifc.html
examples/webgl_loader_ifc.html
+63
-48
未找到文件。
examples/jsm/loaders/IFCLoader.js
浏览文件 @
51afad97
...
...
@@ -14,7 +14,7 @@ import {
InterleavedBuffer
,
InterleavedBufferAttribute
,
BufferAttribute
,
}
from
'
../../../
../
build/three.module.js
'
;
}
from
'
../../../build/three.module.js
'
;
var
ifcAPI
=
new
IfcAPI
();
...
...
examples/webgl_loader_ifc.html
浏览文件 @
51afad97
...
...
@@ -11,7 +11,6 @@
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
>
<a
href=
"https://threejs.org"
target=
"_blank"
rel=
"noopener"
>
three.js
</a>
-
...
...
@@ -26,61 +25,77 @@
import
{
IFCLoader
}
from
'
./jsm/loaders/IFCLoader.js
'
;
//Scene
const
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0x8cc7de
);
//Renderer
const
container
=
document
.
querySelector
(
'
#container
'
);
const
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setPixelRatio
(
Math
.
min
(
window
.
devicePixelRatio
,
2
)
);
renderer
.
setAnimationLoop
(
animation
);
container
.
appendChild
(
renderer
.
domElement
);
//Camera
const
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
1000
);
camera
.
position
.
z
=
-
70
;
camera
.
position
.
y
=
25
;
camera
.
position
.
x
=
90
;
camera
.
lookAt
(
0
,
0
,
0
);
const
controls
=
new
OrbitControls
(
camera
,
renderer
.
domElement
);
//Initial cube
const
geometry
=
new
THREE
.
BoxGeometry
();
const
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
}
);
const
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
scene
.
add
(
cube
);
//Lights
const
directionalLight1
=
new
THREE
.
DirectionalLight
(
0xffeeff
,
0.8
);
directionalLight1
.
position
.
set
(
1
,
1
,
1
);
scene
.
add
(
directionalLight1
);
const
directionalLight2
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.8
);
directionalLight2
.
position
.
set
(
-
1
,
0.5
,
-
1
);
scene
.
add
(
directionalLight2
);
const
ambientLight
=
new
THREE
.
AmbientLight
(
0xffffee
,
0.25
);
scene
.
add
(
ambientLight
);
//Window resize support
window
.
addEventListener
(
'
resize
'
,
()
=>
{
let
scene
,
camera
,
renderer
;
init
();
function
init
()
{
//Scene
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0x8cc7de
);
//Camera
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
1000
);
camera
.
position
.
z
=
-
70
;
camera
.
position
.
y
=
25
;
camera
.
position
.
x
=
90
;
//Initial cube
const
geometry
=
new
THREE
.
BoxGeometry
();
const
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xffffff
}
);
const
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
scene
.
add
(
cube
);
//Lights
const
directionalLight1
=
new
THREE
.
DirectionalLight
(
0xffeeff
,
0.8
);
directionalLight1
.
position
.
set
(
1
,
1
,
1
);
scene
.
add
(
directionalLight1
);
const
directionalLight2
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.8
);
directionalLight2
.
position
.
set
(
-
1
,
0.5
,
-
1
);
scene
.
add
(
directionalLight2
);
const
ambientLight
=
new
THREE
.
AmbientLight
(
0xffffee
,
0.25
);
scene
.
add
(
ambientLight
);
//Setup IFC Loader
const
ifcLoader
=
new
IFCLoader
();
ifcLoader
.
load
(
'
models/ifc/rac_advanced_sample_project.ifc
'
,
function
(
model
)
{
scene
.
add
(
model
);
render
();
}
);
//Renderer
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
//Controls
const
controls
=
new
OrbitControls
(
camera
,
renderer
.
domElement
);
controls
.
addEventListener
(
'
change
'
,
render
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
);
render
();
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
);
render
(
);
//Setup IFC Loader
const
ifcLoader
=
new
IFCLoader
();
//Load IFC file
ifcLoader
.
load
(
'
models/ifc/rac_advanced_sample_project.ifc
'
,
(
geometry
)
=>
scene
.
add
(
geometry
)
);
}
//Animation
function
animation
()
{
function
render
()
{
controls
.
update
();
renderer
.
render
(
scene
,
camera
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录