project ideal point
This commit is contained in:
@@ -202,20 +202,24 @@ fn ms_debug_edge(){
|
||||
|
||||
var v0_world_position: vec4<f32> = model_instance.transform * ve_verts[0];
|
||||
var v1_world_position: vec4<f32> = model_instance.transform * ve_verts[1];
|
||||
|
||||
var v0_screen_position: vec4<f32> = camera.proj * camera.view * v0_world_position;
|
||||
var v1_screen_position: vec4<f32> = camera.proj * camera.view * v1_world_position;
|
||||
|
||||
var edge_dir_world: vec4<f32> = normalize(v0_world_position - v1_world_position);
|
||||
var edge_dir_screen: vec4<f32> = camera.proj * camera.view * edge_dir_world;
|
||||
|
||||
for (var i:u32 = 0; i<=N/2; i++){
|
||||
// two half circles that make a whole
|
||||
var theta: f32 = f32(i) * tau / f32(N);
|
||||
var cos_sin: vec2<f32> = vec2(cos(theta), sin(theta));
|
||||
|
||||
// construct basis vectors
|
||||
var y_axis: vec4<f32> = normalize(v0_screen_position - v1_screen_position);
|
||||
var x_axis: vec4<f32> = y_axis.yxzw;
|
||||
var y_axis: vec2<f32> = edge_dir_screen.xy;
|
||||
var x_axis: vec2<f32> = y_axis.yx;
|
||||
x_axis.x = -x_axis.x;
|
||||
|
||||
var offset: vec4<f32> = x_axis * cos_sin.x + y_axis * cos_sin.y;
|
||||
var offset: vec4<f32> = vec4<f32>(0.5 * (x_axis * cos_sin.x + y_axis * cos_sin.y), 0.0, 0.0);;
|
||||
|
||||
mesh_output.vertices[i].position = v0_screen_position + offset;
|
||||
mesh_output.vertices[N/2+1+i].position = v1_screen_position - offset;
|
||||
|
||||
Reference in New Issue
Block a user