| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import Sampler from './Sampler.js';
- let _id = 0;
- /**
- * Represents a sampled texture binding type.
- *
- * @private
- * @augments Sampler
- */
- class SampledTexture extends Sampler {
- /**
- * Constructs a new sampled texture.
- *
- * @param {string} name - The sampled texture's name.
- * @param {?Texture} texture - The texture this binding is referring to.
- */
- constructor( name, texture ) {
- super( name, texture );
- /**
- * This identifier.
- *
- * @type {number}
- */
- this.id = _id ++;
- /**
- * Whether the texture is a storage texture or not.
- *
- * @type {boolean}
- * @default false
- */
- this.store = false;
- /**
- * This flag can be used for type testing.
- *
- * @type {boolean}
- * @readonly
- * @default true
- */
- this.isSampledTexture = true;
- }
- }
- /**
- * Represents a sampled array texture binding type.
- *
- * @private
- * @augments SampledTexture
- */
- class SampledArrayTexture extends SampledTexture {
- /**
- * Constructs a new sampled array texture.
- *
- * @param {string} name - The sampled array texture's name.
- * @param {?(DataArrayTexture|CompressedArrayTexture)} texture - The texture this binding is referring to.
- */
- constructor( name, texture ) {
- super( name, texture );
- /**
- * This flag can be used for type testing.
- *
- * @type {boolean}
- * @readonly
- * @default true
- */
- this.isSampledArrayTexture = true;
- }
- }
- /**
- * Represents a sampled 3D texture binding type.
- *
- * @private
- * @augments SampledTexture
- */
- class Sampled3DTexture extends SampledTexture {
- /**
- * Constructs a new sampled 3D texture.
- *
- * @param {string} name - The sampled 3D texture's name.
- * @param {?Data3DTexture} texture - The texture this binding is referring to.
- */
- constructor( name, texture ) {
- super( name, texture );
- /**
- * This flag can be used for type testing.
- *
- * @type {boolean}
- * @readonly
- * @default true
- */
- this.isSampled3DTexture = true;
- }
- }
- /**
- * Represents a sampled cube texture binding type.
- *
- * @private
- * @augments SampledTexture
- */
- class SampledCubeTexture extends SampledTexture {
- /**
- * Constructs a new sampled cube texture.
- *
- * @param {string} name - The sampled cube texture's name.
- * @param {?(CubeTexture|CompressedCubeTexture)} texture - The texture this binding is referring to.
- */
- constructor( name, texture ) {
- super( name, texture );
- /**
- * This flag can be used for type testing.
- *
- * @type {boolean}
- * @readonly
- * @default true
- */
- this.isSampledCubeTexture = true;
- }
- }
- export { SampledTexture, SampledArrayTexture, Sampled3DTexture, SampledCubeTexture };
|