Skip to content

Commit b891542

Browse files
committed
Rename ModelComponents.Texture -> TextureReader
1 parent de2f955 commit b891542

File tree

7 files changed

+54
-52
lines changed

7 files changed

+54
-52
lines changed

Source/Scene/FeatureTextureProperty.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ function FeatureTextureProperty(options) {
3232
//>>includeEnd('debug');
3333

3434
var textureInfo = property.texture;
35-
var texture = GltfLoaderUtil.createModelTexture({
35+
var textureReader = GltfLoaderUtil.createModelTexture({
3636
textureInfo: textureInfo,
3737
channels: property.channels,
3838
texture: textures[textureInfo.index],
3939
});
4040

41-
this._texture = texture;
41+
this._textureReader = textureReader;
4242
this._classProperty = classProperty;
4343
this._extras = property.extras;
4444
this._extensions = property.extensions;
@@ -49,13 +49,13 @@ Object.defineProperties(FeatureTextureProperty.prototype, {
4949
* The texture.
5050
*
5151
* @memberof FeatureTextureProperty.prototype
52-
* @type {ModelComponents.Texture}
52+
* @type {ModelComponents.TextureReader}
5353
* @readonly
5454
* @private
5555
*/
56-
texture: {
56+
textureReader: {
5757
get: function () {
58-
return this._texture;
58+
return this._textureReader;
5959
},
6060
},
6161

Source/Scene/GltfLoader.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,21 +613,21 @@ function loadTexture(
613613

614614
loader._textureLoaders.push(textureLoader);
615615

616-
var texture = GltfLoaderUtil.createModelTexture({
616+
var textureReader = GltfLoaderUtil.createModelTexture({
617617
textureInfo: textureInfo,
618618
});
619619

620620
textureLoader.promise.then(function (textureLoader) {
621621
if (loader.isDestroyed()) {
622622
return;
623623
}
624-
texture.texture = textureLoader.texture;
624+
textureReader.texture = textureLoader.texture;
625625
if (defined(samplerOverride)) {
626-
texture.texture.sampler = samplerOverride;
626+
textureReader.texture.sampler = samplerOverride;
627627
}
628628
});
629629

630-
return texture;
630+
return textureReader;
631631
}
632632

633633
function loadMaterial(loader, gltf, gltfMaterial, supportedImageFormats) {
@@ -758,15 +758,15 @@ function loadFeatureIdTexture(
758758
var textureInfo = featureIds.texture;
759759

760760
featureIdTexture.featureTableId = gltfFeatureIdTexture.featureTable;
761-
featureIdTexture.texture = loadTexture(
761+
featureIdTexture.textureReader = loadTexture(
762762
loader,
763763
gltf,
764764
textureInfo,
765765
supportedImageFormats,
766766
Sampler.NEAREST // Feature ID textures require nearest sampling
767767
);
768768

769-
featureIdTexture.texture.channels = featureIds.channels;
769+
featureIdTexture.textureReader.channels = featureIds.channels;
770770

771771
return featureIdTexture;
772772
}

Source/Scene/GltfLoaderUtil.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ var defaultScale = new Cartesian2(1.0, 1.0);
201201
* @param {String} [options.channels] The texture channels to read from.
202202
* @param {Texture} [options.texture] The texture object.
203203
*
204-
* @returns {ModelComponents.Texture} The texture.
204+
* @returns {ModelComponents.TextureReader} The texture.
205205
*/
206206
GltfLoaderUtil.createModelTexture = function (options) {
207207
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
@@ -240,13 +240,13 @@ GltfLoaderUtil.createModelTexture = function (options) {
240240
);
241241
}
242242

243-
var modelTexture = new ModelComponents.Texture();
244-
modelTexture.texture = texture;
245-
modelTexture.texCoord = texCoord;
246-
modelTexture.transform = transform;
247-
modelTexture.channels = channels;
243+
var modelTextureReader = new ModelComponents.TextureReader();
244+
modelTextureReader.texture = texture;
245+
modelTextureReader.texCoord = texCoord;
246+
modelTextureReader.transform = transform;
247+
modelTextureReader.channels = channels;
248248

249-
return modelTexture;
249+
return modelTextureReader;
250250
};
251251

252252
export default GltfLoaderUtil;

Source/Scene/ModelComponents.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ function FeatureIdTexture() {
361361
/**
362362
* The texture containing feature IDs.
363363
*
364-
* @type {ModelComponents.Texture}
364+
* @type {ModelComponents.TextureReader}
365365
* @private
366366
*/
367-
this.texture = undefined;
367+
this.textureReader = undefined;
368368
}
369369

370370
/**
@@ -647,21 +647,21 @@ function Components() {
647647
}
648648

649649
/**
650-
* A texture.
650+
* The components for reading a texture.
651651
*
652-
* @alias ModelComponents.Texture
652+
* @alias ModelComponents.TextureReader
653653
* @constructor
654654
*
655655
* @private
656656
*/
657-
function Texture() {
657+
function TextureReader() {
658658
/**
659659
* The underlying GPU texture. The {@link Texture} contains the sampler.
660660
*
661661
* @type {Texture}
662662
* @private
663663
*/
664-
this.texture = undefined;
664+
this.textureReader = undefined;
665665

666666
/**
667667
* The texture coordinate set.
@@ -700,15 +700,15 @@ function MetallicRoughness() {
700700
/**
701701
* The base color texture.
702702
*
703-
* @type {ModelComponents.Texture}
703+
* @type {ModelComponents.TextureReader}
704704
* @private
705705
*/
706706
this.baseColorTexture = undefined;
707707

708708
/**
709709
* The metallic roughness texture.
710710
*
711-
* @type {ModelComponents.Texture}
711+
* @type {ModelComponents.TextureReader}
712712
* @private
713713
*/
714714
this.metallicRoughnessTexture = undefined;
@@ -775,15 +775,15 @@ function SpecularGlossiness() {
775775
/**
776776
* The diffuse texture.
777777
*
778-
* @type {ModelComponents.Texture}
778+
* @type {ModelComponents.TextureReader}
779779
* @private
780780
*/
781781
this.diffuseTexture = undefined;
782782

783783
/**
784784
* The specular glossiness texture.
785785
*
786-
* @type {ModelComponents.Texture}
786+
* @type {ModelComponents.TextureReader}
787787
* @private
788788
*/
789789
this.specularGlossinessTexture = undefined;
@@ -863,23 +863,23 @@ function Material() {
863863
/**
864864
* The emissive texture.
865865
*
866-
* @type {ModelComponents.Texture}
866+
* @type {ModelComponents.TextureReader}
867867
* @private
868868
*/
869869
this.emissiveTexture = undefined;
870870

871871
/**
872872
* The normal texture.
873873
*
874-
* @type {ModelComponents.Texture}
874+
* @type {ModelComponents.TextureReader}
875875
* @private
876876
*/
877877
this.normalTexture = undefined;
878878

879879
/**
880880
* The occlusion texture.
881881
*
882-
* @type {ModelComponents.Texture}
882+
* @type {ModelComponents.TextureReader}
883883
* @private
884884
*/
885885
this.occlusionTexture = undefined;
@@ -947,7 +947,7 @@ ModelComponents.Skin = Skin;
947947
ModelComponents.Node = Node;
948948
ModelComponents.Scene = Scene;
949949
ModelComponents.Components = Components;
950-
ModelComponents.Texture = Texture;
950+
ModelComponents.TextureReader = TextureReader;
951951
ModelComponents.MetallicRoughness = MetallicRoughness;
952952
ModelComponents.SpecularGlossiness = SpecularGlossiness;
953953
ModelComponents.Material = Material;

Specs/Scene/FeatureTexturePropertySpec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ describe("Scene/FeatureTextureProperty", function () {
9595
0.0, 0.0, 1.0
9696
);
9797

98-
var modelTexture = featureTextureProperty.texture;
99-
expect(modelTexture.texture).toBe(texture);
100-
expect(modelTexture.texCoord).toBe(1);
101-
expect(modelTexture.transform).toEqual(expectedTransform);
102-
expect(modelTexture.channels).toBe("rgb");
98+
var modelTextureReader = featureTextureProperty.textureReader;
99+
expect(modelTextureReader.texture).toBe(texture);
100+
expect(modelTextureReader.texCoord).toBe(1);
101+
expect(modelTextureReader.transform).toEqual(expectedTransform);
102+
expect(modelTextureReader.channels).toBe("rgb");
103103
});
104104

105105
it("constructor throws without property", function () {

Specs/Scene/GltfFeatureMetadataLoaderSpec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,16 +361,16 @@ describe(
361361
var intensityProperty = mapTexture.getProperty("intensity");
362362
var vegetationProperty = orthoTexture.getProperty("vegetation");
363363

364-
expect(colorProperty.texture.texture.width).toBe(1);
365-
expect(colorProperty.texture.texture.height).toBe(1);
366-
expect(colorProperty.texture.texture).toBe(
367-
intensityProperty.texture.texture
364+
expect(colorProperty.textureReader.texture.width).toBe(1);
365+
expect(colorProperty.textureReader.texture.height).toBe(1);
366+
expect(colorProperty.textureReader.texture).toBe(
367+
intensityProperty.textureReader.texture
368368
);
369369

370-
expect(vegetationProperty.texture.texture.width).toBe(1);
371-
expect(vegetationProperty.texture.texture.height).toBe(1);
372-
expect(vegetationProperty.texture.texture).not.toBe(
373-
colorProperty.texture.texture
370+
expect(vegetationProperty.textureReader.texture.width).toBe(1);
371+
expect(vegetationProperty.textureReader.texture.height).toBe(1);
372+
expect(vegetationProperty.textureReader.texture).not.toBe(
373+
colorProperty.textureReader.texture
374374
);
375375

376376
expect(Object.keys(featureMetadata.schema.classes).sort()).toEqual([

Specs/Scene/GltfLoaderSpec.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,11 +791,13 @@ describe(
791791
expect(primitive.featureTextureIds).toEqual(["vegetationTexture"]);
792792

793793
expect(featureIdTexture.featureTableId).toBe("landCoverTable");
794-
expect(featureIdTexture.texture.channels).toBe("r");
795-
expect(featureIdTexture.texture.texCoord).toBe(0);
796-
expect(featureIdTexture.texture.texture.width).toBe(256);
797-
expect(featureIdTexture.texture.texture.height).toBe(256);
798-
expect(featureIdTexture.texture.texture.sampler).toBe(Sampler.NEAREST);
794+
expect(featureIdTexture.textureReader.channels).toBe("r");
795+
expect(featureIdTexture.textureReader.texCoord).toBe(0);
796+
expect(featureIdTexture.textureReader.texture.width).toBe(256);
797+
expect(featureIdTexture.textureReader.texture.height).toBe(256);
798+
expect(featureIdTexture.textureReader.texture.sampler).toBe(
799+
Sampler.NEAREST
800+
);
799801

800802
var classDefinition = featureMetadata.schema.classes.landCover;
801803
var properties = classDefinition.properties;
@@ -823,8 +825,8 @@ describe(
823825
"vegetationDensity"
824826
);
825827

826-
expect(vegetationProperty.texture.texture.width).toBe(256);
827-
expect(vegetationProperty.texture.texture.height).toBe(256);
828+
expect(vegetationProperty.textureReader.texture.width).toBe(256);
829+
expect(vegetationProperty.textureReader.texture.height).toBe(256);
828830
});
829831
});
830832

0 commit comments

Comments
 (0)