How to repeat the texture map like GL_REPEAT?

前端 未结 3 781
慢半拍i
慢半拍i 2020-12-19 03:21

I have a house model in my game, and I have some materials for the house geometry. There is a material for the wall of the house, and I have a texture-map-image to show the

3条回答
  •  离开以前
    2020-12-19 03:27

    It's called THREE.RepeatWrapping there. The loadTexture defaults to THREE.ClampToEdgeWrapping (see ctor function from previous link). Don't know if you can use the callback (because this in JS is a bit weird (looks like it points to the created Image, not the created Texture)). Signature:

    loadTexture: function ( path, mapping, callback ) {
    

    Better you just name the texture locally and set the wrap modes manually:

    var t = THREE.ImageUtils.loadTexture( 'textures/G/G0.jpg' );
    t.wrapS = t.wrapT = THREE.RepeatWrapping;
    

    Looks like you're not going far with threejs without looking at the actual code...

提交回复
热议问题