Search in sources :

Example 1 with RoughNormalEffect

use of raytracer.effects.RoughNormalEffect in project narchy by automenta.

the class RaytracerFrame method changeScene.

/**
 * �ndert die Szene.
 *
 * @param sceneId ID der neuen Szene.
 */
public void changeScene(int sceneId) {
    Scene scene;
    switch(sceneId) {
        case // FlatShader
        0:
            final Sphere s = new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ColorShader(ColorEx.RED));
            scene = new EfficientScene() {

                final double start = System.currentTimeMillis();

                @Override
                public boolean update(double t) {
                    // add(s);
                    return false;
                }
            };
            scene.add(s);
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new ColorShader(ColorEx.GREEN)));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new ColorShader(ColorEx.BLUE)));
            scene.add(new InfinitePlane(new Vector3d(0.0, -1.0, 0.0), new Vector3d(0.0, 1.0, 0.0), new ColorShader(ColorEx.YELLOW)));
            // scene.add(new InfinitePlane(new Vector3d(0.0, -1.0, 0.0), new Vector3d(0.0, 1.0, 0.0), new WallShader(ColorEx.WHITE)));
            break;
        case // EyeLightShader
        1:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new EyeLightShader(new ColorShader(ColorEx.RED))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new EyeLightShader(new ColorShader(ColorEx.GREEN))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new EyeLightShader(new ColorShader(ColorEx.BLUE))));
            scene.add(new InfinitePlane(new Vector3d(0.0, -1.0, 0.0), new Vector3d(0.0, 1.0, 0.0), new EyeLightShader(new ColorShader(ColorEx.YELLOW))));
            break;
        case // FirstPhongShader
        2:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new InfinitePlane(new Vector3d(0.0, -1.0, 0.0), new Vector3d(0.0, 1.0, 0.0), new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            break;
        case // Dreiecke
        3:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            break;
        case // DirectionalLight
        4:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
            scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
            break;
        case // PointLight
        5:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
            scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(20.0f, 20.0f, 20.0f)));
            break;
        case // Shadow
        6:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
            scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
            scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(20.0f, 20.0f, 20.0f)));
            break;
        case // MirrorShader
        7:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new MirrorShader()));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
            scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
            scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
            scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(20.0f, 20.0f, 20.0f)));
            break;
        case // ReflectiveShader
        8:
            scene = new EfficientScene();
            scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ReflectiveShader(0.2f, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
            scene.add(new Sphere(new Vector3d(1.0, -1.0, -1.0), 2.2, new ReflectiveShader(0.2f, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.0f, 0.9f, 0.0f), new Vector3f(0.0f, 0.4f, 0.2f), new Vector3f(0.05f, 0.05f, 0.05f)))));
            scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new ReflectiveShader(0.2f, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
            scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new ReflectiveShader(0.2f, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
            scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new ReflectiveShader(0.2f, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
            scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
            scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
            scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(20.0f, 20.0f, 20.0f)));
            break;
        case // Diamant (FirstPhongShader)
        9:
            try {
                Transformation t = new Transformation();
                t.scale(0.9, 0.9, 0.9);
                t.move(1.0, 1.0, -3.0);
                OffObject off = new OffObject("off/dodecahedron.off", new ConcatShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.3f, 0.7f, 0.4f), new Vector3f(0.4f, 1.0f, 0.5f), new Vector3f(0.0f, 0.0f, 0.0f)), 0.7f, new RefractionShader(RefractionShader.INDEX_DIAMOND, new ColorEx(0.85f, 0.99f, 0.85f))));
                off.transform(t);
                scene = new EfficientScene();
                scene.add(off);
                scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ReflectionShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
                scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new ReflectionShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new ReflectionShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        case // Diamant
        10:
            try {
                Transformation t = new Transformation();
                t.scale(0.9, 0.9, 0.9);
                t.move(1.0, 1.0, -3.0);
                OffObject off = new OffObject("off/dodecahedron.off", new ConcatShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.3f, 0.7f, 0.4f), new Vector3f(0.4f, 1.0f, 0.5f), new Vector3f(0.0f, 0.0f, 0.0f)), 0.7f, new RefractionShader(RefractionShader.INDEX_DIAMOND, new ColorEx(0.85f, 0.99f, 0.85f))));
                off.transform(t);
                scene = new EfficientScene();
                scene.add(off);
                scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new ReflectionShader(new PhongShader(new TextureShader("texture/earth.jpg"), new Vector3f(0.2f, 0.2f, 0.2f), new Vector3f(0.6f, 0.6f, 0.6f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.0f, 0.0f, 0.0f)))));
                scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
                scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
                scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(20.0f, 20.0f, 20.0f)));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        case // Venus
        11:
            try {
                Transformation t = new Transformation();
                t.rotate(90.0, 0.0, 1.0, 0.0);
                t.scale(2.0, 2.0, 2.0);
                t.move(2.0, 2.0, -2.0);
                OffObject off = new OffObject("off/venus.off", new ConcatShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.3f, 0.7f, 0.4f), new Vector3f(0.4f, 1.0f, 0.5f), new Vector3f(0.0f, 0.0f, 0.0f)), 0.7f, new RefractionShader(RefractionShader.INDEX_DIAMOND, new ColorEx(0.85f, 0.99f, 0.85f))));
                off.transform(t);
                scene = new EfficientScene();
                scene.add(off);
                scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.5f, 0.2f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
                scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.05f, 0.05f, 0.05f)))));
                scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
                scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
                scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(20.0f, 20.0f, 20.0f)));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        case // Hase
        12:
            try {
                Transformation t = new Transformation();
                String texture = "texture/synth11.jpg";
                Triangle t1 = new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new ReflectionShader(new PhongShader(new TextureShader(texture), new Vector3f(0.1f, 0.1f, 0.1f), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.0f, 0.0f, 0.0f))));
                Triangle t2 = new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new ReflectionShader(new PhongShader(new TextureShader(texture), new Vector3f(0.1f, 0.1f, 0.1f), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.0f, 0.0f, 0.0f))));
                t1.setTextureCoords(new Vector2d(1.0, 1.0), new Vector2d(1.0, 0.0), new Vector2d(0.0, 0.0));
                t2.setTextureCoords(new Vector2d(0.0, 0.0), new Vector2d(0.0, 1.0), new Vector2d(1.0, 1.0));
                t.reset();
                t.scale(1.5, 1.5, 0.0);
                t1.transformTexture(t);
                t2.transformTexture(t);
                PlyObject ply = new PlyObject("ply/bunny.ply", new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.1f, 0.0f), new Vector3f(0.0f, 0.4f, 0.0f), new Vector3f(0.0f, 0.7f, 0.2f), new Vector3f(0.0f, 0.0f, 0.0f)));
                ply.normalize();
                t.reset();
                t.scale(3.0, 3.0, 3.0);
                t.move(2.0, 1.3, -3.5);
                ply.transform(t);
                scene = new EfficientScene();
                scene.add(new Sphere(new Vector3d(), 30.0, new TextureShader("texture/univ02.jpg")));
                scene.add(ply);
                scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ConcatShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.1f, 0.0f, 0.0f), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(1.0f, 0.4f, 0.2f), new Vector3f(0.0f, 0.0f, 0.0f)), 0.8f, new RefractionShader(RefractionShader.INDEX_GLASS, new ColorEx(0.95f, 0.85f, 0.85f)))));
                scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.0f, 0.0f, 1.0f), new Vector3f(0.05f, 0.05f, 0.05f))));
                scene.add(t1);
                scene.add(t2);
                scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
                // scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
                scene.add(new PointLight(new Vector3d(-7.0, 4.0, -7.0), new ColorEx(10.0f, 10.0f, 10.0f)));
                scene.add(new PointLight(new Vector3d(-7.0, 4.0, 7.0), new ColorEx(6.0f, 6.0f, 6.0f)));
                scene.add(new PointLight(new Vector3d(7.0, 4.0, 7.0), new ColorEx(8.0f, 8.0f, 8.0f)));
                scene.add(new PointLight(new Vector3d(7.0, 4.0, -7.0), new ColorEx(11.0f, 11.0f, 11.0f)));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        case // Soft-Shadows
        13:
            try {
                Transformation t = new Transformation();
                t.scale(0.9, 0.9, 0.9);
                t.move(1.0, 1.0, -3.0);
                // OffObject off = new OffObject("off/cube.off", new ConcatShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(1.0f, 1.0f, 1.0f)), 1.0f, new RefractionShader(RefractionShader.INDEX_DIAMOND, new ColorEx(ColorEx.WHITE))));
                OffObject off = new OffObject("off/cube.off", new ConcatShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.3f, 0.7f, 0.4f), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.0f, 0.0f, 0.0f), 5.0F), 0.0f, new RefractionShader(RefractionShader.INDEX_DIAMOND, new ColorEx(ColorEx.WHITE))));
                // OffObject off = new OffObject("off/dodecahedron.off", new ConcatShader(new FirstPhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.3f, 0.0f), new Vector3f(0.3f, 0.7f, 0.4f), new Vector3f(0.4f, 1.0f, 0.5f), new Vector3f(0.0f, 0.0f, 0.0f)), 0.7f, new RefractionShader(RefractionShader.SOL_DIAMOND, new ColorEx(0.85f, 0.99f, 0.85f))));
                off.transform(t);
                scene = new EfficientScene();
                // scene.add(off);
                scene.add(new Sphere(new Vector3d(-2.0, 1.7, 0.0), 2.0, new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.5f, 0.0f, 0.0f), new Vector3f(0.7f, 0.0f, 0.0f), new Vector3f(0.7f, 0.7f, 0.7f), new Vector3f(0.05f, 0.05f, 0.05f), 10.0F))));
                scene.add(new Sphere(new Vector3d(3.0, 0.8, 2.0), 2.0, new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.0f, 0.0f, 0.5f), new Vector3f(0.7f, 0.7f, 0.7f), new Vector3f(0.05f, 0.05f, 0.05f), 10.0F)));
                scene.add(new Triangle(new Vector3d(-7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, -7.0), new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.05f, 0.05f, 0.05f), 5.0F))));
                scene.add(new Triangle(new Vector3d(7.0, -1.0, -7.0), new Vector3d(7.0, -1.0, 7.0), new Vector3d(-7.0, -1.0, 7.0), new ReflectionShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.9f, 0.9f, 0.0f), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.05f, 0.05f, 0.05f), 5.0F))));
                scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
                // scene.add(new DirectionalLight(new Vector3d(1.0,-1.0,0.0), new ColorEx(0.1f, 0.1f, 0.1f)));
                // scene.add(new PointLight(new Vector3d(-7.0,4.0,-7.0), new ColorEx(10.0f, 10.0f, 10.0f)));
                // scene.add(new AreaLight(new Vector3d(0.0,8.0,0.0),new Vector3d(1.5,0.0,0.0),new Vector3d(0.0,0.0,1.5), new ColorEx(0.8f, 0.8f, 0.8f)));
                // scene.add(new Sphere(new Vector3d(1.0,2.0,0.0), 0.25 , new LightSourceShader(new ColorEx(1.0f, 1.0f, 1.0f))));
                // scene.add(new AreaLight(new Vector3d(1.0, 3.0, 0.0), new Vector3d(0.5, 0.0, 0.0), new Vector3d(0.0, 0.0, 3.0), new ColorEx(12.0f, 12.0f, 12.0f)));
                scene.add(new SphereLight(new Vector3d(1.0, 3.0, 0.0), 0.7, new ColorEx(12.0f, 12.0f, 12.0f)));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        case // Lichtbrechungs-Test
        14:
            try {
                scene = new EfficientScene();
                Shader wallRed = new PhongShader(new ColorShader(ColorEx.RED), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.7f, 0.7f, 0.7f));
                Shader wallBlue = new PhongShader(new ColorShader(ColorEx.BLUE), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.7f, 0.7f, 0.7f));
                Shader wallGray = new PhongShader(new ColorShader(ColorEx.GRAY), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.7f, 0.7f, 0.7f));
                // Linke Wand:
                scene.add(new Triangle(new Vector3d(-1.0, -1.0, 1.0), new Vector3d(-1.0, -1.0, -1.0), new Vector3d(-1.0, 1.0, 1.0), wallRed));
                scene.add(new Triangle(new Vector3d(-1.0, 1.0, 1.0), new Vector3d(-1.0, -1.0, -1.0), new Vector3d(-1.0, 1.0, -1.0), wallRed));
                // Rechte Wand:
                scene.add(new Triangle(new Vector3d(1.0, -1.0, -1.0), new Vector3d(1.0, -1.0, 1.0), new Vector3d(1.0, 1.0, 1.0), wallBlue));
                scene.add(new Triangle(new Vector3d(1.0, 1.0, 1.0), new Vector3d(1.0, 1.0, -1.0), new Vector3d(1.0, -1.0, -1.0), wallBlue));
                // Hintere Wand:
                scene.add(new Triangle(new Vector3d(-1.0, -1.0, -1.0), new Vector3d(1.0, -1.0, -1.0), new Vector3d(-1.0, 1.0, -1.0), wallGray));
                scene.add(new Triangle(new Vector3d(-1.0, 1.0, -1.0), new Vector3d(1.0, -1.0, -1.0), new Vector3d(1.0, 1.0, -1.0), wallGray));
                // Obere Wand:
                scene.add(new Triangle(new Vector3d(-1.0, 1.0, 1.0), new Vector3d(-1.0, 1.0, -1.0), new Vector3d(1.0, 1.0, 1.0), wallGray));
                scene.add(new Triangle(new Vector3d(1.0, 1.0, 1.0), new Vector3d(-1.0, 1.0, -1.0), new Vector3d(1.0, 1.0, -1.0), wallGray));
                // Untere Wand:
                scene.add(new Triangle(new Vector3d(-1.0, -1.0, 1.0), new Vector3d(1.0, -1.0, 1.0), new Vector3d(-1.0, -1.0, -1.0), wallGray));
                scene.add(new Triangle(new Vector3d(-1.0, -1.0, -1.0), new Vector3d(1.0, -1.0, 1.0), new Vector3d(1.0, -1.0, -1.0), wallGray));
                // Licht:
                scene.add(new AreaLight(new Vector3d(0.0, 0.999999, 0.0), new Vector3d(0.2, 0.0, 0.0), new Vector3d(0.0, 0.0, 0.2), new ColorEx(3.0f, 3.0f, 3.0f)));
                // Kugel mit Spiegelung:
                Sphere rs = new Sphere(new Vector3d(-0.5, -0.65, -0.5), 0.35, new MirrorShader());
                rs.setNormalEffect(new RoughNormalEffect(0.03f));
                scene.add(rs);
                // Kugel mit Lichtbrechung:
                rs = new Sphere(new Vector3d(0.5, -0.65, 0.0), 0.35, new RefractionShader(RefractionShader.INDEX_GLASS, new ColorEx(0.9f, 0.9f, 0.9f)));
                rs.setNormalEffect(new RoughNormalEffect(0.1f));
                scene.add(rs);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        case // Bowling-Szene
        15:
            scene = new BowlingScene();
            break;
        case // Bowling-Kugel
        16:
            try {
                Transformation t = new Transformation();
                t.scale(3.0, 3.0, 3.0);
                t.rotate(190.0, 1.0, 0.0, 0.0);
                PlyObject ply = new PlyObject("ply/bowl.ply", new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.1f, 0.1f, 0.1f), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.0f, 0.0f, 0.0f)), true, new RoughNormalEffect(0.2f));
                ply.center();
                ply.transform(t);
                scene = new EfficientScene();
                scene.add(ply);
                scene.setAmbientLight(new ColorEx(0.2f, 0.2f, 0.2f));
                // scene.add(new DirectionalLight(new Vector3d(1.0, -1.0, 0.0), new ColorEx(0.8f, 0.8f, 0.8f)));
                scene.add(new PointLight(new Vector3d(-7.0, 1.0, -7.0), new ColorEx(5.0f, 5.0f, 5.0f)));
                scene.add(new PointLight(new Vector3d(-7.0, 1.0, 7.0), new ColorEx(3.0f, 3.0f, 3.0f)));
                scene.add(new PointLight(new Vector3d(7.0, 1.0, 7.0), new ColorEx(4.0f, 4.0f, 4.0f)));
                scene.add(new PointLight(new Vector3d(7.0, 1.0, -7.0), new ColorEx(5.5f, 5.5f, 5.5f)));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            break;
        default:
            throw new IllegalArgumentException();
    }
    // Szene setzen:
    setCameraScene(this.camera, scene);
    this.sceneId = sceneId;
}
Also used : SphereLight(raytracer.lights.SphereLight) AreaLight(raytracer.lights.AreaLight) Vector2d(javax.vecmath.Vector2d) DirectionalLight(raytracer.lights.DirectionalLight) RoughNormalEffect(raytracer.effects.RoughNormalEffect) InvalidFormatException(raytracer.exception.InvalidFormatException) Vector3d(javax.vecmath.Vector3d) Vector3f(javax.vecmath.Vector3f) PointLight(raytracer.lights.PointLight)

Example 2 with RoughNormalEffect

use of raytracer.effects.RoughNormalEffect in project narchy by automenta.

the class BowlingScene method createBowls.

protected void createBowls() throws Exception {
    // Kugel linke Bahn:
    addBowl(new Vector3d(-1.475, -5.305, -3.0), new ConcatShader(new PhongShader(new ColorShader(ColorEx.WHITE), new Vector3f(0.0f, 0.0f, 0.3f), new Vector3f(0.1f, 0.1f, 0.6f), new Vector3f(0.7f, 0.7f, 1.0f)), 0.85f, new RefractionShader(RefractionShader.INDEX_GLASS, new ColorEx(0.4f, 0.4f, 0.9f))), new RoughNormalEffect(0.15f), 30.0, -1.0, 2.0, -0.5);
    // Kugel mittlere Bahn
    addBowl(new Vector3d(0.53, -5.24, 2.0), new PhongShader(new ColorShader(new ColorEx(0.9f, 0.9f, 0.9f)), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(0.6f, 0.6f, 0.6f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.0f, 0.0f, 0.0f)), new RoughNormalEffect(0.2f), 70.0, 0.0, 1.0, 1.0);
    // Kugeln auf Haltern
    addBowl(new Vector3d(0.67, -4.75, 4.8), new PhongShader(new ColorShader(new ColorEx(1.0f, 1.0f, 0.3f)), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.6f, 0.6f, 0.6f)), new RoughNormalEffect(0.2f), 80.0, -1.0, 2.0, 0.0);
    addBowl(new Vector3d(0.67, -4.75, 4.57), new PhongShader(new ColorShader(new ColorEx(0.85f, 0.0f, 0.1f)), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.6f, 0.6f, 0.6f)), new RoughNormalEffect(0.2f), -60.0, 1.0, 1.0, 0.0);
    addBowl(new Vector3d(0.0, -4.75, 4.69), new PhongShader(new ColorShader(new ColorEx(0.7f, 0.8f, 0.0f)), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0.6f, 0.6f, 0.6f)), new RoughNormalEffect(0.2f), 150.0, 0.0, 1.0, 0.0);
}
Also used : Vector3d(javax.vecmath.Vector3d) Vector3f(javax.vecmath.Vector3f) RoughNormalEffect(raytracer.effects.RoughNormalEffect)

Example 3 with RoughNormalEffect

use of raytracer.effects.RoughNormalEffect in project narchy by automenta.

the class BowlingScene method createRoom.

protected void createRoom() {
    try {
        Transformation t = new Transformation();
        Shader roadShader = new ReflectiveShader(0.15f, new ReflectionShader(1.4f, new PhongShader(new TextureShader("texture/bowlRoad.jpg"), new Vector3f(0.3f, 0.3f, 0.3f), new Vector3f(0.5f, 0.5f, 0.5f), new Vector3f(0.8f, 0.8f, 0.8f))));
        Shader backRoadShader = new ReflectionShader(1.2f, new PhongShader(new TextureShader("texture/BackRoad.jpg"), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.7f, 0.7f, 0.7f), new Vector3f(0.5f, 0.5f, 0.5f)));
        Shader sideRoadShader = new PhongShader(new TextureShader("texture/sideRoad.jpg"), new Vector3f(0.3f, 0.3f, 0.3f), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.7f, 0.7f, 0.7f));
        Shader bowlingHolderShader = new ReflectiveShader(0.2f, new PhongShader(new TextureShader("texture/BowlHolder.jpg"), new Vector3f(0.3f, 0.3f, 0.2f), new Vector3f(0.6f, 0.6f, 0.5f), new Vector3f(0.95f, 0.95f, 0.8f)));
        Shader rampShader = new ReflectiveShader(0.1f, new PhongShader(new ColorShader(ColorEx.DARK_GRAY), new Vector3f(0.3f, 0.3f, 0.3f), new Vector3f(0.7f, 0.7f, 0.7f), new Vector3f(0.5f, 0.5f, 0.5f)));
        // linke Bahn
        t.reset();
        PlyObject ply = new PlyObject("ply/BowlingRoad.ply", roadShader);
        t.scale(1.0, 1.0, 1.0);
        t.move(-1.7, -5.44, 0.0);
        ply.center();
        ply.transform(t);
        t.reset();
        t.rotate(10.0, 0.0, 0.0, 1.0);
        ply.transformTexture(t);
        add(ply);
        // mittler Bahn
        t.reset();
        ply = new PlyObject("ply/BowlingRoad.ply", roadShader);
        t.scale(1.0, 1.0, 1.0);
        t.move(2.301, -5.44, 0.0);
        ply.center();
        ply.transform(t);
        t.reset();
        t.rotate(-3.0, 0.0, 0.0, 1.0);
        t.move(0.3, 0.2, 0.0);
        ply.transformTexture(t);
        add(ply);
        // rechte Bahn
        t.reset();
        ply = new PlyObject("ply/BowlingRoad.ply", roadShader);
        t.scale(1.0, 1.0, 1.0);
        t.move(6.16, -5.44, 0.0);
        ply.center();
        ply.transform(t);
        t.reset();
        t.rotate(-15.0, 0.0, 0.0, 1.0);
        t.move(0.1, 0.7, 0.0);
        ply.transformTexture(t);
        add(ply);
        // Back Road links
        t.reset();
        ply = new PlyObject("ply/BowlingBackRoad.ply", backRoadShader, true, new RoughNormalEffect(0.1f));
        t.scale(0.47, 0.47, 0.47);
        t.move(0.29, -5.43, -0.14);
        ply.center();
        ply.transform(t);
        t.reset();
        t.scale(6.0, 6.0, 0.0);
        ply.transformTexture(t);
        add(ply);
        // Back Road Rechts
        t.reset();
        ply = new PlyObject("ply/BowlingBackRoad.ply", backRoadShader, true, new RoughNormalEffect(0.1f));
        t.scale(0.45, 0.45, 0.45);
        t.move(4.225, -5.43, 0.1);
        ply.center();
        ply.transform(t);
        t.reset();
        t.scale(6.0, 6.0, 0.0);
        t.rotate(100.0, 0.0, 0.0, 1.0);
        ply.transformTexture(t);
        add(ply);
        // Sideroad links
        t.reset();
        ply = new PlyObject("ply/BowlingSideRoad.ply", sideRoadShader);
        t.scale(1.1, 1.1, 1.1);
        t.move(-2.95, -5.44, -0.3);
        ply.center();
        ply.transform(t);
        add(ply);
        // Sideroad rechts
        t.reset();
        ply = new PlyObject("ply/BowlingSideRoad.ply", sideRoadShader);
        t.scale(1.1, 1.1, 1.1);
        t.move(7.4, -5.43, -0.3);
        ply.center();
        ply.transform(t);
        add(ply);
        // Rampe
        t.reset();
        ply = new PlyObject("ply/BowlingRampe.ply", rampShader, new RoughNormalEffect(0.5f));
        ply.normalize();
        t.scale(5.5, 5.5, 5.5);
        t.move(2.2, -5.46, 4.65);
        ply.center();
        ply.transform(t);
        add(ply);
        // Holder links
        t.reset();
        ply = new PlyObject("ply/BowlingHolder.ply", bowlingHolderShader);
        t.move(0.33, -5.1, 4.65);
        ply.center();
        ply.transform(t);
        add(ply);
        // Holder rechts
        t.reset();
        ply = new PlyObject("ply/BowlingHolder.ply", bowlingHolderShader);
        t.move(4.27, -5.1, 4.65);
        ply.center();
        ply.transform(t);
        add(ply);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : PlyObject(raytracer.objects.PlyObject) Vector3f(javax.vecmath.Vector3f) RoughNormalEffect(raytracer.effects.RoughNormalEffect)

Example 4 with RoughNormalEffect

use of raytracer.effects.RoughNormalEffect in project narchy by automenta.

the class BowlingScene method createHouse.

protected void createHouse() throws Exception {
    Transformation t = new Transformation();
    // Haus erzeugen:
    t.reset();
    PlyObject ply = new PlyObject("ply/BowlingHouse.ply", new PhongShader(new WallShader(new ColorEx(1.0f, 1.0f, 0.9f)), new Vector3f(0.6f, 0.6f, 0.6f), new Vector3f(1.0f, 0.9f, 0.9f), new Vector3f(0.7f, 0.7f, 0.6f)), new RoughNormalEffect(0.2f));
    t.rotate(-90.0, 1.0, 0.0, 0.0);
    ply.transform(t);
    add(ply);
    // R�ckwand erzeugen:
    t.reset();
    ply = new PlyObject("ply/BowlingHoleWall.ply", new PhongShader(new TextureShader("texture/HoleWall.jpg"), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.7f, 0.7f, 0.8f), new Vector3f(0.5f, 0.5f, 0.6f)));
    t.move(4.175, -5.32, -0.55);
    ply.transform(t);
    t.reset();
    t.scale(3.0, 3.0, 0.0);
    ply.transformTexture(t);
    add(ply);
    // T�r erzeugen:
    t.reset();
    ply = new PlyObject("ply/BowlingDoor.ply", new PhongShader(new TextureShader("texture/Door.jpg"), new Vector3f(0.3f, 0.3f, 0.3f), new Vector3f(0.4f, 0.4f, 0.4f), new Vector3f(0.7f, 0.7f, 0.7f)));
    t.move(5.5, -4.45, 8.0);
    ply.center();
    ply.transform(t);
    add(ply);
}
Also used : PlyObject(raytracer.objects.PlyObject) Vector3f(javax.vecmath.Vector3f) RoughNormalEffect(raytracer.effects.RoughNormalEffect)

Aggregations

Vector3f (javax.vecmath.Vector3f)4 RoughNormalEffect (raytracer.effects.RoughNormalEffect)4 Vector3d (javax.vecmath.Vector3d)2 PlyObject (raytracer.objects.PlyObject)2 Vector2d (javax.vecmath.Vector2d)1 InvalidFormatException (raytracer.exception.InvalidFormatException)1 AreaLight (raytracer.lights.AreaLight)1 DirectionalLight (raytracer.lights.DirectionalLight)1 PointLight (raytracer.lights.PointLight)1 SphereLight (raytracer.lights.SphereLight)1