├── readme.md
├── Cesium的Property机制总结
├── readme.md
├── images
│ ├── 1.gif
│ ├── 2.gif
│ ├── 3.gif
│ ├── 4.gif
│ ├── 5.gif
│ ├── 6.gif
│ ├── 7.gif
│ └── 8.gif
└── 源码
│ └── sample1.js
├── 解决Cesium1.50对gltf2.0 3dtiles数据读取的问题
├── readme.md
└── 源码
│ └── fixGltf.js
├── Cesium1.53测评
└── 用来替代Cesium自身的环境贴图
│ └── vtxf-envirment.ktx
└── Temp
├── measurement.html
├── imageryCorrection.html
└── clippingPlane.html
/readme.md:
--------------------------------------------------------------------------------
1 | 文章在这里:https://www.jianshu.com/c/c423df2ea4f3
--------------------------------------------------------------------------------
/Cesium的Property机制总结/readme.md:
--------------------------------------------------------------------------------
1 | 文章在这里:https://www.jianshu.com/p/f0b47997224c
--------------------------------------------------------------------------------
/解决Cesium1.50对gltf2.0 3dtiles数据读取的问题/readme.md:
--------------------------------------------------------------------------------
1 | https://www.jianshu.com/p/e0e0a62c5726
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/1.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/2.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/3.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/4.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/5.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/5.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/6.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/6.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/7.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/7.gif
--------------------------------------------------------------------------------
/Cesium的Property机制总结/images/8.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium的Property机制总结/images/8.gif
--------------------------------------------------------------------------------
/Cesium1.53测评/用来替代Cesium自身的环境贴图/vtxf-envirment.ktx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vtxf/cesium-notes/HEAD/Cesium1.53测评/用来替代Cesium自身的环境贴图/vtxf-envirment.ktx
--------------------------------------------------------------------------------
/解决Cesium1.50对gltf2.0 3dtiles数据读取的问题/源码/fixGltf.js:
--------------------------------------------------------------------------------
1 | // 说明文章在这里:
2 | // https://zhuanlan.zhihu.com/p/46189487
3 | // https://www.jianshu.com/p/e0e0a62c5726
4 |
5 | var fixGltf = function(gltf) {
6 | if (!gltf.extensionsUsed) {
7 | return;
8 | }
9 |
10 | var v = gltf.extensionsUsed.indexOf('KHR_technique_webgl');
11 | var t = gltf.extensionsRequired.indexOf('KHR_technique_webgl');
12 | // 中招了。。
13 | if (v !== -1) {
14 | gltf.extensionsRequired.splice(t, 1, 'KHR_techniques_webgl');
15 | gltf.extensionsUsed.splice(v, 1, 'KHR_techniques_webgl');
16 | gltf.extensions = gltf.extensions || {};
17 | gltf.extensions['KHR_techniques_webgl'] = {};
18 | gltf.extensions['KHR_techniques_webgl'].programs = gltf.programs;
19 | gltf.extensions['KHR_techniques_webgl'].shaders = gltf.shaders;
20 | gltf.extensions['KHR_techniques_webgl'].techniques = gltf.techniques;
21 | var techniques = gltf.extensions['KHR_techniques_webgl'].techniques;
22 |
23 | gltf.materials.forEach(function (mat, index) {
24 | gltf.materials[index].extensions || (gltf.materials[index].extensions = {KHR_technique_webgl: {}}); // vtxf 181025
25 | gltf.materials[index].extensions['KHR_technique_webgl'].values = gltf.materials[index].values;
26 | gltf.materials[index].extensions['KHR_techniques_webgl'] = gltf.materials[index].extensions['KHR_technique_webgl'];
27 |
28 | var vtxfMaterialExtension = gltf.materials[index].extensions['KHR_techniques_webgl'];
29 | vtxfMaterialExtension.technique || (vtxfMaterialExtension.technique = gltf.materials[index].technique); // vtxf 181025
30 |
31 |
32 | for (var value in vtxfMaterialExtension.values) {
33 | var us = techniques[vtxfMaterialExtension.technique].uniforms;
34 | for (var key in us) {
35 | if (us[key] === value) {
36 | vtxfMaterialExtension.values[key] = vtxfMaterialExtension.values[value];
37 | delete vtxfMaterialExtension.values[value];
38 | break;
39 | }
40 | }
41 | };
42 | });
43 |
44 | techniques.forEach(function (t) {
45 | for (var attribute in t.attributes) {
46 | var name = t.attributes[attribute];
47 | t.attributes[attribute] = t.parameters[name];
48 | };
49 |
50 | for (var uniform in t.uniforms) {
51 | var name = t.uniforms[uniform];
52 | t.uniforms[uniform] = t.parameters[name];
53 | };
54 | });
55 | }
56 | }
57 |
58 | Object.defineProperties(Cesium.Model.prototype, {
59 | _cachedGltf: {
60 | set: function (value) {
61 | this._vtxf_cachedGltf = value;
62 | if (this._vtxf_cachedGltf && this._vtxf_cachedGltf._gltf) {
63 | fixGltf(this._vtxf_cachedGltf._gltf);
64 | }
65 | },
66 | get: function () {
67 | return this._vtxf_cachedGltf;
68 | }
69 | }
70 | });
--------------------------------------------------------------------------------
/Temp/measurement.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 测量
10 |
11 |
12 |
13 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/Temp/imageryCorrection.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 影像纠偏
11 |
12 |
13 |
14 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
158 |
159 |
160 |
161 |
--------------------------------------------------------------------------------
/Temp/clippingPlane.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 编辑互斥
10 |
11 |
12 |
13 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/Cesium的Property机制总结/源码/sample1.js:
--------------------------------------------------------------------------------
1 | // Cesium的Property机制总结 vtxf 20181120
2 | // 以下代码放在Cesium的SandCastle中可以直接运行
3 | // 文章在这里:https://www.jianshu.com/p/f0b47997224c
4 |
5 | var viewer = new Cesium.Viewer('cesiumContainer', {
6 | imageryProvider : Cesium.createTileMapServiceImageryProvider({
7 | url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
8 | }),
9 | baseLayerPicker : false,
10 | geocoder : false,
11 | shouldAnimate: true,
12 | });
13 |
14 | ////////////////////////////////////////////////////////
15 | // 此段代码仅为消除锯齿,让录屏好看一点,可以忽略 begin
16 | viewer._cesiumWidget._supportsImageRenderingPixelated = Cesium.FeatureDetection.supportsImageRenderingPixelated();
17 | viewer._cesiumWidget._forceResize = true;
18 | if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
19 | var vtxf_dpr = window.devicePixelRatio;
20 | // 适度降低分辨率
21 | while (vtxf_dpr >= 2.0) {
22 | vtxf_dpr /= 2.0;
23 | }
24 | //alert(dpr);
25 | viewer.resolutionScale = vtxf_dpr;
26 | }
27 | // 此段代码仅为消除锯齿,让录屏好看一点,可以忽略 end
28 | ////////////////////////////////////////////////////////
29 |
30 | // 设置时间
31 | var start = Cesium.JulianDate.fromIso8601('2019-01-01T00:00:00.00Z');
32 | var stop = Cesium.JulianDate.fromIso8601('2019-01-03T00:00:00.00Z');
33 | //Make sure viewer is at the desired time.
34 | viewer.clock.startTime = start.clone();
35 | viewer.clock.stopTime = stop.clone();
36 | viewer.clock.currentTime = start.clone();
37 | viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the end
38 | viewer.clock.multiplier = 50000;
39 | viewer.timeline.zoomTo(start, stop);
40 |
41 | // 创建box
42 |
43 | var blueBox = viewer.entities.add({
44 | name : 'Blue box',
45 | //id: 'blueBox',
46 | position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0),
47 | box : {
48 | dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
49 | material : Cesium.Color.BLUE,
50 | outline: true,
51 | },
52 | path: {
53 | show: true
54 | }
55 | });
56 |
57 | var redBox = viewer.entities.add({
58 | name : 'Red box',
59 | position: Cesium.Cartesian3.fromDegrees(-114.0, 30.0, 300000.0),
60 | box : {
61 | dimensions : new Cesium.Cartesian3(200000.0, 200000.0, 200000.0),
62 | material : Cesium.Color.RED,
63 | outline: true,
64 | }
65 | });
66 |
67 | viewer.zoomTo(viewer.entities);
68 |
69 | Sandcastle.addToolbarButton('Constant new', function () {
70 | blueBox.box.dimensions = new ConstantProperty(new Cesium.Cartesian3(400000.0, 300000.0, 200000.0));
71 | // 以上代码等同于
72 | // blueBox.box.dimensions = new Cesium.Cartesian3(400000.0, 300000.0, 200000.0);
73 | });
74 |
75 | Sandcastle.addToolbarButton('Constant set', function () {
76 | blueBox.box.dimensions && blueBox.box.dimensions.setValue(new Cesium.Cartesian3(400000.0, 300000.0, 700000.0));
77 | });
78 |
79 | Sandcastle.addToolbarButton('Sampled', function () {
80 | var property = new Cesium.SampledProperty(Cesium.Cartesian3);
81 |
82 | property.addSample(Cesium.JulianDate.fromIso8601('2019-01-01T00:00:00.00Z'),
83 | new Cesium.Cartesian3(400000.0, 300000.0, 200000.0));
84 |
85 | property.addSample(Cesium.JulianDate.fromIso8601('2019-01-03T00:00:00.00Z'),
86 | new Cesium.Cartesian3(400000.0, 300000.0, 700000.0));
87 |
88 | blueBox.box.dimensions = property;
89 | });
90 |
91 | Sandcastle.addToolbarButton('TimeIntervalCollection', function () {
92 | var property = new Cesium.TimeIntervalCollectionProperty(Cesium.Cartesian3);
93 |
94 | property.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
95 | iso8601 : '2019-01-01T00:00:00.00Z/2019-01-01T12:00:00.00Z',
96 | isStartIncluded : true,
97 | isStopIncluded : false,
98 | data : new Cesium.Cartesian3(400000.0, 300000.0, 200000.0)
99 | }));
100 | property.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
101 | iso8601 : '2019-01-01T12:00:01.00Z/2019-01-02T00:00:00.00Z',
102 | isStartIncluded : true,
103 | isStopIncluded : false,
104 | data : new Cesium.Cartesian3(400000.0, 300000.0, 400000.0)
105 | }));
106 | property.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
107 | iso8601 : '2019-01-02T00:00:01.00Z/2019-01-02T12:00:00.00Z',
108 | isStartIncluded : true,
109 | isStopIncluded : false,
110 | data : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0)
111 | }));
112 | property.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
113 | iso8601 : '2019-01-02T12:00:01.00Z/2019-01-03T00:00:00.00Z',
114 | isStartIncluded : true,
115 | isStopIncluded : true,
116 | data : new Cesium.Cartesian3(400000.0, 300000.0, 700000.0)
117 | }));
118 |
119 | blueBox.box.dimensions = property;
120 | });
121 |
122 | Sandcastle.addToolbarButton('Composit', function () {
123 | // 1 sampledProperty
124 | var sampledProperty = new Cesium.SampledProperty(Cesium.Cartesian3);
125 | sampledProperty.addSample(Cesium.JulianDate.fromIso8601('2019-01-01T00:00:00.00Z'),
126 | new Cesium.Cartesian3(400000.0, 300000.0, 200000.0));
127 |
128 | sampledProperty.addSample(Cesium.JulianDate.fromIso8601('2019-01-02T00:00:00.00Z'),
129 | new Cesium.Cartesian3(400000.0, 300000.0, 400000.0));
130 |
131 | // 2 ticProperty
132 | var ticProperty = new Cesium.TimeIntervalCollectionProperty();
133 | ticProperty.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
134 | iso8601 : '2019-01-02T00:00:00.00Z/2019-01-02T06:00:00.00Z',
135 | isStartIncluded : true,
136 | isStopIncluded : false,
137 | data : new Cesium.Cartesian3(400000.0, 300000.0, 400000.0)
138 | }));
139 | ticProperty.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
140 | iso8601 : '2019-01-02T06:00:00.00Z/2019-01-02T12:00:00.00Z',
141 | isStartIncluded : true,
142 | isStopIncluded : false,
143 | data : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0)
144 | }));
145 | ticProperty.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
146 | iso8601 : '2019-01-02T12:00:00.00Z/2019-01-02T18:00:00.00Z',
147 | isStartIncluded : true,
148 | isStopIncluded : false,
149 | data : new Cesium.Cartesian3(400000.0, 300000.0, 600000.0)
150 | }));
151 | ticProperty.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
152 | iso8601 : '2019-01-02T18:00:00.00Z/2019-01-03T23:00:00.00Z',
153 | isStartIncluded : true,
154 | isStopIncluded : true,
155 | data : new Cesium.Cartesian3(400000.0, 300000.0, 700000.0)
156 | }));
157 |
158 | // 3 compositeProperty
159 | var compositeProperty = new Cesium.CompositeProperty();
160 | compositeProperty.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
161 | iso8601 : '2019-01-01T00:00:00.00Z/2019-01-02T00:00:00.00Z',
162 | data : sampledProperty
163 | }));
164 | compositeProperty.intervals.addInterval(Cesium.TimeInterval.fromIso8601({
165 | iso8601 : '2019-01-02T00:00:00.00Z/2019-01-03T00:00:00.00Z',
166 | isStartIncluded : false,
167 | isStopIncluded : false,
168 | data : ticProperty
169 | }));
170 |
171 | // 4 设置position
172 | blueBox.box.dimensions = compositeProperty;
173 | });
174 |
175 | Sandcastle.addToolbarButton('ConstantPosition', function () {
176 | blueBox.position = new Cesium.ConstantPositionProperty(Cesium.Cartesian3.fromDegrees(-114.0, 45.0, 300000.0));
177 | // 以上代码等同于
178 | // blueBox.position = Cesium.Cartesian3.fromDegrees(-114.0, 45.0, 300000.0)
179 | });
180 |
181 | Sandcastle.addToolbarButton('SampledPosition', function () {
182 | var property = new Cesium.SampledPositionProperty();
183 |
184 | property.addSample(Cesium.JulianDate.fromIso8601('2019-01-01T00:00:00.00Z'),
185 | Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0));
186 |
187 | property.addSample(Cesium.JulianDate.fromIso8601('2019-01-03T00:00:00.00Z'),
188 | Cesium.Cartesian3.fromDegrees(-114.0, 45.0, 300000.0));
189 |
190 | blueBox.position = property;
191 | });
192 |
193 | Sandcastle.addToolbarButton('ColorMaterial', function () {
194 | blueBox.box.material = new Cesium.ColorMaterialProperty(new Cesium.Color(0, 1, 0));
195 | // 以上代码等同于
196 | // blueBox.box.material = new Cesium.Color(0, 1, 0);
197 | });
198 |
199 | Sandcastle.addToolbarButton('SampledColor', function () {
200 | var colorProperty = new Cesium.SampledProperty(Cesium.Color);
201 |
202 | colorProperty.addSample(Cesium.JulianDate.fromIso8601('2019-01-01T00:00:00.00Z'),
203 | new Cesium.Color(0, 1, 0));
204 |
205 | colorProperty.addSample(Cesium.JulianDate.fromIso8601('2019-01-03T00:00:00.00Z'),
206 | new Cesium.Color(0, 0, 1));
207 |
208 | blueBox.box.material = new Cesium.ColorMaterialProperty(colorProperty);
209 | });
210 |
211 | Sandcastle.addToolbarButton('Reference', function () {
212 | var collection = viewer.entities;
213 | redBox.box.dimensions = new Cesium.ReferenceProperty(collection, blueBox.id, ['box', 'dimensions']);
214 | });
215 |
216 | Sandcastle.addToolbarButton('PropertyBag', function () {
217 | var zp = new Cesium.SampledProperty(Number);
218 | zp.addSample(Cesium.JulianDate.fromIso8601('2019-01-01T00:00:00.00Z'), 200000.0);
219 | zp.addSample(Cesium.JulianDate.fromIso8601('2019-01-03T00:00:00.00Z'), 700000.0);
220 |
221 | blueBox.box.dimensions = new Cesium.PropertyBag({
222 | x: 400000.0,
223 | y: 300000.0,
224 | z: zp
225 | });
226 | });
227 |
228 | Sandcastle.addToolbarButton('PropertyBag', function () {
229 | var l = 200000.0;
230 | var property = new Cesium.CallbackProperty(function (time, result) {
231 | result = result || new Cesium.Cartesian3(0, 0, 0);
232 |
233 | l += 10000.0;
234 | if (l > 700000.0) {
235 | l = 200000.0;
236 | }
237 |
238 | result.x = 400000.0;
239 | result.y = 300000.0;
240 | result.z = l;
241 |
242 | return result;
243 | }, false);
244 |
245 | blueBox.box.dimensions = property;
246 | });
247 |
248 | Sandcastle.addToolbarButton('VelocityVector', function () {
249 | blueBox.billboard = {
250 | image : 'https://upload-images.jianshu.io/upload_images/80648-5dfe8a3ea2c250be.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/540/format/webp',
251 | alignedAxis : new Cesium.VelocityVectorProperty(blueBox.position, true) // alignedAxis must be a unit vector
252 | };
253 | });
254 |
255 |
256 |
257 |
--------------------------------------------------------------------------------