POV-Ray : Newsgroups : povray.programming : PROOF : Pov Ray Object Oriented Features : an attempt on classes in Sdl : Re: PROOF : Pov Ray Object Oriented Features : an attempt on classes in Sdl Server Time
16 Apr 2024 14:47:10 EDT (-0400)
  Re: PROOF : Pov Ray Object Oriented Features : an attempt on classes in Sdl  
From: Bruno Cabasson
Date: 1 Mar 2022 18:50:00
Message: <web.621eb00cdad3a7bba03119e524d82e4@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "Bruno Cabasson" <bru### [at] cabassoncom> wrote:
> > [sorry, I pressed the 'post message' by accident ...]
> > Hi There!
>
> just a couple of comments and questions.
>
>
> > ...
> > After having #include'ed the appropriate definitions (currently, I have :
> > primitives.inc, collections.inc, oocore.inc for the basic OO featues),
>
> I've re-read the post a couple of times, am curious about and try to wrap my
> head round the .. substance.  I think it would be very helpful if you could post
> a zip with the includes and two or three demonstrations of the OO features,
> aimed perhaps at the (snipped, sorry) "3D artists".
>
>
> > I can write this, as a syntactic example without any other interest :
> >
> > [START]
> > // == class MyClass =========================
> > #declare MyClass = class
> > (
> >     "MyClass", // Name of the class
> >     no,        // No parent class
> >     None,
> >     array      // properties
> >     {
> >         array mixed {"property1", TYPES._int_},
> >         array mixed {"property2", TYPES._string_}
> >     },
> >     array    // Methods
> >     {
> >         "method1",
> >         "method2"
> >     }
> > )
> > ... here is a code fragment :
> > describe(Sphere,)
> > #declare my_sphere = new
> > (
> >     Sphere,,
> >     dictionary {.center : 1.2*x, .radius_ : 1}
> > )
> > setmods
> > (
> >     my_sphere,
> >     dictionary
> >     {
> >         .texture_ : pigment {Red},
> >     }
> > )
> > setfinish(my_sphere, finish {specular 0.8 roughness 0.002})
> > setnormal(my_sphere, normal {crackle 2 scale 0.3})
> > dump(my_sphere,)
> > spawn(my_sphere)
> > dump(my_sphere,)
> >
> > And let there be the sphere !!
>
> Q - what is the state of the documentation?  because the above isn't exactly
> "self-descriptive", I feel I'd want a (detailed) reference to hand.
>
> also, as a potential user I think that's a lot of code to go from object
> creation to the "instance".  perhaps the raw OO syntax could/should be hidden
> inside wrappers ("syntactic sugar" :-)).
>
>
> > As such, classes for object have no real interest if you just drop objects in
> > your scene. But, with classes and object-orientedness, one can go further and
> > implement behaviours, design pattens ...
> >
> > This post was quite long, therefore, I'll tell more in a next one.
>
> please.  and some "hands-on" example code perhaps?
>
>
> regards, jr.

Thanks for reading! I did not provide all my stuff because the post was already
very long. It was just to show the principle. My work is in very, very, very
very early stage and barely a POC. I can provide a WIP just so that the examples
work.

Let me work a little more on it, add more comments in the code, and I publish
all I have so far.

Regards

Bruno


Post a reply to this message

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