javascript - Resize multiple PlaneBufferGeometries according to size of images with Three.js -


Here I am with a simple task: I am displaying a decent amount of mapped jpg (100 +) Plane gateometrius three. Some of these JPGs are vertical using JS, others are horizontal and the sizes are slightly different. For this loop has been simplified

 for  (i = 0; i  

Therefore, I should be able to change the dimension of my plane geometry: I need a width and height value. It seems that jQuery needs to load the image for a second time, I just can not read the value of the file like:

  var newImg = new image (); NewImg.src = ("image /" + xml project [i] .getAttribute ('IMG') + ".jpg"); Console.log (newImg.width);  

and three JS can not access the image pixels like

  var texture = new three. Aries material ({map: Three.ImageUtils.loadTexture ("picture /" + xml project [i] .getAttribute ('img') + ".jpg")}); Console.log (texture.map.image.width);  

I've seen the entire web for an answer, it seems impossible in the right way: (

Any ideas?)


Comments