pet*_*_de 3 javascript texture-mapping three.js
我想问你是否知道如何使用THREE.TextureLoader()重复纹理.我找到了仅使用THREE.ImageUtils.loadTexture()的解决方案.这是我的代码的一部分:
var loader = new THREE.TextureLoader();
var wall;
loader.load('../images/concreteWall.jpg', function (texture) {
var wallMaterial = new THREE.MeshBasicMaterial({
map: texture
});
wall = new THREE.Mesh(sideWallsGeometry, wallMaterial);
scene.add(wall);
}
);
Run Code Online (Sandbox Code Playgroud)
如果要重复纹理,请遵循以下模式:
var loader = new THREE.TextureLoader();
var texture = loader.load( 'path.jpg', function ( texture ) {
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.offset.set( 0, 0 );
texture.repeat.set( 1, 1 );
// your code
} );
Run Code Online (Sandbox Code Playgroud)
three.js r.84