|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 j+ }& N# }3 E# Y# k) h
使用TextureLoader的方法,添加图片进行load3 _& r) J: V' D* f( f: n C& z
2 F3 v/ U+ e* N/ Z, q
结果如下:/ G& }* M( i F; r: A' p
4 `7 t! e6 c# \# d# `
1 q: H! M8 W5 z7 `" D) R
! @& Y5 ^1 Z' @$ g
this.loader = new TextureLoader()
# h2 {4 }2 l2 L& M
. w4 S, ~. i3 f1 k Nconst {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
; H8 K+ ?0 e# G$ e& L, q
1 V, D- x5 e/ Q/ b1 m, a1 e1 _
' [' d: T% C3 o* P* S2 R
; Q6 m. @$ Q3 a5 A5 P& }7 m$ t" F, _. C5 T+ `# q9 U4 w
loadTexture () {) w+ G9 Q+ @( k2 d" V2 Y* ^5 ^
" U, a8 `2 M- f' g. z- `
const headerTexture = this.loader.load('/game/res/images/head.png')
; d' u6 `2 t, g9 J const bottomTexture = this.loader.load('/game/res/images/bottom.png')
- {$ D3 J- z; |/ `6 f. F! H7 z const middleTexture = this.loader.load('/game/res/images/middle.png')
2 _7 J1 R" `5 j; [
& m8 p, y a) h8 ]( n
6 J- c( G( u8 C% q const headerMaterial = new MeshBasicMaterial({: D# ?. b9 \8 ^: f) n
map: headerTexture
2 H* J$ Q% _: d6 ]: h! W o; l L })
) P F4 X9 M) T const middleMaterial = new MeshBasicMaterial({
7 @; ?$ F# i8 u4 S9 v' n map: middleTexture
6 V* V0 `- L W- b2 q })
8 r- G' N6 G" S' Y! ^6 s( p; m const bottomMaterial = new MeshBasicMaterial({' \) }- s7 \! p' q3 j# U
map: bottomTexture; x3 N, d4 e3 T0 K2 _* J
})
& z; V- E; t* X# D
" f/ D# D3 ?4 t% Q/ V$ `: J4 Q return {headerMaterial,middleMaterial,bottomMaterial}" l* ?! g$ u4 H7 D' F3 d J8 A
}
: ^ t2 p5 w. U. c# y
. h4 k- y; h" J9 K! d, ^8 O( w. [$ E' B
|
|