File: 73%20-%20makegrass%203.txt

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 (109 lines) | stat: -rw-r--r-- 5,430 bytes parent folder | download | duplicates (14)
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
// -----------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------- Grass texture
#declare Tan1 = rgb< 0.76,0.58,0.34>;
//#declare Green1=rgb<0.80,0.67,0.20>;
//#declare Green2=rgb<0.36,0.63,0.03>;
#declare Green1=rgb<0.4,0.7,0.15>*0.1;
#declare Green2=rgb<0.27,0.63,0.12>*0.6;
//----------------------------------
#declare P_Spotted =pigment {
spotted
    color_map {
        [0.0  color Tan1*0.1 ]
        [0.4  color Tan1*0.4 ]
        [0.6  color Green1*0.9 ]
        [1.01 color Green1*1.1 ]
    }
}//---------------------------------
#declare P_Earth =pigment {
    spotted
    color_map {
        [0 color Tan*0.3]
        [0.6 color Tan*0.3]
        [0.6 color Green1*0.4]
        [1   color Green1*0.6]
    }
}//---------------------------------
#declare P_Green=pigment{Green2*1.3}
//#declare P_Spotted=pigment{Red}
//#declare P_Earth=pigment{Blue}
#declare T_Grass=texture {                  
    pigment {
        gradient y
        turbulence 0.2
        pigment_map {                                
            [0.0 P_Earth]
            [0.1 P_Green]
            [0.9 P_Spotted]
            [1.00 P_Earth]
        }
    }
    finish{ specular 0.5 roughness 0.035}
    scale <0.001,1,0.001>
} //---------------------------------------------------------------------------- end Grass texture
// -----------------------------------------------------------------------------------------------


// -----------------------------------------------------------------------------------------------
#include "makegrass.inc"
// -----------------------------------------------------------------------------------------------
// Patch parameters  // ! Final number of triangles = nBlade * nBlade * segBlade * 2 (or 4 if dofold = true)
#declare lPatch=50;               // size of patch
#declare nBlade=15;                // number of blades per line (there will be nBlade * nBlade blades)
//#declare nBlade=4;                // number of blades per line (there will be nBlade * nBlade blades)
#declare ryBlade = 0;            // initial y rotation of blade
#declare segBlade= 10;            // number of blade segments
#declare lBlade = 10;             // length of blade
#declare wBlade = 1.0;            // width of blade at start
#declare wBladeEnd = 0.1;         // width of blade at the end
#declare doSmooth= 1;          // true makes smooth triangles
#declare startBend = <0,1,0.3>;   // bending of blade at start (<0,1,0>=no bending)
#declare vBend = <0,1,2>;         // force bending the blade (<0,1,1> = 45)
#declare pwBend =4;              // bending power (how slowly the curve bends)
#declare rd = 5153;                // seed
#declare stdposBlade = 1;         // standard deviation of blade position 0..1
#declare stdrotBlade = 360;       // standard deviation of rotation
#declare stdBlade = 1.2;           // standard deviation of blade scale
#declare stdBend = 10;            // standard deviation of blade bending
#declare dofold = 1;//false;/true; or 0;/1; // true creates a central fold in the blade (twice more triangles)
#declare dofile = 0;//false;/true; or 0;/1; // true creates a mesh file
#declare fname = "fgrass2.inc"     // name of the mesh file to create
// -----------------------------------------------------------------------------------------------
// Prairie parameters
#declare nxPrairie=12;             // number of patches for the first line
#declare addPatches=1.5;            // number of patches to add at each line
#declare nzPrairie=35;             // number of lines of patches
#declare rd=seed(179);            // random seed
#declare stdscale=1;              // stddev of scale
#declare stdrotate=1;             // stddev of rotation
#declare doTest=0;//false;/true; or 0;/1; // replaces the patch with a sphere
// -----------------------------------------------------------------------------------------------
// Create the patch 
#if (dofile=true) // if the patch is already created, turn off the next line
   MakeGrassPatch(lPatch,nBlade,ryBlade,segBlade,lBlade,wBlade,wBladeEnd,doSmooth,startBend,vBend,pwBend,rd,stdposBlade,stdrotBlade,stdBlade,stdBend,dofold,dofile,fname)
   #declare objectPatch=#include fname
#else        
   #declare objectPatch=object{MakeGrassPatch(lPatch,nBlade,ryBlade,segBlade,lBlade,wBlade,wBladeEnd,doSmooth,startBend,vBend,pwBend,rd,stdposBlade,stdrotBlade,stdBlade,stdBend,dofold,dofile,fname)}
#end        
// -----------------------------------------------------------------------------------------------
// Create the prairie
object{MakePrairie(lPatch,nxPrairie,addPatches,nzPrairie,objectPatch,rd,stdscale,stdrotate,doTest)
// or optional: show Single Patch  
// object{  ObjectPatch
    scale 1/40
    texture{T_Grass }
   /* size ~ 1.00 !!! */
 scale 1.5     // -> size ~  1 units high
 //scale 0.5 // -> size ~0.5 units high
 translate<0,0,-0.75>
}  
// -----------------------------------------------------------------------------------------------
//cylinder{0,y*0.01,5 texture{T_Grass scale 40}}


// Test pole 1 unit high ------------------------------------
cylinder { <0,0,0>,<0,1.00,0>, 0.05  
           pigment { color rgb<1,1,1> }
           scale <1,1,1> rotate<0,0,0> translate<0,0,0>
         } // end of cylinder -------------------------------
//-----------------------------------------------------------