What happened to THREE.ImageUtils?

。_饼干妹妹 提交于 2020-08-20 12:25:13

问题


Working on updating some old javascript three.js code on textures. Specifically the second line below.

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;

What new method/constructor/etc has three.js replaced THREE.ImageUtils().generateDataTexture?


回答1:


generateDataTexture was removed from three.js core in r73. However here is the commit where it was removed where you can find the simple generateDataTexture function. You could just copy and paste it into your code and call it as needed. [r88]




回答2:


Thanks everyone, I was able to replace ImageUtils.generateDataTexture with THREE.DataTexture, using the color as the data.

https://threejs.org/docs/#api/textures/DataTexture



来源:https://stackoverflow.com/questions/47782274/what-happened-to-three-imageutils

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!