|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ j2 Q/ X9 s) H5 S. N$ d使用TextureLoader的方法,添加图片进行load- w- X+ M; ?: I; W
7 T" J7 `+ x' N1 J% N# ?
结果如下:
( \- |; a& e& g$ v1 r1 D; T8 _. F, ]5 y0 {$ Q) ~3 {9 [
/ P5 r6 a& T& i0 b& t& Y
9 m; ^& W" v5 R
this.loader = new TextureLoader()
8 Z+ k2 @3 q H- A, _4 T/ D8 I! f" T" e2 s
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
4 T; A7 W. H0 t2 {3 E
5 d0 e1 Z, s/ R$ j: J# d; U# }/ k P8 \
# J2 n3 a: W4 R* ^0 i2 J. ]* u" s8 u* z" P
loadTexture () {+ ~2 J. b) \( N' F2 h
/ b. o' k& b" l: P
const headerTexture = this.loader.load('/game/res/images/head.png')
4 Y! e- Y- a3 _$ s/ z const bottomTexture = this.loader.load('/game/res/images/bottom.png')
* \$ y0 j+ |" x( E* Q/ a% r) H t) f const middleTexture = this.loader.load('/game/res/images/middle.png')
x% w' @0 F5 @% W$ N* @ ~% r
) w1 O8 s- a& { I& ?# B5 M6 n$ a; f* q
9 a3 j0 A: `" ?" O4 z const headerMaterial = new MeshBasicMaterial({! W9 p+ H+ v7 ?. G9 c7 i
map: headerTexture# W; y. J. q. m* I+ \- E" B' W
}); [( M3 t" I9 C4 {* [' V1 `# ?
const middleMaterial = new MeshBasicMaterial({* @% X' I* Y# w" n" v# K4 B
map: middleTexture3 H% s) Z7 {( H- M. S
}): N/ G, w/ x/ v4 |5 W0 t
const bottomMaterial = new MeshBasicMaterial({
9 l4 r# W0 G( |. { map: bottomTexture
! m7 C: V+ o: N6 r# \9 L })
6 V3 P7 G+ U- g/ O8 D$ V
5 _; I5 p0 r3 Z- _) _; ` return {headerMaterial,middleMaterial,bottomMaterial}) x/ [! n0 I" ?- K3 G E
}
, y9 r1 G/ v+ s3 k: d1 }% K$ g, Y
( h! b' K& b( N: d% G" i
* Y" ^- T9 B( @, N6 C |
|