Skip to content

How about change the ImageLoader cache save timing #31256

@MrYang614

Description

@MrYang614

Description

I know , ImageLoader will save the resource when onloaded .
In this case :
multiply instance request the same url at one time.

// a.js
class Instance {
    constructor(){
        const texture = new THREE.TextureLoader().load(url)
    }
}

// b.js

for(let i = 0;i<100;i++){
new Instance()
}

the image loaded is a promise, it cause loader can not save resource at the first time, but can return the texture at the first time .

is this better ? save the resource when start load not success Load, we dont need know the request is successful or not .

in old , successful load save cache , error not , but if error will error 100 times ,
in new, start load save cache , even error , just one request , one error

Solution

THREE.core.js line 44226

Alternatives

d

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions