|
|
|
|
|
|
| |
| |
|
|
From: Johannes Hubert
Subject: Some musings about POV-Ray and Java...
Date: 25 Nov 1999 14:52:36
Message: <383d9384@news.povray.org>
|
|
|
| |
| |
|
|
No, not another try to do a "platform" independent raytracer in Java... :-)
Today (while hanging up my laundry of all things!) I was musing about the
POV-Ray script language, and that it indeed does allow the programmer much
more freedom than modeler-tools, but that it also is quite an inelegant,
clumsy and limited language (as programming languages go), with, in parts, a
horrible syntax...
I then remembered, that I once saw a project of someone who had create a C++
class library so that you could then program a POV-Ray scene in C++. An idea
I think is quite good, but I guess it never caught on...
Then I thought, that this should be very doable in Java too:
Write a number of Java packages (as a library) so that you can then write a
POV-Ray scene in Java, making use of the many powerful constructs of that
language, that the POV-Ray script language is lacking (most of all classes,
different sorts of loops and nicer syntax without "#declare" and stuff).
This would work in such a way, that the Java program, once run, would create
a textfile (*.pov) with the real POV-Ray script, which would then be parsed
and rendered by the good ole POV-Ray engine.
Another advantage would be, that errors that otherwise could become obvious
only after a lengthy parsing time, would appear already at compile time or
at Java runtime. The resulting POV file would be a plain vanilla file
without #if, #whiles and such, and thus be quite fast to parse (I guess) and
guaranteed to be without parsing errors.
Anyone interested? Do you think that there would be people using such a
thing, or would everyone still simply continue using the POV-Ray script
(let's make the assumption that the Java-layer would allow you to program
every feature into POV-Ray that exists, that it would not hide stuff from
you like modelers do).
Thoughts?
Johannes.
P.S.
for those of you that already know Java, here an "off the top of my head"
example on how such a "Java-POV-Script" could look like (with the "hello
world" of raytracing ;-) :
import pov.textures.*;
class HelloWorld extends POVScene
{
public static void main(String[] args)
{
add(new Sphere(0, 2.5, 0, 3, new TextureChrome()));
add(new Plane(/*appropriate parameters for checkered plane*/));
add(new PointLight(...));
add(new Camera(...));
renderScene("HelloWorld.pov");
// the previous command would create the POV-script and
// start POV-Ray via the command line to render it.
}
}
Obviously, the above example uses none of the advantages Java can give, but
you'll get the idea...
If not, think about the animation possibilities:
import pov.textures.*;
class HelloWorld extends POVScene
{
public static void main(String[] args)
{
add(new Sphere(0, 2.5, 0, 3, new TextureChrome()));
add(new Plane(/*appropriate parameters for checkered plane*/));
add(new PointLight(...));
Camera camera = new Camera(...);
add(camera);
// Fly the camera around the sphere (in 1 degree steps)
// and render one image for each position:
double x, z;
for (int i = 0; i < 360; i++) {
x = cos(i / 180.0 * PI) * 20;
z = sin(i / 180.0 * PI) * 20;
camera.setPosition(x, 5, z);
renderScene("HelloWorld" + i + ".pov");
}
}
}
(For Java purists: Assume that "cos", "sin" and "PI" have been defined as
member-functions of "POVScene" to create a nicer syntax, they are simply
calls/references to Math.cos, Math.sin and Math.PI.)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
This looks like an interesting idea, it might take a bit of time to
figure out the best way to implement it, but would almost certainly be
worth it. And of course, it would be entirely platform independant, and
wouldn't even require POV to be installed.
--
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/
Post a reply to this message
|
|
| |
| |
|
|
From: Johannes Hubert
Subject: Re: Some musings about POV-Ray and Java...
Date: 26 Nov 1999 05:15:39
Message: <383e5dcb@news.povray.org>
|
|
|
| |
| |
|
|
Chris Huff <chr### [at] yahoocom> wrote in message
news:251119992136518380%chr### [at] yahoocom...
> This looks like an interesting idea, it might take a bit of time to
> figure out the best way to implement it, but would almost certainly be
> worth it. And of course, it would be entirely platform independant,
Well, not entirely. You would need to have a platform for wich there is a
Java implementation (with whatever version you plan to do the packages in,
so I would vote for Java 1.1 since it is much more common than Java 2 that
only exists for Windows and Solaris - yet.)
> and wouldn't even require POV to be installed.
For the rendering you would need POV of course, but for the generation of
the POV script you could do without. But what use would be a POV script
without the ability to render it?
Johannes.
Post a reply to this message
|
|
| |
| |
|
|
From: Nieminen Juha
Subject: Re: Some musings about POV-Ray and Java...
Date: 26 Nov 1999 05:36:40
Message: <383e62b8@news.povray.org>
|
|
|
| |
| |
|
|
Personally I like C++ more. For some reason I have never liked Java
(most probably due to the limitations they made to make it a more "secure"
programming language).
On the other hand, compilable programming languages, like C++ or Java, are
a bit tedious to use for this kind of purpose. Every time you make a little
change you have to compile and run it.
Making it with a powerful scripting language like Perl would get rid of
this. Of course Perl is often much more cryptic than C++ or Java (although
more versatile).
Johannes Hubert <jht### [at] nove-mailcom> wrote:
: Another advantage would be, that errors that otherwise could become obvious
: only after a lengthy parsing time, would appear already at compile time or
: at Java runtime. The resulting POV file would be a plain vanilla file
: without #if, #whiles and such, and thus be quite fast to parse (I guess) and
: guaranteed to be without parsing errors.
I don't know if this could be an advantage. The file sizes would grow
wildly. Just imagine a landscape made of 100000 spheres...
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
From: Johannes Hubert
Subject: Re: Some musings about POV-Ray and Java...
Date: 26 Nov 1999 08:21:33
Message: <383e895d@news.povray.org>
|
|
|
| |
| |
|
|
Nieminen Juha <war### [at] punarastascstutfi> wrote in message
news:383e62b8@news.povray.org...
>
> Personally I like C++ more. For some reason I have never liked Java
> (most probably due to the limitations they made to make it a more "secure"
> programming language).
I like both C++ and Java and use them as appropriate for the job. What do
you have in mind when you say "limitations"?
> On the other hand, compilable programming languages, like C++ or Java,
are
> a bit tedious to use for this kind of purpose. Every time you make a
little
> change you have to compile and run it.
I think Java has an advantage over C++ here, because it doesn't need to be
linked.
If you set up your Java development environment (whichever it is) correctly,
you almost always have a "Run" button or command, that compiles and runs the
application. I don't see a difference to interpreted languages, since I
don't expect POV programs to be large (e.g. short compile times). The
execution time of the Java program would simply be "Compile_Time +
Execution_Time", which could still be faster than the execution time of a
script language (and then of course, I don't like Perl very much, too
cryptic...)
> Johannes Hubert <jht### [at] nove-mailcom> wrote:
> : Another advantage would be, that errors that otherwise could become
obvious
> : only after a lengthy parsing time, would appear already at compile time
or
> : at Java runtime. The resulting POV file would be a plain vanilla file
> : without #if, #whiles and such, and thus be quite fast to parse (I guess)
and
> : guaranteed to be without parsing errors.
>
> I don't know if this could be an advantage. The file sizes would grow
> wildly. Just imagine a landscape made of 100000 spheres...
You have a point there...
The "POV-Java" would have to have features so that you can, where you want
it, insert POV-loops.
Well, I guess it is rather a strange idea, since probably no-one would use
it anyway... :-)
Johannes.
Post a reply to this message
|
|
| |
| |
|
|
From: Nieminen Juha
Subject: Re: Some musings about POV-Ray and Java...
Date: 26 Nov 1999 09:28:02
Message: <383e98f2@news.povray.org>
|
|
|
| |
| |
|
|
Johannes Hubert <jht### [at] nove-mailcom> wrote:
: I like both C++ and Java and use them as appropriate for the job. What do
: you have in mind when you say "limitations"?
No templates, typedefs, operator overloading, macros, enums, etc. You can't
pass an instance of a class by value (only by reference). On the other hand,
you can't pass an integer (or other similar types) by reference, only by
value. You can only make multiple inheritance from interfaces but not from
classes (which means that you can't make default implementations for the
methods, but you have to implement _all_ the methods each time you inherit).
And more.
: I think Java has an advantage over C++ here, because it doesn't need to be
: linked.
I don't see the advantage.
: Well, I guess it is rather a strange idea, since probably no-one would use
: it anyway... :-)
That's sadly true...
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
While I was browsing the groups I stumbled upon this archaic,
dust-covered post.
=======Start Message=======
Message-ID: <3697A9C2.9AF6D1C4@lick.pvt.k12.ca.us>
Date: Sat, 09 Jan 1999 11:10:58 -0800
From: Geoffrey Romer <gro### [at] lickpvtk12caus>
Newsgroups: povray.general,povray.programming
Subject: POV-Ray and Perl
It has always struck me that POVRay and Perl make a
natural team. Perl's text-processing facilites, and the fact
that it is a full-featured programming language, make it a
great choice for automating the construction of scenes
which are, for one reason or another, difficult to build by
hand. I have seen a few mentions of this approach at the
IRTC. However, I have yet to come across any mention
of a more general solution- a POVRay Perl module, which
would simplify the process of developing Perl scripts for
POV output, and thereby keep every Perl-POV
programmer from having to start from scratch.
In light of this, I would like to develop just such a module.
However, I have no wish to duplicate someone else's
effort, or step on their toes, so if a POVRay Perl module
already exists, could someone let me know where I could
get information about it?
Thanks in advance.
======= End Message ========
I know how you feel about Perl, and from what little experience I have
with it, I can relate. However, it might be worth checking out for any
progress on Geoffrey's idea. Another thing that comes to mind is to
take a look at Steve's Object Builder and see how much it satisfies
your needs.
Old ideas never die. They just don't get implemented :)
Peter Popov
pet### [at] usanet
ICQ: 15002700
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Johannes Hubert wrote:
>
>
> Well, I guess it is rather a strange idea, since probably no-one would
> use
> it anyway... :-)
>
> Johannes.
Although I think your idea is good I'm afraid your conclusion is even
better.
I've tried making something that is very vaguely similar to something
that comes a teeny bit in this direction until it occurred to me that
the benefit was too slow for the effort: you're trying to help people
who are addicted to typing POV-scripts. They're lost.
On the other hand if there's anyone who'd like to give this a try I'd
very much like to see (test) the results.
Good luck anyway :)
Remco
Post a reply to this message
|
|
| |
| |
|
|
From: Johannes Hubert
Subject: Re: Some musings about POV-Ray and Java...
Date: 26 Nov 1999 19:25:12
Message: <383f24e8@news.povray.org>
|
|
|
| |
| |
|
|
Peter Popov <pet### [at] usanet> wrote in message
news:DKs+OMvOvsPdtod3jt3ltZw+V2zL@4ax.com...
[snip]
>
> I know how you feel about Perl, and from what little experience I have
> with it, I can relate. However, it might be worth checking out for any
> progress on Geoffrey's idea. Another thing that comes to mind is to
> take a look at Steve's Object Builder and see how much it satisfies
> your needs.
>
> Old ideas never die. They just don't get implemented :)
Indeed! :-)
Anyway, *if* I should create such a Java-POV, it would be more or less for
the fun of doing so, and that fun I (personally) can not gain from
programming Perl (brrr :)
This means also, that the main goal is not as much to find something
existing that somehow satisfies my needs (like that I quickly need a tool I
can use in an ongoing project), but to create something new, for the fun of
it (I like programming, haven't you guessed ;-).
Still it would probably be hopless to try to convince anyone else to use it
once it is done, because those POV-users that already do script their scenes
(as opposed to those using modelers) are, as Remco wrote, addicted to the
POV script anyway :-) and my (statistically totally unfounded) guess would
be, that also only a few of them already know Java, which would mean, that
they would have to learn a new language to do essentially the same they are
doing already with POV :-)
Now that would be a topic for one of those endless surveys that have been
popping up recently in p.off-topic: How many of you know Java? (no, no, that
was a joke!)
If I ever proceed to more than just "musings" about this, I will tell you
all - at a povray newsgroup near you! :=)
Johannes.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I tend to try every POV-related but of software if I think it will be
of use to me. If ever you complete this project and release a final
version, I will be glad to try it out. And no, I don't know Java, but
maybe it was about time I learned it :)
Does Java support macros and defines? Can a "scene" in this
hypothetical Java-Pov-whatever language look a lot like a POV scene if
hacked around with defines?
Peter Popov
pet### [at] usanet
ICQ: 15002700
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|