POV-Ray : Newsgroups : povray.newusers : I'm back Server Time
28 Nov 2024 17:44:26 EST (-0500)
  I'm back (Message 1 to 2 of 2)  
From: Peter Cracknell
Subject: I'm back
Date: 14 Feb 2000 15:40:04
Message: <38a86824@news.povray.org>
Sorry to keep asking questions, I dable on and off between POV-Ray and Moray
and I'm currently in POV-Ray trying to get the hang of macros and blobs this
time.  I'm having ago at creating a grass macro (its been done a few time
before I know!) and if I just explain I have a macro creating a blade of
grass with random this n that, which is now sorted, a macro to then line
these up along the x-axis and then finally the idea is that a macro or union
displays the previous macro in a similar fashion along the z-axis, easy huh?
Well it should be well in comparison to the other parts it should be.
Basically as seen at the bottom there is the line xrow(10) which creates an
xrow at the z-position 10, easy, great I can work on that, but the next line
says xrow(5) but does not create another line at z-position 5 and is ignored
completely, am I missing something?  By the way the code isn't actually made
up of proper macros anyway cos I changed it to unions and they didn't work
in random so I swapped em back it havn't got around to sticking the numbers
in.  Anyway if you could please help it doesn't make any sense at all!!



#version 3.1;

#include "colors.inc"

global_settings
{
  assumed_gamma 1.0
}

// ----------------------------------------
camera
{
  location  <0.0, 0.0, -4.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.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

light_source
{
  0*x // light's position (translated below)
  color red 1.0  green 1.0  blue 1.0  // light's color
  translate <-30, 30, -30>
}

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

plane { y, -1 pigment {color rgb <0.7,0.5,0.3>}}


#declare rdd = seed(340);



#macro fgrass (xmover,zmover)

        blob
        {threshold 1

        #declare howmany = 250;
        file://#declare xmover = -1;
        file://#declare zmover = 0;
        #declare gcount = 0;
        #declare sizec = 0.01;
        #declare xtwist = (rand(rdd)*1.6)-0.8;
        #declare ztwist = (rand(rdd)*15)-7.5;
        #declare bwidth = (rand(rdd)*0.02)+0.04;



        #while (gcount<howmany)

        sphere


<rand(rdd)/100+xmover+xtwist,-gcount/howmany,rand(rdd)/100+zmover+ztwist>,
        sizec,
        1
        }

        #declare gcount = gcount + 1;
        #declare sizec = sizec + (bwidth/howmany);
        #declare xtwist = xtwist - (xtwist/howmany*5);
        #declare ztwist = ztwist - (ztwist/howmany*5);


        #end

        texture {pigment {rgb <0,0.2,0>}  }
        scale <1,1,0.3>
//        rotate <0,rand(rdd)*180,0>
        }

        #end




        #declare minmove = 0.1;
        #declare maxmove = 0.2;
        #declare xcount = 0;
        #declare xno = 10;
        #declare xmover = -1;

        #macro xrow (zmover)

        #while (xcount<xno)

         fgrass (xmover,zmover)

        #declare xcount = xcount + 1;
        #declare xmover = xmover + (maxmove-minmove)*rand(rdd)+minmove;

        #end
        #end



        xrow (10)
        xrow (5)


P3TE

--
pc### [at] WYSIWYGlineonenet
remember dont use WYSISYG!

www.p3te.co.uk


Post a reply to this message

From: David Wilkinson
Subject: Re: I'm back
Date: 14 Feb 2000 17:08:58
Message: <m6vgass3j9ajp52k9jhgekss1kg6bdhq1q@4ax.com>
On Mon, 14 Feb 2000 20:41:10 -0000, "Peter Cracknell" <pc### [at] lineonenet> wrote:

Hi Peter,

You need to reset xcount and xmover  in your xrow macro between the final two #end's.
e.g.

      #macro xrow (zmover)
          #while (xcount<xno)
            fgrass (xmover,zmover)
            #declare xcount = xcount + 1;
            #declare xmover = xmover + (maxmove-minmove)*rand(rdd)+minmove;
         #end
         #declare xcount =  0;  //  or control never hits fgrass on the 2nd call to
xrow
         #declare xmover= -1; //  or the row moves along in x
      #end

        xrow (10)
        xrow (5)

----------------------------
dav### [at] cwcomnet
http://www.hamiltonite.mcmail.com
----------------------------


Post a reply to this message

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