[PovRay] Setup

Robert Lowell lowellr at globaldialog.com
Mon Mar 10 23:00:53 EST 1997


This is a repost because I got an "unknown transmission error"

Sometime longago prior to the color wars
somebody started to suggest how to optimize the set up
of povray for personal ease of use
a differant somebody suggested useing #ifdef but wasn't sure how

This file demonstares (that I can't spell worth a damn)
#declare 
#include 
#ifdef 
#ifndef 
#switch 
#case
#break
#while #end loops

The actual floors provided are just good enough for the demo
basicly it was a throw together for this demo.

Why - If  nothing else for fast prototype of ideas
without getting bogged down in details.

Hope this helps someone. If not just erase it.


///////////////////////////////////////// mainfile.pov
program setup code

//  mystuf setup code
#declare FloorTex1   = some texture (optional)
#declare FloorTex2    = some texture (optional)
#declare FloorFinish1 = some finish (optional)
#declare FloorFinish2 = some finish (optional)
#declare WoodFloor = 2 (used in switch fr which floor) not optional

more set up code for mystuf (assuming there was anything else 
like walls or rugs or stuf to set up

#include "mystuf.inc"

lots more code
///////////////////////////////////////////////////////


///////////////////////////////////////// mystuf.inc
/*
Wood floor patterns - with floor plane
declare WoodFloor (0..?) - FloorTex1 - FloorTex2
FloorFinish1 - FloorFinish2
 or accept defaults
*/
#ifdef (WoodFloor) #include "floors\Woodflor.inc" #end

/*
Stone floor patterns - with floor plane
declare FloorTex1 - GroutTex1 - TileShape1
or accept defaults
*/
#ifdef (StoneFloor) #include "floors\stonflor.inc" #end
///////////////////////////////////////////////////////

///////////////////////////////////////// woodfloor.inc
#ifdef(Colors_Inc_Temp)
// do nothing
#else  // debug time
#include "colors.inc"
  light_source{ <5, 50, -5> color White }
  camera{ location <0.0 , 5 ,-5> look_at <0.0 , 1.0 , 1.0>}
#end

#ifdef(Woods_Inc_Temp)
// do nothing
#else
  #include "Woods.inc"
#end


// Set up some defaults
#ifndef (WoodFloor) #declare WoodFloor = 5 #end

#ifndef (FloorTex1) #declare FloorTex1 = texture {T_Wood1} #end

#ifndef (FloorFinish1 )
  #declare FloorFinish1 = finish { ambient 0.320  roughness 0.500 crand
0.20 reflection 0.100 }
#end

#ifndef (FloorTex2) #declare FloorTex2 = texture {T_Wood8} #end
#ifndef (FloorFinish2 )
  #declare FloorFinish2 = finish { ambient 0.320  roughness 0.600 crand
0.20 reflection 0.100 }
#end


 #switch (WoodFloor)
    #case (1)
      #declare T1a = texture { checker  texture { FloorTex1 finish {
FloorFinish1 }},
                     texture { FloorTex2 finish { FloorFinish2 }}
                     scale <.25, .25, 25> }
      #declare T1b = texture { checker  texture { FloorTex1 finish {
FloorFinish1 }},
                     texture { FloorTex2 finish { FloorFinish2 }}
                     scale <.25, .25, 25> }
      #declare Tiles4 = texture { checker  texture {T1a},
                        texture { T1b rotate < 0, 0, 90>}}
      plane { y, -1.0  texture {Tiles4 }}
    #break  //First case ends

    #case (2)
      #declare TB = texture {checker texture {FloorTex1 finish {
FloorFinish1 }},
                    texture {FloorTex2 finish { FloorFinish2 }} scale
<.5, 1, 1>}
      #declare TA = texture { TB rotate < 0, 0, 90> scale <.25, .5, .5>}
      #declare Tiles4 = texture { checker  texture { TA }, texture { TB
}}
      plane { y, -1.0  texture {Tiles4 }}
    #break  //Second case ends

    #case (3)
      #declare FloorBoard1 =
        box { <-1, -1, -1>, <1, 1, 1>
        texture { FloorTex1}
        rotate <90,0,0>
        scale <5, .1, 0.13>
      }

      #declare FloorBoard2 =  //dark
        box { <-1, -1, -1>, <1, 1, 1>
        texture { FloorTex2}
        rotate <90,0,0>
        scale <5.0, .1, 0.13>
        translate <.0,0,.25>
      }

      #declare Floor1 =
      union{
        object {FloorBoard1 finish {FloorFinish1} }
        object {FloorBoard2 finish { FloorFinish2 }}
        rotate < 90, 90, 90 >
        translate < -5, 0, 7>
      }

     #declare Floor =
     union{
        #declare X = -7 #while ( X <= 20)
          object { Floor1 translate < (X ), 0, 0> }
        #declare X = X + .5 #end
     }

     object { Floor translate < -1, -2.1, -4.7 >}
    #break

    #else
      #declare Tiles4 = texture { checker  texture {  FloorTex1 finish
{FloorFinish1}}, texture { FloorTex2 finish {FloorFinish1}} }
      plane { y, -1.0  texture {Tiles4 }}
  #end // End of conditional part



More information about the Irtc-l mailing list