-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render to Texture #186
Render to Texture #186
Conversation
Super cool!!! Love the reflection demo. |
) Small refactor of RTT code that resolve my PR comments: - #186 (comment) - #186 (comment)
thanks for reviewing, i'm currently addressing the comment you provided |
if (this.parentHasRenderTexture && !this.rtt) { | ||
return this.parent?.framebufferDimensions; | ||
} | ||
return { width: this.width, height: this.height }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user updates the width/height properties of an RTT Node this may cause the frame buffer dimensions to be reported differently than the size of the texture that is initially allocated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dimension updates will now also reflect to the render texture
src/core/CoreNode.ts
Outdated
} | ||
|
||
get parentHasRenderTexture(): boolean { | ||
return this.props.parentHasRenderTexture; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in another comment, this property could just live in the CoreNode and simply reach up the parent tree to find out if a parent has RTT on. If that reaching up is too inefficient it could be calculated during an update() stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the logic for tracking whether the parent has a render texture to the CoreNode. This is now being calculated during node update()
this.hasRTTupdates = true; | ||
|
||
// Store RTT nodes in a separate list | ||
this.stage.renderer?.renderToTexture(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If rtt
is set to false
does it remain in this structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! It prompted me to revisit this. I've added support to dynamically toggle render to texture on a Node. This opens up the door for rendering an entire app to a texture, allowing for the application of post-processing effects, before disabling render to texture.
LGTM! Awesome work. |
This feature introduces the capability to render the scene onto a texture, facilitating post-processing effects and potentially allowing for the caching of static UI elements.
Tasks
Done