Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    Conditional Statements -
Deutsch Deutsch

Home
- POV-Ray Tutorial

  - Conditional
    Statements

  Branching
  #if(...) ... #else ... #end
    - in loops
    - in macros
    - in animations
    > turning on/off of parts
  #switch(...) #case(..) ...
          #range(..) ... #end
    - selection by tables

  Check for Existence
    #ifdef(...) #ifndef(...)
    - Check in include files
    - Defaults in include files

  Loops
 Prechecked, Postchecked,
 Count-controlled, Early-Exit
    #while(...)... #end
    #for(...)... #end
    - Samples:
    - Loops with POV-Ray
    - Loops, Sine, Cosine
    - Random with POV-Ray
                                       

Turning on/off parts of a scene

Sample for the use of a single branching by #if for turning on/off parts of a scene:
(i.e. a background with low speed of caculation during developing forground elements):

//-----------------------------
#declare Trees_On     = 0;// 0=off;1=on
#declare Mountains_On = 0;// 0=off;1=on
// turn on/off elements here!
// ...
// ... and somewhere later
// in the scene file:

#if ( Mountains_On = 1 )
// mountains with low speed of caculation
#end // of "#if (  Mountains_On = 1 )"

#if ( Trees_On = 1)
// planting realistic trees
// needs many calculation time
#end // of "#if ( Trees_On = 1 )"
// and on with the forground objects  ....

 
Background
Background_off
Background+Foreground

top

© Friedrich A. Lohmüller, 2010
homepage:www.f-lohmueller.de