|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
9 s9 X% v" g3 ]使用TextureLoader的方法,添加图片进行load
* B/ ?) K B( D9 r. ?! g) ~% M+ Q; J& r5 k
: C2 m* c3 v" b1 _( l结果如下:
7 I& Q* `% [1 o! O/ V" D6 b, q# k% t& ]/ t, e
+ k1 {( _; D4 |$ W. }
& u, b0 w, W5 I. e this.loader = new TextureLoader()
1 g' T1 j! H. E# P! e& N/ C, O1 D% a) F+ T
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()( ]* q- M! f- k! ~
' R6 q2 j. c9 P
0 f% M `3 Y) f6 H' @8 d
9 v& G% Z& ] R) z8 O8 o
# ]2 ?- ^; U. Y: G! B
loadTexture () {
( M9 A/ Z4 I; ?( f: E' E
9 _0 C( v5 @/ n6 Z2 Y- O const headerTexture = this.loader.load('/game/res/images/head.png')
/ O5 O' F* w ?& [$ Z: c const bottomTexture = this.loader.load('/game/res/images/bottom.png')
# e7 U; K/ B }* [+ j: a8 Z const middleTexture = this.loader.load('/game/res/images/middle.png')
5 }+ ` g. b. z3 s% b8 i* f% n9 l- ]9 d1 T
3 F5 Y( _% A" I
const headerMaterial = new MeshBasicMaterial({6 X- y9 o( p5 V9 t
map: headerTexture
' @( [1 ? S) \8 W, N$ v })
1 V% d0 x- [6 } q0 ^ const middleMaterial = new MeshBasicMaterial({1 I% a: E' h- `; e9 i" {* M
map: middleTexture. _( G3 S; l) V/ v6 i7 a" W4 D+ x7 Q
})3 y1 H9 e; F; V7 ]0 R
const bottomMaterial = new MeshBasicMaterial({$ e0 @& o0 b: K+ H/ B5 G
map: bottomTexture* `- s& p" d2 s5 L- _
})
- ~2 P, F% V4 P; v* P3 n% `4 P
return {headerMaterial,middleMaterial,bottomMaterial}
4 a8 a6 p& |8 B2 r% l/ h- B, z }
( r- S) h7 t6 M% Q M9 N
* F* d2 j. A* H3 X$ D; D% e- ~! h
|
|