File: whiltile.pov

package info (click to toggle)
povray 1%3A3.7.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 147,232 kB
  • sloc: cpp: 845,011; ansic: 122,118; sh: 34,204; pascal: 6,420; asm: 3,355; ada: 1,681; makefile: 1,389; cs: 879; awk: 590; perl: 245; xml: 95
file content (188 lines) | stat: -rw-r--r-- 5,168 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a
// letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

// Persistence Of Vision raytracer sample file.
// File: WhilTile.POV 10/01/95  - updated 2013/02/15
// Auth: Eduard Schwan with modifications by Dan Farmer
// Desc: A tile floor, using the 'while' loop and 'if' statements
//       to create a unique pattern automatically.

// Enable this next line to use a simpler test shape for debugging
// #declare DO_SIMPLE_SHAPE = 1;
//
// -w320 -h240
// -w800 -h600 +a0.3

#version 3.7;
global_settings { assumed_gamma 1.0  max_trace_level 5}

#include "colors.inc"
#include "woods.inc"

// ------------------------------------------------------------------
// set viewer's position in the scene
camera {
  location  <0.0, 22.0, -24.0> // position of camera <X Y Z>
  angle 35 // direction 4.0*z              // which way are we looking <X Y Z>
  up        y                  // which way is +up <X Y Z>
  right x*image_width/image_height // keep propotions with any aspect ratio
  look_at   <0.0, 0.0, -1.0>   // point center of view at this point <X Y Z>
}

// ------------------------------------------------------------------
// create a regular point light source
light_source { <10, 10, -10> color rgb 1 translate <-20, 40, -20> }


// ------------------------------------------------------------------
#declare TileShape =
#ifdef (DO_SIMPLE_SHAPE)
  // simpler shape for debugging
  sphere{0, 1 scale <0.5,0.1,0.5> translate 0.1*y}
#else
  // real tile shape
  intersection  {
    box { -1, 1 }  // square tile
    cylinder { -2*x, +2*x, 0.9 } // rounded edges along X axis
    cylinder { -2*z, +2*z, 0.9 } // rounded edges along Z axis
    sphere { 0, 2.0 translate 2.6*y inverse }  // concave top surface
//  sphere { 0, 1.1 } // rounded corners
//  bounded_by { box { -1, 1 } }
    scale <0.5,0.2,0.5>  // flatten the tile down on Y axis
//    translate 0.2*y  // move it up so its bottom is on origin
  }
#end

// ------------------------------------------------------------------
default {
  texture { pigment {rgb 1} finish {ambient 0.2 reflection 0.2 specular 0.7} }
}

// light tinted glass
#declare CrystalTex =
texture {
  pigment { rgbf <1.00, 0.70, 0.70, 0.95> }
  finish {roughness 0.001 }
}

#declare CrystalInt =
interior {ior 1.8}

// Black slate marble with white strata
#declare SlateTex =
texture {
  pigment {
    marble
    turbulence 0.8 rotate 60*y
    color_map {
      [0.10 rgb 0.01]
      [0.12 rgb 0.70]
      [0.15 rgb 0.01]
      [0.20 rgb 0.01]
      [0.30 rgb <0.9,0.7,0.6>]
      [0.50 rgb 0.01]
    }
    scale 0.4
  }
  finish {reflection 0.2}
}

// green crackle
#declare CrackleTex =
texture {
  pigment { color rgb <0.1, 0.5, 0.1> }
  normal {crackle 0.5 turbulence 0.2 scale 0.3}
}

// brown/blue pinwheel radial pattern
#declare PinwheelTex =
texture {
  pigment {
    radial
    frequency 8
    color_map {
      [0.00 blue 0.4]
      [0.50 blue 0.4]
      [0.60 rgb <0.5,0.6,0.9>]
    }
  }
}

#declare MSetTex =
texture {
  pigment {
    mandel 100
    color_map {
      [0.0  color MidnightBlue ]
      [0.2  color Yellow  ]
      [0.6  color Scarlet ]
      [0.8  color Magenta ]
      [1.0  color Gray10 ]
    }
    scale .25
    rotate x*90
    translate x*0.225
    //rotate y*45
  }
}

// ------------------------------------------------------------------
// declare the set of tiles as a union built by a loop
#declare Max  = 16;     // # of tiles across and down
#declare XMax = Max/2;
#declare ZMax = Max/2;

#declare ZCount = -ZMax;

#declare Tile_Set =
union {
    #while (ZCount <= ZMax)

      #declare XCount = -XMax;
      #while (XCount <= XMax)

      object {
        TileShape
        #if(XCount=0 & ZCount=0)
        // Center tile
          texture { MSetTex }
        #else
          #if (abs(XCount) = abs(ZCount))
            // An "X" pattern of tiles, diagonal through origin
            texture { CrystalTex }
            interior { CrystalInt }
          #else
            #if (abs(XCount)*abs(ZCount) < XMax)
              // A "fat plus" pattern, centered on origin
              texture {
                SlateTex
                rotate (XCount+ZCount)*10*y
                translate <-XCount, 0, -ZCount>  // alter texture per tile
              }
            #else
              #if (abs(mod(XCount,3)) = abs(mod(ZCount,2)))
              // An alternating sprinkle of remaining tiles
              texture {
                CrackleTex
                translate <-XCount, 0, -ZCount>  // alter texture per tile
              }
              #else
                texture { PinwheelTex }
              #end
            #end
          #end
        #end
        translate <XCount, 0, ZCount>
      }

      #declare XCount = XCount+1;
      #end  // Inner X loop

    #declare ZCount = ZCount+1;
    #end  // Outer Z loop
}

// ------------------------------------------------------------------
// make the tile object
object { Tile_Set rotate y*30}