POV-Ray : Newsgroups : povray.binaries.images : useful modSwitch macros [~200k] Server Time
14 Nov 2024 18:22:18 EST (-0500)
  useful modSwitch macros [~200k] (Message 1 to 1 of 1)  
From: [GDS|Entropy]
Subject: useful modSwitch macros [~200k]
Date: 15 Feb 2009 03:55:04
Message: <4997d868@news.povray.org>
Greetings,

When one wishes to cycle between certian things in a predictable way, for 
instance when building a controlled random scene (which I love), it is 
useful to use mod() switches. I use them all the time for many things.

I haven't seen anyone else post anything like this, so I decided to post my 
modSwitch.inc file for all to use. Contained therein are macros for 
mod2Switch() through mod9Switch().

They are structured and called as folows:
mod2Switch(ctr,doCommand0,doCommand1)
mod2Switch(i,myMacro(),myOtherMacro())

The ctr variable works, obviously, with a counter variable from a loop.

The macros will accept almost anything for the doCommand variables, except 
#directives and the like. They are great for calling other macros, objects, 
variables, even other modSwitches (but why?), etc..

I havent fully explored all options, so there may be other things they are 
incompatible with, or that they can do, that I am not aware of.

One caveat, they do not seem to like CSGs performed on them.
That could be bad.

Ideas?

I have provided a sample file showing one use of the mod9Switch, which will 
allow you to switch between 10 doCommands.

Here is the sample image. The source is in p.b.s-f.

Comments, criticisim, and most especially expansions, demo files and 
improvements are of course welcome.

ian


Post a reply to this message


Attachments:
Download 'modSwitchTest0.jpg' (146 KB)

Preview of image 'modSwitchTest0.jpg'
modSwitchTest0.jpg


 

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