-
Notifications
You must be signed in to change notification settings - Fork 5
/
Cruising_in_the_sky_001.html
70 lines (59 loc) · 2.2 KB
/
Cruising_in_the_sky_001.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>Babylon.js - Cruising in the sky with Vertex Shaders #001</title>
<style>
html,body,canvas { margin: 0; padding: 0; width: 100%; height: 100%; font-size: 0; }
</style>
<script src="https://code.jquery.com/pep/0.4.1/pep.min.js"></script>
<script src="https://preview.babylonjs.com/babylon.js"></script>
<script>
var Camera_Control = "ON";
var CreateVertexDataScene = function(engine) {
var scene = new BABYLON.Scene(engine);
var start_time = Date.now();
var skybox_data = "./textures/TropicalSunnyDay";
var pos_x = 0;
var pos_y = -128;
var pos_z = 0;
var Limit_z = 5000;
var skybox0 = BABYLON.MeshBuilder.CreateBox("skyBox", {size: Limit_z * 2.0}, scene);
skybox0.rotation.x = Math.PI * 1.0;
skybox0.rotation.y = Math.PI * 0.14;
var skybox0_material = new BABYLON.StandardMaterial('skybox', scene);
skybox0_material.backFaceCulling = false;
skybox0_material.reflectionTexture = new BABYLON.CubeTexture(skybox_data, scene);
skybox0_material.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
skybox0_material.diffuseColor = new BABYLON.Color3(0, 0, 0);
skybox0_material.specularColor = new BABYLON.Color3(0, 0, 0);
skybox0_material.disableLighting = true;
skybox0.material = skybox0_material;
var light_1 = new BABYLON.DirectionalLight('light', new BABYLON.Vector3(100, -1000, 100), scene)
light_1.intensity = 1.0;
// Set the camera
var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, -128, 0), scene);
camera.fov = 30;
camera.minZ = 1;
camera.maxZ = Limit_z * 2.0;
return scene;
}
var demo = {
constructor: CreateVertexDataScene,
onload: function (scene) {
if (Camera_Control == "ON") {
scene.activeCamera.attachControl(canvas);
}
else {
scene.activeCamera.detachControl(scene.getEngine().getRenderingCanvas());
}
}
};
</script>
</head>
<body>
<canvas id="renderCanvas" touch-action="none"></canvas>
<div id="notSupported" class="hidden">Sorry but your browser does not support WebGL...</div>
<script src="loaderCustoms.js"></script>
</body>
</html>