|
@@ -0,0 +1,279 @@
|
|
|
+<!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 - Basic usage</title>
|
|
|
+ <style>
|
|
|
+ babylon {
|
|
|
+ max-width: 800px;
|
|
|
+ max-height: 500px;
|
|
|
+ width: 100%;
|
|
|
+ height: 600px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+
|
|
|
+ <body>
|
|
|
+ <canvas id="babylon-viewer" camera.behaviors.auto-rotate="0" style="max-width: 800px; max-height: 500px; width: 100%; height: 600px;"></canvas>
|
|
|
+ <script src="renderOnlyViewer.js"></script>
|
|
|
+ <script>
|
|
|
+
|
|
|
+ var config = {
|
|
|
+ "Camera.Behaviour": 1,
|
|
|
+ "Camera.Contrast": 1,
|
|
|
+ "Camera.DefaultElevation": 15,
|
|
|
+ "Camera.ElevationLowerLimit (degrees)": -85,
|
|
|
+ "Camera.ElevationReturnTime (s)": 2,
|
|
|
+ "Camera.ElevationReturnWaitTime (s)": 3,
|
|
|
+ "Camera.ElevationUpperLimit (degrees)": 80,
|
|
|
+ "Camera.ExposureValue": 1,
|
|
|
+ "Camera.ExposureValueIsBrightness": false,
|
|
|
+ "Camera.FieldOfView (Degrees)": 45,
|
|
|
+ "Camera.FrameOnModelLoad": true,
|
|
|
+ "Camera.FramingBehaviour": 0,
|
|
|
+ "Camera.FramingElevation": 15,
|
|
|
+ "Camera.FramingPositionY": 0.5,
|
|
|
+ "Camera.FramingRadius": 1,
|
|
|
+ "Camera.FramingRotation": -90,
|
|
|
+ "Camera.FramingTime": 0,
|
|
|
+ "Camera.IdleRotationSpeed (degrees/s)": 0,
|
|
|
+ "Camera.IdleRotationSpinupTime (s)": 2.5,
|
|
|
+ "Camera.IdleRotationWaitTime (s)": 4,
|
|
|
+ "Camera.MaxDistance": 5,
|
|
|
+ "Camera.MinDistance": 0.5,
|
|
|
+ "Camera.State.Position.X": 0,
|
|
|
+ "Camera.State.Position.Y": 0,
|
|
|
+ "Camera.State.Position.Z": 0,
|
|
|
+ "Camera.State.Rotation.W": 1,
|
|
|
+ "Camera.State.Rotation.X": 0,
|
|
|
+ "Camera.State.Rotation.Y": 0,
|
|
|
+ "Camera.State.Rotation.Z": 0,
|
|
|
+ "Camera.ToneMappingEnabled": false,
|
|
|
+ "Camera.ZoomStopsAnimation": false,
|
|
|
+ "ColorGrading.ColorFilterDensityGlobal": 1,
|
|
|
+ "ColorGrading.ColorFilterDensityHighlights": 1,
|
|
|
+ "ColorGrading.ColorFilterDensityMidtones": 1,
|
|
|
+ "ColorGrading.ColorFilterDensityShadows": 1,
|
|
|
+ "ColorGrading.ColorFilterHueGlobal": 1,
|
|
|
+ "ColorGrading.ColorFilterHueHighlights": 0,
|
|
|
+ "ColorGrading.ColorFilterHueMidtones": 0,
|
|
|
+ "ColorGrading.ColorFilterHueShadows": 0,
|
|
|
+ "ColorGrading.ExposureHighlights": 1,
|
|
|
+ "ColorGrading.ExposureMidtones": 1,
|
|
|
+ "ColorGrading.ExposureShadows": 1,
|
|
|
+ "ColorGrading.SaturationGlobal": 1,
|
|
|
+ "ColorGrading.SaturationHighlights": 1,
|
|
|
+ "ColorGrading.SaturationMidtones": 1,
|
|
|
+ "ColorGrading.SaturationShadows": 1,
|
|
|
+ "ColorGrading.TransformData": "",
|
|
|
+ "ColorGrading.TransformDataFormat": "",
|
|
|
+ "ColorGrading.TransformWeight": 1,
|
|
|
+ "Environment.BackgroundClearColorFallback": [
|
|
|
+ 1,
|
|
|
+ 1,
|
|
|
+ 1
|
|
|
+ ],
|
|
|
+ "Environment.Ground_Noise": true,
|
|
|
+ "Environment.Ground_OpacityLevel": 1,
|
|
|
+ "Environment.Ground_PrimaryColor": [
|
|
|
+ 0.847,
|
|
|
+ 0.843,
|
|
|
+ 0.843
|
|
|
+ ],
|
|
|
+ "Environment.Ground_PrimaryLevel": 1,
|
|
|
+ "Environment.Ground_ReflectionLevel": 1,
|
|
|
+ "Environment.Ground_SecondaryColor": [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0
|
|
|
+ ],
|
|
|
+ "Environment.Ground_SecondaryLevel": 0,
|
|
|
+ "Environment.Ground_ShadowLevel": 0,
|
|
|
+ "Environment.Ground_TertiaryColor": [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0
|
|
|
+ ],
|
|
|
+ "Environment.Ground_TertiaryLevel": 0,
|
|
|
+ "Environment.Ground_Texture": "Ground_1.0-1024.png",
|
|
|
+ "Environment.Ground_TextureInGamma": false,
|
|
|
+ "Environment.Ground_UseRGBColor": false,
|
|
|
+ "Environment.RotationAroundY": 0,
|
|
|
+ "Environment.Skybox_Noise": false,
|
|
|
+ "Environment.Skybox_PrimaryColor": [
|
|
|
+ 0.847,
|
|
|
+ 0.843,
|
|
|
+ 0.843
|
|
|
+ ],
|
|
|
+ "Environment.Skybox_PrimaryLevel": 1.5,
|
|
|
+ "Environment.Skybox_SecondaryColor": [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0
|
|
|
+ ],
|
|
|
+ "Environment.Skybox_SecondaryLevel": 0,
|
|
|
+ "Environment.Skybox_TertiaryColor": [
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0
|
|
|
+ ],
|
|
|
+ "Environment.Skybox_TertiaryLevel": 0,
|
|
|
+ "Environment.Skybox_Texture": "Skybox_1.0-128.dds",
|
|
|
+ "Environment.Skybox_TextureInGamma": false,
|
|
|
+ "Environment.Skybox_UseRGBColor": false,
|
|
|
+ "GroundPlane.BottomGridOpacity": 1,
|
|
|
+ "GroundPlane.BottomVisible": false,
|
|
|
+ "ImageProcessing.BloomEnabled": false,
|
|
|
+ "ImageProcessing.BloomQuality": 2,
|
|
|
+ "ImageProcessing.BloomWeight": 0,
|
|
|
+ "ImageProcessing.Enabled": true,
|
|
|
+ "ImageProcessing.PlanarReflectionBlur": true,
|
|
|
+ "ImageProcessing.PlanarReflectionDirect": false,
|
|
|
+ "ImageProcessing.PlanarReflectionEnabled": true,
|
|
|
+ "ImageProcessing.PlanarReflectionQuality": 2,
|
|
|
+ "ImageProcessing.PlanarReflectionWeight": 0.8,
|
|
|
+ "ImageProcessing.VignetteBlendMode": 0,
|
|
|
+ "ImageProcessing.VignetteCentreX": 0,
|
|
|
+ "ImageProcessing.VignetteCentreY": 0,
|
|
|
+ "ImageProcessing.VignetteColorA": 1,
|
|
|
+ "ImageProcessing.VignetteColorB": 1,
|
|
|
+ "ImageProcessing.VignetteColorG": 1,
|
|
|
+ "ImageProcessing.VignetteColorR": 1,
|
|
|
+ "ImageProcessing.VignetteStretch": 0.5,
|
|
|
+ "ImageProcessing.VignetteWeight": 0,
|
|
|
+ "Lighting.BackgroundColorAmount": 1,
|
|
|
+ "Lighting.BackgroundColorB": 1,
|
|
|
+ "Lighting.BackgroundColorG": 1,
|
|
|
+ "Lighting.BackgroundColorR": 1,
|
|
|
+ "Lighting.BackgroundLighting": 0.75,
|
|
|
+ "Lighting.BackgroundShadowAmount": 0.075,
|
|
|
+ "Lighting.BackgroundShadowFalloff": 1,
|
|
|
+ "Lighting.DirectEnabled": true,
|
|
|
+ "Lighting.DirectIntensity": 1,
|
|
|
+ "Lighting.EmissiveIntensity": 1,
|
|
|
+ "Lighting.EnvironmentColorB": 1,
|
|
|
+ "Lighting.EnvironmentColorG": 1,
|
|
|
+ "Lighting.EnvironmentColorR": 1,
|
|
|
+ "Lighting.EnvironmentEnabled": true,
|
|
|
+ "Lighting.EnvironmentIndex": 0,
|
|
|
+ "Lighting.EnvironmentIntensity": 5.5,
|
|
|
+ "Lighting.EnvironmentRotation": -5,
|
|
|
+ "Lighting.Light0_CameraOrientationTracking": 0,
|
|
|
+ "Lighting.Light0_CameraRelative": false,
|
|
|
+ "Lighting.Light0_ColorB": 1,
|
|
|
+ "Lighting.Light0_ColorG": 1,
|
|
|
+ "Lighting.Light0_ColorR": 1,
|
|
|
+ "Lighting.Light0_Enabled": true,
|
|
|
+ "Lighting.Light0_FrustumEdgeFalloff": 1,
|
|
|
+ "Lighting.Light0_Intensity": 80,
|
|
|
+ "Lighting.Light0_IntensityMode": 0,
|
|
|
+ "Lighting.Light0_PositionX": -8,
|
|
|
+ "Lighting.Light0_PositionY": 9,
|
|
|
+ "Lighting.Light0_PositionZ": -8,
|
|
|
+ "Lighting.Light0_Radius": 3.3,
|
|
|
+ "Lighting.Light0_ShadowBufferSize": 512,
|
|
|
+ "Lighting.Light0_ShadowEnabled": true,
|
|
|
+ "Lighting.Light0_ShadowFarClip": 10,
|
|
|
+ "Lighting.Light0_ShadowFieldOfView": 15,
|
|
|
+ "Lighting.Light0_ShadowFrustumSize": 2,
|
|
|
+ "Lighting.Light0_ShadowNearClip": 1,
|
|
|
+ "Lighting.Light0_SpotAngle": 60,
|
|
|
+ "Lighting.Light0_TargetX": 0,
|
|
|
+ "Lighting.Light0_TargetY": 0,
|
|
|
+ "Lighting.Light0_TargetZ": 0,
|
|
|
+ "Lighting.Light0_Type": 0,
|
|
|
+ "Lighting.Light1_CameraOrientationTracking": 0,
|
|
|
+ "Lighting.Light1_CameraRelative": false,
|
|
|
+ "Lighting.Light1_ColorB": 1,
|
|
|
+ "Lighting.Light1_ColorG": 1,
|
|
|
+ "Lighting.Light1_ColorR": 1,
|
|
|
+ "Lighting.Light1_Enabled": true,
|
|
|
+ "Lighting.Light1_FrustumEdgeFalloff": 1,
|
|
|
+ "Lighting.Light1_Intensity": 1,
|
|
|
+ "Lighting.Light1_IntensityMode": 0,
|
|
|
+ "Lighting.Light1_PositionX": 5,
|
|
|
+ "Lighting.Light1_PositionY": 1.3,
|
|
|
+ "Lighting.Light1_PositionZ": 0.26,
|
|
|
+ "Lighting.Light1_Radius": 0.85,
|
|
|
+ "Lighting.Light1_ShadowBufferSize": 512,
|
|
|
+ "Lighting.Light1_ShadowEnabled": false,
|
|
|
+ "Lighting.Light1_ShadowFarClip": 10,
|
|
|
+ "Lighting.Light1_ShadowFieldOfView": 15,
|
|
|
+ "Lighting.Light1_ShadowFrustumSize": 2,
|
|
|
+ "Lighting.Light1_ShadowNearClip": 0.2,
|
|
|
+ "Lighting.Light1_SpotAngle": 35,
|
|
|
+ "Lighting.Light1_TargetX": 0,
|
|
|
+ "Lighting.Light1_TargetY": 0,
|
|
|
+ "Lighting.Light1_TargetZ": 0,
|
|
|
+ "Lighting.Light1_Type": 0,
|
|
|
+ "Lighting.Light2_CameraOrientationTracking": 0,
|
|
|
+ "Lighting.Light2_CameraRelative": false,
|
|
|
+ "Lighting.Light2_ColorB": 1,
|
|
|
+ "Lighting.Light2_ColorG": 1,
|
|
|
+ "Lighting.Light2_ColorR": 1,
|
|
|
+ "Lighting.Light2_Enabled": true,
|
|
|
+ "Lighting.Light2_FrustumEdgeFalloff": 1,
|
|
|
+ "Lighting.Light2_Intensity": 5,
|
|
|
+ "Lighting.Light2_IntensityMode": 0,
|
|
|
+ "Lighting.Light2_PositionX": 0.5,
|
|
|
+ "Lighting.Light2_PositionY": 0,
|
|
|
+ "Lighting.Light2_PositionZ": 4.5,
|
|
|
+ "Lighting.Light2_Radius": 1.2,
|
|
|
+ "Lighting.Light2_ShadowBufferSize": 512,
|
|
|
+ "Lighting.Light2_ShadowEnabled": false,
|
|
|
+ "Lighting.Light2_ShadowFarClip": 10,
|
|
|
+ "Lighting.Light2_ShadowFieldOfView": 15,
|
|
|
+ "Lighting.Light2_ShadowFrustumSize": 2,
|
|
|
+ "Lighting.Light2_ShadowNearClip": 0.2,
|
|
|
+ "Lighting.Light2_SpotAngle": 42,
|
|
|
+ "Lighting.Light2_TargetX": 0,
|
|
|
+ "Lighting.Light2_TargetY": 0,
|
|
|
+ "Lighting.Light2_TargetZ": 0,
|
|
|
+ "Lighting.Light2_Type": 0,
|
|
|
+ "Lighting.MasterEnabled": true,
|
|
|
+ "Model.PositionAlignBase": true,
|
|
|
+ "Model.PositionOffsetX": 0,
|
|
|
+ "Model.PositionOffsetY": 0,
|
|
|
+ "Model.PositionOffsetZ": 0,
|
|
|
+ "Model.RelativeModelLoadScale": 1,
|
|
|
+ "Model.RotationOffsetAngle": 210,
|
|
|
+ "Model.RotationOffsetAxisX": 0,
|
|
|
+ "Model.RotationOffsetAxisY": 1,
|
|
|
+ "Model.RotationOffsetAxisZ": 0,
|
|
|
+ "Renderer.ClearColorA": 1,
|
|
|
+ "Renderer.ClearColorB": 0.3137,
|
|
|
+ "Renderer.ClearColorG": 0.2902,
|
|
|
+ "Renderer.ClearColorOverride": false,
|
|
|
+ "Renderer.ClearColorR": 0.2706
|
|
|
+ }
|
|
|
+
|
|
|
+ // Create viewer with a canvas element
|
|
|
+ var viewer = new BabylonViewer.TemplateFreeViewer(document.getElementById("babylon-viewer"), config);
|
|
|
+
|
|
|
+ // Initialize the viewer (this will setup the scene and load a model if its not)
|
|
|
+ viewer.initialize().then(()=>{
|
|
|
+ // Load a model
|
|
|
+ return viewer.loadModel({
|
|
|
+ title: "Helmet",
|
|
|
+ subtitle: "BabylonJS",
|
|
|
+ thumbnail: "https://www.babylonjs.com/img/favicon/apple-icon-144x144.png",
|
|
|
+ url: "https://www.babylonjs.com/Assets/DamagedHelmet/glTF/DamagedHelmet.gltf"
|
|
|
+ });
|
|
|
+ }).then(()=>{
|
|
|
+ // 1st model has been loaded, wait a second and swap to another model
|
|
|
+ setTimeout(() => {
|
|
|
+ viewer.loadModel({
|
|
|
+ title: "Rabbit",
|
|
|
+ subtitle: "BabylonJS",
|
|
|
+ thumbnail: "https://www.babylonjs.com/img/favicon/apple-icon-144x144.png",
|
|
|
+ url: "https://playground.babylonjs.com/scenes/Rabbit.babylon"
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+
|
|
|
+</html>
|