jagenjo / webglstudio.js

A full open source 3D graphics editor in the browser, with scene editor, coding pad, graph editor, virtual file system, and many features more.
MIT License
5.21k stars 605 forks source link

how to use three.js component? #29

Closed tornadory closed 6 years ago

tornadory commented 7 years ago

Hi all,

I found that there is one component named threejs , sounds like it can support three.js as well.

But when I tried to add threejs component, seems there are some errors and not successful.

Can anyone tell me can I use it or how to use it?

jagenjo commented 7 years ago

Hi:

I did the Three.JS component long time ago so I hadnt check it with the latest updates. I will try to fix it this week and add a tutorial of how to use it soon.

Cheers

tornadory commented 7 years ago

@jagenjo wow, great, thanks very much!

johnnyz2017 commented 7 years ago

it seems that use old version of three.js can make it work, such as r73.

the newest version can not.

jagenjo commented 7 years ago

yes, I was trying to fix the error but the new Three.JS has deprecated the function that reset its render engine, and without it it is hard to integrate both render engines because they change states.

As you say it should work with an older version that still has the Renderer.resetGL function

johnnyz2017 commented 7 years ago

@jagenjo hope you can fix it soon. and I have a question in here that the 3D objects created via script (both litegl.js and three.js) can be access via the scene graph? or can they interact with each other?

many thanks for your help to understand it better.

jagenjo commented 7 years ago

No, because the editor doesnt know about them. But if you create the 3d objects using the LiteScene API then yes.

tornadory commented 7 years ago

@jagenjo thanks for your update, hope you can fix it ASAP.

jagenjo commented 6 years ago

ok, I fixed it, here is an example of scene:

http://www.tamats.com/projects/webglstudio/editor/fileserver/files//guest/projects/features/threeJS.scene.json

tornadory commented 6 years ago

@jagenjo cool! but I can not see anything from this scene, just a black screen, need the player do something else? I just use the load-scene example to load it.

jagenjo commented 6 years ago

Did you opened from the editor? you need to press play to see it.

tornadory commented 6 years ago

@jagenjo I upload it into webglstudio but can not open it as a scene, editor shows error : "Insert not implemented for this resource type: Resource"

@jagenjo before that, I tried to use litescene (Player) directly to open it(have updated all of the current script)

jagenjo commented 6 years ago

go to webglstudio -> project -> load -> from URL and paste the URL I gave you

tornadory commented 6 years ago

@jagenjo sorry, too late to reply, but still not work, some error shows when I tried to run it:

three.min.js:539 Uncaught TypeError: Cannot assign to read only property 'getAttribute' of object '#'

Uncaught TypeError: THREE.Scene is not a constructor

seems that ThreeJS still not loaded normally.

jagenjo commented 6 years ago

Strange, I fixed that bug in LiteScene. Are you sure you are using the latest version from the repository?

tornadory commented 6 years ago

I just used http://webglstudio.org/demo/, so you mean I need use litescene directly? oh...

jagenjo commented 6 years ago

Sorry, that version usually has the old version because is the stable one, if you want the new features always go to http://webglstudio.org/latest/

tornadory commented 6 years ago

@jagenjo cool, I got it.

I downloaded the scene file and use load from file function and finally it works, I see the cube.

It's great!