<commit_before>/**
 * @author <NAME> / spidersharma03
 * @author <NAME> / bhouston, https://clara.io
 *
 * To avoid cube map seams, I create an extra pixel around each face. This way when the cube map is
 * sampled by an application later(with a little care by sampling the centre of the texel), the extra 1 border
 *  of pixels makes sure that there is no seams artifacts present. This works perfectly for cubeUV format as
 *  well where the 6 faces can be arranged in any manner whatsoever.
 * Code in the beginning of fragment shader's main function does this job for a given resolution.
 *  Run Scene_PMREM_Test.html in the examples directory to see the sampling from the cube lods generated
 *  by this class.
 */

 THREE.PMREMGenerator = function( sourceTexture ) {
	if ( sourceTexture instanceof THREE.CubeTexture ) {

		if ( sourceTexture.images[ 0 ] === undefined )
		  console.error( "sourceTexture Not Initialized" );
      if(sourceTexture.images[ 0 ] instanceof THREE.DataTexture) {
          this.resolution = sourceTexture.images[ 0 ].image.width;
      }
      else {
          this.resolution = sourceTexture.images[ 0 ].width;
      }

	}
	else if ( sourceTexture instanceof THREE.WebGLRenderTargetCube ) {
		if ( sourceTexture === undefined ) console.error( "Render Target Not Initialized" );
		this.resolution = sourceTexture.width;
	}
	else {
		console.error( "Wrong Input to PMREMGenerator" );
	}
	this.sourceTexture = sourceTexture;

  var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
    ( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );

  this.sourceTexture.minFilter = ( monotonicEncoding ) ? THREE.LinearFilter : THREE.NearestFilter;
  this.sourceTexture.magFilter = ( monotonicEncoding ) ? THREE.LinearFilter : THREE.NearestFilter;
  this.sourceTexture.generateMipmaps = this.sourceTexture.generateMipmaps && monotonicEncoding;

	this.cubeLods = [];

	var size = this.resolution;
  var params = { format: this.sourceTexture.format, magFilter: this.sourceTexture.magFilter, minFilter: this.sourceTexture.minFilter, type: this.sourceTexture.type };

  // how many LODs fit in the given CubeUV Texture.
	this.numLods = Math.log2( size ) - 2;
  for ( var i = 0; i < this.numLods; i ++ ) {
		var renderTarget = new THREE.WebGLRenderTargetCube( size, size, params );<commit_msg>pick a good default PMREMGenerator cube size, and allow it to be overriden.<commit_after>/**
 * @author <NAME> / spidersharma03
 * @author <NAME> / bhouston, https://clara.io
 *
 * To avoid cube map seams, I create an extra pixel around each face. This way when the cube map is
 * sampled by an application later(with a little care by sampling the centre of the texel), the extra 1 border
 *  of pixels makes sure that there is no seams artifacts present. This works perfectly for cubeUV format as
 *  well where the 6 faces can be arranged in any manner whatsoever.
 * Code in the beginning of fragment shader's main function does this job for a given resolution.
 *  Run Scene_PMREM_Test.html in the examples directory to see the sampling from the cube lods generated
 *  by this class.
 */

THREE.PMREMGenerator = function( sourceTexture, resolution ) {

	this.sourceTexture = sourceTexture;
  this.resolution = ( resolution !== undefined ) ? resolution : 256;

  var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
    ( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );

  this.sourceTexture.minFilter = ( monotonicEncoding ) ? THREE.LinearFilter : THREE.NearestFilter;
  this.sourceTexture.magFilter = ( monotonicEncoding ) ? THREE.LinearFilter : THREE.NearestFilter;
  this.sourceTexture.generateMipmaps = this.sourceTexture.generateMipmaps && monotonicEncoding;

	this.cubeLods = [];

	var size = this.resolution;
  var params = { format: this.sourceTexture.format, magFilter: this.sourceTexture.magFilter, minFilter: this.sourceTexture.minFilter, type: this.sourceTexture.type };

  // how many LODs fit in the given CubeUV Texture.
	this.numLods = Math.log2( size ) - 2;
  for ( var i = 0; i < this.numLods; i ++ ) {
		var renderTarget = new THREE.WebGLRenderTargetCube( size, size, params );
{'fraction_non_alphanumeric': 0.0944236176194939, 'fraction_numerical': 0.0049203373945641985, 'mean_word_length': 4.046099290780142, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '5306450', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1166, 'n_words': 416}