We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Multiple Verg3D projects with angular

Home Forums Programming Multiple Verg3D projects with angular

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21196
    ubul
    Participant

    Hi.First, sorry for my poor english.

    I’m new with Verge 3D, and i not programming with yet, I just use in an angular based website.

    I client who I work for give me three pieces of 3d verge projects. All project are similar (3D buildings)

    He want that i put the buildings to his website and change the buildings when the users clicks buttons (without refresh)

    In an angular controller, there is a run function, and when the user clicks one of the houses icons, every time call the run function, that contains:

    – initial settings (for example: load logicURL js file, gltf file load, app initialization with new v3d.App(…), app.loadScene(…), and app.run();

    – so when the user clicks one after another building model, loader appears every time, and the site is getting slower and slower every time, because the buildings are initializing and load every time and finally the memory is becomes full

    Is there some way to load all buildings at the same time with angular (1.7) (but yes, it’s different projects with different gltf), and change the projects without slowing down the website?

    I know, there is another way if I refresh the page when the user changes the buildings (because every refresh the memory is released), but the client don’t want to get out the angular code from his website.

    #21197

    Hello,

    You can use the same Verge3D project which loads different glTF scenes every time the user clicks a button.

    See the code generated by these puzzles in the visual_logic.js file. Or juts use those puzzles coupled with JavaScript.

    Chief 3D Verger | LinkedIn | Twitter

    #21200
    ubul
    Participant

    thx, I can change the gltf now, but I don’t now it is correct :D

    I declare self.app variable first and i add the app varibale to global after app.loadScene(…).

    
    self.app = app;
    

    When the user clicks another radio button (another building type)

    – I call the self.app.unload();
    – get another sceneURL with the chosen gltf
    – and I call again the app.loadScene but from the global variable:

    
    self.app.loadScene(sceneURL, function () {
                        runCode(self.app, directory);
                        self.app.enableControls();
                        self.app.run();
                        if (v3d.PE)
                            v3d.PE.updateAppInstance(self.app);
                        if (v3d.PL)
                            v3d.PL.init(self.app, initOptions);
                    }, null, function () {
                        console.log('Can\'t load the scene ' + sceneURL);
                    });
    

    The loader is missing now, and better the speed, but can I change the visual logic too? Like .loadSceneWithLogic() in here: https://www.soft8soft.com/docs/api/en/extras/AppPuzzles.html#loadSceneWithLogic

    Because I add the logic file first when i call first the run() function and initialize v3d.

    
    new v3d.PuzzlesLoader().loadLogic(logicURL, function () {
                        var initOptions = v3d.PL ? v3d.PL.execInitPuzzles().initOptions
                                : {useFullscreen: true};
                        loadScene(sceneURL, initOptions, directory);
                    });
    

    but when the user choose another building, I don’t initialize again the v3d to load the logic

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.