Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
谢斯
Model_Library_Front_End
提交
fd61dc24
M
Model_Library_Front_End
项目概览
谢斯
/
Model_Library_Front_End
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Model_Library_Front_End
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fd61dc24
编写于
6月 04, 2021
作者:
X
xiesi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
使用抽屉完成3D场景的抽屉内显示,但是还没有完成每次当数据不同需要重新打开的操作
明天要做的就是要和组件做交互 Signed-off-by:
N
xiesi
<
305492881@qq.com
>
上级
7ed92d01
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
117 addition
and
97 deletion
+117
-97
src/components/LoadFBX.vue
src/components/LoadFBX.vue
+100
-93
src/views/Home.vue
src/views/Home.vue
+17
-4
未找到文件。
src/components/LoadFBX.vue
浏览文件 @
fd61dc24
...
...
@@ -16,112 +16,114 @@ export default {
return
{};
},
mounted
()
{
console
.
log
(
"
mounted
"
+
document
.
getElementById
(
"
fbxdiv
"
)
+
this
.
fbxfilepath
);
const
container
=
document
.
getElementById
(
"
fbxdiv
"
);
let
camera
,
scene
,
renderer
;
const
clock
=
new
THREE
.
Clock
();
let
mixer
;
const
init
=
()
=>
{
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
container
.
clientWidth
/
container
.
clientHeight
,
1
,
2000
setTimeout
(()
=>
{
console
.
log
(
"
mounted
"
+
document
.
getElementById
(
"
fbxdiv
"
)
+
this
.
fbxfilepath
);
camera
.
position
.
set
(
100
,
200
,
300
);
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0xa0a0a0
);
const
hemiLight
=
new
THREE
.
HemisphereLight
(
0xffffff
,
0x444444
);
hemiLight
.
position
.
set
(
0
,
200
,
0
);
scene
.
add
(
hemiLight
);
const
dirLight
=
new
THREE
.
DirectionalLight
(
0xffffff
);
dirLight
.
position
.
set
(
0
,
200
,
100
);
dirLight
.
castShadow
=
true
;
dirLight
.
shadow
.
camera
.
top
=
180
;
dirLight
.
shadow
.
camera
.
bottom
=
-
100
;
dirLight
.
shadow
.
camera
.
left
=
-
120
;
dirLight
.
shadow
.
camera
.
right
=
120
;
scene
.
add
(
dirLight
);
// ground
const
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
2000
,
2000
),
new
THREE
.
MeshPhongMaterial
({
color
:
0x999999
,
depthWrite
:
false
})
);
mesh
.
rotation
.
x
=
-
Math
.
PI
/
2
;
mesh
.
receiveShadow
=
true
;
scene
.
add
(
mesh
);
const
grid
=
new
THREE
.
GridHelper
(
2000
,
20
,
0x000000
,
0x000000
);
grid
.
material
.
opacity
=
0.2
;
grid
.
material
.
transparent
=
true
;
scene
.
add
(
grid
);
// model
const
loader
=
new
FBXLoader
();
loader
.
load
(
"
http://localhost/myfbx.php?filepath=
"
+
this
.
fbxfilepath
,
function
(
object
)
{
mixer
=
new
THREE
.
AnimationMixer
(
object
);
if
(
object
.
animations
[
0
]
!=
null
)
{
const
action
=
mixer
.
clipAction
(
object
.
animations
[
0
]);
action
.
play
();
}
object
.
traverse
(
function
(
child
)
{
if
(
child
.
isMesh
)
{
child
.
castShadow
=
true
;
child
.
receiveShadow
=
true
;
const
container
=
document
.
getElementById
(
"
fbxdiv
"
);
let
camera
,
scene
,
renderer
;
const
clock
=
new
THREE
.
Clock
();
let
mixer
;
const
init
=
()
=>
{
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
container
.
clientWidth
/
container
.
clientHeight
,
1
,
2000
);
camera
.
position
.
set
(
100
,
200
,
300
);
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0xa0a0a0
);
const
hemiLight
=
new
THREE
.
HemisphereLight
(
0xffffff
,
0x444444
);
hemiLight
.
position
.
set
(
0
,
200
,
0
);
scene
.
add
(
hemiLight
);
const
dirLight
=
new
THREE
.
DirectionalLight
(
0xffffff
);
dirLight
.
position
.
set
(
0
,
200
,
100
);
dirLight
.
castShadow
=
true
;
dirLight
.
shadow
.
camera
.
top
=
180
;
dirLight
.
shadow
.
camera
.
bottom
=
-
100
;
dirLight
.
shadow
.
camera
.
left
=
-
120
;
dirLight
.
shadow
.
camera
.
right
=
120
;
scene
.
add
(
dirLight
);
// ground
const
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
2000
,
2000
),
new
THREE
.
MeshPhongMaterial
({
color
:
0x999999
,
depthWrite
:
false
})
);
mesh
.
rotation
.
x
=
-
Math
.
PI
/
2
;
mesh
.
receiveShadow
=
true
;
scene
.
add
(
mesh
);
const
grid
=
new
THREE
.
GridHelper
(
2000
,
20
,
0x000000
,
0x000000
);
grid
.
material
.
opacity
=
0.2
;
grid
.
material
.
transparent
=
true
;
scene
.
add
(
grid
);
// model
const
loader
=
new
FBXLoader
();
loader
.
load
(
"
http://localhost/myfbx.php?filepath=
"
+
this
.
fbxfilepath
,
function
(
object
)
{
mixer
=
new
THREE
.
AnimationMixer
(
object
);
if
(
object
.
animations
[
0
]
!=
null
)
{
const
action
=
mixer
.
clipAction
(
object
.
animations
[
0
]);
action
.
play
();
}
});
scene
.
add
(
object
);
}
);
object
.
traverse
(
function
(
child
)
{
if
(
child
.
isMesh
)
{
child
.
castShadow
=
true
;
child
.
receiveShadow
=
true
;
}
});
scene
.
add
(
object
);
}
);
renderer
=
new
THREE
.
WebGLRenderer
({
antialias
:
true
});
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
container
.
clientWidth
,
container
.
clientHeight
);
renderer
=
new
THREE
.
WebGLRenderer
({
antialias
:
true
});
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
container
.
clientWidth
,
container
.
clientHeight
);
renderer
.
shadowMap
.
enabled
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
shadowMap
.
enabled
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
const
controls
=
new
OrbitControls
(
camera
,
renderer
.
domElement
);
controls
.
target
.
set
(
0
,
100
,
0
);
controls
.
update
();
const
controls
=
new
OrbitControls
(
camera
,
renderer
.
domElement
);
controls
.
target
.
set
(
0
,
100
,
0
);
controls
.
update
();
window
.
addEventListener
(
"
resize
"
,
onWindowResize
);
window
.
addEventListener
(
"
resize
"
,
onWindowResize
);
// stats
//stats = new Stats();
//container.appendChild(stats.dom);
};
// stats
//stats = new Stats();
//container.appendChild(stats.dom);
};
const
onWindowResize
=
()
=>
{
camera
.
aspect
=
container
.
clientWidth
/
container
.
clientHeight
;
camera
.
updateProjectionMatrix
();
const
onWindowResize
=
()
=>
{
camera
.
aspect
=
container
.
clientWidth
/
container
.
clientHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
container
.
clientWidth
,
container
.
clientHeight
);
};
renderer
.
setSize
(
container
.
clientWidth
,
container
.
clientHeight
);
};
const
animate
=
()
=>
{
requestAnimationFrame
(
animate
);
const
delta
=
clock
.
getDelta
();
if
(
mixer
)
mixer
.
update
(
delta
);
renderer
.
render
(
scene
,
camera
);
//stats.update();
};
const
animate
=
()
=>
{
requestAnimationFrame
(
animate
);
const
delta
=
clock
.
getDelta
();
if
(
mixer
)
mixer
.
update
(
delta
);
renderer
.
render
(
scene
,
camera
);
//stats.update();
};
init
();
animate
();
init
();
animate
();
},
1000
);
},
};
</
script
>
...
...
@@ -131,4 +133,9 @@ export default {
width
:
100%
;
height
:
100%
;
}
canvas
{
height
:
100%
;
width
:
100%
;
}
</
style
>
\ No newline at end of file
src/views/Home.vue
浏览文件 @
fd61dc24
...
...
@@ -26,14 +26,22 @@
<el-container>
<el-header
style=
"text-align: center; font-size: 40px"
>
<span>
可以添加属性,可以添加到项目,可以添加到打包集合
</span>
<el-button
@
click=
"drawer = true"
type=
"primary"
style=
"margin-left: 16px"
>
可以添加属性,可以添加到项目,可以添加到打包集合
</el-button>
</el-header>
<el-main>
<LoadFBX
fbxfilepath=
"a.fbx"
>
</LoadFBX>
</el-main>
<el-main>
hello
</el-main>
</el-container>
</el-container>
<el-drawer
v-model=
"drawer"
size=
"70%"
:with-header=
"false"
>
<LoadFBX
fbxfilepath=
"a.fbx"
>
</LoadFBX>
</el-drawer>
</template>
<
script
>
...
...
@@ -44,6 +52,11 @@ export default {
components
:
{
LoadFBX
,
},
data
()
{
return
{
drawer
:
false
,
};
},
};
</
script
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录