How to use the Cache function from three

Find comprehensive JavaScript three.Cache code examples handpicked from public code repositorys.

10
11
12
13
14
15
16
17
18
        () => forceUpdate(i => !i)
      )
    }
  }, [filepath])

  return THREE.Cache.get(filepath) || null
}

module.exports = useImageBitmapLoader
fork icon263
star icon0
watch icon1

9
10
11
12
13
14
15
16
17
18
  SGConnection.getResource('image', filepath)
  .then(({data}) => {
    onBitmapImageBufferLoad(filepath, data)
    .then((bitmap) => {
      console.log('Loaded TEXTUREBITMAP: ', bitmap)
      THREE.Cache.add( filepath, bitmap )
      forceUpdate(i => !i)
    })
  })
}
fork icon263
star icon0
watch icon1

+ 3 other calls in file

163
164
165
166
167
168
169
170
171
// </group>
}

const UITest = () => {
  useMemo(() => {
    THREE.Cache.enabled = true
  }, [])

  const store = useReduxStore()
fork icon263
star icon0
watch icon0

178
179
180
181
182
183
184
185
186
187
load(url, onLoad, onProgress, onError) {
    if (this.path !== undefined)
        url = this.path + url;
    url = this.manager.resolveURL(url);
    const scope = this;
    const cached = three.Cache.get(url);
    if (cached !== undefined) {
        scope.manager.itemStart(url);
        setTimeout(function () {
            if (onLoad)
fork icon2
star icon7
watch icon0

12
13
14
15
16
17
18
19
20
21
22
23
  THREE.ImageLoader.prototype.crossOrigin = 'anonymous';
}


// In-memory caching for XHRs (for images, audio files, textures, etc.).
if (THREE.Cache) {
  THREE.Cache.enabled = true;
}


// TODO: Eventually include these only if they are needed by a component.
require('three/examples/js/loaders/OBJLoader');  // THREE.OBJLoader
fork icon0
star icon0
watch icon0

+ 7 other calls in file

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)