Ray-caster: pass spheres in through uniforms
Keep the hard-coded spheres for comparison.
This commit is contained in:
parent
206a2df480
commit
5bf23fa789
4 changed files with 103 additions and 29 deletions
12
app-proto/inversive-display/src/engine.rs
Normal file
12
app-proto/inversive-display/src/engine.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use nalgebra::DVector;
|
||||
|
||||
pub fn sphere(center_x: f64, center_y: f64, center_z: f64, radius: f64) -> DVector<f64> {
|
||||
let center_norm_sq = center_x * center_x + center_y * center_y + center_z * center_z;
|
||||
DVector::from_column_slice(&[
|
||||
center_x / radius,
|
||||
center_y / radius,
|
||||
center_z / radius,
|
||||
0.5 / radius,
|
||||
0.5 * (center_norm_sq / radius - radius)
|
||||
])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue