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

Extend the Texture asset type to support 3D data #903

Merged
merged 2 commits into from
Nov 22, 2020
Merged

Extend the Texture asset type to support 3D data #903

merged 2 commits into from
Nov 22, 2020

Conversation

bonsairobo
Copy link
Contributor

Textures are still loaded from images as 2D, but they can be reshaped according to how the render pipeline would like to use them.

Also add an example of how this can be used with the texture2DArray uniform type.

@bonsairobo
Copy link
Contributor Author

I also think it would be nice to replace the Texture::size field with the Extent3d type, instead of using Vec3. Then you get unsigned integers which are more fit for use.

@bonsairobo
Copy link
Contributor Author

One thing I am surprised by: I didn't have to change the TextureViewDescriptor for this to work. Right now, it's just constructed using Default, leaving the TextureViewDimension empty. I would've expected it to be necessary to set that to D2Array. But maybe it's just a hint.

@joshuajbouw
Copy link
Member

Please run cargo fmt, clean had failed.

@bonsairobo
Copy link
Contributor Author

Just failing to install udev now.

@Moxinilian Moxinilian added C-Enhancement A new feature A-Rendering Drawing game state to the screen labels Nov 21, 2020
@cart
Copy link
Member

cart commented Nov 22, 2020

A rebase should do the trick.

I like all of these changes. My biggest question mark is "should we have 2d variants of methods on Texture or just let everyone contend with the fact that its 3d now?"

Its not that much harder to deal with and it keeps the api surface smaller. I have a slight bias toward removing the 2d variants (with the exception of aspect_2d())

@bonsairobo
Copy link
Contributor Author

@cart I think I am fine with removing the 2d methods, except aspect, like you said.

What do you think about replacing the Vec3 with Extent3d?

@cart
Copy link
Member

cart commented Nov 22, 2020

Yeah I'm cool with that.

Textures are still loaded from images as 2D, but they can be reshaped
according to how the render pipeline would like to use them.

Also add an example of how this can be used with the texture2DArray uniform type.
@cart cart merged commit 46fac78 into bevyengine:master Nov 22, 2020
@ambeeeeee ambeeeeee mentioned this pull request Nov 28, 2020
@fopsdev fopsdev mentioned this pull request Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants