15
src/ray.rs
15
src/ray.rs
@@ -1,15 +0,0 @@
|
|||||||
use nalgebra::Vector4;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub struct Ray {
|
|
||||||
a: Vector4<f32>,
|
|
||||||
b: Vector4<f32>,
|
|
||||||
}
|
|
||||||
impl Ray {
|
|
||||||
fn new(_a: Vector4<f32>, _b: Vector4<f32>) -> Ray {
|
|
||||||
Ray { a: _a, b: _b }
|
|
||||||
}
|
|
||||||
fn point_at_paremeter(&self, t: f32) -> Vector4<f32> {
|
|
||||||
self.a + t * self.b
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
@vertex
|
|
||||||
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
|
|
||||||
let x = f32(i32(in_vertex_index) - 1);
|
|
||||||
let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
|
|
||||||
return vec4<f32>(x, y, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@fragment
|
|
||||||
fn fs_main() -> @location(0) vec4<f32> {
|
|
||||||
return vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user