POV-Ray : Newsgroups : povray.programming : Object oriented POV scene language? : Re: Object oriented POV scene language? Server Time
28 Jul 2024 14:33:23 EDT (-0400)
  Re: Object oriented POV scene language?  
From: Warp
Date: 23 Jul 2000 09:37:43
Message: <397af527@news.povray.org>
David <dav### [at] maccom> wrote:
: If OOP was done *right* in POV, it would be at the very core of the
: language. Writing "sphere{...}" would create a an *object of the class
: "sphere"* Everything would be object oriented. To the one learning the
: language, object oriented structure would be as fundamental as placing
: lights and cameras.

  But povray already does this.

  When you write this:

#declare MySphere = sphere { 0,1 pigment { rgb 1 } }

what you are actually doing is defining a new object (or class if you like
that name) named 'MySphere'. Now 'MySphere' can be considered a new type,
extactly like a class can be considered in C++/Java.
  Now, when you write this:

object { MySphere }

you are actually creating an instance of that object (class). You can even
modify the attributes of the object (in a quite limited way, but still you
can do it). For example:

object { MySphere translate <1,2,3> }

  And by the way, this is not yet object-oriented programming. This is
modular programming. The first modular programming languages (like Modula2)
already had classes (called "modules") with member attributes, member
functions, public and private parts, etc.
  You get an object-oriented language when you add inheritance and dynamic
binding to this. Adding these to povray would be a quite laborious job and
would probably benefit little to regular non-programmers.

:     Now, when a heard that POV 4.0 would be object oriented

  No-one has said that pov4 would be object-oriented. Yes, its _source code_
will be object-oriented (that's the point of making it in C++ after all), but
no-one has said that the povray scripting language will change that much.
  And by the way, the source code of povray IS already object-oriented.

, my reaction was
: "What, the current POV isn't OOP?!?". My aw of the POV Team grew as a
: learned that they create such a raystacer WITHOUT oop! But for OOP to really
: work, it must be *fully* oop.

  Now I'm not sure if you are talking about the source code or the povray
scripting language. As I said, the source code is OO (although made in C).
The scripting language has some OO (or more precisely modular programming)
characteristics.

: I'm all for an object oriented POV-Ray language, as long as it is fully
: object oriented.

  Well, perhaps inheritance and dynamic binding could have some uses in the
povray scripting language, but do you really think it's worth the efforts?

-- 
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

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