|
|
Le 22/03/2022 à 13:29, Bruno Cabasson a écrit :
> Hi,
>
> Here is an updated package, including "oocore.inc". The test file
> "oocore_ut.pov" provides examples on how classes can be defined and how
> main OO features can work in the "testing whole classes" section.
>
> Again, for the time being, this is only a study, and requires v3.8beta2.
>
> Soon, and if this approach is accepted by people here, I will go further
> with POV objects encapsulation within PROOF. As I already said, such an
> encapsulation, in itself, does not bring much compared to native syntax.
> Except we now can deal with objects and classes we can derive and attach
> behaviour to.
>
> To my eyes, POV-Sdl is not really a *programming* language. It is a
> Scene Description Language, which is quite different and very
> specialized. Since we have Object Orientedness, perhaps we could be in
> position to make it a *real* programming language. Even if not
> full-featured, even with limitations, even with syntactic and functional
> sacrifices.
>
> Of course, if it finally appears that nobody is interested, I will stop
> the study and drop PROOF. Will not bother me much.
>
> B.
>
Hi.
Please find a WIP for the "objects.inc" file, with a basic test file
(not intended for unit-testing) and a result image.
You can see the class hierachy I designed so far :
+- ObjectItem
| | - no properties -
| | commit() // generates Sdl items
| |
| +- ObjectPhotons
| | target_
| | refraction_
| | reflection_
| | collect_
| | pass_through_
| | - no additional methods -
| |
| +- ObjectRadiosity
| | importance_
| | - no additional methods -
| |
| +- ObjectModifiers
| | texture_
| | _has_interior_texture
| | interior_texture_
| | _has_interior
| | interior_
| | _has_pigment
| | pigment_
| | _has_normal
| | normal_
| | _has_finish
| | finish_
| | _has_transform
| | transform_
| | object_photons
| | _has_object_radiosity
| | object_radiosity
| | _has_bounded_by
| | bounded_by_
| | _has_clipped_by
| | clipped_by_
| | double_illuminate_
| | hollow_
| | no_shadow_
| | no_image_
| | no_reflection_
| | no_radiosity_
| | - no additional methods -
|
+- Object
| modifiers
| _spawned
| _instance
| spawn() // Actually creates the Sdl object
| (using ObjectItem's commmit() method)
|
+- Sphere
| center
| radius_
| - no additional methods -
|
+- Box
| ur
| ll
| - no additional methods -
|
+- Cylinder
| base
| cap
| radius_
| open_
| - no additional methods -
|
+- Torus
| major
| minor
| spindle_type
| sturm_
| - no additional methods -
|
.../... and so forth in the future for other POV objects.
I just implemented basic shapes to see what happens : sphere, box,
cylinder and torus.
Objects classes can define 2 methods, invoked by describe() and dump()
convenience macros:
-) describe() ==> MyClass_describe() macro
outputs a description of the class in the #debug channel
-) dump() ==> MyClass_dump() macro
outputs a dump of the contents of an instancein the #debug channel
The "object_test.pov" test file shows how these classes can be used and
the "object_test.png" image is the result of the Run.
Using classes for such a scene is not really interresting. But we are
now in the Object Oriented world. I will not explain the advantages of
OO ....
RECALL : It is just the VERY beginning of a POC.
I hope I can illustrate soon how OO can help in our scenes (or
animations). If any of you has ideas or inspiration, you are welcome to
contribute.
Regards
Bruno
--
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel
antivirus Avast.
https://www.avast.com/antivirus
Post a reply to this message
Attachments:
Download 'objects.inc.txt' (30 KB)
Download 'objects_test.png' (112 KB)
Download 'objects_test.pov.txt' (7 KB)
Preview of image 'objects_test.png'
|
|