PLM之家PLMHome-工业软件践行者

[前端框架] 使用ThreeJS添加纹理的方法

[复制链接]

2020-2-6 12:46:58 2132 0

admin 发表于 2020-2-6 12:46:58 |阅读模式

admin 楼主

2020-2-6 12:46:58

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x

; r; H3 T6 u4 p, K: ?( T7 H  E. M# d! l使用TextureLoader的方法,添加图片进行load! z3 {6 M# c5 T$ O

  |* @. Z$ o2 n1 u& u" l结果如下:
- u+ M7 |' W) ]' Y: H5 x5 k' w! g; y- N# {

$ R1 M  X; L9 m9 d9 U* A3 A! Y( m5 C. B
this.loader = new TextureLoader()+ F# v5 f* w- Y( o; j

* o' }5 F/ J+ V  @# Jconst {headerMaterial,middleMaterial,bottomMaterial} = this.loadTexture ()
$ f+ J( Z6 ]" ~4 t  u
8 d9 T/ E' {0 r$ a9 @( {9 `: {
7 j1 C: ?8 k5 k' V& Z( ]4 @

+ o8 v+ z( l7 ~% F9 c' v6 J4 y1 L
loadTexture () {; e0 O% [& a' M1 I4 C4 ]+ W

* E0 ^( @9 u9 c7 H/ [9 s2 ?        const headerTexture = this.loader.load('/game/res/images/head.png')% n5 ~: b2 o: s
        const bottomTexture = this.loader.load('/game/res/images/bottom.png')( Y! N& \7 n/ f' V
        const middleTexture = this.loader.load('/game/res/images/middle.png')
1 I7 c9 Y) s$ C; U4 q: c5 L
) `$ R, o' Q9 R
5 A" F* M; H. R) r; c        const headerMaterial = new MeshBasicMaterial({- @, a; m. W& t: l. h
            map: headerTexture+ r8 z# d) I3 x
        })
& r$ g& p2 t5 B1 B2 W6 [7 N# L* }        const middleMaterial = new MeshBasicMaterial({
! o6 U# j8 w8 S7 t            map: middleTexture* s6 ~" j+ m; w. U2 e. `4 [
        })3 b! A( }  R4 V% K) p/ R
        const bottomMaterial = new MeshBasicMaterial({
' V8 ^8 J0 Z  r6 q- v            map: bottomTexture5 p; P* o( k  c  d- t
        })+ c4 l/ ?2 Y9 l* F
3 a. Z* \: a; B5 V" P9 f( S& l
        return {headerMaterial,middleMaterial,bottomMaterial}( {: u6 |- j* C. V* I3 W
    }
9 E3 _- Q( k2 q! R$ v$ T; P

& G4 Z4 w. g7 w! Q! I
+ O" K, H3 x8 f* n
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了