-
Notifications
You must be signed in to change notification settings - Fork 5
/
Babylon_303_gltf.html
177 lines (159 loc) · 11.1 KB
/
Babylon_303_gltf.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Babylon.js - GLTF Data - 2019/10/20 by T. Fujita</title>
<link rel = "stylesheet" type="text/css" href = "./css/babylon_menu.css" />
<script src="https://code.jquery.com/pep/0.4.0/pep.min.js"></script>
<script src="https://preview.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylon.glTFFileLoader.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>
<style>
canvas {width: 100%; height: 100%;}
</style>
</head>
<body>
<nav id="menu-wrap">
<ul id="menu">
<li><a href="#">Menu</a>
</li>
<li><a href="#">dds Environment</a>
<ul id="scroll">
<li><a><input type = "radio" name = "dds_Layer" value = "0" checked onclick = "javascript: Sel_dds_Layer();">environment</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "1" onclick = "javascript: Sel_dds_Layer();">blenderSpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "2" onclick = "javascript: Sel_dds_Layer();">circusArenaHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "3" onclick = "javascript: Sel_dds_Layer();">countrySpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "4" onclick = "javascript: Sel_dds_Layer();">deltaParkHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "5" onclick = "javascript: Sel_dds_Layer();">ennisSpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "6" onclick = "javascript: Sel_dds_Layer();">fireplaceHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "7" onclick = "javascript: Sel_dds_Layer();">footprintCourtSpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "8" onclick = "javascript: Sel_dds_Layer();">garageSpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "9" onclick = "javascript: Sel_dds_Layer();">indoorSpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "10" onclick = "javascript: Sel_dds_Layer();">kloofendalPartlyCloudyHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "11" onclick = "javascript: Sel_dds_Layer();">mistyPinesHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "12" onclick = "javascript: Sel_dds_Layer();">mountainFieldHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "13" onclick = "javascript: Sel_dds_Layer();">nightBridgeHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "14" onclick = "javascript: Sel_dds_Layer();">nightSpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "15" onclick = "javascript: Sel_dds_Layer();">parkPathHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "16" onclick = "javascript: Sel_dds_Layer();">Runyon_Canyon_A_2k_cube_specular</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "17" onclick = "javascript: Sel_dds_Layer();">shanghaiBundHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "18" onclick = "javascript: Sel_dds_Layer();">skateParkHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "19" onclick = "javascript: Sel_dds_Layer();">SpecularHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "20" onclick = "javascript: Sel_dds_Layer();">Studio_Softbox_2Umbrellas_cube_specular</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "21" onclick = "javascript: Sel_dds_Layer();">sunnyVondelparkHDR</a></li>
<li><a><input type = "radio" name = "dds_Layer" value = "22" onclick = "javascript: Sel_dds_Layer();">tiergartenOvercastHDR</a></li>
</ul>
</li>
<li><a href="#">GLTF Data</a>
<ul id="scroll">
<li><a><input type = "radio" name = "gltf_Layer" value = "0" checked onclick = "javascript: Sel_gltf();">ChibiRex_Saturated</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "1" onclick = "javascript: Sel_gltf();">DamagedHelmet</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "2" onclick = "javascript: Sel_gltf();">FlightHelmet_Materials</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "3" onclick = "javascript: Sel_gltf();">NeonPipe</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "4" onclick = "javascript: Sel_gltf();">Yeti_Idle</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "5" onclick = "javascript: Sel_gltf();">BrainStem</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "6" onclick = "javascript: Sel_gltf();">Aliddin_Textured</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "7" onclick = "javascript: Sel_gltf();">Disneys_Drossel</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "8" onclick = "javascript: Sel_gltf();">Hazel_from_If_I_Were_A_Wizard</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "9" onclick = "javascript: Sel_gltf();">Jerry</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "10" onclick = "javascript: Sel_gltf();">Stormtrooper_scan_by_Qlone</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "11" onclick = "javascript: Sel_gltf();">gial_1</a></li>
<li><a><input type = "radio" name = "gltf_Layer" value = "12" onclick = "javascript: Sel_gltf();">gial_2</a></li>
</ul>
</li>
</ul>
</nav>
<canvas id = "renderCanvas"></canvas>
<script type = "text/javascript">
var canvas = document.getElementById("renderCanvas");
var temp_dir = "./scenes/GLTF/glTF_01/";
var gltf_data = "ChibiRex_Saturated.gltf";
var temp = null;
var temp_Texture = "./textures/environment.dds";
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
var CreateScene = function() {
var scene = new BABYLON.Scene(engine);
BABYLON.SceneLoader.ImportMesh("", temp_dir, gltf_data, scene, function (mashes) {
scene.createDefaultCameraOrLight(true, true, true);
});
var camera = new BABYLON.ArcRotateCamera("Camera", 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0), scene);
camera.attachControl(canvas, true);
var hdrTexture = BABYLON.CubeTexture.CreateFromPrefilteredData(temp_Texture, scene);
scene.imageProcessingConfiguration.exposure = 0.6;
scene.imageProcessingConfiguration.contrast = 1.6;
// Skybox
var hdrSkybox = BABYLON.Mesh.CreateBox("hdrSkyBox", 1000.0, scene);
var hdrSkyboxMaterial = new BABYLON.PBRMaterial("skyBox", scene);
hdrSkyboxMaterial.backFaceCulling = false;
hdrSkyboxMaterial.reflectionTexture = hdrTexture.clone();
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
hdrSkyboxMaterial.microSurface = 1.0;
hdrSkyboxMaterial.disableLighting = true;
hdrSkybox.material = hdrSkyboxMaterial;
hdrSkybox.infiniteDistance = true;
scene.executeWhenReady(function() {
engine.runRenderLoop(function() {
scene.render();
});
});
return scene;
};
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
var scene = CreateScene();
// Select the Environment Texture
function Sel_dds_Layer() {
temp = document.getElementsByName("dds_Layer");
temp_Texture = "./textures/environment.dds";
if(temp[1].checked) { temp_Texture = "./textures/blenderSpecularHDR.dds"; }
if(temp[2].checked) { temp_Texture = "./textures/circusArenaHDR.dds"; }
if(temp[3].checked) { temp_Texture = "./textures/countrySpecularHDR.dds"; }
if(temp[4].checked) { temp_Texture = "./textures/country.dds"; }
if(temp[5].checked) { temp_Texture = "./textures/deltaParkHDR.dds"; }
if(temp[6].checked) { temp_Texture = "./textures/ennisSpecularHDR.dds"; }
if(temp[7].checked) { temp_Texture = "./textures/fireplaceHDR.dds"; }
if(temp[8].checked) { temp_Texture = "./textures/footprintCourtSpecularHDR.dds"; }
if(temp[9].checked) { temp_Texture = "./textures/forest.dds"; }
if(temp[10].checked) { temp_Texture = "./textures/garageSpecularHDR.dds"; }
if(temp[11].checked) { temp_Texture = "./textures/indoorSpecularHDR.dds"; }
if(temp[12].checked) { temp_Texture = "./textures/kloofendalPartlyCloudyHDR.dds"; }
if(temp[13].checked) { temp_Texture = "./textures/mistyPinesHDR.dds"; }
if(temp[14].checked) { temp_Texture = "./textures/mountainFieldHDR.dds"; }
if(temp[15].checked) { temp_Texture = "./textures/night.dds"; }
if(temp[16].checked) { temp_Texture = "./textures/nightBridgeHDR.dds"; }
if(temp[17].checked) { temp_Texture = "./textures/nightSpecularHDR.dds"; }
if(temp[18].checked) { temp_Texture = "./textures/parking.dds"; }
if(temp[19].checked) { temp_Texture = "./textures/parkPathHDR.dds"; }
if(temp[20].checked) { temp_Texture = "./textures/room.dds"; }
if(temp[21].checked) { temp_Texture = "./textures/Runyon_Canyon_A_2k_cube_specular.dds"; }
if(temp[22].checked) { temp_Texture = "./textures/shanghaiBundHDR.dds"; }
if(temp[23].checked) { temp_Texture = "./textures/skateParkHDR.dds"; }
if(temp[24].checked) { temp_Texture = "./textures/SpecularHDR.dds"; }
if(temp[25].checked) { temp_Texture = "./textures/Studio_Softbox_2Umbrellas_cube_specular.dds"; }
if(temp[26].checked) { temp_Texture = "./textures/sunnyVondelparkHDR.dds"; }
if(temp[27].checked) { temp_Texture = "./textures/tiergartenOvercastHDR.dds"; }
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
var scene = CreateScene();
}
// Select the GLTF Data
function Sel_gltf() {
temp = document.getElementsByName("gltf_Layer");
temp_dir = "./scenes/GLTF/glTF_01/";
gltf_data = "ChibiRex_Saturated.gltf";
if(temp[1].checked) { temp_dir = "./scenes/GLTF/glTF_02/"; gltf_data = "DamagedHelmet.gltf"; }
if(temp[2].checked) { temp_dir = "./scenes/GLTF/glTF_03/"; gltf_data = "FlightHelmet_Materials.gltf"; }
if(temp[3].checked) { temp_dir = "./scenes/GLTF/glTF_06/"; gltf_data = "NeonPipe.gltf"; }
if(temp[4].checked) { temp_dir = "./scenes/GLTF/glTF_07/"; gltf_data = "Yeti_Idle.gltf"; }
if(temp[5].checked) { temp_dir = "./scenes/GLTF/glTF_08/"; gltf_data = "BrainStem.gltf"; }
if(temp[6].checked) { temp_dir = "./scenes/GLTF/Aliddin_Textured/"; gltf_data = "Aladdin.gltf"; }
if(temp[7].checked) { temp_dir = "./scenes/GLTF/Disneys_Drossel/"; gltf_data = "Drossel.gltf"; }
if(temp[8].checked) { temp_dir = "./scenes/GLTF/Hazel_from_If_I_Were_A_Wizard/"; gltf_data = "Hazel_01.gltf"; }
if(temp[9].checked) { temp_dir = "./scenes/GLTF/Jerry/"; gltf_data = "JERRY.PSDout.gltf"; }
if(temp[10].checked) { temp_dir = "./scenes/GLTF/Stormtrooper_scan_by_Qlone/"; gltf_data = "model_Stormtrooper_20171214_154554283.gltf"; }
if(temp[11].checked) { temp_dir = "./scenes/GLTF/girl_01/"; gltf_data = "google poly.gltf"; }
if(temp[12].checked) { temp_dir = "./scenes/GLTF/girl_02/"; gltf_data = "google poly.gltf"; }
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
var scene = CreateScene();
}
</script>
</body>
</html>