POV-Ray : Newsgroups : povray.newusers : Declare : Re: Declare Server Time
6 Sep 2024 14:14:00 EDT (-0400)
  Re: Declare  
From: Mark Wright
Date: 9 Feb 1998 13:21:59
Message: <34df570a.0@news.povray.org>
Ok ... Am I on the right track with this? The problem I seem to be
having now is when I rotate this cross, it's not as one object
and doesn't rotate as one. Man .. I was up way too late trying to
figure all this out.

// DECLARE REDCROSS
#declare redcross =
box { < -0.5, -0.5, -0.5>, < 0.5, 0.5, 0.5>
      texture { pigment { color Red } }
      scale  < 5, 14, -3 >
      translate  < 0, -4, 1 > }

box { < -0.5, -0.5, -0.5>, < 0.5, 0.5, 0.5>
      texture { pigment { color Red } }
      scale  < 14, 5, -3 >
      translate  < 0, -4, 1 > }

// UNION
union { object { redcross } rotate y*(360*clock)}


Thanks again to All that have helped me and others !!

Mark Wright
mwr### [at] netonecomnet


Nieminen Mika wrote in message <34de05a4.0@news.povray.org>...
>Mark Wright (ren### [at] myhousenet) wrote:
>: Could you explain the declare statement to me?
>: The help docs are great, but the declare examples they give
>: don't seem to work for me. A simple sample of some source code
>: would help alot.
>
>  Someone explained something already, but I will try to help too...
>
>  Unlike #define in C, #declare in povray doesn't just define text
replacing
>strings. You can define thinks like float values, vectors, textures,
>objects, etc. For example:
>#declare MyValue=10
>says that the string 'MyValue' has the value 10. So, if you have for
>example "rotate <MyValue,1,2>", this is the same thing as "rotate
<10,1,2>".
>#declare MyVector=<10,1,2>
>defines a vector. Now you can type for example "rotate MyVector" and it
>will be the same as "rotate <10,1,2>".
>  These work just like the text replacing #define in C, but textures,
>objects, etc work a bit different.
>  Suppose you want to define a texture. You type for example:
>#declare MyTexture=texture { pigment { rgb <1,0,0> } normal { bumps .2 } }
>  When you want to use this texture in an object, you type:
>  texture { MyTexture }
>  You can also define pigments, normals, etc, like:
>#declare MyPigment=
>pigment
>{ color rgbf <1,.5,0,.5>
>}
>#declare MyNormal=
>normal
>{ bumps .1 scale 2
>}
>  and then you can use them like this:
>
>sphere
>{ 0,1
>  pigment { MyPigment }
>  normal { MyNormal }
>}
>
>  You can also define an object or CSG:
>#define MyObject=sphere{ 0,1 scale <.5,.4,1> }
>#define MyCSG=
>union
>{ sphere { 0,2 }
>  box { -1,1 }
>}
>
>  When you want to use these object, you use the 'object' directive like
this:
>
>object
>{ MyObject
>  scale 5
>}
>object
>{ MyCSG
>  translate x*5
>}
>
>  or for example:
>
>difference
>{ object { MyObject }
>  object { MyCSG }
>  texture { MyTexture }
>}
>
>--
>                                                              - Warp. -


Post a reply to this message

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