POV-Ray : Newsgroups : povray.pov4.discussion.general : True objects in SDL? Server Time
25 Apr 2024 04:41:52 EDT (-0400)
  True objects in SDL? (Message 1 to 6 of 6)  
From: Chambers
Subject: True objects in SDL?
Date: 2 Feb 2008 23:09:09
Message: <47a53e65@news.povray.org>
What are the odds of this?

For instance, if I define a sphere{}, and pass it as an argument to 
something, I'd like that function to have access to information about 
the sphere.  Both shape specific (ie, center and radius), as well as 
generic (texture / transformations).

Once this is possible, then it's a trivial step to add a "world" or 
"scene" object which is simply a union of everything.

And that makes all kinds of fun tricks available ;)

---
On a separate note, I was looking at Thomas de Groot's image in p.b.i, 
"Ruined Place", and reading Jim's reply about moss growing where the sun 
doesn't reach.  Giving SDL access to more POV-Ray internals would enable 
things like asking POV to gather radiosity (or even simple lighting) 
samples at a particular point and return the result, allowing a scripted 
application of moss in the shade...

-- 
...Ben Chambers
www.pacificwebguy.com


Post a reply to this message

From: Warp
Subject: Re: True objects in SDL?
Date: 3 Feb 2008 03:03:12
Message: <47a57540@news.povray.org>
Chambers <ben### [at] pacificwebguycom> wrote:
> What are the odds of this?

  One of the main points of pov4 is that it should have a better scripting
language.

-- 
                                                          - Warp


Post a reply to this message

From: Chambers
Subject: Re: True objects in SDL?
Date: 3 Feb 2008 03:44:53
Message: <47a57f05$1@news.povray.org>
Warp wrote:
> Chambers <ben### [at] pacificwebguycom> wrote:
>> What are the odds of this?
> 
>   One of the main points of pov4 is that it should have a better scripting
> language.
> 

Nice :)  But I had to ask, since "a better scripting language" doesn't 
really tell us much, so I wasn't sure if this was being considered or not.

-- 
...Ben Chambers
www.pacificwebguy.com


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: True objects in SDL?
Date: 3 Feb 2008 09:57:52
Message: <47a5d670$1@news.povray.org>
Both properties and methods. Unions should have an add_object method :)

Now:
union {
     #while(I<10)
         sphere { x*I, 0.1 }
         #declare I=I+1;
     #end
}

Or, in loops which have things much more complex than that (for example 
if you need to trace() all the created spheres in order to create one more):

#declare Obj = union{};
#while(I<10)
     #declare Obj = union { object{Obj} sphere { x*I, 0.1 } };
     #declare I=I+1;
#end

(I heard POV-Ray has a special optimization for this, to make the final 
in-memory CSG be a flat union like from the first example, instead of a 
nested union)

So I'd like:

obj = union{};
while(I<10) {
     obj.add(sphere { x*I, 0.1 });
     I++;
}

(I'm not suggesting this script syntax, just the concept of adding 
objects to already-created CSG structures)


Post a reply to this message

From: scott
Subject: Re: True objects in SDL?
Date: 6 Feb 2008 04:33:23
Message: <47a97ee3@news.povray.org>
>>> What are the odds of this?
>>
>>   One of the main points of pov4 is that it should have a better 
>> scripting
>> language.
>>
>
> Nice :)  But I had to ask, since "a better scripting language" doesn't 
> really tell us much, so I wasn't sure if this was being considered or not.

Ideally it would be good enough that we wouldn't have to use another 
language to generate POV code.  I regularly use C++ to generate POV code, 
just because the SDL is too slow and clumsy for dealing with arrays of 
objects for animation.  It's a shame because it would be much nicer to be 
able to do that stuff within POV itself.


Post a reply to this message

From: Allen
Subject: Re: True objects in SDL?
Date: 4 Nov 2008 18:55:01
Message: <web.4910dfbde4b57f148f162dfb0@news.povray.org>
I've used Python to generate SDL before for a scene or two, and sometimes use
Python to generate prescene data files for the scene to use.  I think that the
current SDL is exactly that a 'description' language.  It has some scripting
support but not the most powerful and somewhat slow.

However a complete scripting-like language may also be undesired.  I created a
small python povray code once and the code looks like this:

import povray

scene = povray.Scene()
camera = povray.Camera((0, 0, -5), (0, 0, 0))
scene.Add(camera)

box = povray.Box(-2, 2)
scene.Add(box)

scene.Save('scene.pov')

I never completed the thing but even with that it's just to much like a
scripting language.  If somehow the descriptive language and a scripting
language could be combined but more powerful would be nice.

It would also be nice to be able to avoid reparsing the scene for animations
where possible.  And maybe get rid of '#' and add some more common constructs:

Instead of:

#declare x=0
#while(x<10)
blah
#declare x=x+1
#end

#if (somecondition)
  blah
#end

Something like:

for(x=0,x<10,x=x+1)
{
  blah
}

if(somecondition)
{
  blah
}

switch(something)
{
  case somecase
  {
  }

  case someothercase
  {
  }

  range somerange
  {
  }
}

For example:
count = 10 /* replaces #declare count = 10 */

MyObject = union {

  for(cur = 0, cur < count, cur = cur + 1) {
    sphere {
      <0, 0, 5>, 0.25
      rotate <0, cur * count / 360, 0>

      texture {
        pigment {
          if(cur % 2 == 0) { color White } else { color Black }
        }
      }
    }
  }

} // MyObject


Post a reply to this message

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