//generic leaf plant

#include "plants/billboard_and_leaf.inc"


//--- pointArray 
#declare pointDataCount = 35 ;
#declare pointArray = array mixed [pointDataCount][2] ;
#declare pointArray[0][0] = <-0.922, 0, -0.157>  ;
#declare pointArray[0][1] = 11 ;
#declare pointArray[1][0] = <0.939, 0.0, -0.063>  ;
#declare pointArray[1][1] = 2 ;
#declare pointArray[2][0] = <0.064, 0.0, -0.955>  ;
#declare pointArray[2][1] = 3 ;
#declare pointArray[3][0] = <0.200, 0.0, 1.003>  ;
#declare pointArray[3][1] = 1 ;
#declare pointArray[4][0] = <-0.802, 0.0, 0.487>  ;
#declare pointArray[4][1] = 2 ;
#declare pointArray[5][0] = <-0.425, 0.0, 0.799>  ;
#declare pointArray[5][1] = 3 ;
#declare pointArray[6][0] = <0.548, 0.0, 0.821>  ;
#declare pointArray[6][1] = 1 ;
#declare pointArray[7][0] = <0.925, 0.0, 0.449>  ;
#declare pointArray[7][1] = 2 ;
#declare pointArray[8][0] = <0.900, 0.0, -0.489>  ;
#declare pointArray[8][1] = 3 ;
#declare pointArray[9][0] = <0.572, 0.0, -0.817>  ;
#declare pointArray[9][1] = 1 ;
#declare pointArray[10][0] = <-0.406, 0.0, -0.872>  ;
#declare pointArray[10][1] = 2 ;
#declare pointArray[11][0] = <-0.794, 0.0, -0.495>  ;
#declare pointArray[11][1] = 3 ;
#declare pointArray[12][0] = <-0.756, 0.0, 0.904>  ;
#declare pointArray[12][1] = 1 ;
#declare pointArray[13][0] = <0.851, 0.0, 0.850>  ;
#declare pointArray[13][1] = 2 ;
#declare pointArray[14][0] = <-0.827, 0.0, -0.861>  ;
#declare pointArray[14][1] = 3 ;
#declare pointArray[15][0] = <0.944, 0.0, -0.867>  ;
#declare pointArray[15][1] = 1 ;
#declare pointArray[16][0] = <-0.608, 0.0, -0.172>  ;
#declare pointArray[16][1] = 3 ;
#declare pointArray[17][0] = <-0.433, 0.0, 0.357>  ;
#declare pointArray[17][1] = 1 ;
#declare pointArray[18][0] = <-0.007, 0.0, 0.002>  ;
#declare pointArray[18][1] = 2 ;
#declare pointArray[19][0] = <-0.296, 0.0, -0.314>  ;
#declare pointArray[19][1] = 3 ;
#declare pointArray[20][0] = <-0.110, 0.0, -0.642>  ;
#declare pointArray[20][1] = 1 ;
#declare pointArray[21][0] = <0.414, 0.0, -0.478>  ;
#declare pointArray[21][1] = 2 ;
#declare pointArray[22][0] = <0.512, 0.0, -0.085>  ;
#declare pointArray[22][1] = 3 ;
#declare pointArray[23][0] = <0.304, 0.0, 0.254>  ;
#declare pointArray[23][1] = 1 ;
#declare pointArray[24][0] = <-0.121, 0.0, 0.456>  ;
#declare pointArray[24][1] = 2 ;
#declare pointArray[25][0] = <0.277, 0.0, 0.735>  ;
#declare pointArray[25][1] = 3 ;
#declare pointArray[26][0] = <-0.477, 0.0, -0.566>  ;
#declare pointArray[26][1] = 1 ;
#declare pointArray[27][0] = <0.189, 0.0, -0.210>  ;
#declare pointArray[27][1] = 2 ;
#declare pointArray[28][0] = <-0.685, 0.0, 0.111>  ;
#declare pointArray[28][1] = 3 ;
#declare pointArray[29][0] = <0.572, 0.0, 0.423>  ;
#declare pointArray[29][1] = 1 ;
#declare pointArray[30][0] = <-0.313, 0.0, 0.089>  ;
#declare pointArray[30][1] = 2 ;
#declare pointArray[31][0] = <0.271, 0.0, -0.724>  ;
#declare pointArray[31][1] = 31 ;
#declare pointArray[32][0] = <0.687, 0.0, -0.320>  ;
#declare pointArray[32][1] = 1 ;
#declare pointArray[33][0] = <0.714, 0.0, 0.161>  ;
#declare pointArray[33][1] = 2 ;
#declare pointArray[34][0] = <-0.067, 0.0, 0.833>  ;
#declare pointArray[34][1] = 3 ;

// -----------------------------------------------------------------------------------------
//                     L E A F   E
//------------------------------------------------------------------------------------------

// --- leaf E2 material
#declare imgDiffuse =   "plants/plant_E/leaf_E1.png" 
#declare M_leaf_E1 = 
    material{texture{pigment{image_map{png imgDiffuse map_type 0 interpolate 4 }}
    finish{F_matt}}
    scale <1,1,1> rotate x*0 translate <-.5,0,0>  
}


// --- leaf E2 material
#declare imgDiffuse =   "plants/plant_E/leaf_E2.png" 
#declare M_leaf_E2 = 
    material{texture{pigment{image_map{png imgDiffuse map_type 0 interpolate 4 }}
    finish{F_matt}}
    scale <1,1,1> rotate x*0 translate <-.5,0,0>  
}



// --- leaf E2 material
#declare imgDiffuse =   "plants/plant_E/leaf_E3.png" 
#declare M_leaf_E3 = 
    material{texture{pigment{image_map{png imgDiffuse map_type 0 interpolate 4 }}
    finish{F_matt}}
    scale <1,1,1> rotate x*0 translate <-.5,0,0>  
}


#declare leaf_E1 = object { ST_leaf material{M_leaf_E1} scale <1,1.3,.3> translate <0,0,0>}
#declare leaf_E2 = object { ST_leaf material{M_leaf_E2} scale <1,1.1,.3> translate <0,0,0>}
#declare leaf_E3 = object { ST_leaf material{M_leaf_E3} scale <1,1.2,.3> translate <0,0,0>}


#declare plant_seed=seed(21) ;

#declare plant_E =
union {
    #for (i,0,pointDataCount-1)
        #declare pos = pointArray[i][0] ;
        #declare rot = 360*rand(plant_seed) ; 
        #declare obj = pointArray[i][1] ;
        #if (obj=1) object {leaf_E1 rotate <0,rot,0> translate pos} #end
        #if (obj=2) object {leaf_E2 rotate <0,rot,0> translate pos} #end
        #if (obj=3) object {leaf_E3 rotate <0,rot,0> translate pos} #end
    #end
}  
  
  
