Skip to content

Latest commit

 

History

History
55 lines (50 loc) · 2.43 KB

MIGRATION.md

File metadata and controls

55 lines (50 loc) · 2.43 KB

0.9 to 0.10

  • Remove meshes parameter when calling BackgroundImageBundle::from_image or CustomBackgroundImageBundle::with_material.

    // Old
    BackgroundImageBundle::from_image(image, materials, meshes)
    // New
    BackgroundImageBundle::from_image(image, materials)
  • Remove the type parameter from BackgroundMovementScale wherever it is used in your code.

    Before

    let movement_scale = BackgroundMovementScale::<T>::default();
    let movement_scale = BackgroundMovementScale {
        scale: 0.00,
        _phantom: PhantomData::<CustomMaterial>::default(),
    };

    After

    let movement_scale = BackgroundMovementScale::default();
    let movement_scale = BackgroundMovementScale {
        scale: 0.00,
    };
  • BackgroundMovementScale::scale has changed its value mapping. If you used the default before, it should function similar to the new default and won't require changes. The formula for converting to the new value should be roughly (old_value - 0.15) + 1.0 (might not be exact). The value now acts as a multiplier based on the camera speed instead of being arbitrary. So with a value of 1.0 it will move the same speed as the camera, making it appear stationary.

  • If using a custom shader, the fragment inputs have changed and there is a new import. See custombg.wgsl Also, where you implement Material2d for your custom material you will need to add a specialize function and vertex_shader as shown below, see the custom example for more details.

    use bevy::core_pipeline::fullscreen_vertex_shader::FULLSCREEN_SHADER_HANDLE;
    
    impl Material2d for CustomMaterial {
        fn vertex_shader() -> ShaderRef {
            FULLSCREEN_SHADER_HANDLE.typed().into()
        }
        fn fragment_shader() -> ShaderRef {
            "custombg.wgsl".into()
        }
    
        fn specialize(
            descriptor: &mut RenderPipelineDescriptor,
            _: &MeshVertexBufferLayout,
            _: Material2dKey<Self>,
        ) -> Result<(), SpecializedMeshPipelineError> {
            descriptor.primitive = PrimitiveState::default();
            descriptor.vertex.entry_point = "fullscreen_vertex_shader".into();
            Ok(())
        }
    }