Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Commit

Permalink
Merge #218
Browse files Browse the repository at this point in the history
218: Change NDC Y axis r=kvark a=kvark

Blocked on gfx-rs/wgpu#537

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
  • Loading branch information
bors[bot] and kvark authored Mar 27, 2020
2 parents 6fd4bf2 + 637be6a commit 33a9c58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ vulkan = ["wgn/vulkan-portability"]
package = "wgpu-native"
version = "0.4"
git = "https://github.com/gfx-rs/wgpu"
rev = "08e8d406c175579da5ef18c1abf4d6c00e2a9726"
rev = "caf7be0d73584ce4ca095c4ba08eba1c175edd06"

[dependencies.wgc]
package = "wgpu-core"
version = "0.1"
git = "https://github.com/gfx-rs/wgpu"
rev = "08e8d406c175579da5ef18c1abf4d6c00e2a9726"
rev = "caf7be0d73584ce4ca095c4ba08eba1c175edd06"

[dependencies.wgt]
package = "wgpu-types"
version = "0.1"
git = "https://github.com/gfx-rs/wgpu"
rev = "08e8d406c175579da5ef18c1abf4d6c00e2a9726"
rev = "caf7be0d73584ce4ca095c4ba08eba1c175edd06"

[dependencies]
arrayvec = "0.5"
Expand All @@ -61,4 +61,9 @@ futures = "0.3"
#[patch."https://github.com/gfx-rs/wgpu"]
#wgc = { version = "0.1.0", package = "wgpu-core", path = "../wgpu/wgpu-core" }
#wgt = { version = "0.1.0", package = "wgpu-types", path = "../wgpu/wgpu-types" }
#wgn = { version = "0.4.0", package = "wgpu-native", path = "../wgpu/wgpu-native" }
#wgn = { version = "0.4.0", package = "wgpu-native", path = "../wgpu/wgpu-native" }

#[patch.crates-io]
#gfx-hal = { version = "0.5", path = "../gfx/src/hal" }
#gfx-backend-metal = { version = "0.5", path = "../gfx/src/backend/metal" }
#gfx-backend-vulkan = { version = "0.5", path = "../gfx/src/backend/vulkan" }
2 changes: 1 addition & 1 deletion examples/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use winit::event::WindowEvent;
#[allow(unused)]
pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
1.0, 0.0, 0.0, 0.0,
0.0, -1.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.0, 0.0, 0.5, 1.0,
);
Expand Down
4 changes: 3 additions & 1 deletion examples/shadow/forward.frag
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ float fetch_shadow(int light_id, vec4 homogeneous_coords) {
if (homogeneous_coords.w <= 0.0) {
return 1.0;
}
// compensate for the Y-flip difference between the NDC and texture coordinates
const vec2 flip_correction = vec2(0.5, -0.5);
// compute texture coordinates for shadow lookup
vec4 light_local = vec4(
(homogeneous_coords.xy/homogeneous_coords.w + 1.0) / 2.0,
homogeneous_coords.xy * flip_correction/homogeneous_coords.w + 0.5,
light_id,
homogeneous_coords.z / homogeneous_coords.w
);
Expand Down

0 comments on commit 33a9c58

Please sign in to comment.