How to repeat the texture map like GL_REPEAT?

前端 未结 3 788
慢半拍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:36

    I have posted a full working example at: http://stemkoski.github.com/Three.js/Texture-Repeat.html

    The relevant part of the code example is:

    // for example, texture repeated twice in each direction
    var lavaTexture = THREE.ImageUtils.loadTexture( 'images/lava.jpg' );
    lavaTexture.wrapS = lavaTexture.wrapT = THREE.RepeatWrapping;
    lavaTexture.repeat.set( 2, 2 );
    var lavaMaterial = new THREE.MeshBasicMaterial( { map: lavaTexture } );
    var lavaBall = new THREE.Mesh( THREE.GeometryUtils.clone(sphereGeom), lavaMaterial );
    scene.add( lavaBall );      
    

提交回复
热议问题