Browse Source

Lava material committed.

Temechon 9 năm trước cách đây
mục cha
commit
b24e58a0c0

+ 8 - 0
materialsLibrary/config.json

@@ -9,6 +9,14 @@
       "output": "babylon.normalMaterial.js"
     },
     {
+      "file": "materials/lava/babylon.lavaMaterial.ts",
+      "shaderFiles": [
+        "materials/lava/lava.vertex.fx",
+        "materials/lava/lava.fragment.fx"
+      ],
+      "output": "babylon.lavaMaterial.js"
+    },
+    {
       "file": "materials/simple/babylon.simpleMaterial.ts",
       "shaderFiles": [
         "materials/simple/simple.vertex.fx",

+ 1 - 1
materialsLibrary/materials/lava/readme.md

@@ -21,7 +21,7 @@ The diffuse texture will be the color of your lava, the noise texture will repre
 Notice that this material will update each vertex position of your object. If there are not enough vertices, 
 some artefacts may appears.
 
-## Customize the water material
+## Customize the lava material
 
 You can customize two properties of the material:
 

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


+ 14 - 1
materialsLibrary/test/index.html

@@ -8,6 +8,7 @@
 	<script src="../dist/babylon.normalMaterial.js"></script>
 	<script src="../dist/babylon.waterMaterial.js"></script>
 	<script src="../dist/babylon.fireMaterial.js"></script>
+    <script src="../dist/babylon.lavaMaterial.js"></script>
 
 	<style>
 		html, body {
@@ -151,6 +152,15 @@
 				std.diffuseTexture.uScale = 5;
 				std.diffuseTexture.vScale = 5;
 
+                // Lava
+                var lava = new BABYLON.LavaMaterial("lava", scene);
+                lava.diffuseTexture = new BABYLON.Texture("textures/lava/lavatile.jpg", scene);
+                lava.diffuseTexture.uScale = 0.5;
+                lava.diffuseTexture.vScale = 0.5;
+				lava.noiseTexture = new BABYLON.Texture("textures/lava/cloud.png", scene);
+				lava.fogColor = BABYLON.Color3.Black();
+				lava.speed = 2.5;
+
 				var simple = new BABYLON.SimpleMaterial("simple", scene);
 				simple.diffuseTexture = new BABYLON.Texture("textures/amiga.jpg", scene);
 				simple.diffuseTexture.uScale = 5;
@@ -194,7 +204,7 @@
 					skybox: false
 				}
 
-				gui.add(options, 'material', ['standard', 'simple', 'water', 'fire', 'normal']).onFinishChange(function () {
+				gui.add(options, 'material', ['standard', 'simple', 'water', 'fire', 'lava', 'normal']).onFinishChange(function () {
 					water.enableRenderTargets(false);
 					
 					switch (options.material) {
@@ -209,6 +219,9 @@
                         case "fire":
                             currentMaterial = fire;
                             break;
+						case "lava":
+							currentMaterial = lava;
+							break;
 						case "normal":
 							currentMaterial = normal;
 							break;