SampledTexture.js 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import Binding from './Binding.js';
  2. let id = 0;
  3. class SampledTexture extends Binding {
  4. constructor( name, texture ) {
  5. super( name );
  6. this.id = id ++;
  7. this.texture = texture;
  8. this.version = texture ? texture.version : 0;
  9. this.store = false;
  10. this.isSampledTexture = true;
  11. }
  12. update() {
  13. const { texture, version } = this;
  14. if ( version !== texture.version ) {
  15. this.version = texture.version;
  16. return true;
  17. }
  18. return false;
  19. }
  20. }
  21. class SampledArrayTexture extends SampledTexture {
  22. constructor( name, texture ) {
  23. super( name, texture );
  24. this.isSampledArrayTexture = true;
  25. }
  26. }
  27. class Sampled3DTexture extends SampledTexture {
  28. constructor( name, texture ) {
  29. super( name, texture );
  30. this.isSampled3DTexture = true;
  31. }
  32. }
  33. class SampledCubeTexture extends SampledTexture {
  34. constructor( name, texture ) {
  35. super( name, texture );
  36. this.isSampledCubeTexture = true;
  37. }
  38. }
  39. export { SampledTexture, SampledArrayTexture, Sampled3DTexture, SampledCubeTexture };