Explorar el Código

Update sandbox with textures

nockawa hace 9 años
padre
commit
8c9734a999
Se han modificado 6 ficheros con 26 adiciones y 25 borrados
  1. 5 4
      Babylon.js.csproj
  2. BIN
      assets/BrickWall.png
  3. BIN
      assets/brickwall_nh.png
  4. BIN
      assets/rock.png
  5. BIN
      assets/rock_nh.png
  6. 21 21
      typescript/MainClass.ts

+ 5 - 4
Babylon.js.csproj

@@ -70,12 +70,13 @@
     <Reference Include="System.EnterpriseServices" />
   </ItemGroup>
   <ItemGroup>
-    <Content Include="assets\BrickWall.dds" />
-    <Content Include="assets\BrickWall_normal_parallax.dds" />
-    <Content Include="assets\rock_colormap.dds" />
-    <Content Include="assets\rock_normalmap.dds" />
+    <Content Include="assets\BrickWall.png" />
+    <Content Include="assets\brickwall_nh.png" />
+    <Content Include="assets\rock.png" />
+    <Content Include="assets\rock_nh.png" />
     <Content Include="index.html" />
     <Content Include="packages.config" />
+    <Content Include="src\Shaders\ShadersInclude\helperFunctions.fx" />
     <Content Include="src\Shaders\ShadersInclude\bonesDeclaration.fx" />
     <Content Include="src\Shaders\ShadersInclude\bonesVertex.fx" />
     <Content Include="src\Shaders\ShadersInclude\bumpFragmentFunctions.fx" />

BIN
assets/BrickWall.png


BIN
assets/brickwall_nh.png


BIN
assets/rock.png


BIN
assets/rock_nh.png


+ 21 - 21
typescript/MainClass.ts

@@ -40,9 +40,9 @@
             //var normalsHeightTexture = new BABYLON.Texture("assets/BrickWall_nh.png", this.scene);
             var material = new BABYLON.StandardMaterial("mtl01", this.scene);
             material.diffuseTexture = diffuseTexture;
-            //material.bumpTexture = normalsHeightTexture;
-            //material.useParallax = true;
-            //material.specularPower = 500.0;
+            material.bumpTexture = normalsHeightTexture;
+            material.useParallax = true;
+            material.specularPower = 500.0;
 
             mesh.material = material;
             material.specularColor = new BABYLON.Color3(0.5, 0.5, 0.5);
@@ -55,35 +55,35 @@
                         break;
                     case "bump":
                         material.bumpTexture = normalsHeightTexture;
-                        //material.useParallax = false;
+                        material.useParallax = false;
                         break;
                     case "parallax":
                         material.bumpTexture = normalsHeightTexture;
-                        //material.useParallax = true;
-                        //material.useParallaxOcclusion = false;
+                        material.useParallax = true;
+                        material.useParallaxOcclusion = false;
                         break;
                     case "POM":
                         material.bumpTexture = normalsHeightTexture;
-                        //material.useParallax = true;
-                        //material.useParallaxOcclusion = true;
+                        material.useParallax = true;
+                        material.useParallaxOcclusion = true;
                         break;
                 }
                 material.markDirty();
             };
 
-            //var label = <HTMLLabelElement>document.querySelector("#scaleBiasLabel");
-            //label.innerHTML = "Scale Bias: " + material.parallaxScaleBias;
-
-            //document.addEventListener("keydown", (event) => {
-            //    if (event.key == "Up") {
-            //        material.parallaxScaleBias += 0.01;
-            //        label.innerHTML = "Scale Bias: " + material.parallaxScaleBias.toFixed(2);
-            //    }
-            //    else if (event.key == "Down") {
-            //        material.parallaxScaleBias -= 0.01;
-            //        label.innerHTML = "Scale Bias: " + material.parallaxScaleBias.toFixed(2);
-            //    }
-            //});
+            var label = <HTMLLabelElement>document.querySelector("#scaleBiasLabel");
+            label.innerHTML = "Scale Bias: " + material.parallaxScaleBias;
+
+            document.addEventListener("keydown", (event) => {
+                if (event.key == "Up") {
+                    material.parallaxScaleBias += 0.01;
+                    label.innerHTML = "Scale Bias: " + material.parallaxScaleBias.toFixed(2);
+                }
+                else if (event.key == "Down") {
+                    material.parallaxScaleBias -= 0.01;
+                    label.innerHTML = "Scale Bias: " + material.parallaxScaleBias.toFixed(2);
+                }
+            });
 
             //this.scene.debugLayer.show();