|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; r; H3 T6 u4 p, K: ?( T7 H E. M# d! l使用TextureLoader的方法,添加图片进行load! z3 {6 M# c5 T$ O
|* @. Z$ o2 n1 u& u" l结果如下:
- u+ M7 |' W) ]' Y: H5 x5 k' w! g; y- N# {
$ R1 M X; L9 m9 d9 U* A3 A! Y( m5 C. B
this.loader = new TextureLoader()+ F# v5 f* w- Y( o; j
* o' }5 F/ J+ V @# Jconst {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
$ f+ J( Z6 ]" ~4 t u8 d9 T/ E' {0 r$ a9 @( {9 `: {
7 j1 C: ?8 k5 k' V& Z( ]4 @
+ o8 v+ z( l7 ~% F9 c' v6 J4 y1 L
loadTexture () {; e0 O% [& a' M1 I4 C4 ]+ W
* E0 ^( @9 u9 c7 H/ [9 s2 ? const headerTexture = this.loader.load('/game/res/images/head.png')% n5 ~: b2 o: s
const bottomTexture = this.loader.load('/game/res/images/bottom.png')( Y! N& \7 n/ f' V
const middleTexture = this.loader.load('/game/res/images/middle.png')
1 I7 c9 Y) s$ C; U4 q: c5 L
) `$ R, o' Q9 R
5 A" F* M; H. R) r; c const headerMaterial = new MeshBasicMaterial({- @, a; m. W& t: l. h
map: headerTexture+ r8 z# d) I3 x
})
& r$ g& p2 t5 B1 B2 W6 [7 N# L* } const middleMaterial = new MeshBasicMaterial({
! o6 U# j8 w8 S7 t map: middleTexture* s6 ~" j+ m; w. U2 e. `4 [
})3 b! A( } R4 V% K) p/ R
const bottomMaterial = new MeshBasicMaterial({
' V8 ^8 J0 Z r6 q- v map: bottomTexture5 p; P* o( k c d- t
})+ c4 l/ ?2 Y9 l* F
3 a. Z* \: a; B5 V" P9 f( S& l
return {headerMaterial,middleMaterial,bottomMaterial}( {: u6 |- j* C. V* I3 W
}
9 E3 _- Q( k2 q! R$ v$ T; P
& G4 Z4 w. g7 w! Q! I
+ O" K, H3 x8 f* n |
|