|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( z& b g% ?/ f; y |1 q* u
使用TextureLoader的方法,添加图片进行load. f0 {2 [$ g' _- V' ^) ~
, ^7 i- N" b# R+ q0 z# F/ c3 u- e结果如下:$ r' h5 k* A# U5 [% Z& ]5 \
, U. l+ N, Q! ]1 G
4 P5 [" ^. D8 k$ ?; C" Z; I( h- a( D6 F( i6 U4 `* ~
this.loader = new TextureLoader()
9 U( }. D# _- Q; i+ d; S! P0 O7 F
% Z6 U2 }) t2 k) }- @) w, Tconst {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()& f+ z& Z. t; ^2 L8 Z2 e* g* j
( ?( o6 m) K8 A& d0 R6 ^" m
& I3 V, b: r H) ?; G* q% G
2 F) z+ ]8 V6 `8 Z
" c' C0 ^% T6 p8 M/ IloadTexture () {
' D) H. q( }8 H) ]6 W, V6 R b6 ?9 u, L# S/ W/ E+ w
const headerTexture = this.loader.load('/game/res/images/head.png')9 M0 o( z1 h9 M8 w# L6 f
const bottomTexture = this.loader.load('/game/res/images/bottom.png')2 B, c3 R1 c. n' ~
const middleTexture = this.loader.load('/game/res/images/middle.png')- l, J& O5 G+ @2 ?4 w/ W( p9 Z+ r) }
" a7 j$ k) |/ G/ z9 X
' D9 n+ C5 Z: h6 ~ const headerMaterial = new MeshBasicMaterial({- ?# d, t+ N6 v) u8 o% { Y" A
map: headerTexture. V! K& d1 _) t$ ^
})' [9 J: T1 Y& l0 d. M8 F: d
const middleMaterial = new MeshBasicMaterial({
' W) O I# T: ^+ G map: middleTexture
7 t3 D \- c1 ]9 O6 n3 I })
( Y* Z2 S7 x' f/ y. L# B const bottomMaterial = new MeshBasicMaterial({% Z2 {- U7 n4 t- d8 I* j
map: bottomTexture
; O) ^( A. Q5 z8 R7 q0 A/ V- h })
5 |* v, U1 }1 r( T8 m# F- v
! B+ u- r. r9 J+ _, k0 Y return {headerMaterial,middleMaterial,bottomMaterial}
# z. z' S! {- I; H Q. t8 t }
; [4 R$ }2 D' A9 b, B: e9 @; Y0 p5 v! e5 i
4 M! Z0 Z/ a/ N |
|