mylingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
16 lines (13 loc) • 396 B
text/typescript
import { Texture } from "three"
import { forceGet } from "@lincode/utils"
import loadTexture from "./loadTexture"
const cache = new Map<string, Promise<Texture>>()
export default (url: string) =>
forceGet(
cache,
url,
() =>
new Promise<Texture>((resolve) => {
const texture = loadTexture(url, () => resolve(texture))
})
)