|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* G7 n" l! b; t2 j* D3 z' ?使用TextureLoader的方法,添加图片进行load! @% R/ j& J( j* x
3 V1 ]8 k9 G4 K1 j' V( u( C- b结果如下:
$ p: H0 b# B1 `9 Q( S
|4 B( U( Q- n5 S. x* W* ~2 X, F$ \4 D4 w
8 m/ O+ q+ l u% U4 B3 v1 Z2 V& | this.loader = new TextureLoader()! o4 [. D' t, v2 D. |( S! Z; i
5 a+ X; j/ ^0 ~
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
. J6 ]' _; J" {! J$ g3 u5 z. k* ?& \- T, t1 K
O u( Y% J6 U, n3 ~: V+ q
; m6 i$ q6 O. j y3 c; {2 C L
9 F7 s' j, S- Z' H x7 E" zloadTexture () {
7 t- C( o$ e) x' m
; u+ d; e& M4 z( S' I. S& A. s const headerTexture = this.loader.load('/game/res/images/head.png')/ T. l1 v) v7 b/ F: x7 J
const bottomTexture = this.loader.load('/game/res/images/bottom.png')
8 w! P% c9 k. F$ U const middleTexture = this.loader.load('/game/res/images/middle.png')% O/ V9 Z; J* X% Q4 L; o' [6 w+ W% x! ^
3 w- d9 y7 z5 [6 Y1 D2 m, m, e! v- C7 r9 @% \9 Y( f$ A
const headerMaterial = new MeshBasicMaterial({
: s5 T; e5 x! ^ map: headerTexture
+ |9 b$ |7 B% G4 K })
5 Q3 S: |9 A. I6 q- E const middleMaterial = new MeshBasicMaterial({
) {+ c# y7 w6 K! s* u+ u# t* J7 b map: middleTexture3 _6 \. R% @; c2 Z& T5 W
})
( h @$ i* q/ q const bottomMaterial = new MeshBasicMaterial({: Q# l/ e1 ]6 `9 E- Y1 j
map: bottomTexture
8 H2 q0 n! y W$ E7 O6 g6 ?- U })
' Q" @9 b. X: N7 v4 E+ ^/ G; u1 D q" R3 k; t6 A
return {headerMaterial,middleMaterial,bottomMaterial}" p+ l0 A. p7 R, X' Z* }
}7 h) O8 D. [) | \& t l8 I
5 z. I% K; `9 \! \
9 }- f3 {4 |4 n" |* f3 o; c: I' Y |
|