POV-Ray : Newsgroups : povray.newusers : Macro Woes : Macro Woes Server Time
5 Sep 2024 20:20:20 EDT (-0400)
  Macro Woes  
From: Ian Burgmyer
Date: 29 Sep 1999 23:54:55
Message: <37f2df0f@news.povray.org>
I'm having serious problem with macros.  As most of you probably know, I
released an image from the output of my Sphere Spreader 2000.  It created a
sphere in the center with smaller ones going out in four directions.  Sorta.
You'll have to see it, it's on p.b.i.

Anyways, to my problem.  I am trying to have it rotate on every iteration.
However, not without serious problems.  Every time I compile my source (at
the bottom of this message) I get the following error:

-------------------------------
C:\My Documents\POV-Ray Sources\Mine!\Attempts\Sphere.pov:31: error: No
matching } in object, union found instead.

Returned from renderer (non-zero return value)
-------------------------------

You wouldn't believe the crap I went through trying to fix it :(

Any help would be GREATLY appreciated!  Also, please comment on my code
structure.  If it's messy, please tell me how I can fix it.  I really want
to improve at hand-coding.  Hell, maybe I'll just make macros ;)

--
This message brought to you by:
-=< Ian (the### [at] hotmailcom >=-

Please visit my site at spectere2000.cjb.net! :)

// POV-Ray Scene File
// Filename: Sphere.pov
// Date: v.1.0 - 9/21/99
// Author: Ian Burgmyer
//

#version 3.1

#include "textures.inc"

#declare SphereTexture = Ruby_Glass

#macro SphereMacro(Amount, StartSize, SizeDivide, RotationSpeed)
  #declare Counter = 0;
  #declare Pos = 0;
  #declare SizeNow = StartSize;
  #declare Rotation = 0 - RotationSpeed;

// Note: Some statements are commented out, as you can see.
// This is some code from the old macro that I didn't want to remove
// just in case. . . :(
  #while (Counter < Amount)
//    #if (Counter != 0)
      MakeSpheres()
//    #else

// ---
// The original purpose of the following statement was to save you
// 3 objects.
// --
//      sphere { <0,0,0>, StartSize texture{SphereTexture} }
//    #end
    #debug concat(str(Counter, 0, 0) + "th Loop")
    #declare Counter = Counter + 1;
  #end
#end

// This used to be in the above macro without a problem.
// I put it here and STILL have trouble :(
#macro MakeSpheres()
  union {
    #declare SizeNow = SizeNow / SizeDivide;
    #declare Pos = Pos+(SizeDivide*SizeNow);
    #declare Rotation = Rotation + RotationSpeed
    sphere { <0-Pos, 0+Pos, 0-Pos>, SizeNow texture{SphereTexture} }
    sphere { <0+Pos, 0+Pos, 0-Pos>, SizeNow texture{SphereTexture} }
    sphere { <0-Pos, 0-Pos, 0-Pos>, SizeNow texture{SphereTexture} }
    sphere { <0+Pos, 0-Pos, 0-Pos>, SizeNow texture{SphereTexture} }
    rotate <0, 0, Rotation> }
#end

global_settings
{
  assumed_gamma 2

  radiosity
  {
    count 250
  }
}

// -----------------
// Scene starts here
// -----------------

camera
{
  location  <0.0, 0, -12.0>
  direction 1.5*z
  right     4/3*x
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.000 0.002 color rgb <0.05, 0.05, 0.3>
                   color rgb <0.05, 0.05, 0.5>]
      [0.002 0.200 color rgb <0.05, 0.05, 0.7>
                   color rgb <0.05, 0.05, 0.9>]
    }
    translate -1
  }
  pigment {
    bozo
    turbulence 0.65
    octaves 6
    omega 0.7
    lambda 2
    color_map {
      [0.0 0.1 color rgbt <0.85, 0.85, 0.85, 0>
               color rgbt <0.85, 0.85, 0.85, 0.1>]
      [0.1 0.3 color rgbt <0.85, 0.85, 0.85, 0.1>
               color rgbt <0.85, 0.85, 0.85, 0.333>]
      [0.3 0.6 color rgbt <0.85, 0.85, 0.85, 0.333>
               color rgbt <0.85, 0.85, 0.85, 0.667>]
      [0.6 0.8 color rgbt <0.85, 0.85, 0.85, 0.667>
               color rgbt <0.85, 0.85, 0.85, 1>]
      [0.8 0.9 color rgbt <0.85, 0.85, 0.85, 1>
               color rgbt <0.85, 0.85, 0.85, 1>]
      [0.9 1.0 color rgbt <0.85, 0.85, 0.85, 1>
               color rgbt <0.85, 0.85, 0.85, 1>]
    }
    scale <0.1, 0.2, 0.1>
  }
  rotate -135*x
}

light_source {<0.333, 0.333, -2>}

object { SphereMacro(15, 1, 1.5, 10)


Post a reply to this message

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