I’m creating a 3D application which uses a node addon written in C++ to generate 3D objects (vertices, normals, indices etc) which I need to pass down to my electron renderer which contains a webGL window (I’m using Three.js)
What is the most efficient way to transmit my large data arrays (My 3D objects contain many polygons) from C++ (Node addon) to the renderer front end in electron? Ideally I would love it if I could allocate some heap memory in C++ and have it accessible from the renderer thread to create the Three.Js objects. Is that possible?
Right now I’m allocating buffers in C++, passing them down to Node’s (main thread) via v8, and then using MainWindow.webContents to send this data to the electron’s render thread which can then create my Three.js objects for rendering in webGL. This seems inefficient so I hope there is a better way.