File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ All notable changes to the `bevy voxel plot` crate will be documented in this fi
66
77### Added:
88
9- * .. .
9+ * Assume voxel vertices are real world coordinates in shader .
1010
1111# 2.0.1
1212
Original file line number Diff line number Diff line change 1- #import bevy_pbr :: mesh_functions :: {get_world_from_local , mesh_position_local_to_clip }
1+ #import bevy_pbr :: mesh_functions :: {mesh_position_local_to_world }
2+ #import bevy_pbr :: view_transformations :: position_world_to_clip
23
34struct Vertex {
45 @location (0 ) position : vec3 <f32 >,
@@ -16,21 +17,16 @@ struct VertexOutput {
1617
1718@vertex
1819fn vertex (vertex : Vertex ) -> VertexOutput {
19- let position = vertex . position * vertex . i_pos_scale . w + vertex . i_pos_scale . xyz ;
20+ // NOTE: Assumes vertex positions are real world positions
21+ let world_position = vertex . position * vertex . i_pos_scale . w + vertex . i_pos_scale . xyz ;
22+
2023 var out : VertexOutput ;
21- // NOTE: Passing 0 as the instance_index to get_world_from_local() is a hack
22- // for this example as the instance_index builtin would map to the wrong
23- // index in the Mesh array. This index could be passed in via another
24- // uniform instead but it's unnecessary for the example.
25- out . clip_position = mesh_position_local_to_clip (
26- get_world_from_local (0u ),
27- vec4 <f32 >(position , 1 .0 )
28- );
24+ out . clip_position = position_world_to_clip (world_position );
2925 out . color = vertex . i_color ;
3026 return out ;
3127}
3228
3329@fragment
3430fn fragment (in : VertexOutput ) -> @location (0 ) vec4 <f32 > {
3531 return in . color ;
36- }
32+ }
You can’t perform that action at this time.
0 commit comments