<commit_before>//TODO: perhaps object hover/select and other interactions other than basic camera movement should be moved
//out of viewer
//TODO: offload handling of complexities of renderer(s) into a renderManager of sorts
Polymer('three-viewer', {
  viewAngle: 40,
  cameraUp : [0,0,1],
  projection: "perspective",
  orientation: "diagonal",
  autoRotate:false,
  
	showShadows:true,
	showStats: false,
	showAxes:true,

  //full screen postprocessing
  postProcess:false,
  fullScreen:false,

  //additional
  lighting: null,

  selectedObject : null,

  //generic custom element callbacks
  created: function() {
    this.width = 0;
    this.height = 0;
    this.bg = "rgb(255, 255, 255)";

	  this.scene = new THREE.Scene();
    this.rootAssembly = new THREE.Object3D();
  },
  ready:function(){
    this.cameraUp = new THREE.Vector3(this.cameraUp[0],this.cameraUp[1],this.cameraUp[2]);
  },
  enteredView: function() {
    this._setStyle();
    this.init();
    this.animate();

    //setup various handlers
    window.addEventListener("resize",this.onResize.bind(this));

    if (this.requestFullscreen) document.addEventListener("fullscreenchange", this.onFullScreenChange.bind(this), false);
    if (this.mozRequestFullScreen) document.addEventListener("mozfullscreenchange", this.onFullScreenChange.bind(this), false);
    if (this.webkitRequestFullScreen) document.addEventListener("webkitfullscreenchange", this.onFullScreenChange.bind(this), false);
  },
  //public api
  clearScene:function()
  {
    while (this.rootAssembly.children.length > 0) {
      this.rootAssembly.remove(this.rootAssembly.children[this.rootAssembly.children.length - 1]);
    }

    // cleanup without calling render (data needs to be cleaned up before a new scene can be generated)
    //see here https://github.com/mrdoob/three.js/issues/2760
    if(this.renderer instanceof THREE.WebGLRenderer)
    {
      this.renderer.initWebGLObjects(this.scene);
    }
  },
	addToScene: function ( object , options)
	{
    /*
    var center = options.center || true;
    var resize = options.resize || true;<commit_msg>- added orientation change handler to correctly resize viewport or mobile rotation (closes #5 )<commit_after>//TODO: perhaps object hover/select and other interactions other than basic camera movement should be moved
//out of viewer
//TODO: offload handling of complexities of renderer(s) into a renderManager of sorts
Polymer('three-viewer', {
  viewAngle: 40,
  cameraUp : [0,0,1],
  projection: "perspective",
  orientation: "diagonal",
  autoRotate:false,
  
	showShadows:true,
	showStats: false,
	showAxes:true,

  //full screen postprocessing
  postProcess:false,
  fullScreen:false,

  //additional
  lighting: null,

  selectedObject : null,

  //generic custom element callbacks
  created: function() {
    this.width = 0;
    this.height = 0;
    this.bg = "rgb(255, 255, 255)";

	  this.scene = new THREE.Scene();
    this.rootAssembly = new THREE.Object3D();
  },
  ready:function(){
    this.cameraUp = new THREE.Vector3(this.cameraUp[0],this.cameraUp[1],this.cameraUp[2]);
  },
  enteredView: function() {
    this._setStyle();
    this.init();
    this.animate();

    //setup various handlers
    window.addEventListener("resize",this.onResize.bind(this));
    window.addEventListener("orientationchange",this.onResize.bind(this));

    if (this.requestFullscreen) document.addEventListener("fullscreenchange", this.onFullScreenChange.bind(this), false);
    if (this.mozRequestFullScreen) document.addEventListener("mozfullscreenchange", this.onFullScreenChange.bind(this), false);
    if (this.webkitRequestFullScreen) document.addEventListener("webkitfullscreenchange", this.onFullScreenChange.bind(this), false);
  },
  //public api
  clearScene:function()
  {
    while (this.rootAssembly.children.length > 0) {
      this.rootAssembly.remove(this.rootAssembly.children[this.rootAssembly.children.length - 1]);
    }

    // cleanup without calling render (data needs to be cleaned up before a new scene can be generated)
    //see here https://github.com/mrdoob/three.js/issues/2760
    if(this.renderer instanceof THREE.WebGLRenderer)
    {
      this.renderer.initWebGLObjects(this.scene);
    }
  },
	addToScene: function ( object , options)
	{
    /*
    var center = options.center || true;
    var resize = options.resize || true;
{'fraction_non_alphanumeric': 0.1241110346409727, 'fraction_numerical': 0.012617572837806837, 'mean_word_length': 4.023041474654378, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1017518', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1289, 'n_words': 306}