whs.js icon indicating copy to clipboard operation
whs.js copied to clipboard

Improve TextureModule

Open thejmazz opened this issue 7 years ago • 3 comments

Some improvements can be made to TextureModule

  • [x] allow setting more options on underlying texture from constructor (make sure includes every option three does)
    • [x] minFilter and magFilter
  • [ ] allow passing in an "image object", i.e. (new THREE.TextureLoader()).load(imageUrl)
  • [ ] support data textures (or maybe make a DataTexture module - I have a wip for this)
  • [ ] support for a LoaderModule which can pass the resolved texture to the component, while managing loading status for all items used in it - see #215
Version:
  • [x] v2.x.x
  • [ ] v1.x.x
Issue type:
  • [ ] Bug
  • [x] Proposal/Enhancement
  • [ ] Question

Tested on:
Desktop
  • [ ] Chrome
  • [ ] Chrome Canary
  • [ ] Chrome dev-channel
  • [ ] Firefox
  • [ ] Opera
  • [ ] Microsoft IE
  • [ ] Microsoft Edge
Android
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Opera
IOS
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Opera

thejmazz avatar Mar 22 '17 15:03 thejmazz

@thejmazz

There is a way to modify the texture before it is applied to mesh. See fix() property. This one works similarly to module bridges. https://github.com/WhitestormJS/whitestorm.js/blob/beta/src/modules/mesh/TextureModule.js#L27

Usage:

  // ...

  new TextureModule({
    url: 'my/path/to/texture.png',

    fix(tex) {
      tex.minFilter = // ...
      return tex;
    }
  })

sasha240100 avatar Mar 22 '17 15:03 sasha240100

hello,I have some issues in textureModule,Can you help me ? issue is here

elva2596 avatar Mar 23 '17 01:03 elva2596

@elva2596 Yes, will do. /ping @hirako2000

sasha240100 avatar Mar 23 '17 05:03 sasha240100