|
![](/i/fill.gif) |
Christopher James Huff <chr### [at] mac com> wrote in
news:pan### [at] mac com:
>> While it would not only not work practically when implemented as a
>> parse-time variable, it is also not necessary if implemented as a
>> render-time variable - the scope and object are always known and
>> well-defined without ambiguity at that time!
> Actually, I think it might work fine if everything has a default value
> and is considered to exist at the opening { brace.
> If that were so, this:
> sphere {min_extent(self), 1}
> would center the sphere on the min_extent of the default sphere. I don't
> know what it would do for meshes or CSG though, and it might not give a
> perfectly obvious result all the time...
I think that is rather easy to implement - even more - I could implement it
my self - as pre-procesor, and I think that same algorithm will work for
new parser :
1. if You fond keyword 'this' in expresion 'zzz(this)' then
1a. parse '#declare this_obj = xxx { yyy }' where xxx is type, and yyy are
object modificers and parameters of object in with keyword 'this' was found
1b. change 'qqq zzz(this)' to 'object {this_obj qqq zzz(this_obj)'
and continue parsing
qqq zzz(this) - this is last sentens, that was not completly paresed
(because) 'this' was found while parsing it.
i.e. translate <1,2,3> will be translated fully, and it would be part of
yyy in example above, and entrie
translate min_extent(this) is qqq/xxx
It should work, ie.:
union { sphere{1,2} sphere{0,1} translate min_extent(this) }
would become
#declare this_obj = union { sphere{1,2} sphere{0,1} }
object { this_obj translate min_extent(this_obj) }
btw - Name 'this' or 'self' - maybe use both - for users that like C++ and
thoes who like Pascal/Deplhi ;)
--
Post a reply to this message
|
![](/i/fill.gif) |