source: subversion/applications/rendering/parking/osray/osray_furniture.py @ 22376

Last change on this file since 22376 was 22359, checked in by kdrangmeister, 9 years ago

lowered diffuse from 0.8 to 0.7 due to assumed_gamma

File size: 2.1 KB
Line 
1# -*- coding: utf-8 -*-
2# by kay - basic functions
3
4from osray_db import *
5from osray_geom import *
6
7Radiosity = True
8
9declarations = """
10#macro tree_broad_leafed (xp,yp,height)
11#local wipfel = sphere {
12  <0,0.666,0>,0.333
13  texture {
14    pigment {
15      color rgb <0.6,1.0,0.6>
16    }
17    finish {
18      diffuse 0.7
19      ambient 0
20    }
21  }   
22} // end of sphere
23#local stamm = cylinder {
24  <0,0,0>,<0,0.4,0>,0.12
25  texture {
26    pigment {
27      color rgb <0.4,0.3,0.1>
28    }
29    finish {
30      diffuse 0.7
31      ambient 0
32    }
33  }   
34} // end of cylinder
35
36union{
37  object{wipfel scale <height,height,height> translate <xp,0,yp>}
38  object{stamm scale <height,height,height> translate <xp,0,yp>}
39 } // end of tree
40#end
41
42#macro tree_conifer (xp,yp,height)
43#local wipfel = cone {
44  <0,0.3,0>,0.3
45  <0,1.0,0>,0.0
46  texture {
47    pigment {
48      color rgb <0.5,0.8,0.6>
49    }
50    finish {
51      diffuse 0.7
52      ambient 0
53    }
54  }   
55} // end of sphere
56#local stamm = cylinder {
57  <0,0,0>,<0,0.31,0>,0.12
58  texture {
59    pigment {
60      color rgb <0.4,0.3,0.1>
61    }
62    finish {
63      diffuse 0.7
64      ambient 0
65    }
66  }   
67} // end of cylinder
68
69union{
70  object{wipfel scale <height,height,height> translate <xp,0,yp>}
71  object{stamm scale <height,height,height> translate <xp,0,yp>}
72 } // end of tree
73#end
74
75"""
76def pov_tree(f,tree):
77    treetype = tree['type']
78    x,y = tree['coords']
79    heightstring = tree['height'] # height
80    if (heightstring==None):
81        height = random_range_seed(8,12,x+y) # generate a tree about 10 m high, with some variance
82    else:
83        height = parse_length_in_meters(heightstring,0.01)
84    f.write("/* tree osm_id={0} */\n".format(tree['osm_id']))
85    if treetype=='conifer':
86        f.write("object {{ tree_conifer ({x},{y},{height}) }}\n".format(x=x,y=y,height=height))
87    else:
88        f.write("object {{ tree_broad_leafed ({x},{y},{height}) }}\n".format(x=x,y=y,height=height))
89   
90def render_furniture(f,osraydb,options):
91    Radiosity = options['radiosity']
92    f.write(declarations)
93
94    trees = osraydb.select_trees()
95
96    for tree in trees:
97        pov_tree(f,tree)
98
Note: See TracBrowser for help on using the repository browser.