POV-Ray : Newsgroups : povray.pov4.discussion.general : Identifier declaration consistent with other languages : Re: Identifier declaration consistent with other languages Server Time
2 May 2024 13:58:26 EDT (-0400)
  Re: Identifier declaration consistent with other languages  
From: Allen
Date: 5 Nov 2008 16:15:01
Message: <web.49120bff909e69788f162dfb0@news.povray.org>
Other ideas:

Currently there is a difference between declaring an item and using it:

// Declare a circle
#declare MyCircle = circle {
  ...
}

// Use a circle
circle {
  ...
}

// or
object {
  MyCirlce
  ...
}

When you use the item you can't give its 'instance' a name however.  In most
languages you can declare objects and create named instances of these objects.

// Declare an object (but don't use/create and instance of it)
circle MyCircle
{
}

texture MyTexture
{
  pigment
  {
    color Green
  }
}

// Create an unnamed instance of an unnamed object
circle
{
}

// create an unnamed instance of a named object
MyCircle
{
}

// Create a named instance of a named object
circle1 = MyCircle
{
  // overrides
}

circle2 = MyCircle
{
  scale circle1.radius

  texture { MyTexture }
}

circle3 = MyCircle
{
  <(circle2.x + circle1.x) / 2,
   (circle2.y + circle1.y) / 2,
   0>
}

Better yet why not have a full scripting built on top of an existing scripting
language (of course security may be an issue) such as Python, or AngelScript,
etc


Post a reply to this message

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