POV-Ray : Newsgroups : povray.bugreports : #declare problems Server Time
13 May 2024 20:17:27 EDT (-0400)
  #declare problems (Message 1 to 3 of 3)  
From: Dean Wilson
Subject: #declare problems
Date: 8 Jun 1999 19:25:42
Message: <375da676@news.povray.org>
i hav been having a problem with povray-3.1 it seems that once
something is declared it connot be redefined example.

i have an oushapes.inc that has a "jetmotor" defined in it inside jetmotor
we have

                       #ifndef (flames)
                       #declare flames = true ;
                       #else   #end
                         #if (flames=true )  object {exhaust scale 5
translate -13.9*x}
                             #else
                            #end

this is a the tail end of a union. Now when i do


#declare flames = false

object { jetmotor rotate <0,-90,0> scale .8 translate <0,0,-75>  }

the flames are always on unless i declare flames before including ourshapes
then the flames are always off.
this setup was working with pov-3.0, Additionally i have pov-3.1e for linux
and get the same results.
the question is is this the new behavior or did i really find a problem. it
acts to me as if the flames label is treated as a const and not changeable
after declaration?



Dean Wilson  me### [at] speedbroscom


thanks


Post a reply to this message

From: Nathan Kopp
Subject: Re: #declare problems
Date: 9 Jun 1999 01:11:34
Message: <375DF6E5.84E7F877@Kopp.com>
You'll have to put your 'jetmotor' into a macro if you want it to adapt to
variables.  Once you #declare something, it is stuck the way it is.  You
build it and put it into memory... #declare only attaches a name to the
object.  A macro works much like #define in C, if that's what you're used
to.  Use something like:

#macro jetmotor(flames)
  union{
    // jetmotor stuff

    #if (flames=true )
      object {exhaust scale 5 translate -13.9*x}
    #end  // notice no "#else"
  }
#end

Then you use:

object { jetmotor(false) rotate <0,-90,0> scale .8 translate <0,0,-75>  }
  or
object { jetmotor(true) rotate <0,-90,0> scale .8 translate <0,0,-75>  }

I just whipped up this code so it may have errors in it, but you get the
idea.

-Nathan

Dean Wilson wrote:
> 
>     i hav been having a problem with povray-3.1 it seems that once
> something is declared it connot be redefined example.
> 
> i have an oushapes.inc that has a "jetmotor" defined in it inside jetmotor
> we have
> 
>                        #ifndef (flames)
>                        #declare flames = true ;
>                        #else   #end
>                          #if (flames=true )  object {exhaust scale 5
> translate -13.9*x}
>                              #else
>                             #end
> 
> this is a the tail end of a union. Now when i do
> 
> #declare flames = false
> 
> object { jetmotor rotate <0,-90,0> scale .8 translate <0,0,-75>  }
> 
> the flames are always on unless i declare flames before including ourshapes
> then the flames are always off.
> this setup was working with pov-3.0, Additionally i have pov-3.1e for linux
> and get the same results.
> the question is is this the new behavior or did i really find a problem. it
> acts to me as if the flames label is treated as a const and not changeable
> after declaration?
> 
> Dean Wilson  me### [at] speedbroscom
> 
> thanks


Post a reply to this message

From: Bob
Subject: Re: #declare problems
Date: 9 Jun 1999 08:51:38
Message: <375E6339.CD68F024@aol.com>
At first I thought this was about the "Already defined" kind of error. This is a
simple
case of not rerunning through the included file after a change is made. Nathan's
answer
is the way to go if wanting to go include once and make any changes thereafter.
Otherwise you have to feed the include file the parameters all over again. Not knowing
enough of macro making I can't say proof positive this example is correct, looks right
though.


Nathan Kopp wrote:
> 
> You'll have to put your 'jetmotor' into a macro if you want it to adapt to
> variables.  Once you #declare something, it is stuck the way it is.  You
> build it and put it into memory... #declare only attaches a name to the
> object.  A macro works much like #define in C, if that's what you're used
> to.  Use something like:
> 
> #macro jetmotor(flames)
>   union{
>     // jetmotor stuff
> 
>     #if (flames=true )
>       object {exhaust scale 5 translate -13.9*x}
>     #end  // notice no "#else"
>   }
> #end
> 
> Then you use:
> 
> object { jetmotor(false) rotate <0,-90,0> scale .8 translate <0,0,-75>  }
>   or
> object { jetmotor(true) rotate <0,-90,0> scale .8 translate <0,0,-75>  }
> 
> I just whipped up this code so it may have errors in it, but you get the
> idea.
> 
> -Nathan
> 
> Dean Wilson wrote:
> >
> >     i hav been having a problem with povray-3.1 it seems that once
> > something is declared it connot be redefined example.
> >
> > i have an oushapes.inc that has a "jetmotor" defined in it inside jetmotor
> > we have
> >
> >                        #ifndef (flames)
> >                        #declare flames = true ;
> >                        #else   #end
> >                          #if (flames=true )  object {exhaust scale 5
> > translate -13.9*x}
> >                              #else
> >                             #end
> >
> > this is a the tail end of a union. Now when i do
> >
> > #declare flames = false
> >
> > object { jetmotor rotate <0,-90,0> scale .8 translate <0,0,-75>  }
> >
> > the flames are always on unless i declare flames before including ourshapes
> > then the flames are always off.
> > this setup was working with pov-3.0, Additionally i have pov-3.1e for linux
> > and get the same results.
> > the question is is this the new behavior or did i really find a problem. it
> > acts to me as if the flames label is treated as a const and not changeable
> > after declaration?
> >
> > Dean Wilson  me### [at] speedbroscom
> >
> > thanks

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

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