Explorar o código

examples on how to reconfigure the viewr using external files

Raanan Weber %!s(int64=7) %!d(string=hai) anos
pai
achega
fd4fc6a945

+ 22 - 0
Viewer/dist/external/msftConfig.json

@@ -0,0 +1,22 @@
+{
+    "ground": {
+        "material": {
+            "primaryColorHighlightLevel": 0.05
+        }
+    },
+    "skybox": {
+        "material": {
+            "primaryColorShadowLevel": 0.1
+        }
+    },
+    "scene": {
+        "imageProcessingConfiguration": {
+            "vignetteWeight": 0
+        },
+        "mainColor": {
+            "r": 0.9607843137254902,
+            "g": 0.9607843137254902,
+            "b": 0.9607843137254902
+        }
+    }
+}

+ 39 - 0
Viewer/dist/msftCodeExample.html

@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+
+    <head>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta http-equiv="X-UA-Compatible" content="ie=edge">
+        <title>BabylonJS Viewer - Configuration usage with code</title>
+        <style>
+        </style>
+    </head>
+
+    <body>
+        <div id="viewport" touch-action="none"></div>
+        <script src="viewer.js"></script>
+        <script>
+            var config = {
+                extends: 'extended',
+                configuration: "/external/msftConfig.json",
+                model: {
+                    url: "https://babylonjs.com/Assets/FlightHelmet/glTF/FlightHelmet_Materials.gltf",
+                },
+                templates: {
+                    main: {
+                        params: {
+                            fillScreen: true
+                        }
+                    }
+                }
+            }
+
+            // create viewer
+            var viewerElement = document.getElementById("viewport");
+            new BabylonViewer.DefaultViewer(viewerElement, config);
+
+        </script>
+    </body>
+
+</html>

+ 20 - 0
Viewer/dist/msftExample.html

@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+
+    <head>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta http-equiv="X-UA-Compatible" content="ie=edge">
+        <title>BabylonJS Viewer - Configuration usage</title>
+        <style>
+        </style>
+    </head>
+
+    <body>
+        <babylon id="viewer" configuration="/external/msftConfig.json" templates.main.params.fill-screen="true" extends="extended"
+            model.url="https://babylonjs.com/Assets/FlightHelmet/glTF/FlightHelmet_Materials.gltf"></babylon>
+        <div id="viewport" touch-action="none"></div>
+        <script src="viewer.js"></script>
+    </body>
+
+</html>