2
0
Mr.doob 1 жил өмнө
parent
commit
a1dc93c971

+ 72 - 3
build/three.cjs

@@ -23793,6 +23793,72 @@ function WebGLState( gl ) {
 
 
 }
 }
 
 
+function contain( texture, aspect ) {
+
+	const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
+
+	if ( imageAspect > aspect ) {
+
+		texture.repeat.x = 1;
+		texture.repeat.y = imageAspect / aspect;
+
+		texture.offset.x = 0;
+		texture.offset.y = ( 1 - texture.repeat.y ) / 2;
+
+	} else {
+
+		texture.repeat.x = aspect / imageAspect;
+		texture.repeat.y = 1;
+
+		texture.offset.x = ( 1 - texture.repeat.x ) / 2;
+		texture.offset.y = 0;
+
+	}
+
+	return texture;
+
+}
+
+function cover( texture, aspect ) {
+
+	const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
+
+	if ( imageAspect > aspect ) {
+
+		texture.repeat.x = aspect / imageAspect;
+		texture.repeat.y = 1;
+
+		texture.offset.x = ( 1 - texture.repeat.x ) / 2;
+		texture.offset.y = 0;
+
+	} else {
+
+		texture.repeat.x = 1;
+		texture.repeat.y = imageAspect / aspect;
+
+		texture.offset.x = 0;
+		texture.offset.y = ( 1 - texture.repeat.y ) / 2;
+
+	}
+
+	return texture;
+
+}
+
+function fill( texture ) {
+
+	texture.repeat.x = 1;
+	texture.repeat.y = 1;
+
+	texture.offset.x = 0;
+	texture.offset.y = 0;
+
+	return texture;
+
+}
+
+
+
 /**
 /**
  * Given the width, height, format, and type of a texture. Determines how many
  * Given the width, height, format, and type of a texture. Determines how many
  * bytes must be used to represent the texture.
  * bytes must be used to represent the texture.
@@ -23928,7 +23994,10 @@ function getTextureTypeByteLength( type ) {
 }
 }
 
 
 const TextureUtils = {
 const TextureUtils = {
-	getByteLength,
+	contain,
+	cover,
+	fill,
+	getByteLength
 };
 };
 
 
 function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
 function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
@@ -24782,7 +24851,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 
 										if ( texture.layerUpdates.size > 0 ) {
 										if ( texture.layerUpdates.size > 0 ) {
 
 
-											const layerByteLength = TextureUtils.getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
+											const layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
 
 
 											for ( const layerIndex of texture.layerUpdates ) {
 											for ( const layerIndex of texture.layerUpdates ) {
 
 
@@ -24908,7 +24977,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 
 						if ( texture.layerUpdates.size > 0 ) {
 						if ( texture.layerUpdates.size > 0 ) {
 
 
-							const layerByteLength = TextureUtils.getByteLength( image.width, image.height, texture.format, texture.type );
+							const layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );
 
 
 							for ( const layerIndex of texture.layerUpdates ) {
 							for ( const layerIndex of texture.layerUpdates ) {
 
 

+ 72 - 3
build/three.module.js

@@ -23791,6 +23791,72 @@ function WebGLState( gl ) {
 
 
 }
 }
 
 
+function contain( texture, aspect ) {
+
+	const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
+
+	if ( imageAspect > aspect ) {
+
+		texture.repeat.x = 1;
+		texture.repeat.y = imageAspect / aspect;
+
+		texture.offset.x = 0;
+		texture.offset.y = ( 1 - texture.repeat.y ) / 2;
+
+	} else {
+
+		texture.repeat.x = aspect / imageAspect;
+		texture.repeat.y = 1;
+
+		texture.offset.x = ( 1 - texture.repeat.x ) / 2;
+		texture.offset.y = 0;
+
+	}
+
+	return texture;
+
+}
+
+function cover( texture, aspect ) {
+
+	const imageAspect = ( texture.image && texture.image.width ) ? texture.image.width / texture.image.height : 1;
+
+	if ( imageAspect > aspect ) {
+
+		texture.repeat.x = aspect / imageAspect;
+		texture.repeat.y = 1;
+
+		texture.offset.x = ( 1 - texture.repeat.x ) / 2;
+		texture.offset.y = 0;
+
+	} else {
+
+		texture.repeat.x = 1;
+		texture.repeat.y = imageAspect / aspect;
+
+		texture.offset.x = 0;
+		texture.offset.y = ( 1 - texture.repeat.y ) / 2;
+
+	}
+
+	return texture;
+
+}
+
+function fill( texture ) {
+
+	texture.repeat.x = 1;
+	texture.repeat.y = 1;
+
+	texture.offset.x = 0;
+	texture.offset.y = 0;
+
+	return texture;
+
+}
+
+
+
 /**
 /**
  * Given the width, height, format, and type of a texture. Determines how many
  * Given the width, height, format, and type of a texture. Determines how many
  * bytes must be used to represent the texture.
  * bytes must be used to represent the texture.
@@ -23926,7 +23992,10 @@ function getTextureTypeByteLength( type ) {
 }
 }
 
 
 const TextureUtils = {
 const TextureUtils = {
-	getByteLength,
+	contain,
+	cover,
+	fill,
+	getByteLength
 };
 };
 
 
 function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
 function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
@@ -24780,7 +24849,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 
 										if ( texture.layerUpdates.size > 0 ) {
 										if ( texture.layerUpdates.size > 0 ) {
 
 
-											const layerByteLength = TextureUtils.getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
+											const layerByteLength = getByteLength( mipmap.width, mipmap.height, texture.format, texture.type );
 
 
 											for ( const layerIndex of texture.layerUpdates ) {
 											for ( const layerIndex of texture.layerUpdates ) {
 
 
@@ -24906,7 +24975,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 
 						if ( texture.layerUpdates.size > 0 ) {
 						if ( texture.layerUpdates.size > 0 ) {
 
 
-							const layerByteLength = TextureUtils.getByteLength( image.width, image.height, texture.format, texture.type );
+							const layerByteLength = getByteLength( image.width, image.height, texture.format, texture.type );
 
 
 							for ( const layerIndex of texture.layerUpdates ) {
 							for ( const layerIndex of texture.layerUpdates ) {
 
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
build/three.module.min.js


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно