<commit_before>define(
  [ 'collection/Map', 'render/Camera2D', 'core/Math', 'lib/Detector', 'lib/Three' ],
  function( Map, Camera2D, Math, _Detector, _Three ) {

    var instance = null;

    var SceneManager = function() {
      this.cameras = new Map();
      this.cameraIterator = this.cameras.iterator();
      this.scenes = new Map();
    };

    SceneManager.prototype.DEFAULT_CAMERA_ID = 'default_camera_id';
    SceneManager.prototype.DEFAULT_SCENE_ID = 'default_scene_id';

    SceneManager.prototype.init = function( bgcolor, width, height, target ) {
      // If its not supported, instantiate the canvas renderer to support all non WebGL browsers
      this.renderer = Detector.webgl ? new THREE.WebGLRenderer( { antialias: false } ) : new THREE.CanvasRenderer();

      // Set the background color of the renderer, with full opacity
      this.renderer.setClearColor( ( bgcolor ) ? bgcolor : 0xFFFFFF, 1 );

      // if no dimensions are provided, get the size of the inner window (content area) to create a full size renderer
      this.canvasWidth = ( width ) ? width : window.innerWidth;
      this.canvasHeight = ( height ) ? height : window.innerHeight;

      // since the rendering area is actually 3D, a Z translation on camera is required.
      this.z = Math.max( this.canvasWidth, this.canvasHeight );

      // set the renderer size
      this.renderer.setSize( this.canvasWidth, this.canvasHeight );

      // attach a canvas tag on the body
      var body = ( target ) ? target : document.getElementsByTagName( 'body' )[ 0 ];
      body.appendChild( this.renderer.domElement );

      this.createScene();
      this.createCamera();
    };

    // create a THREE.scene
    SceneManager.prototype.createScene = function( sceneId ) {
      this.scenes.put( sceneId ? sceneId : this.DEFAULT_SCENE_ID, new THREE.Scene() );
    };

    // create a camera to a scene
    SceneManager.prototype.createCamera = function( cameraId, sceneId, width, height ) {
      var scene = this.scenes.get( ( sceneId ) ? sceneId : this.DEFAULT_SCENE_ID );

      if( !cameraId ) {
        cameraId = this.DEFAULT_CAMERA_ID;
      }

      if( !width ) {
        width = this.canvasWidth;
      }

      if( !height ) {
        height = this.canvasHeight;
      }

      if( scene ) {
        // left, right, top, bottom, near, far
        var camera = new Camera2D( width / -2, width / 2, height / -2, height / 2, 1, Math.max( width, height ) );

        camera.addScene( ( sceneId ) ? sceneId : this.DEFAULT_SCENE_ID, scene );
        this.cameras.put( cameraId, camera );<commit_msg>Z near and Z far minor fix to allow better rotations (X, Y, Z)<commit_after>define(
  [ 'collection/Map', 'render/Camera2D', 'core/Math', 'lib/Detector', 'lib/Three' ],
  function( Map, Camera2D, Math, _Detector, _Three ) {

    var instance = null;

    var SceneManager = function() {
      this.cameras = new Map();
      this.cameraIterator = this.cameras.iterator();
      this.scenes = new Map();
    };

    SceneManager.prototype.DEFAULT_CAMERA_ID = 'default_camera_id';
    SceneManager.prototype.DEFAULT_SCENE_ID = 'default_scene_id';

    SceneManager.prototype.init = function( bgcolor, width, height, target ) {
      // If its not supported, instantiate the canvas renderer to support all non WebGL browsers
      this.renderer = Detector.webgl ? new THREE.WebGLRenderer( { antialias: false } ) : new THREE.CanvasRenderer();

      // Set the background color of the renderer, with full opacity
      this.renderer.setClearColor( ( bgcolor ) ? bgcolor : 0xFFFFFF, 1 );

      // if no dimensions are provided, get the size of the inner window (content area) to create a full size renderer
      this.canvasWidth = ( width ) ? width : window.innerWidth;
      this.canvasHeight = ( height ) ? height : window.innerHeight;

      // since the rendering area is actually 3D, a Z translation on camera is required.
      this.z = Math.max( this.canvasWidth, this.canvasHeight );

      // set the renderer size
      this.renderer.setSize( this.canvasWidth, this.canvasHeight );

      // attach a canvas tag on the body
      var body = ( target ) ? target : document.getElementsByTagName( 'body' )[ 0 ];
      body.appendChild( this.renderer.domElement );

      this.createScene();
      this.createCamera();
    };

    // create a THREE.scene
    SceneManager.prototype.createScene = function( sceneId ) {
      this.scenes.put( sceneId ? sceneId : this.DEFAULT_SCENE_ID, new THREE.Scene() );
    };

    // create a camera to a scene
    SceneManager.prototype.createCamera = function( cameraId, sceneId, width, height ) {
      var scene = this.scenes.get( ( sceneId ) ? sceneId : this.DEFAULT_SCENE_ID );

      if( !cameraId ) {
        cameraId = this.DEFAULT_CAMERA_ID;
      }

      if( !width ) {
        width = this.canvasWidth;
      }

      if( !height ) {
        height = this.canvasHeight;
      }

      if( scene ) {
        // left, right, top, bottom, near, far
        var camera = new Camera2D( width / -2, width / 2, height / -2, height / 2, Math.max( width, height ) / -2, Math.max( width, height ) / 2 );

        camera.addScene( ( sceneId ) ? sceneId : this.DEFAULT_SCENE_ID, scene );
        this.cameras.put( cameraId, camera );
{'fraction_non_alphanumeric': 0.11569148936170212, 'fraction_numerical': 0.004749240121580547, 'mean_word_length': 2.7155963302752295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4870487', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1540, 'n_words': 453}