orig/genwindow.csh
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 0 0aa115157c9c
permissions -rw-r--r--
New IES test file with spaces in file name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     1
#!/bin/csh -f
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     2
# RCSid: $Id: genwindow.csh,v 2.2 2003/02/22 02:07:23 greg Exp $
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     3
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     4
#  Generate source description for window with venetian blinds.
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     5
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     6
#	1/11/88		Greg Ward
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     7
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     8
#  Usage: genwindow shellfile
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
     9
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    10
#  Takes as input the following shell variables from file $1:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    11
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    12
#	worient		Window orientation (degrees from south)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    13
#	wwidth		Window width
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    14
#	wheight		Window height
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    15
#	wtrans		Window transmission
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    16
#	bdepth		Blind depth
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    17
#	bspac		Blind vertical spacing
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    18
#	gap		Gap between blinds and window
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    19
#	brcurv		Blind curvature radius (negative upward, zero none)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    20
#	bangle		Blind inclination (degrees from horizontal, up and out)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    21
#	material	Blind material type (metal or plastic)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    22
#	ucolor		Blind up side color ("red green blue")
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    23
#	uspec		Blind up side specularity (0 to 1)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    24
#	urough		Blind up side roughness (0 to .2)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    25
#	dcolor		Blind down side color (opt)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    26
#	dspec		Blind down side specularity (opt)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    27
#	drough		Blind down side roughness (opt)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    28
#	lat		Site latitude (degrees)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    29
#	long		Site longitude (degrees)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    30
#	mer		Site standard meridian (degrees)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    31
#	hour		Hour (standard 24hr time)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    32
#	day		Day (of month)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    33
#	month		Month (of year)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    34
#	grefl		Ground plane reflectance
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    35
#	sky		Sky conditions (sunny, clear, cloudy)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    36
#	nsources	Number of sources to divide window
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    37
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    38
#  Creates the following output files:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    39
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    40
#	stdout		Window description for Radiance
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    41
#	$1.d$$		Window output distribution
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    42
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    43
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    44
if ( $#argv != 1 ) then
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    45
	echo Usage: $0 input
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    46
	exit 1
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    47
endif
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    48
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    49
#	Set input and output files
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    50
set input = $1
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    51
set distrib = $1.d$$
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    52
set tmpdir = /tmp
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    53
set descrip = $tmpdir/gw$$.des
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    54
set distoct = $tmpdir/gw$$.oct
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    55
set skydesc = $tmpdir/gw$$.sky
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    56
set remove = ( $distoct $skydesc $descrip )
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    57
set removerr = ( $remove $distrib )
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    58
onintr error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    59
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    60
#	Set default values
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    61
set worient = 0.
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    62
set wtrans = ( .96 .96 .96 )
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    63
set bdepth = 0.025
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    64
set bspac = 0.0155
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    65
set gap = 0.
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    66
set brcurv = 0.
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    67
set bangle = 0.
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    68
set material = plastic
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    69
set ucolor = ( 0.5 0.5 0.5 ) 
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    70
set uspec = 0.
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    71
set urough = 0.05
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    72
set lat = 37.8
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    73
set long = 122
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    74
set mer = 120
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    75
set hour = 12
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    76
set day = 21
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    77
set month = 10
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    78
set grefl = .2
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    79
set sky = sunny
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    80
set nsources = 6
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    81
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    82
#	Get input
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    83
source $input
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    84
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    85
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    86
#	Create window
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    87
cat > $descrip <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    88
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    89
void glass clear_glass
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    90
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    91
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    92
3 $wtrans
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    93
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    94
clear_glass polygon window
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    95
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    96
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    97
12
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    98
	0	0	0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
    99
	0	0	$wheight
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   100
	$wwidth	0	$wheight
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   101
	$wwidth	0	0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   102
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   103
void $material blind_upmat
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   104
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   105
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   106
5 $ucolor $uspec $urough
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   107
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   108
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   109
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   110
#	Blinds
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   111
genblinds blind_upmat blind_up $bdepth $wwidth $wheight \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   112
		`ev "ceil($wheight/$bspac)"` $bangle -r $brcurv \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   113
	| xform -t $gap -$wwidth 1e-4 -rz 90 >> $descrip
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   114
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   115
if ( $?dcolor ) then
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   116
	cat >> $descrip <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   117
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   118
	void $material blind_dnmat
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   119
	0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   120
	0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   121
	5 $dcolor $dspec $drough
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   122
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   123
	genblinds blind_dnmat blind_down $bdepth $wwidth $wheight \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   124
			`ev "ceil($wheight/$bspac)"` $bangle -r $brcurv \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   125
		| xform -t $gap -$wwidth 0 -rz 90 >> $descrip
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   126
	if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   127
endif
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   128
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   129
#	Make sky
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   130
switch ($sky)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   131
case sun*:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   132
	set skysw = +s
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   133
	breaksw
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   134
case clear:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   135
	set skysw = -s
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   136
	breaksw
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   137
case cloud*:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   138
	set skysw = -c
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   139
	breaksw
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   140
endsw
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   141
dosky:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   142
gensky $month $day $hour $skysw -a $lat -o $long -m $mer -g $grefl \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   143
	| xform -rz `ev "-($worient)"` > $skydesc
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   144
if ( $skysw == +s ) then
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   145
	if ( `sed -n 13p $skydesc | rcalc -e '$1=if($3,-1,1)'` < 0 ) then
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   146
		set skysw = -s
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   147
		goto dosky
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   148
	endif
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   149
endif
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   150
cat >> $skydesc <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   151
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   152
skyfunc glow skyglow
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   153
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   154
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   155
4 1 1 1 0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   156
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   157
skyglow source sky
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   158
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   159
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   160
4 0 -1 0 180
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   161
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   162
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   163
#	Make distribution
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   164
oconv $skydesc $descrip > $distoct
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   165
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   166
echo 2 5 85 9 0 340 18 > $distrib
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   167
makedist -h -d -x1 0 1 0 -x2 0 0 1 -x3 1 0 0 -alpha 5-85:10 -beta 0-340:20 \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   168
		-tw $bspac -th $bspac -td `ev "2*($bdepth+$gap)"` \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   169
		-tc `ev "$wwidth/2" "$bdepth+$gap" "$wheight/2"` \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   170
		-ab 2 -aa .1 -ad 64 -as 64 \
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   171
		-x 16 -y 16 $distoct >> $distrib
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   172
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   173
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   174
set wsgrid = (`ev "floor(sqrt($nsources*$wwidth/$wheight)+.5)" "floor(sqrt($nsources*$wheight/$wwidth)+.5)"`)
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   175
@ nsources = $wsgrid[1] * $wsgrid[2]
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   176
#	Print header
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   177
cat <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   178
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   179
#  Window with venetian blinds
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   180
#  Created from $input `date`
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   181
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   182
#	Window orientation (degrees from south):	$worient
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   183
#	Window height:					$wheight
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   184
#	Window width:					$wwidth
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   185
#	Window transmission:				$wtrans
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   186
#	Blind depth:					$bdepth
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   187
#	Blind spacing:					$bspac
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   188
#	Gap to window:					$gap
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   189
#	Blind curvature radius:				$brcurv
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   190
#	Blind inclination (degrees altitude):		$bangle
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   191
#	Blind material:					$material
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   192
#	Up side color:					$ucolor
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   193
#	Up side specularity:				$uspec
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   194
#	Up side roughness:				$urough
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   195
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   196
if ( $?dcolor ) then
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   197
	cat <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   198
#	Down side color:				$dcolor
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   199
#	Down side specularity:				$dspec
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   200
#	Down side roughness:				$drough
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   201
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   202
else
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   203
	echo \#\	Down side same as up
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   204
endif
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   205
cat <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   206
#	Latitude (degrees):				$lat
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   207
#	Longitude (degrees):				$long
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   208
#	Standard Meridian (degrees):			$mer
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   209
#	Month Day Hour:					$month $day $hour
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   210
#	Ground plane reflectance:			$grefl
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   211
#	Sky condition:					$sky
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   212
#	Number of window sources:			$nsources
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   213
#
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   214
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   215
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   216
#	Send sources
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   217
xform -e -rz $worient <<_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   218
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   219
void brightdata wdistrib
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   220
10 noop $distrib source.cal src_theta src_phi -rx 90 -ry -90 -mx
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   221
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   222
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   223
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   224
wdistrib illum willum
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   225
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   226
0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   227
3 1 1 1
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   228
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   229
!gensurf willum wsource "$wwidth*t" $bdepth "$wheight*s" $wsgrid[2] $wsgrid[1]
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   230
_EOF_
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   231
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   232
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   233
#	Send window
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   234
xform -rz $worient $descrip
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   235
if ( $status ) goto error
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   236
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   237
#	All done, print and exit
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   238
rm -f $remove
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   239
exit 0
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   240
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   241
#	Error exit
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   242
error:
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   243
	rm -f $removerr
0aa115157c9c Added original CSH script from HEAD-20110409.
Axel Jacobs <axel@jaloxa.eu>
parents:
diff changeset
   244
	exit 1