Skip to content
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

"Global" RenderStates #233

Closed
emilk opened this issue Apr 15, 2022 · 4 comments
Closed

"Global" RenderStates #233

emilk opened this issue Apr 15, 2022 · 4 comments
Labels

Comments

@emilk
Copy link
Contributor

emilk commented Apr 15, 2022

Currently RenderStates is part of the material. For my use case it would make much more sense to be able to set one RenderStates for everything I want to render (i.e. pass it as an argument to three_d::render_pass.

In particular, I want to set a clip region (different each frame), and it is weird to have to mutate each of my allocated meshes to be able to do so.

Perhaps there are circumstances where it makes sense to have RenderStates be tied to the material (though I find it hard to come up with a situation). To support those cases, perhaps we can change *Material::render_states into an Option<RenderStates>?

@asny
Copy link
Owner

asny commented Apr 16, 2022

You're right, it doesn't make sense to specify clip for each material, it's a leftover from the time where the render states was given as argument to each render call. It should be specified when starting to write to a render target. And then removed from each material. Will do it in combination with #200 . Also this is related to #76 .

Does that solve your problem or do you need other global render states? I think most of them makes sense that they are tied to a material, or at least can be specified from a material, but I could also imagine that you wanted to specify some of them globally, for example write mask.

@asny asny added the 0.12 label Apr 16, 2022
@emilk
Copy link
Contributor Author

emilk commented Apr 19, 2022

That sounds good to me! For me it is only the clip/scissor rect I currently want to remove form the material; I haven't thought through the others.

@asny
Copy link
Owner

asny commented Apr 20, 2022

I'll start with clip/scissor then and keep the others on the material. I'll have something soon 🙂

asny added a commit that referenced this issue Apr 25, 2022
@asny
Copy link
Owner

asny commented Apr 25, 2022

Just merged the changes, so now you can specify a ScissorBox when writing to a render target (screen or textures).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants