|
![](/i/fill.gif) |
OO scripting is what I would like to see as well. Like this:
// This is a "class"
#declare MySphere=sphere{
<0,0,0>, 0.5
pigment{Red}
attribute rot_direction
attribute rot_speed
// This is a "method"
#macro Rotate()
rotate rot_direction*rot_speed
#end
}
// An instance (like before)
object{
MySphere
}
// Accessing the attributes
#declare MySphere.position=<3,1,5>;
#declare MySphere.size=MySphere.size+0.3;
#declare MySphere.pigment=pigment{rgb <0,0,1>}
#declare MySphere.rot_direction=<0,0,1>;
#declare MySphere.rot_speed=30;
// Calling of a method
MySphere.Rotate()
Note the fourth & fifth line after the pigment{} line! This is my
suggestion to letting the object have attributes that works as regular
variables, but in a POV-Ray manner. The keyword "attribute" means
"universal type", that works just as we're used to in POV-Ray:
- once declared as type [X], the identifier is always of type [X].
(Of course) position, size and pigent etc. has to be reserved words.
---
Collision detection is the next big thing. One suggestion is to use an
overlap directive that returns true or false, like this:
#if (overlap{MyBox MyPlane})
MyBox.rot_dir=MyBox.rot_dir*-1;
#end
NOTE:
This would not change anything for those who just want to make instant
scenes. You can still "create an instant instance" like you always did in
POV-Ray. And you can still #declare Something=something, and then make an
instance with object{} like before.
The new thing is the attributes (reserved or not) and usage of #macro as
class method.
Just my 2 cents....
Regards,
- Mikael.
Post a reply to this message
|
![](/i/fill.gif) |