POV-Ray : Newsgroups : povray.newusers : weird macro error : Re: weird macro error Server Time
29 Jul 2024 04:20:48 EDT (-0400)
  Re: weird macro error  
From: CdeathJd
Date: 19 Sep 2006 07:25:00
Message: <web.450fd2b72a8514e5e2e0912a0@news.povray.org>
Cheers! I should have spotted that! But it was really late!
now i have a bigger and less obvious error, i get the error "RENDERING
ERROR: TOO MANY NESTED OBJECTS".

This is the povray file that gives the error:

// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Checkered Floor Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"

#declare MAX_FIRE=1000;

global_settings {
  assumed_gamma 1.0
  max_trace_level 5
}
#declare fire_array=array[MAX_FIRE][10];

#declare a=0;
#while (a<MAX_FIRE)
        #declare fire_array[a][0]=0;
        #declare fire_array[a][1]=0;
        #declare fire_array[a][2]=0;
        #declare fire_array[a][3]=0;
        #declare fire_array[a][4]=0;
        #declare fire_array[a][5]=0;
        #declare fire_array[a][6]=0;
        #declare fire_array[a][7]=0;
        #declare fire_array[a][8]=0;
        #declare fire_array[a][9]=0;
        #declare a=a+1;
#end

#include "Fires.inc"

#macro Save_Fires()
#declare index=0;

  #fopen IFV_File "Fires.inc" write
  #write ( IFV_File, "// This is a generated file which " )
  #write ( IFV_File, "can probably be deleted without too much harm.n" )
//  #write ( IFV_File, concat("#declare fire_array=array[1001][9]n" )
  #write ( IFV_File, "#declare fire_array=array[1001][10]n" )

#while (index<MAX_FIRE)

  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][0]=",
str(fire_array[index] [0],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][1]=",
str(fire_array[index] [1],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][2]=",
str(fire_array[index] [2],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][3]=",
str(fire_array[index] [3],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][4]=",
str(fire_array[index] [4],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][5]=",
str(fire_array[index] [5],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][6]=",
str(fire_array[index] [6],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][7]=",
str(fire_array[index] [7],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][8]=",
str(fire_array[index] [8],0,3),";n" ))
  #write ( IFV_File, concat(  "#declare fire_array[",str(index,0,0),"][9]=",
str(fire_array[index] [9],0,3),";n" ))

  #declare index=index+1;

#end
  #fclose IFV_File
#end


#declare r1=seed(sin(clock*clock*clock)*0.2);

#declare index=0;
#while (index<2)    //10 is self set max spawn rate per frame
  #if (rand(r1)>0.1)
        #declare index2=0;
        #while (index2<MAX_FIRE)
                #if (fire_array[index2][0]=0)
                        #declare fire_array[index2][0]=1;      //EXISTS
                        #declare fire_array[index2][1]=0;       //XPOS
                        #declare fire_array[index2][2]=0;       //YPOS
                        #declare fire_array[index2][3]=0;       //ZPOS
                        #declare fire_array[index2][4]=1;       //XVEL
                        #declare fire_array[index2][5]=-2;       //YVEL
                        #declare fire_array[index2][6]=1;       //ZVEL
                        #declare fire_array[index2][7]=30+(rand(r1)*25);
//scale
                        #if (rand(r1)>0.8)
                                #declare fire_array[index2] [8]=1;  //WARP
EFFECT
                        #end
                        #declare fire_array[index2][9]=rand(r1);
//life
                #else
                        sphere {
                        #declare
fire_array[index2][1]=fire_array[index2][1]+fire_array[index2][4];
                        #declare
fire_array[index2][2]=fire_array[index2][2]+fire_array[index2][5];
                        #declare
fire_array[index2][3]=fire_array[index2][3]+fire_array[index2][6];
                        <fire_array[index2][1], fire_array[index2][2],
fire_array[index2][3]> // center of sphere <X Y Z>
                        fire_array[index2][7]       // radius of sphere
                        }
                        #declare
fire_array[index2][9]=fire_array[index2][9]-0.02;
                        #declare
fire_array[index2][7]=fire_array[index2][7]*fire_array[index2][9];

                        #if (fire_array[index2][9]<0.02)
        #declare fire_array[index2][0]=0;
        #declare fire_array[index2][1]=0;
        #declare fire_array[index2][2]=0;
        #declare fire_array[index2][3]=0;
        #declare fire_array[index2][4]=0;
        #declare fire_array[index2][5]=0;
        #declare fire_array[index2][6]=0;
        #declare fire_array[index2][7]=0;
        #declare fire_array[index2][8]=0;
        #declare fire_array[index2][9]=0;
                        #end
                #end
                #declare index2=index2+1;
        #end
  #end
  #declare index=index+1;
#end


// ----------------------------------------

camera {
  location  <0.0, 0.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
  angle 75
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

plane {               // checkered floor
  y, -1
  texture
  {
    pigment {
      checker
      color rgb 1
      color blue 1
      scale 0.5
    }
    finish{
      diffuse 0.8
      ambient 0.1
    }
  }
}

sphere {              // reflective sphere
  <0,50,200>, 100
  texture {
    pigment {
      color rgb <0.8,0.8,1.0>
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.8
        metallic
      }
      conserve_energy
    }
  }
}

Save_Fires()


Post a reply to this message

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