我在我的游戏中有一个房子模型,我有一些房子几何的材料.有一个房子的墙壁的材料,我有一个纹理地图图像来显示砖块.
var mat = new THREE.MeshPhongMaterial( { ambient: 0x969696,map: THREE.ImageUtils.loadTexture( 'textures/G/G0.jpg' ),overdraw: true,combine: THREE.MultiplyOperation } );
以上述方式,纹理贴图显示为GL_CLAMP,我希望它像GL_REPEAT一样显示.
我该怎么办?
如果看不到图像检查this.
解决方法
我已经发布了一个完整的工作示例:
http://stemkoski.github.com/Three.js/Texture-Repeat.html
http://stemkoski.github.com/Three.js/Texture-Repeat.html
代码示例的相关部分是:
// 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 );