#include "functions.inc" global_settings { assumed_gamma 2.2 } #declare path="/home/Raytracing/Povscn/POVEarth/Rohdaten/"; // path for ASCII file containg elevation data #declare path_textures="/home/Raytracing/Povscn/POVEarth/Texturen/"; #declare xdim=3601; // full resolution: 3601; #declare ydim=3601; // full resolution: 3601; #declare rd=6378140-422; #declare rng=9270; #declare latstart=80; #declare latend=81; #declare longstart=14; #declare longend=15; #declare latsize=latend-latstart; #declare longsize=longend-longstart; #declare month=7; #declare res=3601; // full resolution: 3601; #if (latstart-1 < 0) #declare lat="s"; #else #declare lat="n"; #end #if (longstart < 0) #declare long="w"; #else #declare long="e"; #end #declare tilename=concat(lat, str(latstart, -2, 0), long, str(longstart, -3, 0)); // tiles are named by the coordinates of their southwestern corner! #declare altdataname = concat(path, tilename, ".txt"); #declare NumVertices = xdim*ydim; #declare NumFaces = (xdim-1)*(ydim-1)*2; #declare NumNormals = NumVertices; #declare V_vec_Arr = array[NumVertices]; #declare Face_Arr = array[NumFaces]; #declare N_vec_Arr = array[NumNormals]; #declare a = 0; #declare P_Heightfield= pigment { image_map { "Heightfields/n80e014_cleaned.png" interpolate 2 } } #declare a=0; #declare c=0; #while (a < ydim) #declare b=0; #while (b < xdim) #declare hcolor = eval_pigment(P_Heightfield, <(0.5+b)*(1/xdim), (0.5+a)*(1/ydim), 1>); #declare hval = hcolor.red*rng+hcolor.green*(rng/255); #declare V_vec_Arr[c] = (rd+hval)*/* -ApproxLook */; #declare c=c+1; #declare b=b+1; #end #declare a=a+1; #end #declare a = 0; #declare c = 0; #while (a < ydim-1) #declare b = 0; #while (b < xdim-1) #declare Face_Arr[c] = ; #declare Face_Arr[c+1] = ; #declare c = c+2; #declare b = b+1; #end #declare a = a+1; #end #declare a=0; // vcross(C-B,A-B) #declare c=0; #while (a < ydim) #declare b=0; #while (b < xdim) #if (a=0 & b=0) // lower left corner: 1 adjacent face #declare nno = vcross(V_vec_Arr[xdim]-V_vec_Arr[1], V_vec_Arr[0]-V_vec_Arr[1]); #else #if (a=0 & b>0 & b0 & a0 & a0 & b0 & a0 & b); #declare ApproxLook = lNormVect * rd; #fopen ES concat(tilename, ".inc") write #write (ES, concat("#declare ApproxLook = <", vstr(3, ApproxLook,",",3,4), ">;\n")) #write (ES, concat("#declare Earth_Slice =\nmesh2\n{\n vertex_vectors\n {\n",str(xdim*ydim, 1, 0),"\n")) #declare sf=1; #declare i=0; #while (i")) #if (i=NumVertices-1) #write (ES, "\n") #else #write (ES, ",\n") #end #declare i=i+1; #end #write (ES," }\n") #write (ES," normal_vectors\n") #write (ES," {\n") #write (ES, concat(" ",str(xdim*ydim, 1, 0),"\n")) #declare i=0; #while (i")) #if (i=NumNormals-1) #write (ES, "\n") #else #write (ES, ",\n") #end #declare i=i+1; #end #write (ES," }\n") #write (ES, concat(" face_indices\n{\n ",str((xdim-1)*2*(ydim-1), 7, 0),"\n")) #declare i=0; #while (i")) #if (i=NumFaces-1) #write (ES, "\n") #else #write (ES, ",\n") #end #declare i=i+1; #end #write (ES, " }\n") #write (ES, " double_illuminate\n") #write (ES, " translate ApproxLook\n") #if (tilename="n80e014") #write (ES, " texture\n") #write (ES, " {\n") #write (ES, " pigment { color rgb <0.66, 0.65, 0.65> }\n") #write (ES, " finish { ambient 0.1 diffuse 1 brilliance 0.4 }\n") #write (ES, " }\n") #end #write (ES, "}") #fclose ES