|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 T6 d; ~( C( E9 \0 E1 ~
使用TextureLoader的方法,添加图片进行load
% S0 y7 w1 i4 ?3 ?- j5 ?% o/ [( k
: B1 A0 e l# E! g; L0 e结果如下:
0 `8 i3 i6 c. b3 s
$ ~2 w9 g8 T- D
1 U; v1 b* g; Y6 e8 h* M, B& Q. W3 f# R# s I. j- f
this.loader = new TextureLoader(); a% V- Y7 M- }( J9 y* v
/ X0 L. v7 O5 {$ H
const {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
* M0 G% @* P- u2 K6 P( Z4 n+ N* D0 i" G! ~6 ?9 E
/ Z5 t. j3 w2 [3 j/ h
% Q3 _. @6 h" q7 Y- f
0 D1 Z3 \6 E8 N! [loadTexture () {
. ~% |9 \9 O$ Q. A9 N4 ^& p) I* s
const headerTexture = this.loader.load('/game/res/images/head.png')/ L' r- k5 L# V& x4 ]. c% B5 F
const bottomTexture = this.loader.load('/game/res/images/bottom.png')
" v1 t. x% G5 [9 Y const middleTexture = this.loader.load('/game/res/images/middle.png')
% ^3 w4 y M# _1 [0 t9 R
1 J' D3 ]! z) F, K+ o: m0 r; w- F9 d6 \
- V* ?& W9 s& h( S const headerMaterial = new MeshBasicMaterial({7 ^4 F2 _- N# g2 P M
map: headerTexture1 g& _2 f0 F1 K9 j
})( T5 q2 s4 w l7 X$ d& N" o* n
const middleMaterial = new MeshBasicMaterial({, M" Y/ p! L5 M# |
map: middleTexture4 D1 M( [4 J, R
})4 j. s5 H2 w) ^1 F* ^+ _4 B3 ]2 S* q
const bottomMaterial = new MeshBasicMaterial({
* F1 h2 p6 _2 R* x% Y* w7 ?, W map: bottomTexture
- {' N! w1 o; H) b- S, C0 T })
+ q: e0 Z Y; ^% h; }5 j9 w9 M5 [+ m- L3 |3 J
return {headerMaterial,middleMaterial,bottomMaterial} o. H+ J# a$ `( A0 h3 e3 G
}: ~/ p. ?: [. r |" h* n& l8 o1 S
0 r' X3 R7 b" R# @
# x5 t. D, _8 F. L |
|