Skip to content

Commit 2640bd8

Browse files
authored
Merge pull request #12611 from Hiwen/Texture3D
Support Texture3D and add Volume Cloud SandBox Sample
2 parents fb31446 + 6ec26fe commit 2640bd8

File tree

9 files changed

+1612
-1
lines changed

9 files changed

+1612
-1
lines changed

Apps/Sandcastle/gallery/development/VolumeCloud.html

Lines changed: 658 additions & 0 deletions
Large diffs are not rendered by default.
92.6 KB
Loading

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 1.130 - 2025-06-02
4+
5+
### @cesium/engine
6+
7+
#### Additions :tada:
8+
9+
- Support Texture3D and add Volume Cloud SandBox Sample. [#12550](https://github.com/CesiumGS/cesium/issues/12550)
10+
311
## 1.129 - 2025-05-01
412

513
### @cesium/engine

packages/engine/Source/Core/PixelFormat.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,29 @@ PixelFormat.textureSizeInBytes = function (
392392
);
393393
};
394394

395+
/**
396+
* @private
397+
*/
398+
PixelFormat.texture3DSizeInBytes = function (
399+
pixelFormat,
400+
pixelDatatype,
401+
width,
402+
height,
403+
depth,
404+
) {
405+
let componentsLength = PixelFormat.componentsLength(pixelFormat);
406+
if (PixelDatatype.isPacked(pixelDatatype)) {
407+
componentsLength = 1;
408+
}
409+
return (
410+
componentsLength *
411+
PixelDatatype.sizeInBytes(pixelDatatype) *
412+
width *
413+
height *
414+
depth
415+
);
416+
};
417+
395418
/**
396419
* @private
397420
*/
@@ -499,6 +522,19 @@ PixelFormat.toInternalFormat = function (pixelFormat, pixelDatatype, context) {
499522
}
500523
}
501524

525+
if (pixelDatatype === PixelDatatype.UNSIGNED_BYTE) {
526+
switch (pixelFormat) {
527+
case PixelFormat.RGBA:
528+
return WebGLConstants.RGBA8;
529+
case PixelFormat.RGB:
530+
return WebGLConstants.RGB8;
531+
case PixelFormat.RG:
532+
return WebGLConstants.RG8;
533+
case PixelFormat.RED:
534+
return WebGLConstants.R8;
535+
}
536+
}
537+
502538
return pixelFormat;
503539
};
504540

0 commit comments

Comments
 (0)