Multiple viewers in 1 page

Nicat
Posts: 2
Joined: Wed Apr 12, 2017 3:33 pm

Multiple viewers in 1 page

Postby Nicat » Wed Apr 12, 2017 3:46 pm

Hello,
I'm trying to change scenes via js,

Code: Select all

viewer.story.loadScene(c);
used this, then this

Code: Select all

viewer.story.sceneUid = c;
all changing scene actions changing in all Forge.viewer elements.
So my question: when u have multiple elements in one page, is there any other methods for changing scene?
which will not affect to other viewers

My test code:
https://codepen.io/Nodelines/pen/GmRNYJ

User avatar
rroux
ForgeJS Team
Posts: 91
Joined: Wed Oct 26, 2016 12:19 pm

Re: Multiple viewers in 1 page

Postby rroux » Thu Apr 13, 2017 3:27 pm

Hi Nicat,

In fact we did not test this case, so thank you very much for this very clear sample!
I will make multi instances tests as soon as possible.
I'll try to get back to you with an answer during next week.

Did you tried with the non minified code and break points, any clues?

Have a nice week end!
- Raphaël

Nicat
Posts: 2
Joined: Wed Apr 12, 2017 3:33 pm

Re: Multiple viewers in 1 page

Postby Nicat » Sat Apr 15, 2017 2:57 am

So i found out FORGE.BackgroundShaderRenderer._mesh.material.uniforms a same for both viewers, cus they linked with

Code: Select all

this._viewer.renderer.view.current.shaderSTW
, so when changing texture in other viewer changes too, so i cloned this with

Code: Select all

var shaderSTW = JSON.parse(JSON.stringify(this._viewer.renderer.view.current.shaderSTW));
and now works perfect

User avatar
rroux
ForgeJS Team
Posts: 91
Joined: Wed Oct 26, 2016 12:19 pm

Re: Multiple viewers in 1 page

Postby rroux » Sat Apr 15, 2017 9:31 pm

Hi Nicat,

thank you very much for your investigation!
I'll try to push a fix next week based on your informations :)

Have a nice week end!
- Raphaël

User avatar
rroux
ForgeJS Team
Posts: 91
Joined: Wed Oct 26, 2016 12:19 pm

Re: Multiple viewers in 1 page

Postby rroux » Tue Apr 25, 2017 8:33 am

Hi Nicat,

I still working on the multiple instances case, because it does not affects only the shaders, it also affects plugins for example.
That's why there's no fix for multiple viewers in the 0.9.2 release.
I'll tell you when my fix will be in the master!

Have a nice day!
- Raphaël

User avatar
rroux
ForgeJS Team
Posts: 91
Joined: Wed Oct 26, 2016 12:19 pm

Re: Multiple viewers in 1 page

Postby rroux » Tue Apr 25, 2017 9:45 am

Hey, I have a pull request for the multiple instance case if want to test it!
https://github.com/gopro/forgejs/pull/59
- Raphaël

gwhiz
Posts: 4
Joined: Mon May 15, 2017 3:09 pm

Re: Multiple viewers in 1 page

Postby gwhiz » Mon May 15, 2017 3:16 pm

rroux wrote:Hey, I have a pull request for the multiple instance case if want to test it!
https://github.com/gopro/forgejs/pull/59


Hi, so can we have multiple viewers per page now? Is there a limit to the number ? Is there an issue having one viewer that is not displayed, but is running anyway?

User avatar
rroux
ForgeJS Team
Posts: 91
Joined: Wed Oct 26, 2016 12:19 pm

Re: Multiple viewers in 1 page

Postby rroux » Wed May 17, 2017 12:13 pm

Hi gwhiz,

We do not test how many Viewers you can have at the same time.
I know that you have to disable the history feature to make it work like in this example : https://github.com/gopro/forgejs-sample ... fig-0.json

I don't think that have an hidden Viewer running is a problem but we haven't tested it.

If you make some test you can provide feedback.

Have a nice day!
- Raphaël

Who is online

Users browsing this forum: No registered users and 1 guest