POV-Ray : Newsgroups : povray.pov4.discussion.general : Next Generation SDL: What's wrong with Lua, JavaScript, ... : Re: Next Generation SDL: What's wrong with Lua, JavaScript, ... Server Time
21 Apr 2024 06:41:35 EDT (-0400)
  Re: Next Generation SDL: What's wrong with Lua, JavaScript, ...  
From: clipka
Date: 13 Apr 2009 05:45:00
Message: <web.49e30870e7a64ad8d037e2230@news.povray.org>
SharkD <mik### [at] gmailcom> wrote:
> What I was trying to say is that objects in the scene tree should just
> have parameters (i.e. data) and no methods. Modifications to the tree
> would be done using methods/functions with global scope.
> I think this would be "cleaner", but would be more like procedural
> programming and not like OO programming. I personally think that OO
> programming is too bulky, in that there are loads of "junk" items
> attached to each object and taking up memory that you are likely never
> to use.

It does, on the other hand, clutter global space with "junk" that you're only
using in some particular context.

It also clutters up those global methods/functions with loads of exceptional
rules for how to deal with things. For instance, "translate(mySphere,v)" will
have to do some things different than "translate(myTexture,v)".

> > var MyObject = new Object();
> > MyObject.radius = 1;
> > MyObject.translation.append([0,0,1]);
> > MyObject.add(new Texture(...));
> > MyObject.translation.append([0,2,0]);
> AFAIK, what you are trying to do doesn't make "sense" according to a
> scripting language. I.e. the scripting language doesn't know that you
> want the latter translation to occur "after" the texture has been added.

Well, it's a *scripting* language after all, isn't it? Not a declarative one. So
things should happen sequentially.

>   It doesn't remember/behave differently based on the sequence of your
> commands. Further, this is something I would gladly see scrapped in any
> future SDL.

I *strongly* object!

Translation may be a weak example because it is easy to handle, but other
transformations may make my point stronger. Suppose for example that I want to
model a simple wooden ring: I may want the geometry to be a distorted torus;
but of course I do not want to distort the texture along with it, so what I do
in 3.x SDL is transform the geometry first, *then* apply the texture. Easy as
eating pancakes.

If a transformation would always affect the texture of the object, there would
be no way to do this - no easy one at least; I would have to apply an inverse
transformation to the texture to achieve the same, which is far from handy.

If on the other hand a transformation would never affect texture, then I would
have a hard time pushing that ring around the scene *together* with the texture
- which is the natural thing to do with finished objects.

There are even simpler cases when I would want to apply transformations
sequentialy: For instance, in some cases I want to *first* rotate an object
about the Z axis, *then* about the X axis, and *then* about the Y axis: The
math involved here is far from trivial; and in case I want to add a translation
step in between, it would get even uglier.

No, the sequential operation of transformations is a blessing, not a curse. If
you don't like it, feel free to leave it aside and always apply just one single
transformation to the assembled object. But other users will definitely want it.

Post a reply to this message

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