POV-Ray : Newsgroups : povray.newusers : object variables for rending similar objects differently : object variables for rending similar objects differently Server Time
4 Jul 2024 14:00:18 EDT (-0400)
  object variables for rending similar objects differently  
From: nip
Date: 1 Nov 2010 07:20:01
Message: <web.4ccea11b6541604eb52264400@news.povray.org>
Hello!

I'm wondering if there's a way to supply variables\values to a union object to
alter the way it is rendered. I'm not sure if I've worded that correctly, so
consider the code below. I'm trying to rotate the top box on the second figure,
but leave the first figure as-is. Is something like this possible or would I
need completely separate declarations for each "pose".

Thanks for any help you can offer.
-nip



Sample code:

#include "colors.inc"

#declare Tilted = 0.0;

#declare Figure = union {
    box {
        <0, 0, 0>, <1, 1, 1>
        pigment { Green }
    }

    box {
        <0, 0, 0>, <1, 1, 1>
        pigment { Blue }

        #if (Tilted > 0)
            rotate z*15
        #end

        translate y*1
    }
}

object { Figure }

object {
    #declare Tilted = 1; //this does not make the right blue box rotate
    Figure
    translate <2, 0, 0>
}


camera {
    location <5, 1, -5>
    look_at <0, 1, 3>
}


light_source {
    <5, 1, -5>
    color rgb <1, 1, 1>
}


Post a reply to this message

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