POV-Ray : Newsgroups : povray.pov4.discussion.general : True objects in SDL? : Re: True objects in SDL? Server Time
5 May 2024 00:48:17 EDT (-0400)
  Re: True objects in SDL?  
From: Allen
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.