#include "colors.inc" #include "shapes.inc" #declare S = seed(0); #declare COLOR = array[3] { Red, Green, Blue } // 粒子 // RAD:半径 #macro Particle(RAD) object { Sphere scale RAD } #end // 爆発(複数の粒子を球状にランダムに配置) // N:配置する粒子の最大数 // T:時刻 #macro Boom(N, T) merge { #local I = 0; #while ( I < N ) #local X = (rand(S)-0.5)*200; // x座標:-100〜+100 #local Y = (rand(S)-0.5)*200; #local Z = (rand(S)-0.5)*200; #local R2 = X*X + Y*Y + Z*Z; // 原点からの距離の自乗 #if ((5000 < R2) & (R2 < 10000)) // 球面付近の粒子だけ #local C = int(mod(rand(S)*10, 3)); // 色番号:0〜2 object { Particle(1) translate *T pigment { color COLOR[C] } } #local I = I + 1; #end #end } #end object { Boom(500, clock) } // 背景 background { color LightBlue } // 照明(陰影を減らすため,複数の照明を配置) light_source { <500, 800, -600> // 照明の位置 color White*1.5 parallel point_at <0, 0, 0> } light_source { <500, 800, 600> // 照明の位置 color White*1.5 parallel point_at <0, 0, 0> } light_source { <0, -800, 0> // 照明の位置 color White*0.5 parallel point_at <0, 0, 0> } // カメラ camera { location <100.0, 100.0, -100.0> // カメラの位置 look_at <0.0, 0.0, -0.5> // カメラの注目する位置 angle 35 // カメラの視野角 }