This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
index.html
182 lines (166 loc) · 6.13 KB
/
index.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
178
179
180
181
182
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version (or Chrome Frame if pre-IE11). -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Cesium Material Pack Demo</title>
<link rel="stylesheet" href="//cesiumjs.org/releases/1.0/Build/Cesium/Widgets/widgets.css" />
<script src="//cesiumjs.org/releases/1.0/Build/Cesium/Cesium.js"></script>
<script src="../Build/MaterialPack.js"></script>
<link rel="stylesheet" href="example.css">
</head>
<body>
<div id="cesiumContainer" class="fullWindow"></div>
<script>
var widget = new Cesium.CesiumWidget('cesiumContainer');
var scene = widget.scene;
var primitives = scene.primitives;
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-120.0, 30.0, -100.0, 40.0),
material : Cesium.Material.fromType('Asphalt')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-100.0, 30.0, -80.0, 40.0),
material : Cesium.Material.fromType('Blob')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-80.0, 30.0, -60.0, 40.0),
material : Cesium.Material.fromType('Brick')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-120.0, 20.0, -100.0, 30.0),
material : Cesium.Material.fromType('Cement')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-100.0, 20.0, -80.0, 30.0),
material : Cesium.Material.fromType('Facet')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-80.0, 20.0, -60.0, 30.0),
material : Cesium.Material.fromType('Grass')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-120.0, 10.0, -100.0, 20.0),
material : Cesium.Material.fromType('TieDye')
}));
primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-100.0, 10.0, -80.0, 20.0),
material : Cesium.Material.fromType('Wood')
}));
var rectangle = primitives.add(new Cesium.RectanglePrimitive({
rectangle : Cesium.Rectangle.fromDegrees(-80.0, 10.0, -60.0, 20.0),
material : Cesium.Material.fromType('Erosion')
}));
scene.tweens.addProperty({
object : rectangle.material.uniforms,
property : 'time',
startValue : 0.0,
stopValue : 1.0,
duration : 10.0
});
var imagePath = 'images/checkerboard.png';
var radius = 500000.0;
var radii = new Cesium.Cartesian3(radius, radius, radius);
var height = radius * 0.5;
primitives.add(new Cesium.EllipsoidPrimitive({
center : Cesium.Cartesian3.fromDegrees(-110.0, 50.0, height),
radii : radii,
material : new Cesium.Material({
fabric : {
materials : {
fresnel : {
type : 'Fresnel',
materials : {
reflection : {
uniforms : {
cubeMap : {
positiveX : imagePath,
negativeX : imagePath,
positiveY : imagePath,
negativeY : imagePath,
positiveZ : imagePath,
negativeZ : imagePath
}
}
},
refraction : {
uniforms : {
cubeMap : {
positiveX : imagePath,
negativeX : imagePath,
positiveY : imagePath,
negativeY : imagePath,
positiveZ : imagePath,
negativeZ : imagePath
}
}
}
}
}
},
components: {
diffuse: 'fresnel.diffuse + 0.7'
}
}
})
}));
primitives.add(new Cesium.EllipsoidPrimitive({
center : Cesium.Cartesian3.fromDegrees(-90.0, 50.0, height),
radii : radii,
material : new Cesium.Material({
fabric : {
materials : {
reflection: {
type : 'Reflection',
uniforms: {
cubeMap: {
positiveX: imagePath,
negativeX: imagePath,
positiveY: imagePath,
negativeY: imagePath,
positiveZ: imagePath,
negativeZ: imagePath
}
}
}
},
components: {
diffuse: 'reflection.diffuse + 0.7'
}
}
})
}));
primitives.add(new Cesium.EllipsoidPrimitive({
center : Cesium.Cartesian3.fromDegrees(-70.0, 50.0, height),
radii : radii,
material : new Cesium.Material({
fabric : {
materials : {
refraction: {
type : 'Refraction',
uniforms: {
cubeMap: {
positiveX: imagePath,
negativeX: imagePath,
positiveY: imagePath,
negativeY: imagePath,
positiveZ: imagePath,
negativeZ: imagePath
},
indexOfRefractionRatio: 0.9
}
}
},
components: {
diffuse: 'refraction.diffuse + 0.7'
}
}
})
}));
</script>
</body>
</html>