idflood / ThreeNodes.js

vvvv "clone" in javascript/webgl
http://idflood.github.com/ThreeNodes.js/
Other
2.18k stars 316 forks source link

Export to Three.js Code #11

Open zz85 opened 12 years ago

zz85 commented 12 years ago

Would it be difficult to implement a javascript code exporter? It could be useful for embedding scene information into another, and allow the code to be further tweak modified by hand.

Btw, looks like lots of nice progress coming along :D

idflood commented 12 years ago

I think it's not impossible but clearly not easy to implement. One thing that would make it a lot easier would be to still use the nodes from threenodes instead of creating straight three.js code. What do you think?

zz85 commented 12 years ago

Do you mean threeNode objects instead of three.js objects? I think doing that should be good too, from threenodes object would also be a good first step to converting to three.js objects by hand compared to interpreting a JSON file.

idflood commented 12 years ago

Yes, exactly :) So this may be a lot easier to do than I first thought.

zz85 commented 12 years ago

just btw, how difficult do you think to integrate https://github.com/zz85/sparks.js/ ? it could turn out like http://flexmonkey.blogspot.com/2010/03/flex-flint-particles-editor-with-node.html

not sure if i would do it though I could give it a try sometime...

idflood commented 12 years ago

It looks relatively easy, at least for basic functionality. This could be fun.

imgntn commented 12 years ago

i would LOVE if this could export to three.js code. i'm running a research group this quarter at UC Santa Cruz to create a webGL based netart piece and have several undergraduate engineers/designers working on the project. i think i'd be able to get a lot more out of them if they could prototype in threeNodes. then they can tweak the code as necessary after that, but once we get a few design pattern blocks put together, i think this would be a lot better. i'm already using collaborative solutions like cloud9IDE, etc. second zz85's desire to integrate the sparks.js editor, and i'd like to see the glsl shader playground from mr.doob thrown in there as well... keep us updated!

idflood commented 12 years ago

I've added a basic ThreeNodes.js code export under the menu "File -> Export to code". Here is a live demo created from the code export: http://idflood.github.com/ThreeNodes.js/public/code_export_example.html

And an example javascript code output: https://github.com/idflood/ThreeNodes.js/blob/master/public/assets/js/code_export_example.js

These are the next things on my list for this issue:

imgntn commented 12 years ago

hooray!

idflood commented 12 years ago

: ) I've added the animation and switched the view mode to "player". The only missing piece right know is to add tests but I will have to do some little refactoring first and certainly change one line in the exported code.

zz85 commented 12 years ago

Cool! :)