// Last edited on 2011-03-02 00:44:35 by stolfilocal #macro jumper_double_jump(sz,PA,HAB,PB,HBC,PC,rot,tt,tx_bod,tx_leg) // Jumper jumping from PA to PB to PC as {tt} ranges from 0 to 1. // {sz} = relative size of jumper. // {PA,PB,PC} = touchdown points. // {HAB,HBC} = heights of jumps. // {rot} = angle of rotation about Z. // {tt} = phase in double jump. // {tx_bod,tx_leg} = textures for body and legs. #local sz_leg = pow(sz,3/2); #local sz_bod = pow(sz,2/3); #local L_upp = 4*sz_leg; #local L_low = 3*sz_leg; #local L_fot = 2*sz_leg; #local R_leg = 0.5*sz; // Radius of legs. #local L_bod = 6.0*sz_bod; // Total length of body. #local R_bod = 2.0*sz_bod; // Radius of body. #macro prepare(pos,p) // Preparation at {p}, starts and ends with feet flat on ground: #local A_hip = A_hip_lo + (A_hip_hi - A_hip_lo)*sin(pi*pos); #local A_kne = A_kne_lo + (A_kne_hi - A_kne_lo)*sin(pi*pos); #local A_ank = -(A_hip + A_kne); object{ jumper(L_upp,L_low,L_fot,R_leg,tx_leg, L_bod,R_bod,tx_bod, A_hip,A_kne,A_ank, A_hip,A_kne,A_ank) rotate rot*z translate p } #end #macro fly(pos,p0,p1,h) // Aerial and semi-aerial part of jump from {p} to {q}. // Starts and ends with feet flat on ground, legs // moderately bent. // Max downturning of feet: #local A_ank_fu_0 = -35; #local A_ank_fu_1 = -40; #local A_ank_dt = 0.20; // Time while feet are turning #local A_hip_0 = A_hip_lo; #local A_kne_0 = A_kne_lo; #local A_ank_0 = A_ank_lo + A_ank_fu_0; #local A_hip_1 = A_hip_lo; #local A_kne_1 = A_kne_lo; #local A_ank_1 = A_ank_lo + A_ank_fu_1; #if (pos < A_ank_dt) #local s = (pos - 0.00)/A_ank_dt; #local f = s*s*(3 - 2*s); #local A_ank_0 = A_ank_lo + f*A_ank_fu_0; #local A_ank_1 = A_ank_lo + f*A_ank_fu_1; #end #if ((pos >= 0.10) & (pos < 0.90)) #local A_ank_0 = A_ank_lo + A_ank_fu_0; #local A_ank_1 = A_ank_lo + A_ank_fu_1; #end #if (pos >= 1.00 - A_ank_dt) #local s = (1.00 - pos)/A_ank_dt; #local f = s*s*(3 - 2*s); #local A_ank_0 = A_ank_lo + f*A_ank_fu_0; #local A_ank_1 = A_ank_lo + f*A_ank_fu_1; #end #local p = (1-pos)*p0 + pos*p1 + 4*pos*(1-pos)*h*z; object{ jumper(L_upp,L_low,L_fot,R_leg,tx_leg, L_bod,R_bod,tx_bod, A_hip_0,A_kne_0,A_ank_0, A_hip_1,A_kne_1,A_ank_1) rotate rot*z translate p } #end // Times of key frames: #local tt0 = 0.000; #local tt1 = 0.200; #local tt2 = 0.500; #local tt3 = 0.700; #local tt4 = 1.000; // Jumping jumper 01: #if((tt >= tt0) & (tt < tt1)) #local pos = (tt - tt0)/(tt1 - tt0); object{ prepare(pos,PA) } #end #if((tt >= tt1) & (tt < tt2)) #local pos = (tt - tt1)/(tt2 - tt1); object{ fly(pos,PA,PB,HAB) } #end #if((tt >= tt2) & (tt < tt3)) #local pos = (tt - tt2)/(tt3 - tt2); object{ prepare(pos,PB) } #end #if((tt >= tt3) & (tt <= tt4)) #local pos = (tt - tt3)/(tt4 - tt3); object{ fly(pos,PB,PC,HBC) } #end #end #macro jumper_take_01(tt,DY,DZ) // A jumper jumping from box to box. // Makes two jumps as {tt} ranges from 0 to 1. // The boxes alternate high and low, height difference {DZ}. // The boxes are spaced in Y by {DY}. // The final position is like the initial one but 2 boxes down the line. #local with_pedestals = 1; // Set only one of these: #local test_jumper = 0; #local test_jumping = 0; #local do_frame = 1; #declare tx_stripes = texture{ pigment{ gradient z color_map{ [ 0.0 color rgb < 0.000, 0.000, 0.000 > ] [ 0.5 color rgb < 0.000, 0.000, 0.000 > ] [ 0.5 color rgb < 0.000, 0.800, 1.000 > ] [ 1.0 color rgb < 0.000, 0.800, 1.000 > ] } } finish{ diffuse 0.9 ambient 0.1 } scale 2 } #declare tx_plastic_red_dk = texture{ pigment{ color rgb < 0.800, 0.150, 0.050 > } finish{ diffuse 0.80 ambient 0.02 specular 0.18 roughness 0.005 } } #declare tx_plastic_red_lt = texture{ pigment{ color rgb < 1.000, 0.100, 0.100 > } finish{ diffuse 0.80 ambient 0.02 specular 0.18 roughness 0.005 } } #declare tx_plastic_yellow_dk = texture{ pigment{ color rgb < 1.000, 0.850, 0.050 > } finish{ diffuse 0.80 ambient 0.02 specular 0.18 roughness 0.005 } } #declare tx_plastic_yellow_lt = texture{ pigment{ color rgb < 1.000, 0.900, 0.100 > } finish{ diffuse 0.80 ambient 0.02 specular 0.18 roughness 0.005 } } #declare tx_matte_green_dk = texture{ pigment{ color rgb < 0.020, 0.300, 0.005 > } finish{ diffuse 0.95 ambient 0.05 } } #declare tx_glass_red = texture{ pigment{ color rgb < 1.000, 0.250, 0.200 > filter 0.90 } finish{ diffuse 0.03 reflection 0.05 ambient 0.02 specular 0.15 roughness 0.005 } } #declare tx_tiles = texture{ pigment{ checker color rgb < 0.500, 0.850, 0.600 >, color rgb < 1.000, 0.980, 0.600 > } finish{ diffuse 0.90 ambient 0.10 } scale DY/4 } # #declare lol = # texture{ # pigment{ color rgb < 0.0, 0.5, 0.8 > } # finish{ diffuse 0.8 ambient 0.01 specular 0.5 roughness 0.005 } # } # # #declare tx_plastico = # texture{ # pigment{ color rgb < 0.80, 0.90, 0.90 > } # finish{ diffuse 0.8 ambient 0.01 specular 0.5 roughness 0.005 } # } # # #declare tx_plastico2 = # texture{ # pigment{ color rgb < 0.90, 0.90, 0.90 > } # finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } # } # # #declare tx_fosca = # texture{ # pigment{ color rgb < 1.00, 0.80, 0.10 > } # finish{ diffuse 0.9 ambient 0.1 } # } # # #declare tx_fosca2 = # texture{ # pigment{ color rgb < 0.50, 0.50, 0.10 > } # finish{ diffuse 0.9 ambient 0.1 } # } # # #declare tx_espelho = # texture{ # pigment{ color rgb < 1.00, 0.85, 0.30 > } # finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } # } # #local tx_leg_1 = texture{ tx_plastic_red_lt } #local tx_bod_1 = texture{ tx_plastic_red_dk } #local tx_leg_2 = texture{ tx_plastic_yellow_lt } #local tx_bod_2 = texture{ tx_plastic_yellow_dk } // #local tx_bas = texture{ tx_matte_green_dk } // #local tx_bas = texture{ tx_tiles } #local tx_bas = texture{ tx_stripes } #local A_hip_lo = +05; #local A_hip_hi = +30; #local A_kne_lo = -2*A_hip_lo; #local A_kne_hi = -2*A_hip_hi; #local A_ank_lo = -(A_hip_lo + A_kne_lo); #local A_ank_hi = -(A_hip_hi + A_kne_hi); #macro base() box{ < -0.2499, -0.2499, -99.9999 >, < +0.2499, +0.2499, -0.0001 > scale DY texture{ tx_bas } } #end #if (test_jumper) // Test of single static jumper: object{ jumper(L_upp,L_low,L_fot,R_leg,tx_leg, L_bod,R_bod,tx_bod, 45,-45,+45, -30,-60,0) } #end #if (test_jumping) #local ystep = 3.0; #local N = 15; #local p0 = < -10, 0, 0 >; #local p1 = < 000, 0, 5 >; #local p2 = < +10, 0, 0 >; union{ #local i = 0; #while (i <= N) #local pos = 0.25 + 0.25*(i/N); object{ jumper_double_jump(0.50,p0,10,p1,10,p2,-90, pos, tx_bod_1,tx_leg_1) translate ystep*(i - N/2)*y } #local i = i + 1; #end } #end #if (do_frame) // Tops of pedestals: #local T_X = < 0, -4*DY, 06 >; #local T_Y = < 0, -3*DY, DZ+06 >; #local T_Z = < 0, -2*DY, 06 >; #local T_A = < 0, -1*DY, DZ+06 >; #local T_B = < 0, 00*DY, 06 >; #local T_C = < 0, +1*DY, DZ+06 >; #local T_D = < 0, +2*DY, 06 >; #local T_E = < 0, +3*DY, DZ+06 >; #local T_F = < 0, +4*DY, 06 >; union{ object{ jumper_double_jump(1.00,T_A,10,T_B,10,T_C, 000, tt, tx_bod_1,tx_leg_1) } object{ jumper_double_jump(0.75,T_C,20,T_A,20,T_Z, 180, tt, tx_bod_2,tx_leg_2) } #if (with_pedestals) object{ base() translate T_X } object{ base() translate T_Y } object{ base() translate T_Z } object{ base() translate T_A } object{ base() translate T_B } object{ base() translate T_C } object{ base() translate T_D } object{ base() translate T_E } object{ base() translate T_F } #end } #end #end