threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ITexture.ts 821B

123456789101112131415161718192021222324252627
  1. import {IMaterial} from './IMaterial'
  2. import {Texture} from 'three'
  3. export interface ITextureUserData{
  4. disposeOnIdle?: boolean // automatically dispose when added to a material and then not used in any material
  5. __appliedMaterials?: Set<IMaterial>
  6. }
  7. export interface ITexture extends Texture {
  8. assetType?: 'texture'
  9. userData: ITextureUserData
  10. readonly isTexture: true
  11. isDataTexture?: boolean
  12. isCubeTexture?: boolean
  13. isVideoTexture?: boolean
  14. isCanvasTexture?: boolean
  15. isCompressedTexture?: boolean
  16. is3DDataTexture?: boolean
  17. }
  18. export function upgradeTexture(this: ITexture) {
  19. this.assetType = 'texture'
  20. if (!this.userData) this.userData = {}
  21. if (!this.userData.__appliedMaterials) this.userData.__appliedMaterials = new Set()
  22. // todo: uiconfig, dispose, etc
  23. }