Browse Source

Getting back to normal

David Catuhe 9 năm trước cách đây
mục cha
commit
4fdc108d83

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 2
materialsLibrary/dist/babylon.fireMaterial.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.fireMaterial.min.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.normalMaterial.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.normalMaterial.min.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.simpleMaterial.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.simpleMaterial.min.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.terrainMaterial.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
materialsLibrary/dist/babylon.terrainMaterial.min.js


+ 0 - 21
materialsLibrary/materials/pbr/Demo/gulpfile.js

@@ -1,21 +0,0 @@
-var gulp = require("gulp");
-var webserver = require('gulp-webserver');
-
-gulp.task('copyReference', function () {
-    return gulp.src(["..../../../dist/preview release/babylon.max.js", 
-        "../../../dist/babylon.pbrMaterial.js"]).pipe(gulp.dest("refs"));
-});
-
-/**
- * Web server task to serve a local test page
- */
-gulp.task('default', ['copyReference'], function() {
-  gulp.src('.')
-    .pipe(webserver({
-      livereload: false,
-      open: 'http://localhost:1339/index.html',
-      port: 1339,
-      fallback: 'index.html'
-    }));
-});
-

+ 0 - 42
materialsLibrary/materials/pbr/Demo/index.html

@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-	<title>PBR Demo</title>
-	<script src="refs/babylon.max.js"></script>
-    <script src="refs/babylon.pbrMaterial.js"></script>
-
-	<style>
-		html, body {
-			width: 100%;
-			height: 100%;
-			padding: 0;
-			margin: 0;
-			overflow: hidden;
-		}
-
-		#renderCanvas {
-			width: 100%;
-			height: 100%;
-		}
-
-		#fps {
-			position: absolute;
-			background-color: black;
-			border: 2px solid red;
-			text-align: center;
-			font-size: 16px;
-			color: white;
-			top: 15px;
-			left: 10px;
-			width: 60px;
-			height: 20px;
-		}
-	</style>
-</head>
-<body>
-	<div id="fps">0</div>
-	<canvas id="renderCanvas"></canvas>
-
-	<script src="index.js"></script>
-</body>
-</html>

+ 0 - 92
materialsLibrary/materials/pbr/Demo/index.js

@@ -1,92 +0,0 @@
-(function initDemo() {
-    if (!BABYLON.Engine.isSupported()) {
-        return;
-    }
-
-    var canvas = document.getElementById("renderCanvas");
-    var engine = new BABYLON.Engine(canvas, true);
-    var divFps = document.getElementById("fps");
-
-    // Scene + camera.
-    var scene = new BABYLON.Scene(engine);
-    var camera = new BABYLON.ArcRotateCamera("Camera", -Math.PI / 4, Math.PI / 2.5, 200, BABYLON.Vector3.Zero(), scene);
-    camera.attachControl(canvas, true);
-    camera.minZ = 0.1;
-    
-    // Register a render loop to repeatedly render the scene
-    engine.runRenderLoop(function () {
-        scene.render();
-        divFps.innerHTML = engine.getFps().toFixed() + " fps";
-    });
-
-    // Light
-    // Not necessary but add known spec effect...
-    new BABYLON.PointLight("point", new BABYLON.Vector3(20, 20, 10), scene);
-    
-    // Environment Texture
-    var hdrTexture = new BABYLON.HDRCubeTexture("textures/room.hdr", scene, 512);
-    
-    // Skybox
-    var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", 1000.0, scene);
-    var hdrSkyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
-    hdrSkyboxMaterial.backFaceCulling = false;
-    hdrSkyboxMaterial.reflectionTexture = hdrTexture.clone();
-    hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
-    hdrSkyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
-    hdrSkyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
-    hdrSkyboxMaterial.disableLighting = true;
-    hdrSkybox.material = hdrSkyboxMaterial;
-    hdrSkybox.infiniteDistance = true;
-
-    // Create meshes
-    var sphereGlass = BABYLON.Mesh.CreateSphere("sphere", 48, 30.0, scene);
-    sphereGlass.translate(new BABYLON.Vector3(1, 0, 0), -50);
-    
-    var sphereMetal = BABYLON.Mesh.CreateSphere("sphere", 48, 30.0, scene);
-    sphereMetal.translate(new BABYLON.Vector3(1, 0, 0), 50);
-
-    var woodPlank = BABYLON.MeshBuilder.CreateBox("plane", { width: 45, height: 1, depth: 90 }, scene);
-
-    // Create materials
-    var glass = new BABYLON.PBRMaterial("glass", scene);
-    glass.reflectionTexture = hdrTexture;
-    glass.refractionTexture = hdrTexture;
-    glass.linkRefractionWithTransparency = true;
-    glass.indexOfRefraction = 0.52;
-    glass.alpha = 0;
-    glass.directIntensity = 0.0;
-    glass.environmentIntensity = 0.5;
-    glass.cameraExposure = 0.5;
-    glass.cameraContrast = 1.7;
-    glass.microSurface = 1;
-    glass.reflectivityColor = new BABYLON.Color3(0.1, 0.1, 0.1);
-    glass.albedoColor = new BABYLON.Color3(0.3, 0.3, 0.3);
-    sphereGlass.material = glass;
-
-    var metal = new BABYLON.PBRMaterial("metal", scene);
-    metal.reflectionTexture = hdrTexture;
-    metal.directIntensity = 0.3;
-    metal.environmentIntensity = 0.7;
-    metal.cameraExposure = 0.6;
-    metal.cameraContrast = 1.6;
-    metal.microSurface = 0.96;
-    metal.reflectivityColor = new BABYLON.Color3(0.9, 0.9, 0.9);
-    metal.albedoColor = new BABYLON.Color3(1, 1, 1);
-    sphereMetal.material = metal;
-    
-    var wood = new BABYLON.PBRMaterial("wood", scene);
-    wood.reflectionTexture = hdrTexture;
-    wood.directIntensity = 1.5;
-    wood.environmentIntensity = 0.5;
-    wood.specularIntensity = 0.3;
-    wood.cameraExposure = 0.9;
-    wood.cameraContrast = 1.6;
-    
-    wood.reflectivityTexture = new BABYLON.Texture("textures/reflectivity.png", scene);
-    wood.useMicroSurfaceFromReflectivityMapAlpha = true;
-    
-    wood.albedoColor = BABYLON.Color3.White();
-    wood.albedoTexture = new BABYLON.Texture("textures/albedo.png", scene);
-    woodPlank.material = wood;
-    
-})();

+ 0 - 13
materialsLibrary/materials/pbr/Demo/package.json

@@ -1,13 +0,0 @@
-{
-  "name": "BabylonJSPBRDemo",
-  "version": "2.4.0",
-  "description": "Quick PBR DEMO",
-  "main": "",
-  "repository": { "url": "https://github.com/BabylonJS/Babylon.js/" },
-  "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
-  "license": "(Apache-2.0)",
-  "devDependencies": {
-    "gulp": "^3.8.11",
-    "gulp-webserver": "^0.9.1"
-  }
-}

+ 0 - 19
materialsLibrary/materials/pbr/Demo/readme.md

@@ -1,19 +0,0 @@
-# PBR DEMO
-
-A Quick Demo of the PBR helping to catch some of its capabilities.
-
-## How to run
-
-Only two steps are needed:
-
-First, install the node dependencies:
-
-```
-npm install
-```
-
-Then you can start your local server:
-
-```
-gulp
-```

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 38437
materialsLibrary/materials/pbr/Demo/refs/babylon.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 1784
materialsLibrary/materials/pbr/Demo/refs/babylon.pbrMaterial.js


BIN
materialsLibrary/materials/pbr/Demo/textures/albedo.png


BIN
materialsLibrary/materials/pbr/Demo/textures/reflectivity.png


BIN
materialsLibrary/materials/pbr/Demo/textures/room.hdr


+ 22 - 5
materialsLibrary/test/refs/babylon.max.js

@@ -8415,6 +8415,10 @@ var BABYLON;
             this.getScene().getPhysicsEngine()._createLink(this, otherMesh, pivot1, pivot2, options);
         };
         AbstractMesh.prototype.updatePhysicsBodyPosition = function () {
+            BABYLON.Tools.Warn("updatePhysicsBodyPosition() is deprecated, please use updatePhysicsBody()");
+            this.updatePhysicsBody();
+        };
+        AbstractMesh.prototype.updatePhysicsBody = function () {
             if (!this._physicImpostor) {
                 return;
             }
@@ -11520,7 +11524,7 @@ var BABYLON;
             this._keys = [];
             this._viewMatrix = new BABYLON.Matrix();
             // Panning
-            this.panningAxis = new BABYLON.Vector3(1, 0, 1);
+            this.panningAxis = new BABYLON.Vector3(1, 1, 0);
             this._isRightClick = false;
             this._isCtrlPushed = false;
             this.checkCollisions = false;
@@ -11883,9 +11887,13 @@ var BABYLON;
                 if (Math.abs(this.inertialPanningY) < BABYLON.Engine.Epsilon)
                     this.inertialPanningY = 0;
                 this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);
+                this._localDirection.multiplyInPlace(this.panningAxis);
                 this._viewMatrix.invertToRef(this._cameraTransformMatrix);
                 BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);
-                this._transformedDirection.multiplyInPlace(this.panningAxis);
+                //Eliminate y if map panning is enabled (panningAxis == 1,0,1)
+                if (!this.panningAxis.y) {
+                    this._transformedDirection.y = 0;
+                }
                 this.target.addInPlace(this._transformedDirection);
             }
             // Limits
@@ -19604,7 +19612,7 @@ var BABYLON;
             this.useSpecularOverAlpha = false;
             this.disableLighting = false;
             this.roughness = 0;
-            this.indexOfRefraction = 1.05;
+            this.indexOfRefraction = 0.98;
             this.invertRefractionY = true;
             this.useLightmapAsShadowmap = false;
             this.useGlossinessFromSpecularMapAlpha = false;
@@ -20398,6 +20406,8 @@ var BABYLON;
             newStandardMaterial.useReflectionFresnelFromSpecular = this.useReflectionFresnelFromSpecular;
             newStandardMaterial.useSpecularOverAlpha = this.useSpecularOverAlpha;
             newStandardMaterial.roughness = this.roughness;
+            newStandardMaterial.indexOfRefraction = this.indexOfRefraction;
+            newStandardMaterial.invertRefractionY = this.invertRefractionY;
             if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.clone) {
                 newStandardMaterial.diffuseFresnelParameters = this.diffuseFresnelParameters.clone();
             }
@@ -20422,8 +20432,10 @@ var BABYLON;
             serializationObject.specular = this.specularColor.asArray();
             serializationObject.specularPower = this.specularPower;
             serializationObject.emissive = this.emissiveColor.asArray();
-            serializationObject.useReflectionFresnelFromSpecular = serializationObject.useReflectionFresnelFromSpecular;
-            serializationObject.useEmissiveAsIllumination = serializationObject.useEmissiveAsIllumination;
+            serializationObject.useReflectionFresnelFromSpecular = this.useReflectionFresnelFromSpecular;
+            serializationObject.useEmissiveAsIllumination = this.useEmissiveAsIllumination;
+            serializationObject.indexOfRefraction = this.indexOfRefraction;
+            serializationObject.invertRefractionY = this.invertRefractionY;
             if (this.diffuseTexture) {
                 serializationObject.diffuseTexture = this.diffuseTexture.serialize();
             }
@@ -20478,6 +20490,8 @@ var BABYLON;
             material.emissiveColor = BABYLON.Color3.FromArray(source.emissive);
             material.useReflectionFresnelFromSpecular = source.useReflectionFresnelFromSpecular;
             material.useEmissiveAsIllumination = source.useEmissiveAsIllumination;
+            material.indexOfRefraction = source.indexOfRefraction;
+            material.invertRefractionY = source.invertRefractionY;
             material.alpha = source.alpha;
             material.id = source.id;
             if (source.disableDepthWrite) {
@@ -23684,6 +23698,9 @@ var BABYLON;
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
             return this._currentPlugin.name;
         };
+        PhysicsEngine.prototype.getWorldObject = function () {
+            return this._currentPlugin.getWorldObject();
+        };
         // Statics
         PhysicsEngine.NoImpostor = 0;
         PhysicsEngine.SphereImpostor = 1;