在纹理上更新一些旧的javascript three.js代码。 特别是下面的第二行。
var groundColor = new THREE.Color(0xd2ddef);
var groundTexture = new THREE.ImageUtils().generateDataTexture(1, 1, groundColor); // this line
var groundMaterial = new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0x111111, map: groundTexture });
var groundTexture = new THREE.TextureLoader().load('img/ground.jpg', undefined, function() { groundMaterial.map = groundTexture });
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping;
groundTexture.repeat.set(25, 25);
groundTexture.anisotropy = 16;
什么新方法/构造函数/ etc有three.js替换了THREE.ImageUtils()。generateDataTexture?
答案 0 :(得分:2)
generateDataTexture
已从r73中的three.js核心中删除。但是here is the commit where it was removed您可以在其中找到简单的generateDataTexture
函数。您可以将其复制并粘贴到代码中,并根据需要调用它。 [R88]
答案 1 :(得分:1)
谢谢大家,我能够用DataTexture替换ImageUtils.generateDataTexture,使用颜色作为数据。