Open HypnosNova opened 3 years ago
VideoTexture
is better than needsUpdate
and we can add play() or pause() API
.
There is a principle that Oasis' Texture2D will not record any image and canvas memory, because it is a pure gpu video memory texture, and image/canvas is only a kind of data source. needUpdate
is only valid when the data source is image/canvas, and no useful for data source is pixel buffer. The needupdate design will make the Texture2D design dirty and waste memory, use another class videoTexture
meybe better.
Is your feature request related to a problem? Please describe. For example, if I use a canvas as a texture image source or use a video, I have to update the texture manually. And oasis will have fbo features later that we can render scene into a texture. These cases, the image source is updating all the time.
Other engines like Three.js, texture has a "needsUpdate" flag or has CanvasTexture or VideoTexture that can auto update the texture.
Describe the solution you'd like I think the features could be:
These features could help developers using engine easier.
But update texture each frame will cost more performance, so in API docs we can let developers know that we don't need to set autoUpdate true only if the image source is changing all the time.