Repository navigation
Stream textures: an app replaces a texture's pixels while the scene runs - #148
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A texture whose pixels the embedding app replaces every frame without rebuilding the scene: a screen in the scene that shows what a program draws, a camera, a video. Made for an embedded room whose device screen shows a simulator's frames.
StreamTexture(name, width, height, rgba?)in@threert/scene(a clampedDataTexture, opaque black until the first picture);TextureDesc.streamcarries its name.TextureSource::Stream. Its key in the texture pages is its name and size (texpack::stream_key), soset_keydoes not change with a picture.packrecords each stream'sPlace;texpack::patchbuilds its padded rect at every mip level exactly aspackfills it;Gpu::write_streamwrites it withqueue.write_texture. The last picture is kept and re-applied when the pages are packed again.LiveCore::write_stream(name, w, h, rgba)before a frame'srender. No script-side call: pictures come from the app.docs/RUNTIME.md"Stream textures".Tests:
texpack::tests::a_patch_is_the_pages_texels(a patch equals the pages packed with the new pixels, every level, every texel);npm run typecheck,npm test,cargo build --release, wasm32--libcheck pass locally. Used in a macOS app for two days (640 x 360 at frame rate on an M3 Max).Known: content that changes every frame should be emitted from a material function (short history); through a plain
emissiveMapthe live view blends a few frames.🤖 Generated with Claude Code