From ed70516e4e1aee4582a90ce9bb83c586d7c3434c Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 17 Nov 2014 19:16:02 +0100 Subject: [PATCH] Removed SphericalRefractionMapping. See #5622. --- docs/api/constants/Textures.html | 3 +-- docs/api/extras/ImageUtils.html | 2 +- docs/api/textures/CompressedTexture.html | 2 +- docs/api/textures/DataTexture.html | 2 +- docs/api/textures/Texture.html | 2 +- examples/canvas_materials.html | 3 +-- examples/js/renderers/CanvasRenderer.js | 17 ----------------- examples/webgl_environment_maps.html | 2 -- src/Three.js | 7 +++---- src/renderers/WebGLRenderer.js | 1 - src/renderers/webgl/WebGLProgram.js | 14 ++++++++++---- .../blender/addons/io_three/__init__.py | 3 +-- .../blender/addons/io_three/constants.py | 3 +-- 13 files changed, 21 insertions(+), 40 deletions(-) diff --git a/docs/api/constants/Textures.html b/docs/api/constants/Textures.html index d6a8c56347..4bc5587aa7 100644 --- a/docs/api/constants/Textures.html +++ b/docs/api/constants/Textures.html @@ -21,8 +21,7 @@ THREE.UVMapping
THREE.CubeReflectionMapping
THREE.CubeRefractionMapping
- THREE.SphericalReflectionMapping
- THREE.SphericalRefractionMapping + THREE.SphericalReflectionMapping

Wrapping Modes

diff --git a/docs/api/extras/ImageUtils.html b/docs/api/extras/ImageUtils.html index 8c477f0dfe..676f7daa3f 100644 --- a/docs/api/extras/ImageUtils.html +++ b/docs/api/extras/ImageUtils.html @@ -58,7 +58,7 @@

[method:todo loadTexture]([page:String url], [page:UVMapping mapping], [page:Function onLoad], [page:Function onError])

url -- the url of the texture
- mapping -- Can be an instance of [page:UVMapping THREE.UVMapping], [page:CubeReflectionMapping THREE.CubeReflectionMapping], [page:SphericalReflectionMapping THREE.SphericalReflectionMapping] or [page:SphericalRefractionMapping THREE.SphericalRefractionMapping]. Describes how the image is applied to the object.
Use undefined instead of null as a default value. See mapping property of [page:Texture texture] for more details. + mapping -- Can be an instance of [page:UVMapping THREE.UVMapping], [page:CubeReflectionMapping THREE.CubeReflectionMapping] or [page:SphericalReflectionMapping THREE.SphericalReflectionMapping]. Describes how the image is applied to the object.
Use undefined instead of null as a default value. See mapping property of [page:Texture texture] for more details. onLoad -- callback function
onError -- callback function
diff --git a/docs/api/textures/CompressedTexture.html b/docs/api/textures/CompressedTexture.html index cbe8fa8adf..1e653b0d23 100644 --- a/docs/api/textures/CompressedTexture.html +++ b/docs/api/textures/CompressedTexture.html @@ -26,7 +26,7 @@ height -- The height of the biggest mipmap
format -- The format used in the mipmaps
type -- The type used in the mipmaps
- mapping -- How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; THREE.SphericalReflectionMapping, a spherical reflection map projection; and THREE.SphericalRefractionMapping.
+ mapping -- How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; and THREE.SphericalReflectionMapping, a spherical reflection map projection.
wrapS -- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
wrapT -- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
magFilter -- How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texels.
diff --git a/docs/api/textures/DataTexture.html b/docs/api/textures/DataTexture.html index 3af829ac99..26ecacc405 100644 --- a/docs/api/textures/DataTexture.html +++ b/docs/api/textures/DataTexture.html @@ -26,7 +26,7 @@ height -- The height of the image.
format -- The default is THREE.RGBAFormat for the texture. Other formats are: THREE.AlphaFormat, THREE.RGBFormat, THREE.LuminanceFormat, and THREE.LuminanceAlphaFormat. There are also compressed texture formats, if the S3TC extension is supported: THREE.RGB_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT3_Format, and THREE.RGBA_S3TC_DXT5_Format.
type -- The default is THREE.UnsignedByteType. Other valid types (as WebGL allows) are THREE.ByteType, THREE.ShortType, THREE.UnsignedShortType, THREE.IntType, THREE.UnsignedIntType, THREE.FloatType, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type, and THREE.UnsignedShort565Type.
- mapping -- How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; THREE.SphericalReflectionMapping, a spherical reflection map projection; and THREE.SphericalRefractionMapping.
+ mapping -- How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; and THREE.SphericalReflectionMapping, a spherical reflection map projection.
wrapS -- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
wrapT -- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
magFilter -- How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texel.
diff --git a/docs/api/textures/Texture.html b/docs/api/textures/Texture.html index 2e99540c34..b16f950594 100644 --- a/docs/api/textures/Texture.html +++ b/docs/api/textures/Texture.html @@ -40,7 +40,7 @@

[property:object mapping]

- How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; THREE.SphericalReflectionMapping, a spherical reflection map projection; and THREE.SphericalRefractionMapping. + How the image is applied to the object. An object type of THREE.UVMapping() is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; and THREE.SphericalReflectionMapping, a spherical reflection map projection.

[property:number wrapS]

diff --git a/examples/canvas_materials.html b/examples/canvas_materials.html index 35acdf3b54..6a3b7d7111 100644 --- a/examples/canvas_materials.html +++ b/examples/canvas_materials.html @@ -76,8 +76,7 @@ new THREE.MeshDepthMaterial( { overdraw: 0.5 } ), new THREE.MeshNormalMaterial( { overdraw: 0.5 } ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ), - new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', THREE.SphericalReflectionMapping ), overdraw: 0.5 } ), - new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', THREE.SphericalRefractionMapping ), overdraw: 0.5 } ) + new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/envmap.png', THREE.SphericalReflectionMapping ), overdraw: 0.5 } ) ]; diff --git a/examples/js/renderers/CanvasRenderer.js b/examples/js/renderers/CanvasRenderer.js index bc504e92c3..7fdbc33422 100644 --- a/examples/js/renderers/CanvasRenderer.js +++ b/examples/js/renderers/CanvasRenderer.js @@ -728,25 +728,8 @@ THREE.CanvasRenderer = function ( parameters ) { patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap ); - } else if ( mapping === THREE.SphericalRefractionMapping ) { - - _normal.copy( element.vertexNormalsModel[ uv1 ] ).applyMatrix3( _normalViewMatrix ); - _uv1x = - 0.5 * _normal.x + 0.5; - _uv1y = - 0.5 * _normal.y + 0.5; - - _normal.copy( element.vertexNormalsModel[ uv2 ] ).applyMatrix3( _normalViewMatrix ); - _uv2x = - 0.5 * _normal.x + 0.5; - _uv2y = - 0.5 * _normal.y + 0.5; - - _normal.copy( element.vertexNormalsModel[ uv3 ] ).applyMatrix3( _normalViewMatrix ); - _uv3x = - 0.5 * _normal.x + 0.5; - _uv3y = - 0.5 * _normal.y + 0.5; - - patternPath( _v1x, _v1y, _v2x, _v2y, _v3x, _v3y, _uv1x, _uv1y, _uv2x, _uv2y, _uv3x, _uv3y, material.envMap ); - } - } else { _color.copy( material.color ); diff --git a/examples/webgl_environment_maps.html b/examples/webgl_environment_maps.html index db7db16783..1dd54c1ce2 100644 --- a/examples/webgl_environment_maps.html +++ b/examples/webgl_environment_maps.html @@ -72,11 +72,9 @@ if ( refract ) { textureEquirec.mapping = THREE.EquirectangularRefractionMapping; textureCube.mapping = THREE.CubeRefractionMapping; - textureSphere.mapping = THREE.SphericalRefractionMapping; } else { textureEquirec.mapping = THREE.EquirectangularReflectionMapping; textureCube.mapping = THREE.CubeReflectionMapping; - textureSphere.mapping = THREE.SphericalReflectionMapping; } sphereMaterial.needsUpdate = true; } diff --git a/src/Three.js b/src/Three.js index 6c7dc46664..f9689195dc 100644 --- a/src/Three.js +++ b/src/Three.js @@ -120,11 +120,10 @@ THREE.UVMapping = 300; THREE.CubeReflectionMapping = 301; THREE.CubeRefractionMapping = 302; -THREE.SphericalReflectionMapping = 303; -THREE.SphericalRefractionMapping = 304; +THREE.EquirectangularReflectionMapping = 303; +THREE.EquirectangularRefractionMapping = 304; -THREE.EquirectangularReflectionMapping = 305; -THREE.EquirectangularRefractionMapping = 306; +THREE.SphericalReflectionMapping = 305; // Wrapping modes diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index a7228a5879..fdc32c0391 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -4786,7 +4786,6 @@ THREE.WebGLRenderer = function ( parameters ) { uniforms.combine.value = material.combine; uniforms.useRefract.value = material.envMap && ( material.envMap.mapping === THREE.CubeRefractionMapping || - material.envMap.mapping === THREE.SphericalRefractionMapping || material.envMap.mapping === THREE.EquirectangularRefractionMapping ); } diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js index 66807c6284..59fc9f7589 100644 --- a/src/renderers/webgl/WebGLProgram.js +++ b/src/renderers/webgl/WebGLProgram.js @@ -85,21 +85,27 @@ THREE.WebGLProgram = ( function () { } var envMapTypeDefine = null; + if ( parameters.envMap ) { + switch ( material.envMap.mapping ) { + case THREE.CubeReflectionMapping: case THREE.CubeRefractionMapping: envMapTypeDefine = "ENVMAP_TYPE_CUBE"; break; - case THREE.SphericalReflectionMapping: - case THREE.SphericalRefractionMapping: - envMapTypeDefine = "ENVMAP_TYPE_SPHERE"; - break; + case THREE.EquirectangularReflectionMapping: case THREE.EquirectangularRefractionMapping: envMapTypeDefine = "ENVMAP_TYPE_EQUIREC"; break; + + case THREE.SphericalReflectionMapping: + envMapTypeDefine = "ENVMAP_TYPE_SPHERE"; + break; + } + } // console.log( "building new program " ); diff --git a/utils/exporters/blender/addons/io_three/__init__.py b/utils/exporters/blender/addons/io_three/__init__.py index f54b4cb0fb..5928ff6b29 100644 --- a/utils/exporters/blender/addons/io_three/__init__.py +++ b/utils/exporters/blender/addons/io_three/__init__.py @@ -151,8 +151,7 @@ def _mapping(index): types = (constants.MAPPING_TYPES.UV, constants.MAPPING_TYPES.CUBE_REFLECTION, constants.MAPPING_TYPES.CUBE_REFRACTION, - constants.MAPPING_TYPES.SPHERICAL_REFLECTION, - constants.MAPPING_TYPES.SPHERICAL_REFRACTION) + constants.MAPPING_TYPES.SPHERICAL_REFLECTION) return (types[index], types[index], types[index]) bpy.types.Texture.THREE_mapping = EnumProperty( diff --git a/utils/exporters/blender/addons/io_three/constants.py b/utils/exporters/blender/addons/io_three/constants.py index 99c4db054d..18b514d1ed 100644 --- a/utils/exporters/blender/addons/io_three/constants.py +++ b/utils/exporters/blender/addons/io_three/constants.py @@ -29,8 +29,7 @@ MAPPING_TYPES = type('Mapping', (), { 'UV': 'UVMapping', 'CUBE_REFLECTION': 'CubeReflectionMapping', 'CUBE_REFRACTION': 'CubeRefractionMapping', - 'SPHERICAL_REFLECTION': 'SphericalReflectionMapping', - 'SPHERICAL_REFRACTION': 'SphericalRefractionMapping' + 'SPHERICAL_REFLECTION': 'SphericalReflectionMapping' }) JSON = 'json' -- GitLab