|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ b& |0 b: E3 {3 l8 b5 ]$ D9 r% a
使用TextureLoader的方法,添加图片进行load
1 \3 X$ e" N" X& r* ?5 j7 ?$ g2 U7 l, C. v# A
结果如下:
# t1 \8 g1 K9 S" j, Y+ Y7 n1 t+ c4 N7 ]4 r- `
$ q; E" ^' ]3 H3 H1 M4 l5 e# ^8 [6 ~/ @4 r$ |6 u
this.loader = new TextureLoader()
( \& x7 a* F/ F7 P
8 w8 L; G }5 c2 Zconst {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()2 a3 q1 |: G& W; v: H8 C6 L
* t; Y& G. S( X. v
. i& S6 K9 d) ^- W
' d* X* A# A6 y: {" C+ k A U1 f% O
loadTexture () {3 V, p# X! [$ k6 j! Y/ a( O
9 U+ q* o+ G( {) F4 c6 ?/ G( e const headerTexture = this.loader.load('/game/res/images/head.png'): t. _: _- X- a
const bottomTexture = this.loader.load('/game/res/images/bottom.png')1 v4 m6 ?0 a9 ^
const middleTexture = this.loader.load('/game/res/images/middle.png')3 R# G' b( J8 O E- I+ a
9 U8 l0 k7 o/ H$ b! ]6 g/ ]' J+ b" w7 g( D
const headerMaterial = new MeshBasicMaterial({# D, @( y6 Q: w8 J2 i# v1 A
map: headerTexture
! A/ x! x2 N1 _1 P* ~ })( `# @% q& z4 B% H
const middleMaterial = new MeshBasicMaterial({
% R8 \& S4 y1 q! h k map: middleTexture
' z. D& P% W! s9 b }) i1 O, G) t, `6 K. ^8 n
const bottomMaterial = new MeshBasicMaterial({
, j# k0 v* U8 P4 O map: bottomTexture& Z$ y) ?& v( W$ R- T% M' e$ u
})
- h8 w9 \# c! {, W. Z3 z5 s, v3 D! k
! M- T5 Q3 U2 U4 C/ w7 n$ h return {headerMaterial,middleMaterial,bottomMaterial}
6 Z3 P0 h. |1 t- D) U }
1 y' x, e8 O' S2 ?) T4 g4 q$ Z! M6 G: n6 {8 t' f
/ t7 D: ]; o, p- }7 ?5 v |
|