Skip to content

Commit a0bcd74

Browse files
committed
Merge remote-tracking branch 'agi/master' into frustum-debug
2 parents 58783cb + b6b3ad2 commit a0bcd74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3141
-74
lines changed
16.7 KB
Loading

Apps/Sandcastle/gallery/Materials.html

+30-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@
202202
});
203203
}
204204

205+
function applyCompressedTextureMaterial(primitive, scene) {
206+
Sandcastle.declare(applyCompressedTextureMaterial); // For highlighting in Sandcastle.
207+
208+
var compressedImageUrl;
209+
if (scene.getCompressedTextureFormatSupported('s3tc')) {
210+
compressedImageUrl = '../images/LogoDXT1.ktx';
211+
} else if (scene.getCompressedTextureFormatSupported('etc1')) {
212+
compressedImageUrl = '../images/LogoETC1.ktx';
213+
} else if (scene.getCompressedTextureFormatSupported('pvrtc')) {
214+
compressedImageUrl = '../images/LogoPVR.ktx';
215+
}
216+
217+
primitive.appearance.material = new Cesium.Material({
218+
fabric : {
219+
type : 'Image',
220+
uniforms : {
221+
image : compressedImageUrl
222+
}
223+
}
224+
});
225+
}
226+
205227
function applyNormalMapMaterial(primitive, scene) {
206228
Sandcastle.declare(applyNormalMapMaterial); // For highlighting in Sandcastle.
207229
primitive.appearance.material = new Cesium.Material({
@@ -310,6 +332,13 @@
310332
applyImageMaterial(rectangle, scene);
311333
Sandcastle.highlight(applyImageMaterial);
312334
}
335+
}, {
336+
text : 'Compressed Image',
337+
onselect : function() {
338+
toggleRectangleVisibility();
339+
applyCompressedTextureMaterial(rectangle, scene);
340+
Sandcastle.highlight(applyCompressedTextureMaterial);
341+
}
313342
}]);
314343

315344
Sandcastle.addToolbarMenu([{
@@ -443,7 +472,7 @@
443472
Sandcastle.highlight(applyPolylineOutlineMaterial);
444473
}
445474
}]);
446-
475+
447476
document.getElementById('toolbar').style.width = '10%';
448477
}
449478

Apps/Sandcastle/images/LogoDXT1.ktx

32.1 KB
Binary file not shown.

Apps/Sandcastle/images/LogoETC1.ktx

32.1 KB
Binary file not shown.

Apps/Sandcastle/images/LogoPVR.ktx

16.1 KB
Binary file not shown.

CHANGES.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Change Log
33

44
### 1.31 - 2017-03-01
55
* Added support to `DebugCameraPrimitive` to draw multifrustum planes. The attribute `debugShowFrustumPlanes` of `Scene` and `frustumPlanes` of `CesiumInspector` toggles this. `FrameState` has been augmented to include `frustumSplits` which is a `Number[]` of the near/far planes of the camera frustums.
6+
* Enable rendering `GroundPrimitives` on hardware without the `EXT_frag_depth` extension; however, this could cause artifacts for certain viewing angles.
7+
* Added compressed texture support. [#4758](https://github.com/AnalyticalGraphicsInc/cesium/pull/4758)
8+
* glTF models and imagery layers can now reference [KTX](https://www.khronos.org/opengles/sdk/tools/KTX/) textures and textures compressed with [crunch](https://github.com/BinomialLLC/crunch).
9+
* Added `loadKTX`, to load KTX textures, and `loadCRN` to load crunch compressed textures.
10+
* Added new `PixelFormat` and `WebGLConstants` enums from WebGL extensions `WEBGL_compressed_s3tc`, `WEBGL_compressed_texture_pvrtc`, and `WEBGL_compressed_texture_etc1`.
11+
* Added `CompressedTextureBuffer`.
612

713
### 1.30 - 2017-02-01
814

LICENSE.md

+79
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,85 @@ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
288288
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
289289
THIS SOFTWARE.
290290

291+
### crunch
292+
293+
https://github.com/BinomialLLC/crunch
294+
295+
>crunch/crnlib uses the ZLIB license:
296+
>http://opensource.org/licenses/Zlib
297+
>
298+
>Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC
299+
>
300+
>This software is provided 'as-is', without any express or implied
301+
warranty. In no event will the authors be held liable for any damages
302+
arising from the use of this software.
303+
>
304+
>Permission is granted to anyone to use this software for any purpose,
305+
including commercial applications, and to alter it and redistribute it
306+
freely, subject to the following restrictions:
307+
>
308+
>1. The origin of this software must not be misrepresented; you must not
309+
claim that you wrote the original software. If you use this software
310+
in a product, an acknowledgment in the product documentation would be
311+
appreciated but is not required.
312+
>
313+
>2. Altered source versions must be plainly marked as such, and must not be
314+
misrepresented as being the original software.
315+
>
316+
>3. This notice may not be removed or altered from any source distribution.
317+
318+
### crunch_lib.cpp
319+
320+
https://github.com/Apress/html5-game-dev-insights/blob/master/jones_ch21/crunch_webgl/crunch_js/crunch_lib.cpp
321+
322+
>Copyright (c) 2013, Evan Parker, Brandon Jones. All rights reserved.
323+
>
324+
>Redistribution and use in source and binary forms, with or without modification,
325+
are permitted provided that the following conditions are met:
326+
>
327+
> * Redistributions of source code must retain the above copyright notice, this
328+
list of conditions and the following disclaimer.
329+
> * Redistributions in binary form must reproduce the above copyright notice,
330+
this list of conditions and the following disclaimer in the documentation
331+
and/or other materials provided with the distribution.
332+
>
333+
>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
334+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
335+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
336+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
337+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
338+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
339+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
340+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
341+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
342+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
343+
344+
### texture-tester
345+
346+
https://github.com/toji/texture-tester
347+
348+
>Copyright (c) 2014, Brandon Jones. All rights reserved.
349+
>
350+
>Redistribution and use in source and binary forms, with or without modification,
351+
>are permitted provided that the following conditions are met:
352+
>
353+
>* Redistributions of source code must retain the above copyright notice, this
354+
list of conditions and the following disclaimer.
355+
>* Redistributions in binary form must reproduce the above copyright notice,
356+
this list of conditions and the following disclaimer in the documentation
357+
and/or other materials provided with the distribution.
358+
>
359+
>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
360+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
361+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
362+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
363+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
364+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
365+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
366+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
367+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
368+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
369+
291370
Tests
292371
=====
293372

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*global define*/
2+
define([
3+
'./defined',
4+
'./defineProperties'
5+
], function(
6+
defined,
7+
defineProperties
8+
) {
9+
'use strict';
10+
11+
/**
12+
* Describes a compressed texture and contains a compressed texture buffer.
13+
*
14+
* @param {PixelFormat} internalFormat The pixel format of the compressed texture.
15+
* @param {Number} width The width of the texture.
16+
* @param {Number} height The height of the texture.
17+
* @param {Uint8Array} buffer The compressed texture buffer.
18+
*/
19+
function CompressedTextureBuffer(internalFormat, width, height, buffer) {
20+
this._format = internalFormat;
21+
this._width = width;
22+
this._height = height;
23+
this._buffer = buffer;
24+
}
25+
26+
defineProperties(CompressedTextureBuffer.prototype, {
27+
/**
28+
* The format of the compressed texture.
29+
* @type PixelFormat
30+
* @readonly
31+
*/
32+
internalFormat : {
33+
get : function() {
34+
return this._format;
35+
}
36+
},
37+
/**
38+
* The width of the texture.
39+
* @type Number
40+
* @readonly
41+
*/
42+
width : {
43+
get : function() {
44+
return this._width;
45+
}
46+
},
47+
/**
48+
* The height of the texture.
49+
* @type Number
50+
* @readonly
51+
*/
52+
height : {
53+
get : function() {
54+
return this._height;
55+
}
56+
},
57+
/**
58+
* The compressed texture buffer.
59+
* @type Uint8Array
60+
* @readonly
61+
*/
62+
bufferView : {
63+
get : function() {
64+
return this._buffer;
65+
}
66+
}
67+
});
68+
69+
/**
70+
* Creates a shallow clone of a compressed texture buffer.
71+
*
72+
* @param {CompressedTextureBuffer} object The compressed texture buffer to be cloned.
73+
* @return {CompressedTextureBuffer} A shallow clone of the compressed texture buffer.
74+
*/
75+
CompressedTextureBuffer.clone = function(object) {
76+
if (!defined(object)) {
77+
return undefined;
78+
}
79+
80+
return new CompressedTextureBuffer(object._format, object._width, object._height, object._buffer);
81+
};
82+
83+
/**
84+
* Creates a shallow clone of this compressed texture buffer.
85+
*
86+
* @return {CompressedTextureBuffer} A shallow clone of the compressed texture buffer.
87+
*/
88+
CompressedTextureBuffer.prototype.clone = function() {
89+
return CompressedTextureBuffer.clone(this);
90+
};
91+
92+
return CompressedTextureBuffer;
93+
});

0 commit comments

Comments
 (0)