diff --git a/Apps/Sandcastle/gallery/development/VolumeCloud.html b/Apps/Sandcastle/gallery/VolumeCloud.html
similarity index 99%
rename from Apps/Sandcastle/gallery/development/VolumeCloud.html
rename to Apps/Sandcastle/gallery/VolumeCloud.html
index c9b61289edb1..f7f3b632d3cc 100644
--- a/Apps/Sandcastle/gallery/development/VolumeCloud.html
+++ b/Apps/Sandcastle/gallery/VolumeCloud.html
@@ -11,7 +11,7 @@
name="description"
content="Rendering Volume Cloud with Texture3D and Custom GLSL. Transplanted from Three.js"
/>
-
+
Cesium Demo
>includeStart('debug', pragmas.debug);
+ if (!TextureWrap.validate(wrapR)) {
+ throw new DeveloperError("Invalid sampler.wrapR.");
+ }
+
if (!TextureWrap.validate(wrapS)) {
throw new DeveloperError("Invalid sampler.wrapS.");
}
@@ -44,6 +49,7 @@ function Sampler(options) {
);
//>>includeEnd('debug');
+ this._wrapR = wrapR;
this._wrapS = wrapS;
this._wrapT = wrapT;
this._minificationFilter = minificationFilter;
@@ -52,6 +58,11 @@ function Sampler(options) {
}
Object.defineProperties(Sampler.prototype, {
+ wrapR: {
+ get: function () {
+ return this._wrapR;
+ },
+ },
wrapS: {
get: function () {
return this._wrapS;
@@ -84,6 +95,7 @@ Sampler.equals = function (left, right) {
left === right ||
(defined(left) &&
defined(right) &&
+ left._wrapR === right._wrapR &&
left._wrapS === right._wrapS &&
left._wrapT === right._wrapT &&
left._minificationFilter === right._minificationFilter &&
@@ -94,6 +106,7 @@ Sampler.equals = function (left, right) {
Sampler.NEAREST = Object.freeze(
new Sampler({
+ wrapR: TextureWrap.CLAMP_TO_EDGE,
wrapS: TextureWrap.CLAMP_TO_EDGE,
wrapT: TextureWrap.CLAMP_TO_EDGE,
minificationFilter: TextureMinificationFilter.NEAREST,
diff --git a/packages/engine/Source/Renderer/Texture3D.js b/packages/engine/Source/Renderer/Texture3D.js
index c44c2cd434a9..9e6813fa1f85 100644
--- a/packages/engine/Source/Renderer/Texture3D.js
+++ b/packages/engine/Source/Renderer/Texture3D.js
@@ -13,21 +13,30 @@ import Sampler from "./Sampler.js";
import TextureMagnificationFilter from "./TextureMagnificationFilter.js";
import TextureMinificationFilter from "./TextureMinificationFilter.js";
+/**
+ * @typedef {object} Texture3D.Source
+ * @property {number} width The width (in pixels) of the 3D texture source data.
+ * @property {number} height The height (in pixels) of the 3D texture source data.
+ * @property {number} depth The depth (in pixels) of the 3D texture source data.
+ * @property {TypedArray|DataView} arrayBufferView The source data for a 3D texture. The type of each element needs to match the pixelDatatype.
+ * @property {TypedArray|DataView} [mipLevels] An array of mip level data. Each element in the array should be a TypedArray or DataView that matches the pixelDatatype.
+ */
+
/**
* @typedef {object} Texture3D.ConstructorOptions
*
* @property {Context} context
- * @property {object} [source] The source for texel values to be loaded into the texture3D.
+ * @property {Texture3D.Source} [source] The source for texel values to be loaded into the 3D texture.
* @property {PixelFormat} [pixelFormat=PixelFormat.RGBA] The format of each pixel, i.e., the number of components it has and what they represent.
* @property {PixelDatatype} [pixelDatatype=PixelDatatype.UNSIGNED_BYTE] The data type of each pixel.
* @property {boolean} [flipY=true] If true, the source values will be read as if the y-axis is inverted (y=0 at the top).
* @property {boolean} [skipColorSpaceConversion=false] If true, color space conversions will be skipped when reading the texel values.
- * @property {Sampler} [sampler] Information about how to sample the texture3D.
- * @property {number} [width] The pixel width of the texture3D. If not supplied, must be available from the source.
- * @property {number} [height] The pixel height of the texture3D. If not supplied, must be available from the source.
- * @property {number} [depth] The pixel depth of the texture3D. If not supplied, must be available from the source.
+ * @property {Sampler} [sampler] Information about how to sample the 3D texture.
+ * @property {number} [width] The width (in pixels) of the 3D texture. If not supplied, must be available from the source.
+ * @property {number} [height] The height (in pixels) of the 3D texture. If not supplied, must be available from the source.
+ * @property {number} [depth] The depth (in pixels) of the 3D texture. If not supplied, must be available from the source.
* @property {boolean} [preMultiplyAlpha] If true, the alpha channel will be multiplied into the other channels.
- * @property {string} [id] A unique identifier for the texture3D. If this is not given, then a GUID will be created.
+ * @property {string} [id] A unique identifier for the 3D texture. If this is not given, then a GUID will be created.
*
* @private
*/
@@ -253,7 +262,7 @@ function Texture3D(options) {
* Load texel data from a buffer into a texture3D.
*
* @param {Texture3D} texture3D The texture3D to which texel values will be loaded.
- * @param {object} source The source for texel values to be loaded into the texture3D.
+ * @param {Texture3D.Source} source The source for texel values to be loaded into the texture3D.
*
* @private
*/
@@ -503,6 +512,7 @@ function setupSampler(texture3D, sampler) {
gl.bindTexture(target, texture3D._texture);
gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minificationFilter);
gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magnificationFilter);
+ gl.texParameteri(target, gl.TEXTURE_WRAP_R, sampler.wrapR);
gl.texParameteri(target, gl.TEXTURE_WRAP_S, sampler.wrapS);
gl.texParameteri(target, gl.TEXTURE_WRAP_T, sampler.wrapT);
if (defined(texture3D._textureFilterAnisotropic)) {
diff --git a/packages/engine/Specs/Renderer/SamplerSpec.js b/packages/engine/Specs/Renderer/SamplerSpec.js
index 7ae117336e27..71cfae9671f2 100644
--- a/packages/engine/Specs/Renderer/SamplerSpec.js
+++ b/packages/engine/Specs/Renderer/SamplerSpec.js
@@ -21,6 +21,7 @@ describe(
it("has expected default values", function () {
const sampler = new Sampler();
+ expect(sampler.wrapR).toEqual(TextureWrap.CLAMP_TO_EDGE);
expect(sampler.wrapS).toEqual(TextureWrap.CLAMP_TO_EDGE);
expect(sampler.wrapT).toEqual(TextureWrap.CLAMP_TO_EDGE);
expect(sampler.minificationFilter).toEqual(
@@ -32,6 +33,14 @@ describe(
expect(sampler.maximumAnisotropy).toEqual(1.0);
});
+ it("throws when creating a sampler with invalid wrapR", function () {
+ expect(function () {
+ return new Sampler({
+ wrapR: "invalid wrap",
+ });
+ }).toThrowDeveloperError();
+ });
+
it("throws when creating a sampler with invalid wrapS", function () {
expect(function () {
return new Sampler({