David Catuhe 7 年之前
父节点
当前提交
7d0b0fd709

文件差异内容过多而无法显示
+ 7762 - 7762
Playground/babylon.d.txt


文件差异内容过多而无法显示
+ 5456 - 5456
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 4 - 4
dist/preview release/babylon.js


文件差异内容过多而无法显示
+ 3 - 23
dist/preview release/babylon.max.js


文件差异内容过多而无法显示
+ 3 - 23
dist/preview release/babylon.no-module.max.js


文件差异内容过多而无法显示
+ 4 - 4
dist/preview release/babylon.worker.js


文件差异内容过多而无法显示
+ 3 - 23
dist/preview release/es6.js


文件差异内容过多而无法显示
+ 4 - 4
dist/preview release/viewer/babylon.viewer.js


文件差异内容过多而无法显示
+ 3 - 23
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 10
src/Helpers/babylon.photoDome.ts

@@ -84,16 +84,7 @@ module BABYLON {
 
             // create
             let material = this._material = new BackgroundMaterial(name + "_material", scene);
-            if (this._useDirectMapping) {
-                this._mesh = BABYLON.Mesh.CreateSphere("sphere1", options.resolution, options.size, scene, false, BABYLON.Mesh.BACKSIDE);
-            } else {
-                this._mesh = MeshBuilder.CreateIcoSphere(name + "_mesh", {
-                    flat: false, // saves on vertex data
-                    radius: options.size,
-                    subdivisions: options.resolution,
-                    sideOrientation: Mesh.BACKSIDE // needs to be inside out
-                }, scene);    
-            }
+            this._mesh = BABYLON.Mesh.CreateSphere(name + "_mesh", options.resolution, options.size, scene, false, BABYLON.Mesh.BACKSIDE);
 
             // configure material
             material.opacityFresnel = false;

+ 1 - 10
src/Helpers/babylon.videoDome.ts

@@ -76,16 +76,7 @@ module BABYLON {
             let tempOptions: VideoTextureSettings = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true, poster: options.poster };
             let material = this._material = new BackgroundMaterial(name + "_material", scene);
             let texture = this._videoTexture = new VideoTexture(name + "_texture", urlsOrVideo, scene, false, this._useDirectMapping, Texture.TRILINEAR_SAMPLINGMODE, tempOptions);
-            if (this._useDirectMapping) {
-                this._mesh = BABYLON.Mesh.CreateSphere("sphere1", options.resolution, options.size, scene, false, BABYLON.Mesh.BACKSIDE);
-            } else {
-                this._mesh = MeshBuilder.CreateIcoSphere(name + "_mesh", {
-                    flat: false, // saves on vertex data
-                    radius: options.size,
-                    subdivisions: options.resolution,
-                    sideOrientation: Mesh.BACKSIDE // needs to be inside out
-                }, scene);    
-            }
+            this._mesh = BABYLON.Mesh.CreateSphere(name + "_mesh", options.resolution, options.size, scene, false, BABYLON.Mesh.BACKSIDE);
 
             // configure material
             material.useEquirectangularFOV = true;

+ 12 - 7
src/Shaders/ShadersInclude/reflectionFunction.fx

@@ -19,10 +19,12 @@ vec3 parallaxCorrectNormal( vec3 vertexPos, vec3 origVec, vec3 cubeSize, vec3 cu
 vec3 computeReflectionCoords(vec4 worldPos, vec3 worldNormal)
 {
 #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
-	vec3 direction = vDirectionW;
-
-	float t = clamp(direction.y * -0.5 + 0.5, 0., 1.0);
-	float s = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;
+	vec3 direction = normalize(vDirectionW);
+	float lon = atan(direction.z, direction.x);
+	float lat = acos(direction.y);
+	vec2 sphereCoords = vec2(lon, lat) * RECIPROCAL_PI2 * 2.0;
+	float s = sphereCoords.x * 0.5 + 0.5;
+	float t = sphereCoords.y;	
 
  	#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED
 		return vec3(1.0 - s, t, 0);
@@ -34,9 +36,12 @@ vec3 computeReflectionCoords(vec4 worldPos, vec3 worldNormal)
 #ifdef REFLECTIONMAP_EQUIRECTANGULAR
 
 	vec3 cameraToVertex = normalize(worldPos.xyz - vEyePosition.xyz);
-	vec3 r = reflect(cameraToVertex, worldNormal);
-	float t = clamp(r.y * -0.5 + 0.5, 0., 1.0);
-	float s = atan(r.z, r.x) * RECIPROCAL_PI2 + 0.5;
+	vec3 r = normalize(reflect(cameraToVertex, worldNormal));
+	float lon = atan(r.z, r.x);
+	float lat = acos(r.y);
+	vec2 sphereCoords = vec2(lon, lat) * RECIPROCAL_PI2 * 2.0;
+	float s = sphereCoords.x * 0.5 + 0.5;
+	float t = sphereCoords.y;		
 
 	return vec3(s, t, 0);
 #endif