nannou icon indicating copy to clipboard operation
nannou copied to clipboard

polyline does not support 3D?

Open horsetery2017 opened this issue 2 years ago • 1 comments

let mut pts = Vec::new();
pts.push(vec3(-100.0,-100.0,100.0));
pts.push(vec3(100.0,-100.0,100.0));
pts.push(vec3(100.0,100.0,100.0));
pts.push(vec3(-100.0,100.0,100.0));

pts.push(vec3(-150.0,-150.0,-100.0));
pts.push(vec3(150.0,-150.0,-100.0));
pts.push(vec3(150.0,150.0,-100.0));
pts.push(vec3(-150.0,150.0,-100.0));

draw.polyline().points(pts).y_radians(app.mouse.x).x_radians(45.0);

above code and don't see rotation in space

horsetery2017 avatar Jul 31 '22 02:07 horsetery2017

i just tried it to see if it would work, and it did work fine.

use nannou::prelude::*;

fn main() {
    nannou::sketch(view).run()
}

fn view(app: &App, frame: Frame) {
    // Begin drawing
    let draw = app.draw();

    // Clear the background to black.
    draw.background().color(BLUE);

    let mut pts = Vec::new();
    pts.push(vec3(-100.0, -100.0, 100.0));
    pts.push(vec3(100.0, -100.0, 100.0));
    pts.push(vec3(100.0, 100.0, 100.0));
    pts.push(vec3(-100.0, 100.0, 100.0));

    pts.push(vec3(-150.0, -150.0, -100.0));
    pts.push(vec3(150.0, -150.0, -100.0));
    pts.push(vec3(150.0, 150.0, -100.0));
    pts.push(vec3(-150.0, 150.0, -100.0));
    draw.polyline()
        .points(pts)
        //.color(rgb(128f32, 0f32, 128f32))
        .y_radians(app.mouse.x)
        .x_radians(45.0);

    draw.to_frame(app, &frame).unwrap();
}

mvklingeren avatar Aug 07 '22 19:08 mvklingeren