Search in sources :

Example 1 with RayTracer

use of spacegraph.slam.raytrace.RayTracer in project narchy by automenta.

the class ExampleStereoTwoViewsOneCamera method main.

public static void main(String[] args) throws InterruptedException {
    ExampleStereoTwoViewsOneCamera e = new ExampleStereoTwoViewsOneCamera();
    new SpaceGraphPhys3D(new SimpleSpatial(e) {

        @Override
        public void renderAbsolute(GL2 gl, int dtMS) {
            for (ColorPoint3D p : e.gui.view.cloud) {
                int cc = p.rgb;
                gl.glColor3f(Bitmap2D.decodeRed(cc), Bitmap2D.decodeGreen(cc), Bitmap2D.decodeBlue(cc));
                Draw.rect(gl, (float) p.x, (float) p.y, 1, 1, (float) p.z);
            }
        }
    }).show(800, 800);
    RayTracer r = RayTracer.raytracer();
    r.update();
    r.renderProgressively();
    r.scene.camera.position.x = 4 - 1;
    // r.scene.camera.direction.x = -0.577 + 0.25f;
    r.update();
    r.renderProgressively();
    e.snap(r.image);
    Thread.sleep(200);
    // new Thread(()->{
    double t = 0;
    // while (true) {
    r.scene.camera.position.x = 4 + 1;
    // r.scene.camera.direction.x = -0.577 - 0.25f;
    r.update();
    if (r.renderProgressively()) {
        r.input.waitForInput();
    }
    // r.scene.camera.position.x += Math.cos(t)*0.2f;
    t += 0.2f;
    // }
    // }).start();
    // new Thread(()->{
    // while (true) {
    e.snap(r.image);
    try {
        Thread.sleep(250);
    } catch (InterruptedException e1) {
        e1.printStackTrace();
    }
// }
// 
// }).start();
}
Also used : SimpleSpatial(spacegraph.space3d.SimpleSpatial) ColorPoint3D(boofcv.gui.d3.ColorPoint3D) GL2(com.jogamp.opengl.GL2) SpaceGraphPhys3D(spacegraph.space3d.SpaceGraphPhys3D) RayTracer(spacegraph.slam.raytrace.RayTracer) DetectDescribePoint(boofcv.abst.feature.detdesc.DetectDescribePoint)

Aggregations

DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)1 ColorPoint3D (boofcv.gui.d3.ColorPoint3D)1 GL2 (com.jogamp.opengl.GL2)1 RayTracer (spacegraph.slam.raytrace.RayTracer)1 SimpleSpatial (spacegraph.space3d.SimpleSpatial)1 SpaceGraphPhys3D (spacegraph.space3d.SpaceGraphPhys3D)1