#version 3.7; #include "colors.inc" #include "skies.inc" global_settings{assumed_gamma 1.70} #declare myclock=clock*4; #declare inches=1; #declare Camera=<0,10,0>; #declare Lookat=<0,10,1>; #local loffset0=<-2,2,0>; // Move a Vector from, to, increment #macro MoveV(_from, _to, __i) <_from.x+((_to.x-_from.x)*__i), _from.y+((_to.y-_from.y)*__i), _from.z+((_to.z-_from.z)*__i)> #end // Animate this segment of the clock from 0 to 1 #macro AniSegment(_start, _end) ((myclock-_start)/(_end-_start)) #end #macro vdebug(vec) concat("<", str(vec.x,0,2), ", ",str(vec.y,0,2), ", ", str(vec.z,0,2), ">") #end // Convert this vector into its angle #macro VtoA(V) #local _V=vnormalize(V); #local rZ=degrees(acos(_V.x)); #local rY=degrees(atan2(_V.y,_V.z)); //<-rY,-rZ,0> #local rX=degrees(atan2(sqrt(_V.y*_V.y+_V.z*_V.z),_V.x))-90; #local rY=degrees(atan2(sqrt(_V.z*_V.z+_V.x*_V.x),_V.y))-90; #local rZ=degrees(atan2(sqrt(_V.x*_V.x+_V.y*_V.y),_V.z)); #debug concat("rX/Y/Z=<", str(rX,0,2), ", ", str(rY,0,2), ", ", str(rZ,0,2), ">\n") // #end #switch (myclock) #range(0,1) #local _i=AniSegment(0,1); #declare Lookat=Lookat+MoveV(<0,0,0>,loffset0,_i); #break #end #local V=vnormalize(Lookat-Camera); sphere {V+Camera,0.02*inches pigment {Red}} #declare FlashlightRot=VtoA(V); #debug concat ("Flashlight V=", vdebug(V), " Rot=", vdebug(FlashlightRot), "\n") #local FOO=<0,0,10>; #local FOO=vrotate(FOO, FlashlightRot); // +Camera; #debug concat ("rot FOO=", vdebug(FOO), "\n") sphere {FOO+Camera, 0.5*inches pigment {Cyan}} #debug concat ("FOO=", vdebug(FOO), "\n") camera { location Camera look_at Lookat } light_source {<0,20,0> rgb 1} sky_sphere { S_Cloud3 rotate y * 180} plane { y, 0 texture { checker texture { pigment {ForestGreen} }, texture { pigment{White} } } scale 12*inches }