I'm currently learning three.js and 3D graphics for the first time and am trying to create a voxel engine (think Minecraft, Infiniminer). I'm finding that my script is taking up a lot of memory, but I have my suspicions why - every block that I create uses a new Mesh object, even if some of the blocks look the same.
I asked some people I knew whether they know of a more memory-efficient way of doing this - they suggested creating one Mesh for each type of block and using matrices to transform the Mesh for each instance of the block (they're familiar with OpenGL, but not so much three.js). Does three.js allow for something like this? If so, how would you do so and if not, are there any other alternatives?
(So far my understanding is that every item you want to render needs to be in the scene graph, so even if multiple blocks look the same you need to add multiple copies of the block (with different x, y, z coords) to the graph. I'm probably wrong.)
I believe they are accomplishing what you're asking in the three.js trackball controls. Check out this link here
If you have trouble viewing the source use the keyboard shortcut cntrl + u (windows)