POV-Ray : Newsgroups : povray.advanced-users : the POV-ray SDL--similar to Java and/or Python? : Re: the POV-ray SDL--similar to Java and/or Python? Server Time
6 Oct 2024 15:24:19 EDT (-0400)
  Re: the POV-ray SDL--similar to Java and/or Python?  
From: nemesis
Date: 27 Oct 2006 13:00:01
Message: <web.45423a3cdcfb777f3976a8750@news.povray.org>
oh, man... java guys are completely bonkers!

compare this:

import org.pov.*;
import org.pov.vegetation.*;
import org.pov.hormann.isowood.*;
import org.pov.tran.clouds.*;
import org.pov.someguru.WonderfulFeature4;
import org.pov.cabasson.PoorFeature1;

public class MyScene extends BasicOutDoorScene // Which extends POVScene,
and already has a light_source, a sun, and methods for the seasons and
Earth rotation ....
{
    public static main (int argc, String [] argv)
    {
        SetHandedness(LEFT_HANDEDNESS);

        GlobalSetting gs = new GlobalSettings();
        Radiosity rad = new RadiositySettings(); // Empty constructor with
defaults
        rad.setPretrace(0.04, 0.01);
        rad.setErrorbound(0.6);

        gs.setRadiosity(rad); // Or
gs.setRadiosity(Radiosity.OUT_DOOR_LOW_QUALITY)

        BuildScene();

        Render(640, 480);
    }

    private void BuildScene() // virtual method
    {
        final RADIUS = Double.parseDouble(argv[0]).doubleValue();

        Sphere s = new Sphere (0, RADIUS); // promotion is implemented by
method overloading: could be new Sphere (new Position(0,0,0), RADIUS) or so
.....

        s.translate(10, 0, 0);
        s.rotate(-20, 0, 0);
        Pigment p = new Pigment(new Rgbt(1));
        Interior interior = new Interior();
        interior.setIor(Consts.GLASS_IOR);
        interior.setFadeColor(Colors.Blue);
        interior.setFadeDistance(s.getRadius()/2);
        s.setPigment(p);
        s.setInterior(interior);
        set.setPhotons(new ObjectPhotons(...));
        this.add(s);

        Plane ground = new Plane
        (
            y, 0,
            new Pigment
            (
                CHECKER,
                new ColorMap
                (
                    .../...
                ),
                new Turbulence(0.5, 2.0, 0.65, 8)
            )
        )
        ground.getPigment().setWarp(BLACK_HOLE, new Position(...));
        ground.getPigment().scale(2.0);
        this.add(ground);

        /// Etc ....

    }
}


to this:

// +W640 +H480

#include "org/pov/vegetation"
#include "org/pov/hormann/isowood"
#include "org/pov/tran/clouds"
#include "org/pov/someguru/WonderfulFeature4"
#include "org/pov/cabasson/PoorFeature1"

/* user-adjustable params */
#declare RADIUS = 1;


// "method"
#macro setPretrace( s, e )
  pretrace_start s
  pretrace_end e
#end

global_settings {
 radiosity {
  setPretrace(0.04, 0.01)
  error_bound .6
  OUT_DOOR_LOW_QUALITY() // a macro
 }
}

#local MyScene =
union {
 object { BasicOutDoorScene } /* Which extends POVScene,
and already has a light_source, a sun, and methods for the seasons and
Earth rotation .... */

        SetHandedness(LEFT_HANDEDNESS); // user povray macro

        #local s = sphere { 0, RADIUS }
 object { s
  translate 10*x
  rotate -20*x
  pigment { rgbt 1 }
  interior { ior GLASS_IOR fade_color z fade_distance RADIUS/2 ... }
 }

        #local ground = plane {
            y, 0
            pigment
            {
                checker,
                colorMap //?? for checker?!
                {
                    .../...
                },
                turbulence <0.5, 2.0, 0.65>*8
            }
        }
        object { ground pigment { warp{ BLACK_HOLE, NEWPOS } scale 2.0 } }
    }
}

object { MyScene }


None of those declarations are really needed, but i decided to do a straigh
conversion to compare...

Java guys truly hate conciseness and practical matters.  Why would someone
want to transform the latter into the former is way beyond me...

Besides, just waiting for the JVM startup and load all the wrappers libs
would take an eternity, *before* any parsing or trace whatsoever!

well, programming language pissing is always a popular sport... :)

povray SDL has C syntax and scripting language semantics.  However, it's not
that much of an imperative language, being much more of a declarative
language, like HTML.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.