POV-Ray : Newsgroups : povray.general : Object on or off ??? : Re: Object on or off ??? Server Time
7 Nov 2024 17:28:18 EST (-0500)
  Re: Object on or off ???  
From:
Date: 13 Aug 2003 13:30:37
Message: <3f3a75bd$1@news.povray.org>
Hi Boris,

as usual, there are many solutions, for example:


(1) COMMENT/UNCOMMENT

//*
  // SDL of object goes here
// */

To switch the object off, delete one of the "/" of "//*".
(A really nice trick I've seen somewhere here, but can't remember
who invented it. Don't omit the space in "// */".)


(2) DECLARE AND USE OR DON'T USE

#declare myObject = ...

object { myObject } // in scene
//object { myObject } // not in scene



(3) INCLUDE OR DON'T INCLUDE

#include "myObject.inc" // in scene
//#include "myObject.inc" // not in scene



(4) ACTIVATE OBJECTS BY A STRING

#declare Enabled = "abcdefg" // string of "one-character-names"
                             // of enabled objects
#macro Use(U)
  #local I = 1;
  #while (I<=strlen(Enabled))
    #if (strcmp(substr(Enabled,I,1),U)=0)
      #declare I = 999; // exit loop
      #end//if
    #local I = I+1;
    #end//while I
  (I=1000)
  #end//macro Use

#if (Use("a"))
  // SDL for object "a" goes here; displayed when Enabled contains "a"
  #end//"a"

#if (Use("b"))
  // SDL for object "b" goes here; displayed when Enabled contains "b"
  #end//"b"


And of course all the other solutions in this thread ...

   Sputnik


Post a reply to this message

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