/********************************* Shows the use of slp2pov in converting a PRo-Engineer CAD mesh to POVRAY include files ***************************/

#declare Animate = no;
#if ( Animate = yes)
#declare klok = clock;
#declare BoxKlok = 0;
#declare LidKlok = klok;
#else
#declare BoxKlok = 0.00;
#declare LidKlok = 1.00;
#end

//background { rgb <0.2,0.2,0.85>*0.8}

/*********************************************************** Select parts to include in the assembly ***********************************************/

#declare LidIn = yes;
#declare LidParzIn = yes; #declare LidTiesIn = no;
#declare BoxIn = yes;
#declare BoxParzIn = yes;
#declare OpxParzIn = yes;

#declare AssyIn = yes;
#declare LogoIn = yes;
#declare Globalyte = yes; #declare NLytes = 12; #if(NLytes = 1) #declare GLyte = 1.5; #else #declare GLyte =1.2; #end
#declare Offset = 0.0; #declare LidOffs = <0,-100,-355>;
#declare BakCloth = no;

#declare SeeThruVu = no; #if(SeeThruVu = yes) #declare Gst = 0.95; #else #declare Gst = 0.0; #end
#declare Amb = 0.0;
#include "textures.inc" #include "NRSTTex.inc" #include "colors.inc" #include "woods.inc"

/*********************************************************** Set up the cameras for a range of views ***********************************************/

#declare Aspect149 = 14/9; #declare Aspect133 = 4/3; #declare Aspect100 = 1.0; #declare Aspect075 = 0.75;

#declare WanglVu = no; #if (WanglVu = yes) camera { location <-2e3,3.0e3,-2e3>*0.30 look_at < -20, 0, -20> angle 60 up y right x*Aspect149} #end
#declare InBoxVu = no; #if (InBoxVu = yes) camera { location <-2e3,3.0e3,-2e3>*0.30 look_at < -20, -20, -20> angle 45 up y right x*Aspect133} #end
#declare PortrVu = no; #if (PortrVu = yes) camera { location <-2e3,3.5e3,-2e3>*1.50 look_at < -60, 500, 20> angle 10 up y right x*Aspect075} #end
#declare AniView = no; #if (AniView = yes) camera { location < 0,1.2e3,-2e3>*1.00 look_at < 0, 0, -50> angle 24 up y right x*Aspect133} #end
#declare BleekVu = no; #if (BleekVu = yes) camera { location <-2e3,2.0e3,-2e3> look_at < -20, 0, 200> angle 24 up y right x*Aspect149} #end
#declare FrntlVu = no; #if (FrntlVu = yes) camera { location < 0, 0,-2e3> look_at < 0, 0, 2e3> angle 26 up y right x*Aspect133} #end
#declare SideVue = no; #if (SideVue = yes) camera { location < -4e3,0,0> look_at < 1e3, 0, 0> angle 26 up y right x*Aspect133} #end
#declare UppaVue = no; #if (UppaVue = yes) camera { location < -4e2,1e4,0> look_at <-4e2, 0, 0> angle 6 up y right x*Aspect133} #end
#declare BoxOnly = no; #if (BoxOnly = yes) camera { location < 0e3,3.0e3,-2e3>*0.35 look_at < 20, 0, -50> angle 42 up y right x*Aspect100} #end
#declare RearVue = no; #if (RearVue = yes) camera { location < 0e3,3.0e3,-2e3>*0.50 look_at < 50, 0, 150> angle 45 up y right x*Aspect133} #end
#declare RearVu1 = no; #if (RearVu1 = yes) camera { location < 0e3,3.0e3,-2e3>*0.35 look_at < 50, 0, 150> angle 45 up y right x*Aspect133} #end
#declare RearVu2 = no; #if (RearVu2 = yes) camera { location < 0e3,3.0e3,-2e3>*0.50 look_at < 150, 0, -300> angle 45 up y right x*Aspect133} #end
#declare TrolyVu = no; #if (TrolyVu = yes) camera { location <-2e3,2.0e3,-2e3> look_at < 0, -70, 30> angle 26 up y right x*Aspect133} #end
#declare LiftLid = yes; #if (LiftLid = yes) camera { location <-1e3,2.0e3,-2e3>*0.70 look_at <-100, 450, -150> angle 29 up y right x*Aspect075} #end
#declare LookLbl = no; #if (LookLbl = yes) camera { location <-1e3,0.0e3,-2e0>*1.00 look_at < 0, 0, 150> angle 27 up y right x*Aspect075} #end
#declare NiceVue = no; #if (NiceVue = yes) camera { location <-2e3,2.0e3,-2e3> look_at < 0, 0, 0> angle 18 up y right x*Aspect133} #end

/************************************************************** Set up the Assembly *****************************************************************/

#if(AssyIn = yes)
union { #if( LidIn = yes )
#declare Lid = union { object { #include "mesh_c.inc" Mesh_C } // inside lid
object { #include "mesh_d.inc" Mesh_D } // outside lid
}
#end

#if( LidParzIn = yes )
#declare LidParz = union { object { #include "mesh_e.inc" Mesh_E } // flat tronix boards on lid
object { #include "mesh_f.inc" Mesh_F } // tronix packs on lid edges
object { #include "mesh_g.inc" Mesh_G } // transistors on lid
object { #include "mesh_i.inc" Mesh_I } // board frames
object { #include "mesh_j.inc" Mesh_J } // flatboards
#if(LidTiesIn = yes)
object { #include "mesh_k.inc" Mesh_K } // lid straps
#end
object { #include "mesh_p.inc" Mesh_P } // bolts for lid tronix
object { #include "mesh_q.inc" Mesh_Q } // lid screwdowns
object { #include "mesh_r.inc" Mesh_R } // washers on bolts for Item E
}
#end

#if( BoxIn = yes)
#declare Box = union { object { #include "mesh_v.inc" Mesh_V } // inside of box
object { #include "mesh50.inc" Mesh50 } // windows
object { #include "mesh54.inc" Mesh54 } // window frames
#if(SeeThruVu = no)
object { #include "mesh_u.inc" Mesh_U } // outside of box
object { #include "mesh_x.inc" Mesh_X } // sealing ring for lid
object {#include "mesh_w.inc" Mesh_W } // handles
#end
#if( LogoIn = yes)
#declare LG = 80;
#declare Br = 8; #declare Br2 = 0.5*Br;
#declare Rivet = sphere { -z*2,2 texture { Polished_Brass } }
#declare Logo = union { box { <-LG,-50,-2.01>,<LG,50,-2.0>
pigment { image_map {jpeg "PageNRSTlbl.jpg"}
translate <-0.5,-0.5,0> scale <LG,50,1>*2}
finish { ambient 1 diffuse 0.5 specular 0.6 roughness 0.001 }
}
box { <-LG-Br,-50-Br,-1.99>,<LG+Br,50+Br,0>
texture { Brushed_Aluminium }
}
object { Rivet translate <-LG-Br2,-50-Br2,0> }
object { Rivet translate <-LG-Br2, 50+Br2,0> }
object { Rivet translate < LG+Br2,-50-Br2,0> }
object { Rivet translate < LG+Br2, 50+Br2,0> }
}

object { Logo scale 0.85 rotate y*90 translate <-260,35,150>}
object { Logo scale 0.70 rotate -y*90 translate < 260,35, 50+45>}
#end
}
#end

#if( BoxParzIn =yes)
#declare BoxParz = union { object { #include "mesh01.inc" Mesh01} // strip connectors at front of box
object { #include "mesh02.inc" Mesh02 } // gyro at rear centre of box
object { #include "mesh03.inc" Mesh03 } // big mounting frame
object { #include "mesh09.inc" Mesh09 } // two sockets at front of box?
object { #include "mesh23.inc" Mesh23 } // connectors
object { #include "mesh24.inc" Mesh24 } // card and plug
object { #include "mesh25.inc" Mesh25 } // fans and bits
object { #include "mesh26.inc" Mesh26 } // tronix components
object { #include "mesh27.inc" Mesh27 } // connectors in camera
object { #include "mesh28.inc" Mesh28 } // tronix in camera space
object { #include "mesh29.inc" Mesh29 } // screws and sockets and connectors
object { #include "mesh31.inc" Mesh31 } // array of cube things
object { #include "mesh32.inc" Mesh32 } // box fixings
object { #include "mesh33.inc" Mesh33 } // vertical things
object { #include "mesh34.inc" Mesh34 } // strip connectors?
object { #include "mesh35.inc" Mesh35 } // something very small
object { #include "mesh38.inc" Mesh38 } // plates with holes
object { #include "mesh39.inc" Mesh39 } // two small tronix pax on box floor at back
object { #include "mesh40.inc" Mesh40 } // washers at back of box
object { #include "mesh41.inc" Mesh41 } // sockets and spacers
object { #include "mesh42.inc" Mesh42 } // boards at back of cameras
object { #include "mesh43.inc" Mesh43 } // ali plugs on rear of camera box
object { #include "mesh44.inc" Mesh44 } // heat pipes
object { #include "mesh45.inc" Mesh45 } // and brackets
object { #include "mesh46.inc" Mesh46 } // two large tronix pax on box floor
object { #include "mesh47.inc" Mesh47 } // fibre optic cables
object { #include "mesh48.inc" Mesh48 } // three sockets on rear of box
object { #include "mesh49.inc" Mesh49 } // AMP sockets in box
object { #include "mesh51.inc" Mesh51 } // fan filter in box
}
#end
#if(OpxParzIn )
#declare OpxParz = union { object { #include "mesh04.inc" Mesh04 } // lens beamsplitting units
object { #include "mesh05.inc" Mesh05 } // spacer rings
object { #include "mesh06.inc" Mesh06 } // shuffle plates and many fixings
object { #include "mesh07.inc" Mesh07 } // foldmirrors and filter bits
object { #include "mesh08.inc" Mesh08 } // boxes in optics bit
object { #include "mesh10.inc" Mesh10 } // filter holder
object { #include "mesh11.inc" Mesh11 } // micromotors,lens holders,plates
object { #include "mesh12.inc" Mesh12 } // big brackets for camera
object { #include "mesh13.inc" Mesh13 } // more lenses
object { #include "mesh14.inc" Mesh14 } // optical barrels
object { #include "mesh15.inc" Mesh15 } // optical discs
object { #include "mesh16.inc" Mesh16 } // lenses
object { #include "mesh17.inc" Mesh17 } // bits of optics?
object { #include "mesh18.inc" Mesh18 } // filters
object { #include "mesh19.inc" Mesh19 } // connectors and gyro clamp
object { #include "mesh20.inc" Mesh20 } // support brackets
object { #include "mesh21.inc" Mesh21 } // cooler and dewar
object { #include "mesh22.inc" Mesh22 } // small discs
object { #include "mesh30.inc" Mesh30 } // plates with holes in camera region
object { #include "mesh36.inc" Mesh36 } // cooler clamps?
object { #include "mesh37.inc" Mesh37 } // chassis in camera
}
#end
#end

/******************************************************************* Set up lights ****************************************************************/

#declare SpotRad = 2;

#if ( Globalyte = yes )
#declare R2L = 1e4; #declare WAL = R2L/2; #declare Sun = 2*R2L*0.01;
#declare Cula1 = rgb 0.7*GLyte;
#declare Cula2 = rgb 0.6*GLyte;
union { light_source { y*R2L Cula2*1.0 area_light x*WAL/4, z*WAL/4, NLytes, NLytes adaptive 1 jitter }
light_source { y*R2L Cula1 area_light x*WAL, z*WAL, NLytes, NLytes adaptive 1 jitter rotate y*60 }
light_source { -x*R2L Cula1 area_light y*WAL, z*WAL, NLytes, NLytes adaptive 1 jitter rotate -z*45 rotate -y*45 }
light_source { -z*R2L Cula1 area_light y*WAL, x*WAL, NLytes, NLytes adaptive 1 jitter rotate x*45 }
rotate <-15,15,-15>
}
#else
light_source { <-3e4,2e4,-1e4> rgb 1.5*1.8}
light_source { <-3e2,6e4,-1e4> rgb 2.0*1.8}

#end

/************************************************************** Render animated assembly ************************************************************/

#if (AssyIn = yes )
union { union { #if( LidIn = yes )
object { Lid }
#end
#if( LidParzIn = yes )
object { LidParz }
#end
translate LidOffs rotate -x*180*(1-0.5*LidKlok) translate -LidOffs
}
union { #if(BoxIn = yes )
object { Box }
#end
#if(BoxParzIn = yes )
object { BoxParz }
#end
}
#if( OpxParzIn = yes )
object { OpxParz }
#end
}
rotate -y*360*(BoxKlok+Offset)
}
#end

/******************************************************************* Lab environment ****************************************************************/

#declare TheLabIn = yes;
#if( TheLabIn = yes)
#declare TrolleyIn = yes;
#declare FloorIn = yes;
#declare ClothIn = no;
#declare BaublesIn = no;
#declare ScaleRIn = no;
#if( ScaleRIn = yes)
#declare ScaleR = union { box { <-150,0,-10>,<150,5,10> texture { WoodTex } }
text { ttf "cyrvetic.ttf", "300mm",10,0 pigment { rgb 0 } finish { ambient 1 }
scale <20,20,0.03> rotate x*90 translate y*5.2-z*7-x*25
}
}
object { ScaleR translate <0,-130,-420>}
#end
#include "thelab.inc"
#end

/****************************************************************************************************************************************************/

#if(BakCloth = yes )
#declare Cloth = plane { y,-130 texture { pigment { image_map { jpeg "pagenrstlbl.jpg"} rotate x*90 scale 500 }
finish { ambient 0.2 diffuse 0.3 roughness .1 }
}
}
object { Cloth }
#end