|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ c7 m# `" M; { A" a
使用TextureLoader的方法,添加图片进行load* I6 f- c8 b7 e. B
5 `6 O: k3 k! E7 w, G结果如下:
( R2 q: _; \/ i- ~& m: n4 H
0 P4 ~2 y( N6 X8 Y* ]8 |' B$ }/ Y/ T* L' q
: Y$ f5 o2 }6 h8 _. I+ o
this.loader = new TextureLoader()
0 q. }, B) Y" ~! C! B% |# Z5 ]) A, ]/ @
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
7 |) Z6 {% y) {9 O# |" ?4 L# f) X* y6 L5 n* Y, [
/ L: ?* D3 y C3 `+ P6 l2 a' S+ |
# O5 f( x8 i# @
loadTexture () {9 `+ }' b6 Q. W4 h5 Z+ \0 T5 ~) S* h
8 I6 K7 Z- K2 b! T4 q: p const headerTexture = this.loader.load('/game/res/images/head.png')
- c, i9 f4 R2 P8 H; Z+ ? ? const bottomTexture = this.loader.load('/game/res/images/bottom.png')
C$ P+ E; H( o7 y5 w( E% D const middleTexture = this.loader.load('/game/res/images/middle.png')# K7 |3 ^; @/ L" ` r
% \9 V! }' R) ~) K5 {" d
! x( Y0 C1 b+ O0 S! ]# e. W const headerMaterial = new MeshBasicMaterial({2 G! D4 E0 i+ i4 r/ W! e- c7 w
map: headerTexture( i- G5 |+ c. w/ n% t/ T7 K1 E
})) W% u9 U) s, ~0 g
const middleMaterial = new MeshBasicMaterial({
- R3 S$ J, D$ ]& W( _8 { map: middleTexture
# X+ H: r* X" R4 R })
/ \* ^' z% |* P. s const bottomMaterial = new MeshBasicMaterial({
1 L& n- _5 x0 d map: bottomTexture
* Z. }$ q6 _9 r })
6 E5 d) \- M! d2 \4 _' d# T2 A# _) M5 Q8 I$ K; Q% F% G0 k- L
return {headerMaterial,middleMaterial,bottomMaterial}
0 [% B2 }6 _7 j, l0 M* _& m( v) V }" K. S! W$ c; ]9 R' ?% j
4 x1 r9 g- x% `4 f/ I+ T! D8 l( h1 O7 [* A# U# c2 s1 x
|
|