// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Copyright Johan Feyaerts 2006
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
#include "shapes_lo.inc"
#include "analytical_g.inc"
#include "shapes.inc"
#include "colors.inc"
#include "textures.inc"
#include "golds.inc"
#include "metals.inc"
#include "glass.inc"
#include "glass_old.inc"
camera {
orthographic
location <0,0,8> // position & direction of view
//location <-10,5,2> // position & direction of view
//location <4,4,8>
look_at <0,0,0>
// right 5*x // horizontal size of view \___ to be rendered at square size
// up 5*y // vertical size of view /
}
//#declare Radiosity=on;
#declare Radiosity=off;
global_settings {
max_trace_level 100
assumed_gamma 1.25
#if (Radiosity)
radiosity {
pretrace_start 0.04 // start pretrace at this size
pretrace_end 0.00520 // end pretrace at this size
count 600 // 1600 // higher -> higher quality (1..1600) [35]
nearest_count 10// 20 // higher -> higher quality (1..10) [5]
error_bound 1.2 // higher -> smoother, less accurate [1.8]
recursion_limit 1 // how much interreflections are calculated (1..5+) [3]
low_error_factor .5 // reduce error_bound during last pretrace step
gray_threshold 0.0 // increase for weakening colors (0..1) [0]
minimum_reuse 0.015 // reuse of old radiosity samples [0.015]
brightness 0.4 // brightness of radiosity effects (0..1) [1]
adc_bailout 0.01/2
//normal on // take surface normals into account [off]
//media on // take media into account [off]
//save_file "file_name" // save radiosity data
//load_file "file_name" // load saved radiosity data
//always_sample off // turn sampling in final trace off [on]
//max_sample 1.0 // maximum brightness of samples
}
#else
//ambient_light rgb <0,0,0>
#end
}
#declare useinterior = off;
#if (Radiosity)
#declare useinterior=on;
#end
#declare Color_Scheme_Ruby=1;
#declare Color_Scheme_Blue=2;
#declare Color_Scheme_Green=3;
#declare Color_Scheme_Yellow=4;
#declare LIGHT_COLOR_RUBY_MSOVER_PRESSED_HIGHLIGHT=color rgb <5.8,0.,0.>;
#declare LIGHT_COLOR_RUBY_HIGHLIGHT=color rgb <5.,0.,0.>;
#declare LIGHT_COLOR_RUBY_MSOVER_HIGHLIGHT=color rgb <4.5,0.,0.>;
#declare LIGHT_COLOR_RUBY_NORMAL=color rgb<4.,0,0>;
#declare NUMLIGHTS_RUBY=8;
#declare LIGHT_COLOR_BLUE_MSOVER_PRESSED_HIGHLIGHT=color rgb <0,5.0,6>;
#declare LIGHT_COLOR_BLUE_HIGHLIGHT=color rgb <0,4.5,5.5>;
#declare LIGHT_COLOR_BLUE_MSOVER_HIGHLIGHT=color rgb <0,3.9,5.2>;
#declare LIGHT_COLOR_BLUE_NORMAL=color rgb<0,1.0,5>;
#declare NUMLIGHTS_BLUE=14;
#declare LIGHT_COLOR_GREEN_MSOVER_PRESSED_HIGHLIGHT=color rgb <3,6.8,0.>;
#declare LIGHT_COLOR_GREEN_HIGHLIGHT=color rgb <2,5.8,0.>;
#declare LIGHT_COLOR_GREEN_MSOVER_HIGHLIGHT=color rgb <1,4.8,0.>;
#declare LIGHT_COLOR_GREEN_NORMAL=color rgb<2,4.0,0>;
#declare NUMLIGHTS_GREEN=8;
#declare LIGHT_COLOR_YELLOW_MSOVER_PRESSED_HIGHLIGHT=color rgb <6.8,6.8,0>;
#declare LIGHT_COLOR_YELLOW_HIGHLIGHT=color rgb <5.8,5.8,0>;
#declare LIGHT_COLOR_YELLOW_MSOVER_HIGHLIGHT=color rgb <4.8,4.8,0>;
#declare LIGHT_COLOR_YELLOW_NORMAL=color rgb<4.0,4.0,0>;
#declare NUMLIGHTS_YELLOW=8;
#declare Col_Ruby_Inner_Cap=color rgbf <0.9, 0.1, 0.2, 0.8>;
#declare Col_Blue_Inner_Cap=color rgbf <0.1,0.6,0.9,0.9>;
#declare Col_Green_Inner_Cap=color rgbf <0.7, 0.9, 0.0, 0.8>;
#declare Col_Yellow_Inner_Cap=color rgbf <0.9,0.9,0.0,0.8>;
//#declare colorscheme=Color_Scheme_Ruby;
#declare colorscheme=Color_Scheme_Blue;
//#declare colorscheme=Color_Scheme_Green;
//#declare colorscheme=Color_Scheme_Yellow;
#if (colorscheme=Color_Scheme_Ruby)
#declare Color_Inner_Cap=Col_Ruby_Inner_Cap;
#declare LIGHT_COLOR_MSOVER_PRESSED_HIGHLIGHT=LIGHT_COLOR_RUBY_MSOVER_PRESSED_HIGHLIGHT;
#declare LIGHT_COLOR_HIGHLIGHT=LIGHT_COLOR_RUBY_HIGHLIGHT;
#declare LIGHT_COLOR_MSOVER_HIGHLIGHT=LIGHT_COLOR_RUBY_MSOVER_HIGHLIGHT;
#declare LIGHT_COLOR_NORMAL=LIGHT_COLOR_RUBY_NORMAL;
#declare NUM_LIGHTS=NUMLIGHTS_RUBY;
#else
#if (colorscheme=Color_Scheme_Blue)
#declare Color_Inner_Cap=Col_Blue_Inner_Cap;
#declare LIGHT_COLOR_MSOVER_PRESSED_HIGHLIGHT=LIGHT_COLOR_BLUE_MSOVER_PRESSED_HIGHLIGHT;
#declare LIGHT_COLOR_HIGHLIGHT=LIGHT_COLOR_BLUE_HIGHLIGHT;
#declare LIGHT_COLOR_MSOVER_HIGHLIGHT=LIGHT_COLOR_BLUE_MSOVER_HIGHLIGHT;
#declare LIGHT_COLOR_NORMAL=LIGHT_COLOR_BLUE_NORMAL ;
#declare NUM_LIGHTS=NUMLIGHTS_BLUE;
#else
#if (colorscheme=Color_Scheme_Green)
#declare Color_Inner_Cap=Col_Green_Inner_Cap;
#declare LIGHT_COLOR_MSOVER_PRESSED_HIGHLIGHT=LIGHT_COLOR_GREEN_MSOVER_PRESSED_HIGHLIGHT;
#declare LIGHT_COLOR_HIGHLIGHT=LIGHT_COLOR_GREEN_HIGHLIGHT;
#declare LIGHT_COLOR_MSOVER_HIGHLIGHT=LIGHT_COLOR_GREEN_MSOVER_HIGHLIGHT;
#declare LIGHT_COLOR_NORMAL=LIGHT_COLOR_GREEN_NORMAL ;
#declare NUM_LIGHTS=NUMLIGHTS_GREEN;
#else
#declare Color_Inner_Cap=Col_Yellow_Inner_Cap;
#declare LIGHT_COLOR_MSOVER_PRESSED_HIGHLIGHT=LIGHT_COLOR_YELLOW_MSOVER_PRESSED_HIGHLIGHT;
#declare LIGHT_COLOR_HIGHLIGHT=LIGHT_COLOR_YELLOW_HIGHLIGHT;
#declare LIGHT_COLOR_MSOVER_HIGHLIGHT=LIGHT_COLOR_YELLOW_MSOVER_HIGHLIGHT;
#declare LIGHT_COLOR_NORMAL=LIGHT_COLOR_YELLOW_NORMAL ;
#declare NUM_LIGHTS=NUMLIGHTS_YELLOW;
#end
#end
#end
#declare I_Glass_Outer_Cap=
interior {
ior 1.5
fade_distance 1.0
fade_power 2
}
#declare I_Glass_Inner_Cap=
interior {
ior 1.5
dispersion 1.5 //1.02
fade_distance 1
fade_power 2
}
#declare F_Glass_Outer_Cap =
finish {
specular 0.7
roughness 0.001
ambient 0
diffuse 0
reflection {
0.00, 0.05
fresnel on
}
conserve_energy
}
#declare F_Glass_Inner_Cap =
finish {
specular 0.7
roughness 0.001
ambient 0
diffuse 0.5
reflection {
0.00, 0.05
fresnel on
}
conserve_energy
}
#declare T_Glass_Outer_Cap =
texture {
pigment { color rgbf<1.0, 1.0, 1.0, 0.7> }
finish { F_Glass_Outer_Cap }
}
/*
#declare T_Glass_Inner_Cap =
texture {
pigment { color rgbf<0.9, 0.1, 0.2, 0.8> }
finish { F_Glass_Inner_Cap }
}
*/
#declare F_Colored_Glass_Inner_Cap =
finish {
#if (Radiosity)
ambient 0
#else
ambient 0.1
#end
diffuse 0.1
reflection .25
specular 1
roughness 0.001
}
#declare T_Colored_Glass_Inner_Cap =
texture {
finish { F_Colored_Glass_Inner_Cap }
pigment { Color_Inner_Cap }
}
#declare meditextsfer=material {texture {
pigment {
rgbt <0,0,1,1>
}
finish{
ambient 0
diffuse 0
}
}
interior{
media {
intervals 30
ratio 0.9
samples 2,4
confidence 0.9
variance 1.0/128.0
method 1
absorption <0,0,0>
emission <0.6,0,0.0>
//scattering {1, <0,0,0.12> extinction 1}
density{ spherical
turbulence 0.0
density_map {
[0.0 color rgb 0]
[1 color rgb 1]
}
}
}
}
}
#declare meditextcyl=material {texture {
pigment {
rgbt <0,0,1,1>
}
finish{
ambient 0
diffuse 0
}
}
interior{
media {
intervals 30
ratio 0.9
samples 2,4
confidence 0.9
variance 1.0/128.0
method 1
absorption <0,0,0>
emission <0.6,0,0.0>
//scattering {1, <0,0,0.12> extinction 1}
density{ cylindrical
turbulence 0
density_map {
[0.0 color rgb 0.0]
[1 color rgb 1]
}
}
}
}
}
// PEEK texture. (PEEK is a special kind of thermoplastic)
#declare PEEK_Texture =
texture {
pigment {color rgb <1.0,1.0,0.7>}
finish {ambient 0 diffuse 0.6 specular 0.25 roughness 0.003}
}
// Elements in the brushed metal texture.
#declare Brushed_Depth = 0.1; // Bump size
#declare Brushed_Pigment = pigment {colour rgb 0.73}
#declare Brushed_Finish = finish {
ambient 0
diffuse 0.95
specular 0.96
roughness 0.0005
phong 0.43
phong_size 25
brilliance 3.15
reflection { .33, .33 metallic }
metallic on
}
// The brushed metal texture.
#declare Brushed_Texture =
texture {
average
texture_map {
[
pigment {Brushed_Pigment}
normal {wood +Brushed_Depth ramp_wave rotate 90*x scale 50}
finish {Brushed_Finish}
]
[
pigment {Brushed_Pigment}
normal {wood -Brushed_Depth ramp_wave rotate 90*x scale 50}
finish {Brushed_Finish}
]
}
}
// Elements in the brushed metal texture.
#declare Brushed_Gold_Depth = 0.5; // Bump size
#declare Brushed_Gold_Pigment = pigment {colour rgb <0.73,0.73,0.2>}
#declare Brushed_Gold_Finish = finish {
ambient 0
diffuse 0.95
specular 0.96
roughness 0.05
phong 0.43
phong_size 25
brilliance 3.15
reflection { .33, .33 metallic }
metallic on
}
// The brushed metal texture.
#declare Brushed_Gold_Texture =
texture {
average
texture_map {
[
pigment {Brushed_Gold_Pigment}
normal {wood +Brushed_Gold_Depth ramp_wave rotate 90*x scale 50}
finish {Brushed_Gold_Finish}
]
[
pigment {Brushed_Pigment}
normal {wood -Brushed_Gold_Depth ramp_wave rotate 90*x scale 50}
finish {Brushed_Gold_Finish}
]
}
}
// create a regular point light source
light_source {
0*x // light's position (translated below)
color rgb <0.7,0.7,0.7> // light's color
translate <40, 40, 50>
// light_source { ...
// put this inside a light_source to make it parallel
// parallel
// point_at <1, 0, 0>
}
/*
light_source {
0*x // light's position (translated below)
color rgb <1,1,1> // light's color
translate <-10, -20, 40>
// light_source { ...
// put this inside a light_source to make it parallel
// parallel
// point_at <1, 0, 0>
}
*/
sky_sphere {
pigment {
gradient z
color_map {
[0 color White]
[1 color White]
}
scale 2
translate -1
}
}
plane { z, -1.0 texture {pigment {rgb <0,0,0>}} }
#declare axison=0;
#if (axison = 1)
cylinder { <0, 0, 0>, <3, 0, 0>, 0.02 texture {pigment{ rgb <1,0,0>}}}
cylinder { <0, 1, 0>, <2, 1, 0>, 0.01 texture {pigment{ rgb <1,0,0>}}}
cylinder { <0, 2, 0>, <2, 2, 0>, 0.01 texture {pigment{ rgb <1,0,0>}}}
cylinder { <0, 0, 0>, <0, 3, 0>, 0.02 texture {pigment{ rgb <0,1,0>}}}
cylinder { <1, 0, 0>, <1, 2, 0>, 0.01 texture {pigment{ rgb <0,1,0>}}}
cylinder { <2, 0, 0>, <2, 2, 0>, 0.01 texture {pigment{ rgb <0,1,0>}}}
//cylinder { <0, 0, 0>, <0, 0, 3>, 0.02 texture {pigment{ rgb <0,0,1>}}}
#end //if
// ----------------------------------------
#macro buttonbase(wire_rad,len,wdth,hgth)
object { // Round_Box(A, B, WireRadius, UseMerge)
Round_Box(<-len,-wdth,0>,,wire_rad, 1)
}
#end //buttonbase
//corners = number of corners of screw
// wire radius, radius of the screws roundings
// hradius =radius of rounding in height direction
// height=height of the screw
#macro screw_head(corners,wire_radius,hradius,height)
//screw head
object{ difference {
// Round_N_Pyramid (N, Wire_Radius, Pyramid_R, Pyramid_R2, Pyramid_Height, Fill_On, Merge_On)
union { object{ Round_N_Pyramid (corners, wire_radius , hradius, hradius, height , 1,0)}
box { <-0.9*hradius, wire_radius, -0.16*hradius>, <0.9*hradius, height, 0.16*hradius>
texture {pigment {rgb <1,1,0>}}
}
}
box { <-1.2*hradius, 0.4*height, -0.15*hradius>, <1.2*hradius, 1.5*height, 0.15*hradius> //texture{pigment{rgb <1,0,1>}}
}
translate <0,wire_radius,0>
}
}
#end //screwhead macro
// len = length of the base plate
// wid = width of the base plate
// baseheight= height of the base plate
// wire_rad = radius of the curved edges of the plate
// screwscale = scale of the screws
// screwlenoffset= offset of the screw to the edge of the plate
// screwwidoffset=offset of screw to edge of the plate
// rseed=random seed for screw angle position
#macro basewscrews(len, wid, baseheight,wire_rad,screwscale,screwlenoffset,screwwidoffset,rseed)
#declare R1=seed(rseed);
union{
object {buttonbase(wire_rad,len/2, wid/2, baseheight)
texture{ Brushed_Texture}
}
object {screw_head(6, 0.1, 1, 0.3)
texture{ Brushed_Texture}
scale
rotate <90,0,0>
rotate<0,0,rand(R1)*360>
translate <-len/2+screwlenoffset,-wid/2+screwwidoffset,baseheight>
}
object {screw_head(6, 0.1, 1, 0.3)
texture{ Brushed_Texture}
scale
rotate <90,0,0>
rotate<0,0,rand(R1)*360>
translate <-(-len/2+screwlenoffset),-wid/2+screwwidoffset,baseheight>
}
object {screw_head(6, 0.1, 1, 0.3)
texture{ Brushed_Texture}
scale
rotate <90,0,0>
rotate<0,0,rand(R1)*360>
translate <-len/2+screwlenoffset,-(-wid/2+screwwidoffset),baseheight>
}
object {screw_head(6, 0.1, 1, 0.3)
texture{ Brushed_Texture}
scale
rotate <90,0,0>
rotate<0,0,rand(R1)*360>
translate <-(-len/2+screwlenoffset),-(-wid/2+screwwidoffset),baseheight>
}
}
#end //basewscrews
#macro halfroundedbox(len,wdth,hght,wire_rad)
#declare avoidsides=wire_rad/10000;
object{
merge{
merge{
box { <-len/2+wire_rad-avoidsides, -wdth/2, 0-avoidsides>, }
box { <-len/2, -wdth/2+wire_rad-avoidsides, 0>, }
}
cylinder { <0, 0, 0-avoidsides/2>, <0, 0, hght+avoidsides/2>, wire_rad translate }
cylinder { <0, 0, 0-avoidsides/2>, <0, 0, hght+avoidsides/2>, wire_rad translate <-len/2+wire_rad,wdth/2-wire_rad,0> }
cylinder { <0, 0, 0-avoidsides/2>, <0, 0, hght+avoidsides/2>, wire_rad translate }
cylinder { <0, 0, 0-avoidsides/2>, <0, 0, hght+avoidsides/2>, wire_rad translate <-len/2+wire_rad,-wdth/2+wire_rad,0> }
}
}
#end //halfroundedbox
#macro halfroundedhollowbox(len,wdth,hght,wire_rad,thickn)
#declare tresh=wire_rad/10;
#if ((wire_rad-thickn) <= tresh )
#declare radi=wire_rad/10;
#else
#declare radi=wire_rad-thickn;
#end
object {
difference{
halfroundedbox(len,wdth,hght,wire_rad)
object{halfroundedbox(len-2*thickn,wdth-2*thickn,hght+thickn,radi) translate <0,0,-thickn/2>}
}
}
#end //end of halfroundedhollowbox
#macro halfroundedtop(len,wdth,wire_rad)
difference {
#declare avoidsides=wire_rad/10000;
merge{
box { <-len/2+wire_rad-avoidsides, -wdth/2+wire_rad-avoidsides, 0>, }
cone {
(-len/2+wire_rad)*x, wire_rad,
(len/2-wire_rad)*x, wire_rad
translate <0,wdth/2-wire_rad,0>
}
cone {
(-len/2+wire_rad)*x, wire_rad,
(len/2-wire_rad)*x, wire_rad
translate <0,-wdth/2+wire_rad,0>
}
cone {
(-wdth/2+wire_rad)*y, wire_rad,
(wdth/2-wire_rad)*y, wire_rad
translate <-len/2+wire_rad,0,0>
}
cone {
(-wdth/2+wire_rad)*y, wire_rad,
(wdth/2-wire_rad)*y, wire_rad
translate
}
sphere { <-len/2+wire_rad,-wdth/2+wire_rad, 0>, wire_rad }
sphere { , wire_rad }
sphere { , wire_rad }
sphere { <-len/2+wire_rad,wdth/2-wire_rad, 0>, wire_rad }
}
box { <-len/2-1, -wdth/2-1, 0>, }
}
#end //end of macro halfroundedtop
#macro halfroundedhollowtop(len,wdth,wire_rad,thickn)
#declare tresh=wire_rad/10;
#if ((wire_rad-thickn) <= tresh )
#declare radi=wire_rad/10;
#else
#declare radi=wire_rad-thickn;
#end // End of conditional part
difference{
object{ halfroundedtop(len,wdth,wire_rad)}
object{halfroundedtop(len-2*thickn,wdth-2*thickn,radi) translate <0,0,-thickn/40>}
}
#end // macro halfroundedhollowtop
#macro hollowcap(len,wdth,hght,wire_rad,thickn)
merge{
#declare avoidsides=wire_rad/10000;
object{halfroundedhollowbox(len,wdth,hght+avoidsides,wire_rad,thickn)}
object{halfroundedhollowtop(len,wdth,wire_rad,thickn) translate <0,0,hght>}
}
#end //macro hollowcap
#macro buttonlightgroup(numlightsx,startposx,endposx,numlightsy,startposy,endposy,numlightsz,startposz,endposz,buttonpressed,buttonhighlighted)
#declare Nrx= 0;
#declare Nry= 0;
#declare Nrz= 0;
#if (numlightsx>1)
#declare incrx=(endposx-startposx)/(numlightsx-1);
#declare sposx=startposx;
#else
#declare incrx=0;
#declare sposx=startposx+((endposx-startposx)/2);
#end
#if (numlightsy>1)
#declare incry=(endposy-startposy)/(numlightsy-1);
#declare sposy=startposy;
#else
#declare incry=0;
#declare sposy=startposy+((endposy-startposy)/2);
#end
#if (numlightsz>1)
#declare incrz=(endposz-startposz)/(numlightsz-1);
#declare sposz=startposz;
#else
#declare incrz=0;
#declare sposz=startposz+((endposz-startposz)/2) ;
#end
#while (Nrx < numlightsx)
#declare Nry=0;
#while (Nry < numlightsy)
#declare Nrz=0;
#while (Nrz < numlightsz)
// #warning concat("Nrz Value is:",str(Nrz,5,0),"\n")
light_source{
0*x
#if (buttonpressed)
#if (buttonhighlighted)
LIGHT_COLOR_MSOVER_PRESSED_HIGHLIGHT
#else
LIGHT_COLOR_HIGHLIGHT
#end //if buttonhighlighted
#else
#if (buttonhighlighted)
LIGHT_COLOR_MSOVER_HIGHLIGHT
#else
LIGHT_COLOR_NORMAL
#end //if buttonhighlighted
#end //if buttonpressed
translate
}
// #warning concat(" sposx :",str(sposx,5,3)," sposy :",str(sposy,5,3)," sposz :",str(sposz,5,3),"\n")
// #warning concat(" Nrx :",str(Nrx,5,3)," Nry :",str(Nry,5,3)," Nrz :",str(Nrz,5,3),"\n")
// #warning concat(" incrx :",str(incrx,5,3)," incry :",str(incry,5,3)," incrz :",str(incrz,5,3),"\n")
//sphere { , 0.2 texture{pigment{rgb<10,1,1>}} }
#declare Nrz = Nrz + 1;
#end
#declare Nry = Nry + 1;
#end
#declare Nrx=Nrx+1;
#end
#end //macro buttonlightgroup
#macro halfroundedboxwcarves(len,wdth,hght,wire_rad)
#declare textbar=texture{pigment{Green}};
#declare bwdth=hght/6;
#declare blen=wdth;
#declare incrx=2*sqrt(2*(bwdth*bwdth))/cosd(45);
difference {
object {halfroundedbox(len,wdth,hght,wire_rad) }
#declare startx=(len/2)+(tand(45)*wdth/2);
#declare numsteps=2*startx/incrx;
#declare nr=0;
#while ( nr ,
rotate <0,0,45>
translate
}
box { <-blen, -bwdth, -bwdth>,
rotate <0,0,-45>
translate
}
#declare nr=nr+1;
#end
}
#end
// btextstr=button text string
// fontname=name of the font in the button
// len = pushbutton length
// wdth = pushbutton width
// hghtbase =pushbutton base height
// hghttransp = height transparent part
// hghtglass = height glass part
// wire_rad = radius of the roundings
// thickntransp = thickness of the transparent part
// thicknglass = thickness of the glass part
// platetexture = texture of the base plate
// insideglasstexture = texture of the inside glass
// insideglassinterior
// glasstexture
// glassinterior
#macro pushbutton(btextstr,fontname,len,wdth,hghtbase,hghttransp, hghtglass,wire_rad, thickntransp,thicknglass,
platetexture,insideglasstexture,insideglassinterior,glasstexture,glassinterior,
buttonpressed,buttonhighlighted)
#declare lightposxstart=len/2-thicknglass-(thickntransp*2);
#declare lightposystart=wdth/2-thicknglass-(thickntransp*2);
#declare lightposzstart=hghtbase+((hghttransp- thickntransp)/2);
#warning concat("lightposzstart:",str(lightposzstart,5,3)," hghtbase:",str(hghtbase,5,3),
" hghttransp:",str(hghttransp,5,3)," thickntransp:",str(thickntransp,5,3),"\n")
#declare btext= text {
ttf // font type (only TrueType format for now)
fontname, // Microsoft Windows-format TrueType font file name
btextstr, // the string to create
thickntransp , // the extrusion depth
0 // inter-character spacing
}
#declare minbtxt=min_extent(btext);
#declare maxbtxt=max_extent(btext);
union{
#if (Radiosity)
//no backlight if radiosisty is used the text will emit itself
#else
#declare nlights=int(len/4*NUM_LIGHTS);
#warning concat("nlights:",str(nlights,5,3),"\n")
buttonlightgroup(nlights,lightposxstart,-lightposxstart,1,0,0,1,lightposzstart,lightposzstart,buttonpressed,buttonhighlighted)
#end //if
#declare avoidsides=(wire_rad/10000);
#warning concat("minbtxt.x:",str(minbtxt.x,5,3)," minbtxt.y:",str(minbtxt.y,5,3),
" minbtxt.z:",str(minbtxt.z,5,3)," maxbtxt.x:",str(maxbtxt.x,5,3),
" maxbtxt.y:",str(maxbtxt.y,5,3),
" maxbtxt.z:",str(maxbtxt.z,5,3),"\n")
#declare sizebtxtx=maxbtxt.x-minbtxt.x;
#declare sizebtxty=maxbtxt.y-minbtxt.x;
union{
object{halfroundedbox(len,wdth,hghtbase, wire_rad) texture {platetexture } }
merge {
// object{halfroundedhollowbox(len-thicknglass,wdth-thicknglass+(2*avoidsides),hghttransp,wire_rad,thickntransp)
// translate <0,0,hghtbase-avoidsides>
#declare usetransparentsides=on;
object{halfroundedhollowbox(len-thicknglass,wdth-thicknglass+avoidsides,hghttransp+hghtbase+avoidsides,wire_rad,thickntransp)
translate <0,0,0>
#if (usetransparentsides=off)
texture { pigment{color rgb <0,0,0>}
finish{
diffuse 0.00
ambient 0.0
phong 0.8 }
}
#else
texture { insideglasstexture}
#if (useinterior=on)
interior{insideglassinterior}
#end //for some reason enabling this interios slows the render down very much
#end //if radiosity
}
#if (Radiosity)
#declare radiosity_type_bttn=1;
#if ( radiosity_type_bttn=0)
object{halfroundedbox(len-thicknglass-avoidsides,wdth-thicknglass-avoidsides,thickntransp,wire_rad)
translate <0,0,hghtbase+hghttransp-thickntransp-2*avoidsides>
texture { insideglasstexture}
interior{insideglassinterior}
}
object{ btext
texture {pigment{Yellow}
finish { diffuse 0 ambient rgb<300.7,150.7,300.7>}}
rotate <0,180,0>
translate
}
#else
difference{
object{halfroundedboxwcarves(len-thicknglass-avoidsides,wdth-thicknglass-avoidsides,thickntransp,wire_rad)
translate <0,0,hghtbase+hghttransp-thickntransp-2*avoidsides>
texture { insideglasstexture}
interior{insideglassinterior}
}
object{ btext rotate <0,180,0>
translate
texture {pigment {color rgb<0.052, 0.052, 0.052>}
finish{
diffuse 0.01
ambient 0.0
phong 0.8 }
}
}
}
object { // Round_Box(A, B, WireRadius, UseMerge)
btext rotate <0,180,0>
texture {pigment{Yellow}
finish { diffuse 0 ambient rgb<800.7,800.7,800.7>}}
translate
} // ---------------------------------------------------------
#end // if radiosity_type_bttn
#else
difference{
object{halfroundedboxwcarves(len-thicknglass-avoidsides,wdth-thicknglass-avoidsides,thickntransp,wire_rad)
translate <0,0,hghtbase+hghttransp-thickntransp-2*avoidsides>
texture { insideglasstexture}
#if (useinterior=on)
interior{insideglassinterior}
#end
}
object{ btext rotate <0,180,0>
translate
texture {pigment {color rgbf<0.2, 0.2, 0.2, 0.04>}
finish{
diffuse 1.5
ambient 0.3
phong 0.8 }
}
}
}
#end //if radiosity
}
object{hollowcap(len,wdth,hghtglass+hghttransp,wire_rad,thicknglass)
translate <0,0,hghtbase>
texture { glasstexture}
//#if (useinterior=on)
interior{glassinterior}
//#end
}
}
#if (buttonpressed)
translate <0,0,-hghtbase-hghttransp/1.4>
#end //if buttonpressed
}
#end //macro pushbutton
//buttonglass(4,2,1,0.6)
#declare textarray=array[10];//contains buttontexts
#declare seedarray=array[10];//contains random seeds for screw positions
#declare textarray[0]="Home";
#declare textarray[1]="Bandleden";
#declare textarray[2]="Agenda";
#declare textarray[3]="Playlist";
#declare textarray[4]="Foto's";
#declare textarray[5]="Contact";
#declare textarray[6]="Links";
#declare textarray[7]="Gastenboek"
#declare textarray[8]="Media";
#declare textarray[9]="";
#declare seedarray[0]=2224;
#declare seedarray[1]=3456;
#declare seedarray[2]=6543;
#declare seedarray[3]=9098;
#declare seedarray[4]=3434;
#declare seedarray[5]=1434;
#declare seedarray[6]=3435;
#declare seedarray[7]=6542;
#declare seedarray[8]=8764;
#declare seedarray[9]=2224;
#declare btfont="Magnetob.ttf"; //"crystal.ttf";
#declare maxtxtwidth=0;
#declare maxtxtheight=0;
#macro calcmaxtextwidth(textarr)
#declare Nr = 0; // start
#declare EndNr = dimension_size(textarr,1); // end
#while (Nr< EndNr)
#local bttext= text {
ttf // font type (only TrueType format for now)
btfont, // Microsoft Windows-format TrueType font file name
textarr[Nr], // the string to create
0.3 , // the extrusion depth
0 // inter-character spacing
}
#if (strlen(textarr[Nr])!=0)
#local minbttxt=min_extent(bttext);
#local maxbttxt=max_extent(bttext);
#local sizebttxtx=maxbttxt.x-minbttxt.x;
#local sizebttxty=maxbttxt.y-minbttxt.x;
#if ( sizebttxtx > maxtxtwidth)
#declare maxtxtwidth= sizebttxtx;
#end
#if ( sizebttxty > maxtxtheight)
#declare maxtxtheight= sizebttxty;
#end
#end //if textarr length
#declare Nr = Nr + 1; // next Nr
#end // --------------- end of loop
#warning concat("maxtxtwidth:",str(maxtxtwidth,5,3)," maxtxtheight:",str(maxtxtheight,5,3),"\n")
#end //macro calcmaxtextwidth
calcmaxtextwidth(textarray)
// textstr= string of text to be shown inthe button
// platelength=length of the metal base plate
// platewidth=width of the metal base plate
// baseheight= height of the base plate
// wire_rad = radius of the curved edges of the plate
// screwscale = scale of the screws
// screwlenoffset= offset of the screw to the edge of the plate
// screwwidoffset=offset of screw to edge of the plate
// rseed=random seed for screw angle position
// len = pushbutton length
// wdth = pushbutton width
// hghtbase =pushbutton base height
// hghttransp = height transparent part
// hghtglass = height glass part
// wire_rad = radius of the roundings
// thickntransp = thickness of the transparent part
// thicknglass = thickness of the glass part
// platetexture = texture of the base plate
// insideglasstexture = texture of the inside glass
// insideglassinterior
// glasstexture
// glassinterior
#macro pushbuttonwithbaseplate(textstr,fontname,platelength,platewidth,baseheight,wire_rad,screwscale,screwlenoffset,screwwidoffset,rseed,
len,wdth,hghtbase,hghttransp,hghtglass,pbwire_rad,thickntransp,thicknglass,platetexture,insideglasstexture,insideglassinterior,glasstexture,glassinterior,
buttonpressed,buttonhighlighted)
union{
//the base plate
difference{
basewscrews(platelength,platewidth,baseheight,wire_rad,screwscale,screwlenoffset,screwwidoffset,rseed)
object{halfroundedbox(len,wdth, baseheight*5,pbwire_rad) texture{Brushed_Texture} translate<0,0,-0.2>}
}
// the button to push on
pushbutton(textstr,fontname,len,wdth,hghtbase, hghttransp,hghtglass,pbwire_rad, thickntransp, thicknglass,
platetexture,insideglasstexture,insideglassinterior,glasstexture,glassinterior,buttonpressed,buttonhighlighted )
}
#end
/*
difference{
basewscrews(5,3,0.3,0.1,0.14,0.3,0.3,2224)
object{halfroundedbox(4,2, 2,0.3) texture{Brushed_Texture} translate<0,0,-0.1>}
}
//pushbutton("home","crystal.ttf",4,2,0.2, 0.4,0.2,0.3, 0.2, 0.08,pigment{rgb <1,1,1>},Ruby_Glass,I_Glass_Inner_Cap,T_Glass_Outer_Cap,I_Glass_Outer_Cap )
*/
// sphere { <0, 1, 0>, 0.5 texture {pigment{rgb <1,1,0>}} }
//pushbuttonwithbaseplate("Home",btfont, 5, 3, 0.3, 0.1, 0.14, 0.3, 0.3, 2224,
// 4, 2, 0.2, 0.4, 0.2, 0.3, 0.2, 0.08,pigment{rgb <1,1,1>},Ruby_Glass,I_Glass_Inner_Cap,T_Glass_Outer_Cap,I_Glass_Outer_Cap )
#macro createwebpushbutton(maxtwidth,maxtheight,textarr,seedarr,index,buttonpressed,buttonhighlighted)
#local pushblen=maxtwidth*1.15;
#local pushbwid=maxtheight*2.4;
#local pplatelen=pushblen*1.15;
#local pplatewidth=pushbwid*1.80;
#local hghtbase=0.3;
#local wradplate=0.1;
#local screwscale=0.18;
#local screwlenoffset=(pplatelen-pushblen)/3;
#local screwwidoffset=(pplatewidth-pushbwid)/3;
#local pushbhghtbase=0.2;
#local pushbhghttransp=0.4;
#local pushbhghtglass=0.2;
#local pbwirerad=0.3;
#local pbthickntransp=0.2;
#local pbthicknglass=0.08;
#warning concat("================ parameters ===================","\n")
#warning concat("pplatelen:",str(pplatelen,5,3)," pplatewidth:",str(pplatewidth,5,3),"\n")
#warning concat("hghtbase:",str(hghtbase,5,3)," wradplate:",str(wradplate,5,3),"\n")
#warning concat("screwscale:",str(screwscale,5,3)," screwlenoffset:",str(screwlenoffset,5,3),"\n")
#warning concat("screwwidoffset:",str(screwwidoffset,5,3),"\n")
#warning concat("pushblen:",str(pushblen,5,3)," pushbwid:",str(pushbwid,5,3),"\n")
#warning concat("pushbhghtbase:",str(pushbhghtbase,5,3)," pushbhghttransp:",str(pushbhghttransp,5,3),"\n")
#warning concat("pushbhghtglass:",str(pushbhghtglass,5,3)," pbwirerad:",str(pbwirerad,5,3),"\n")
#warning concat("pbthickntransp:",str(pbthickntransp,5,3)," pbthicknglass:",str(pbthicknglass,5,3),"\n")
#if (axison = 1)
cylinder { <0, pushbwid/2, 0>, <10, pushbwid/2, 0>, 0.01 texture {pigment{ rgb <1,1,0>}}}
cylinder { <0, pplatewidth/2, 0>, <10, pplatewidth/2, 0>, 0.01 texture {pigment{ rgb <1,1,0>}}}
#end //if
pushbuttonwithbaseplate(textarr[index],btfont, pplatelen,pplatewidth, hghtbase, wradplate, screwscale, screwlenoffset, screwwidoffset, seedarr[index],
pushblen, pushbwid,pushbhghtbase, pushbhghttransp,pushbhghtglass, pbwirerad,pbthickntransp , pbthicknglass,
pigment{rgb <1,1,1>},T_Colored_Glass_Inner_Cap,I_Glass_Inner_Cap,T_Glass_Outer_Cap,I_Glass_Outer_Cap,
buttonpressed,buttonhighlighted )
#end
#declare animationon=on;
#if ( animationon)
#declare btype= mod(clock,4);
#declare index=int(clock/4);
#switch(btype)
#case(0)
#declare bpressed=0;
#declare bhighlight=0;
#break
#case(1)
#declare bpressed=0;
#declare bhighlight=1;
#break
#case(2)
#declare bpressed=1;
#declare bhighlight=0;
#break
#case(3)
#declare bpressed=1;
#declare bhighlight=1;
#break
#end //switch btype
createwebpushbutton(maxtxtwidth,maxtxtheight,textarray,seedarray,index,bpressed,bhighlight)
#else
createwebpushbutton(maxtxtwidth,maxtxtheight,textarray,seedarray,3,0,0)
#end //if animationon