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

feat: Add texture animation #641

Merged
merged 2 commits into from Apr 17, 2018

Conversation

Projects
None yet
4 participants
@Rhuagh
Member

Rhuagh commented Apr 13, 2018

Supports swapping textures (using indexing into a MaterialTextureSet resource) and modifying offset into a texture.
The PR also adds support for targeting parts of a texture, using a Material defined offset.

Material only support the Step interpolation function, all other functions will result in a panic (except possibly a user supplied function).

This change is Reviewable

@jojolepro

I went through quickly and it seems good. Will do a full review later (but don't wait on me to merge if everything is fine)

@azriel91

This comment has been minimized.

Show comment
Hide comment
@azriel91

azriel91 Apr 15, 2018

Contributor

The flat passes haven't got buffers set up for the texture offsets, and using Material animation using DrawFlat (and probably DrawFlatSeparate) gives an error:

Buffer update for effect failed! Buffer not found: "AlbedoOffset"

I got around it in #638 by calling setup_textures(&mut builder, &TEXTURES);, though I don't know where TEXTURES comes from, and whether I should've just created an "AlbedoOffset" buffer instead.

Contributor

azriel91 commented Apr 15, 2018

The flat passes haven't got buffers set up for the texture offsets, and using Material animation using DrawFlat (and probably DrawFlatSeparate) gives an error:

Buffer update for effect failed! Buffer not found: "AlbedoOffset"

I got around it in #638 by calling setup_textures(&mut builder, &TEXTURES);, though I don't know where TEXTURES comes from, and whether I should've just created an "AlbedoOffset" buffer instead.

@Rhuagh

This comment has been minimized.

Show comment
Hide comment
@Rhuagh

Rhuagh Apr 15, 2018

Member

Ah, that was a miss from an earlier PR, all passes should call setup_textures, the Flat ones didn't, apparently.

Member

Rhuagh commented Apr 15, 2018

Ah, that was a miss from an earlier PR, all passes should call setup_textures, the Flat ones didn't, apparently.

@Rhuagh

This comment has been minimized.

Show comment
Hide comment
@Rhuagh

Rhuagh Apr 15, 2018

Member

Fixed now.

Member

Rhuagh commented Apr 15, 2018

Fixed now.

@Rhuagh

This comment has been minimized.

Show comment
Hide comment
Member

Rhuagh commented Apr 16, 2018

@Xaeroxe

LGTM! Thanks!

@jojolepro

This comment has been minimized.

Show comment
Hide comment
@jojolepro

jojolepro Apr 17, 2018

Collaborator

I'll check later today if I get time

Collaborator

jojolepro commented Apr 17, 2018

I'll check later today if I get time

@jojolepro

Thanks!

+ Offset((f32, f32), (f32, f32)),
+}
+
+impl InterpolationPrimitive for MaterialPrimitive {

This comment has been minimized.

@jojolepro

jojolepro Apr 17, 2018

Collaborator

I'm not too sure I understand the point of adding a trait if you just panic on all functions..?

@jojolepro

jojolepro Apr 17, 2018

Collaborator

I'm not too sure I understand the point of adding a trait if you just panic on all functions..?

This comment has been minimized.

@Rhuagh

Rhuagh Apr 17, 2018

Member

Because of the trait bound on the interpolation functions in minterpolate that we use. I will implement these for some of the variants later on. For now we can only use step interpolation that won't actually call any of the functions

@Rhuagh

Rhuagh Apr 17, 2018

Member

Because of the trait bound on the interpolation functions in minterpolate that we use. I will implement these for some of the variants later on. For now we can only use step interpolation that won't actually call any of the functions

This comment has been minimized.

@jojolepro

jojolepro Apr 17, 2018

Collaborator

👍

@jojolepro

jojolepro Apr 17, 2018

Collaborator

👍

@@ -101,8 +101,12 @@ pub(crate) fn set_light_args(
pub(crate) fn setup_light_buffers(builder: &mut EffectBuilder) {
builder
.with_raw_constant_buffer("FragmentArgs", mem::size_of::<FragmentArgs>(), 1)
- .with_raw_constant_buffer("PointLights", mem::size_of::<PointLight>(), 128)
- .with_raw_constant_buffer("DirectionalLights", mem::size_of::<DirectionalLight>(), 16)
+ .with_raw_constant_buffer("PointLights", mem::size_of::<PointLightPod>(), 128)

This comment has been minimized.

@jojolepro

jojolepro Apr 17, 2018

Collaborator

Can't this be user defined? (out of the scope of this PR, I assume?)

@jojolepro

jojolepro Apr 17, 2018

Collaborator

Can't this be user defined? (out of the scope of this PR, I assume?)

This comment has been minimized.

@Rhuagh

Rhuagh Apr 17, 2018

Member

It needs to match the size in the shader I believe

@Rhuagh

Rhuagh Apr 17, 2018

Member

It needs to match the size in the shader I believe

@Xaeroxe

This comment has been minimized.

Show comment
Hide comment
@Xaeroxe

Xaeroxe Apr 17, 2018

Member

bors r+

Member

Xaeroxe commented Apr 17, 2018

bors r+

bors bot added a commit that referenced this pull request Apr 17, 2018

Merge #641 #648
641: feat: Add texture animation r=Xaeroxe a=Rhuagh

Supports swapping textures (using indexing into a `MaterialTextureSet` resource) and modifying offset into a texture.
The PR also adds support for targeting parts of a texture, using a `Material` defined offset.

Material only support the `Step` interpolation function, all other functions will result in a panic (except possibly a user supplied function).

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/amethyst/amethyst/641)
<!-- Reviewable:end -->


648: fix: Update winit+glutin+gfx_window_* r=Xaeroxe a=Rhuagh

Fixes #544. 

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/amethyst/amethyst/648)
<!-- Reviewable:end -->


Co-authored-by: Simon Rönnberg <seamonr@gmail.com>
@bors

This comment has been minimized.

Show comment
Hide comment

@bors bors bot merged commit a1b85d5 into amethyst:develop Apr 17, 2018

3 checks passed

bors Build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Rhuagh Rhuagh deleted the Rhuagh:feature/texture-animation branch Apr 18, 2018

bors bot added a commit that referenced this pull request Apr 22, 2018

Merge #644
644: feat: Deferred start animation r=Xaeroxe,jojolepro a=Rhuagh

Depends on #641.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/amethyst/amethyst/644)
<!-- Reviewable:end -->


Co-authored-by: Simon Rönnberg <seamonr@gmail.com>

bors bot added a commit that referenced this pull request Apr 23, 2018

Merge #638
638: Feature/634/sprite rendering and animation r=jojolepro,Xaeroxe a=azriel91

Attempt at sprite animation: #634. This is branched off #641.

![example](https://user-images.githubusercontent.com/2993230/39100375-798d6d82-46dd-11e8-8869-550fcb0fe887.gif)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/amethyst/amethyst/638)
<!-- Reviewable:end -->


Co-authored-by: Azriel Hoh <azriel91@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment