|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! M7 j! @- ^6 ?* U: F* Z
使用TextureLoader的方法,添加图片进行load) m0 e. C2 V8 \4 A( u
3 C+ T& G C5 z R
结果如下:; s: h% x5 I% \4 H* P
$ l. I7 n1 G* H" I; }. G% V% O! v& Z' x0 P5 K9 G& j
% `- R* C2 w# g& e. O+ E this.loader = new TextureLoader()
: t6 x$ Q$ N7 ]7 G6 J
0 |6 p1 y6 O: h8 J1 @0 L+ Y; uconst {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
; G$ f+ l( [* H i9 f2 e: `' Z9 A0 k9 M
+ t c) \1 I y# I3 R
% p. H5 N, @9 m+ @" [$ _
- ]4 V, d' a0 C9 O4 _7 }loadTexture () {
1 d6 H. _( N% U' A7 L) M2 J2 v5 y, p- E2 _
const headerTexture = this.loader.load('/game/res/images/head.png')# {: S1 j4 i0 ?8 ^/ ~( h4 i
const bottomTexture = this.loader.load('/game/res/images/bottom.png')/ {' Y1 E* X4 ~# p
const middleTexture = this.loader.load('/game/res/images/middle.png')1 r6 a: ?; M# A& X% t$ w; q
, A$ d# Q/ F6 q, h$ ?8 }7 |
6 \7 q" `7 n8 F4 _4 E0 ?) o const headerMaterial = new MeshBasicMaterial({
% v) J, f3 K7 u$ @* F0 z map: headerTexture
9 q5 Z5 k. |* |- s })
8 V% B5 V# m- p" D, |$ p7 | const middleMaterial = new MeshBasicMaterial({
) E/ `1 o: M% C5 w1 l7 Y( N5 p map: middleTexture
$ H, m F* ]8 P" S- Y })
5 d- H" H3 g! m: O const bottomMaterial = new MeshBasicMaterial({
) O( |9 i; M) V2 g, F. a% | map: bottomTexture
2 a6 ]/ k3 C: f- l })" Q$ ], {& ?( W' j
$ ?: r! _2 B" U+ }8 s* Y! N" ~( q
return {headerMaterial,middleMaterial,bottomMaterial}$ o" k, f: l$ P$ ]. l0 I0 B
}9 M/ l; q6 t! Z0 d; N2 n1 s/ p
/ h4 | K. V% D+ n6 }
+ S2 t9 v7 `% a) m |
|