// Persistence of Vision Ray Tracer Scene Description File // File: DiffBox.pov // Vers: POV-Ray 3.5b6 // Desc: Macro to transform a difference of unmodified boxes into an union of boxes // Date: 24 oct 2001 // Auth: Philippe Debar - phdebar@yahoo.fr //-------------------------------------------------------// // TESTING SCENE SETUP // //-------------------------------------------------------// #version 3.5; global_settings { assumed_gamma 1.0 } #default{ pigment{color rgb 1} finish{ambient 0 diffuse .6} } background { color rgb <.6,.8,1> } plane { y,0 texture { pigment { checker color rgb <.5,.25,.1>, color rgb <1,.95,.75> scale .3 rotate 30*y } } } camera { location <0,0,-8> direction 2*z up 1*y right 4/3*x look_at 0 translate 1.7*y } #local dir_light= <3,4,-2>*1e10 ; #local int_total= 1.5 ; #local int_A=int_total*.2 ; //high shadowless #local int_B=int_total-int_A ; //high normal #local int_C=int_total*.3 ; //low shadowless light_source { 0 color rgb int_A translate dir_light shadowless } light_source { 0 color rgb int_B translate dir_light } light_source { 0 color rgb int_C translate -dir_light shadowless } //-------------------------------------------------------// // MACROS // //-------------------------------------------------------// #include "arrays.inc" #macro Sort_Compare(Array, IdxA, IdxB) (Array[IdxA][0] < Array[IdxB][0]) #end #macro Sort_Swap_Data(Array, IdxA, IdxB) #local Tmp = array [2] {Array[IdxA][0],Array[IdxA][1]}; #declare Array[IdxA][0] = Array[IdxB][0]; #declare Array[IdxA][1] = Array[IdxB][1]; #declare Array[IdxB][0] = Tmp[0]; #declare Array[IdxB][1] = Tmp[1]; #end #macro NumberArray(arArray) // arArray must be a 1-dimensional array of floats ; NumberArray returns a 2d array in which the [0][#] are the corresponding index, and the [1][#] are the arArry elements #if (dimensions(arArray)!=1) #error ""#end #local Ite0=0; #local CountTo1=dimension_size(arArray,1); #local Result=array [CountTo1][2] #while (Ite0, } #undef FirstIndex // finished this run, forget it #end #end #declare Ite2=Ite2+1; #end // while Ite2 #declare Ite1=Ite1+1; #end // while Ite1 #declare Ite0=Ite0+1; #end // while Ite0 #end // macro DifferenceBoxes //-------------------------------------------------------// // TESTING // //-------------------------------------------------------// #declare arTest2=array[16][2] { {< 0, 0, 0>-2.5, < 5, 5, 5>-2.5}, // from this box {<-1,-1,-1>-2.5, < 1, 1, 1>-2.5}, // we'll substract these boxes {<-1,-1, 6>-2.5, < 1, 1, 4>-2.5}, {<-1, 6,-1>-2.5, < 1, 4, 1>-2.5}, {<-1, 6, 6>-2.5, < 1, 4, 4>-2.5}, {< 6,-1,-1>-2.5, < 4, 1, 1>-2.5}, {< 6,-1, 6>-2.5, < 4, 1, 4>-2.5}, {< 6, 6,-1>-2.5, < 4, 4, 1>-2.5}, {< 6, 6, 6>-2.5, < 4, 4, 4>-2.5}, {< 2, 2,-1>-2.5, < 3, 3, 1>-2.5} {< 2, 2, 6>-2.5, < 3, 3, 5>-2.5} {< 2,-1, 2>-2.5, < 3, 1, 3>-2.5} {< 2, 6, 2>-2.5, < 3, 5, 3>-2.5} {<-1, 2, 2>-2.5, < 1, 3, 3>-2.5} {< 6, 2, 2>-2.5, < 5, 3, 3>-2.5} {< 2, 2, 2>-2.5, < 3, 3 ,3>-2.5} } union { DifferenceBoxes(arTest2) // do it scale 2/5 translate 1.7*y texture{ pigment { bozo color_map { [0.00 color rgbt .4] [1.00 color rgbt .8] } scale .2 } } } // eof