提交 06ba5eba 编写于 作者: W WestLangley

equiangular -> equirectangular

上级 c0e66929
......@@ -2,7 +2,7 @@
* @author Richard M. / https://github.com/richardmonette
*/
THREE.EquiangularToCubeGenerator = function ( sourceTexture, resolution ) {
THREE.EquirectangularToCubeGenerator = function ( sourceTexture, resolution ) {
this.sourceTexture = sourceTexture;
this.resolution = resolution;
......@@ -36,9 +36,9 @@ THREE.EquiangularToCubeGenerator = function ( sourceTexture, resolution ) {
};
THREE.EquiangularToCubeGenerator.prototype = {
THREE.EquirectangularToCubeGenerator.prototype = {
constructor: THREE.EquiangularToCubeGenerator,
constructor: THREE.EquirectangularToCubeGenerator,
update: function ( renderer ) {
......@@ -81,7 +81,7 @@ THREE.EquiangularToCubeGenerator.prototype = {
varying vec3 localPosition;\n\
uniform sampler2D equirectangularMap;\n\
\n\
vec2 EquiangularSampleUV(vec3 v) {\n\
vec2 EquirectangularSampleUV(vec3 v) {\n\
vec2 uv = vec2(atan(v.z, v.x), asin(v.y));\n\
uv *= vec2(0.1591, 0.3183); // inverse atan\n\
uv += 0.5;\n\
......@@ -89,7 +89,7 @@ THREE.EquiangularToCubeGenerator.prototype = {
}\n\
\n\
void main() {\n\
vec2 uv = EquiangularSampleUV(normalize(localPosition));\n\
vec2 uv = EquirectangularSampleUV(normalize(localPosition));\n\
vec3 color = texture2D(equirectangularMap, uv).rgb;\n\
\n\
gl_FragColor = vec4( color, 1.0 );\n\
......@@ -99,7 +99,7 @@ THREE.EquiangularToCubeGenerator.prototype = {
} );
shaderMaterial.type = 'EquiangularToCubeGenerator';
shaderMaterial.type = 'EquirectangularToCubeGenerator';
return shaderMaterial;
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>threejs webgl - materials - equiangular exr image based lighting</title>
<title>threejs webgl - materials - equirectangular exr image based lighting</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
......@@ -28,13 +28,13 @@
<body>
<div id="container"></div>
<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">threejs</a> - Example of an IBL (Image based lighting) pipeline based around<br> equiangular EXR lightprobe data. Created by <a href="https://github.com/richardmonette" target="_blank" rel="noopener">Richard Monette</a></div>
<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">threejs</a> - Example of an IBL (Image based lighting) pipeline based around<br> equirectangular EXR lightprobe data. Created by <a href="https://github.com/richardmonette" target="_blank" rel="noopener">Richard Monette</a></div>
<script src="../build/three.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/loaders/EXRLoader.js"></script>
<script src="js/loaders/EquiangularToCubeGenerator.js"></script>
<script src="js/loaders/EquirectangularToCubeGenerator.js"></script>
<script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script>
......@@ -106,7 +106,7 @@
texture.magFilter = THREE.NearestFilter;
texture.encoding = THREE.LinearEncoding;
var cubemapGenerator = new THREE.EquiangularToCubeGenerator( texture, 512 );
var cubemapGenerator = new THREE.EquirectangularToCubeGenerator( texture, 512 );
var cubeMapTexture = cubemapGenerator.update( renderer );
var pmremGenerator = new THREE.PMREMGenerator( cubeMapTexture );
......@@ -124,11 +124,11 @@
} );
new THREE.TextureLoader().load( 'textures/equiangular.png', function ( texture ) {
new THREE.TextureLoader().load( 'textures/equirectangular.png', function ( texture ) {
texture.encoding = THREE.sRGBEncoding;
var cubemapGenerator = new THREE.EquiangularToCubeGenerator( texture, 512 );
var cubemapGenerator = new THREE.EquirectangularToCubeGenerator( texture, 512 );
var cubeMapTexture = cubemapGenerator.update( renderer );
var pmremGenerator = new THREE.PMREMGenerator( cubeMapTexture );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册