# Objective
#20830 created the possibility that we may want to have render targets
that produce a number of outputs, e.g. depth and normals. This is a
first step towards something like that (e.g. a `RendersTo` relation) by
converting `RenderTarget` to be a component. This is also useful for
out-of-tree render targets that may want to do something like
`#[require(RenderTarget::Image)]` once BSN lands.
## Solution
Make it a component.
# Objective
Use the scale factor of the render target for `Text2d` entities, instead
of always using the scale factor of the primary window.
Fixes#17342Fixes#1890
## Solution
Iterate the cameras, find the first camera with `RenderLayers`
intersecting the `Text2d` entity's `RenderLayers` and use that camera's
target's scale factor.
This also allows us to remove the `bevy_window` dependency from
`bevy_sprite_render` and make it optional for `bevy_sprite` on the
"bevy_sprite_picking_backend" feature.
`Text2d` is still limited to generating only one text layout per
`Text2d` entity. If a `Text2d` entity is simultaneously rendered to
multiple targets with different scale factors then the maximum of the
target scale factors is used.
## Testing
I think I'm using `RenderLayers` and `VisibleEntities` correctly, and my
tests and the examples seem to work, but it would be best if a rendering
SME gave this a glance just to to make sure that I'm not doing something
naive.
Comes with a new example `multi_window_text` that can be used for
testing:
```
cargo run --example multi_window_text
```
If the changes are working correctly, the secondary window's text should
be twice as big as the primary window's text without blurriness.
## Showcase
<img width="642" alt="primary"
src="https://github.com/user-attachments/assets/547edf21-5c6e-4a95-ac8b-1b08b1c1364e"
/>
<img width="642" alt="secondary"
src="https://github.com/user-attachments/assets/b38d278d-64bc-4a90-9b11-0ac27d3a02bb"
/>
All the text uses a font-size of `30`. The secondary window has a scale
factor of `2.`, so the secondary window's text uses glyphs drawn at
double the resolution. On main, `Text2d` use glyphs drawn at the same
size for both windows, and so the text drawn with `Text2d` to the
secondary window is blurry:
<img width="642" alt="secondary_main"
src="https://github.com/user-attachments/assets/1aa3a523-e1d4-4196-a13c-d6ac8aa34cf3"
/>