Skip to content

Commit

Permalink
fix shader offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-orr committed Jan 6, 2023
1 parent 77348db commit c3abbfd
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 14 deletions.
6 changes: 3 additions & 3 deletions assets/level_list.levels.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
levels:
- name: test
file: test.lvl.json
- name: Beverley Beck
file: beverley.lvl.json
file: beverley.lvl.json
- name: test
file: test.lvl.json
193 changes: 192 additions & 1 deletion assets/levels/test.lvl.json
Original file line number Diff line number Diff line change
@@ -1 +1,192 @@
{"tiles":[[{"tile_type":"City","contents":"None","is_goal":false,"is_wet":false,"height":1},{"tile_type":"City","contents":"None","is_goal":true,"is_wet":false,"height":2},{"tile_type":"City","contents":"None","is_goal":false,"is_wet":false,"height":2},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":1},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0}],[{"tile_type":"City","contents":"None","is_goal":false,"is_wet":false,"height":1},{"tile_type":"City","contents":"None","is_goal":false,"is_wet":false,"height":1},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":2},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":1},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0}],[{"tile_type":"City","contents":"None","is_goal":false,"is_wet":false,"height":0},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0}],[{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":0},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":1},{"tile_type":"Land","contents":"Canal","is_goal":false,"is_wet":true,"height":2},{"tile_type":"Land","contents":"Canal","is_goal":false,"is_wet":true,"height":2}],[{"tile_type":"Land","contents":"Canal","is_goal":false,"is_wet":true,"height":1},{"tile_type":"Land","contents":"Canal","is_goal":false,"is_wet":true,"height":1},{"tile_type":"Land","contents":"Canal","is_goal":false,"is_wet":true,"height":2},{"tile_type":"Land","contents":"Canal","is_goal":false,"is_wet":true,"height":2},{"tile_type":"Land","contents":"None","is_goal":false,"is_wet":false,"height":3}]],"title":"Test Level","width":5,"height":5}
{
"tiles": [
[
{
"tile_type": "City",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 1
},
{
"tile_type": "City",
"contents": "None",
"is_goal": true,
"is_wet": false,
"height": 2
},
{
"tile_type": "City",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 2
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 1
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
}
],
[
{
"tile_type": "City",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 1
},
{
"tile_type": "City",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 1
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 2
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 1
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
}
],
[
{
"tile_type": "City",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
}
],
[
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 0
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 1
},
{
"tile_type": "Land",
"contents": "Canal",
"is_goal": false,
"is_wet": true,
"height": 2
},
{
"tile_type": "Land",
"contents": "Canal",
"is_goal": false,
"is_wet": true,
"height": 2
}
],
[
{
"tile_type": "Land",
"contents": "Canal",
"is_goal": false,
"is_wet": true,
"height": 1
},
{
"tile_type": "Land",
"contents": "Canal",
"is_goal": false,
"is_wet": true,
"height": 1
},
{
"tile_type": "Land",
"contents": "Canal",
"is_goal": false,
"is_wet": true,
"height": 2
},
{
"tile_type": "Land",
"contents": "Canal",
"is_goal": false,
"is_wet": true,
"height": 2
},
{
"tile_type": "Land",
"contents": "None",
"is_goal": false,
"is_wet": false,
"height": 3
}
]
],
"title": "Test Level",
"width": 5,
"height": 5
}
2 changes: 1 addition & 1 deletion assets/shaders/tile_shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn fragment(
}


let world_position = in.world_position + vec4<f32>(settings.world_offset_and_wetness.xz, 0., 0.);
let world_position = in.world_position + vec4<f32>(settings.world_offset_and_wetness.xyz, 0.);
var test_position : vec3<f32> = world_position.xyz * 0.3;
var overlay_1: f32 = simplex_noise_3d(test_position);

Expand Down
12 changes: 6 additions & 6 deletions src/game/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ impl Plugin for BoardPlugin {
.add_system(animate_goal.run_in_state(AppState::InGame))
.add_system(process_selection_events.run_in_state(AppState::InGame))
.add_exit_system(AppState::InGame, clear_board);
// #[cfg(feature = "dev")]
// app.add_plugin(bevy_inspector_egui::quick::AssetInspectorPlugin::<
// TileMaterial,
// >::default());
#[cfg(feature = "dev")]
app.add_plugin(bevy_inspector_egui::quick::AssetInspectorPlugin::<
TileMaterial,
>::default());
// .add_plugin(bevy_inspector_egui::quick::ResourceInspectorPlugin::<
// BoardRuntimeAssets,
// >::default());
Expand Down Expand Up @@ -419,13 +419,13 @@ fn setup_board_materials(
});
let tile_offset_h_material = tile_materials.add(TileMaterial {
settings: InkSettings {
world_offset: Vec4::new(0., 0.5, 0., 0.),
world_offset: Vec4::new(0., 0., 0.5, 0.),
..Default::default()
},
});
let tile_offset_wh_material = tile_materials.add(TileMaterial {
settings: InkSettings {
world_offset: Vec4::new(0.5, 0.5, 0., 0.),
world_offset: Vec4::new(0.5, 0., 0.5, 0.),
..Default::default()
},
});
Expand Down
10 changes: 7 additions & 3 deletions src/game/in_game_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ fn display_ui(mut commands: Commands, level: Res<Level>) {
.style(ButtonStyle::Small);
parent.div().padding(20.);
if let Some(text) = &level.sidebar_text {
parent.div().opaque().size(Size::new(Val::Px(200.),Val::Auto)).with_children(|parent| {
parent
.div()
.opaque()
.size(Size::new(Val::Px(200.), Val::Auto))
.with_children(|parent| {
parent.text(text).size(15.);
});
}
});
}
});

#[cfg(feature = "dev")]
Expand Down

0 comments on commit c3abbfd

Please sign in to comment.