javascript - Dynamically Change Three.js texture in externally loaded Collada file -


i using three.js collada loader import .dae file texture (.png) image applied. need overwrite .png file new texture, , creating texture using canvas element exports .png format. if clear cache, change texture (i naming exported "new" .png texture same filename original .png texture referenced in .dae file).

how can ensure new texture recognized/rendered without having user clear cache? example: user creates new texture, , exported on original texture, , collada file re-renders after user clicks button render box.

once have javascript image object in memory, regardless of source, can assign objects' materials' textures via .image attribute. you'll need let thre.js know alter binding. example, if have new image called, say, img , mesh called mesh typical material:

mesh.material.map.image = img; mesh.material.map.needsupdate = true; 

should trick. no need send dom elemetn disk .png, use it.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -