model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

addon boilerplate?

Open coderofsalvation opened this issue 1 year ago • 0 comments

Description

First of all thanks for all the work on this wonderful project. Can somebody be so kind to provide some boilerplate for addons to get the scene, camera & renderer? I've looked at the effects-composer addon, but I wasn't able to understand the Symbol magic. In the console I tried retrieving the THREEjs scene on the modelviewer.dev page:

Live Demo

  const enableAddon = (modelviewer) => {
    modelviewer.addEventListener('before-render', function(e){
      let sceneSymbol = 'Symbol("scene")'
      let symbols = Object.getOwnPropertySymbols(this);
      let sceneValue = this[symbols.find(symbol => symbol === sceneSymbol)];
      console.log(sceneSymbol)
      console.dir(symbols)
      console.dir(sceneValue)
    })
  }
  
  let els = [ ...document.body.querySelectorAll('model-viewer') ]
  els.map( enableAddon )

But I can't seem to access those symbols...any idea? My main interest is: THREE's camera, scene and renderer

Version

model-viewer: v3.5.0

Browser Affected

  • [x] Firefox

OS

  • [x] Linux

coderofsalvation avatar May 20 '24 14:05 coderofsalvation