|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# `7 @0 G, Y+ _/ K" P* B9 x使用TextureLoader的方法,添加图片进行load
; q5 }, C+ o6 [8 G
7 e: }4 F" _/ M. { ?* V4 O结果如下:
; `0 |' `- B% q5 Q
! N/ M& \1 ^0 M* p- w o. x2 m6 ]3 [$ Q0 A5 Y
# a: l0 n; ?$ B5 j/ L( v' h" r this.loader = new TextureLoader()5 B4 A1 E3 t$ Z( ]8 Z: ^8 M
& Q) @, U! i4 o1 z2 A+ B
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()& O, T" ]7 @* v O" Y
! _# u" F/ b$ G1 a8 |
& U" Z& e0 P, N
) E% v. e6 X1 x( q
4 N. u$ U- b D; B2 L BloadTexture () {
4 }) o, }2 A7 J9 w0 `2 @) `, m% a0 y! B0 f# ?
const headerTexture = this.loader.load('/game/res/images/head.png'): I1 Q8 b5 c$ L# n) K8 N; E
const bottomTexture = this.loader.load('/game/res/images/bottom.png')( H4 j" v& G/ u; J
const middleTexture = this.loader.load('/game/res/images/middle.png')
5 a: v8 U! \' J7 L8 `, R* k4 s5 H) e3 R( H4 o; }
; L# Y- ]0 a7 L; k
const headerMaterial = new MeshBasicMaterial({
0 d8 t8 G" ~4 y' c# P% J map: headerTexture
# t7 Y$ z1 j, a- ~0 d })
9 T, D: z, x7 D; l3 {8 U+ I const middleMaterial = new MeshBasicMaterial({9 u) i8 _' X6 g6 I% J# Q
map: middleTexture, P; Q9 @% J& y$ O) i% f( H
})0 D- f5 k3 p- v+ @0 N
const bottomMaterial = new MeshBasicMaterial({
! E4 u e% X: j7 f2 F map: bottomTexture
- x) M/ Y6 x& t: c4 _ })
! F" G% V; e+ X5 Y/ Z4 d4 @
/ o" F/ W1 W- n5 F return {headerMaterial,middleMaterial,bottomMaterial}6 @+ o9 g& J0 ?. g. |% O, P! x1 f
}* b# c- D2 T, O, R5 H
1 K$ L7 v: O2 V' r! q1 p5 ]/ D) V: W& h8 h' O/ Q
|
|