I'm loading a *.js model which has a texture. The texture itself is a separate file located in the same directory as the model, so the loader adds this texture to the *.js model.
var loader = new THREE.JSONLoader();
var aMesh;
loader.load("models/mesh.js", function (geometry, materials) {
aMesh = new THREE.Mesh(geometry, materials[0]);
scene.add(aMesh);
});
The texture gets blurred when viewed at some angle so I need to apply anisotropy filtering to it.
I can only guess that I need to create a var Texture, load the texture into it, apply anisotropy and then add this texture variable to the mesh or to its material[0].
Or can I access the texture in the aMesh material directly somehow?
This may work, untested.
var loader = new THREE.JSONLoader();
var aMesh;
loader.load("models/mesh.js", function (geometry, materials) {
var maxAnisotropy = renderer.getMaxAnisotropy();
materials[0].map.anisotropy = maxAnisotropy;
aMesh = new THREE.Mesh(geometry, materials[0]);
scene.add(aMesh);
});
If not, you could always override the load function of the JSONLoader class.
Or load the model and texture separately.