kiss3d
kiss3d copied to clipboard
Long lines render unreliably.
Short lines render reliably, but long lines do not. Lines with extreme start and endpoints (e.g., std::f32::MIN or std::f32::MAX) do not render at all. Lines of intermediate length render unreliably and are subject to camera angle.
This code ought to display the intersection of a red and green line:
extern crate alga;
extern crate kiss3d;
extern crate nalgebra;
use std::f32::{MIN, MAX};
use kiss3d::window::Window;
use kiss3d::light::Light;
use nalgebra::geometry::Point3;
fn main() {
let mut window = Window::new("lines");
window.set_light(Light::StickToCamera);
let green = Point3::new(0.0, 1.0, 0.0);
let red = Point3::new(1.0, 0.0, 0.0);
while window.render() {
// little lines are fine
window.draw_line(
&Point3::new(0.0, 0.0, 0.0),
&Point3::new(1.0, 0.0, 0.0),
&green);
// big lines are not (and are not reliably rendered)
window.draw_line(
&Point3::new(0.0, MIN, 0.0),
&Point3::new(0.0, MAX, 0.0),
&red);
}
}
...like this:
...but, instead, only the red line appears:
I encountered this issue while writing a renderer for ncollide's 2D plane. It's an important that the rendered line appears to extend to infinity. Shortening the line length to 20000 units produces this visual effect, but the line flickers in and out of existence as the camera angle changes.
Is this related to https://github.com/sebcrozet/kiss3d/issues/116 (which isn't fixed for me on mac, but is ok on linux)?