|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 S# ~- l; n; C G" K. p
使用TextureLoader的方法,添加图片进行load
, ?1 a! m" g$ [( [( j- _4 R4 d3 @0 W7 l% C8 ^$ g( f. I
结果如下:
. n" k' Y/ X$ {5 n2 U8 I6 B( a. Q; w. |0 l* X! f
7 P- z9 Q( u8 v5 E: ?
' B" n" u; Y) T this.loader = new TextureLoader(): y( r3 H# l! o
+ K! D* w' p* z# i* i, `* D; u6 q9 t
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
5 y, [/ D( E7 _6 J0 S! ]) A9 t/ U6 M) U2 b
, W+ Y9 ~4 L, m; K6 _) r! c1 l" D5 k' }8 \+ ]( f
1 A! l* R! e0 d7 a
loadTexture () {
4 E( W# y* s5 o1 h7 K/ q
( F* w$ W3 F6 H! v+ S" M const headerTexture = this.loader.load('/game/res/images/head.png')
: S4 b0 Q$ h, y; J$ ~2 M' J7 h const bottomTexture = this.loader.load('/game/res/images/bottom.png')) l' p6 m" m% J9 u% n) F
const middleTexture = this.loader.load('/game/res/images/middle.png')9 N8 I0 o) p5 \4 ^$ }7 T' J0 y% k
\; x/ k! u- _8 U& l' {
/ ]* z$ F" r+ R! I1 I4 ` const headerMaterial = new MeshBasicMaterial({! A; H* `! p' D+ ~$ J* r+ a+ z G4 W! ?
map: headerTexture
" v5 n9 U+ Y, @7 l" J4 s( ~ })( d, b0 ~& o' W) }
const middleMaterial = new MeshBasicMaterial({
2 F. d; t5 ^6 A* _ map: middleTexture2 }/ j* ~' x$ A* P! |" {- S5 S
})7 `8 A! S' c) ^1 h s+ E
const bottomMaterial = new MeshBasicMaterial({; }6 [1 s" k! h0 Z* |% U% w T, p
map: bottomTexture0 o. c7 q& y/ X \. \9 n, g8 S
})
" E/ ?4 L% s/ H% I- K/ j ^! x# ^( G3 S! r
return {headerMaterial,middleMaterial,bottomMaterial}' `" \6 @1 \( Y" w( k8 k( c
}
y# _" g1 ~& o7 b) R% p" X4 \) t4 v; f7 a4 A
; t+ v; Q5 N e1 c9 Y |
|