enhance your spline seq

This commit is contained in:
Tonton Th 2025-10-22 03:00:56 +02:00
parent fc8ae98193
commit fcb1fb7467

View File

@ -17,7 +17,7 @@
object { Le_Decor }
// #include "dynamic.inc"
#include "dynamic.inc"
// =======================================================
#declare Spline_1 =
spline {
@ -28,48 +28,99 @@ object { Le_Decor }
0.2, < 2, 1.0, -2>,
0.4, < 2, 1.5, 0>,
0.6, < 0, 2.2, 0>,
0.8, <-1, 1.0, 2>,
0.8, <-1, 0.8, 2>,
1.0, < 2, 1.0, 2>, // end point
1.2, < 4, 1.0, 2> // control point
}
#local Scaler = <2, 1, 3>;
#declare ViewSpline = object
{
#local Scaler = <2, 1, 2>;
union {
#for (CK, 0.00, 1.00, 0.0034)
sphere { <0,0,0>, 0.034
#for (CK, 0.00, 1.00, 0.0025)
sphere { <0,0,0>, 0.030
texture{
pigment {color rgb <0.20, 0.90, 0.20> }
finish {ambient 0.15 diffuse 0.85 phong 1}
pigment {color rgb <0.20, 0.14, 0.14> }
finish {ambient 0.15 diffuse 0.85 phong 0.6 }
}
translate (Scaler * Spline_1(CK))
}
#end // for loop
sphere {
0, 0.09
texture { WIP_color }
translate (Scaler * Spline_1(NormClock))
}
} // closing union
}
object { ViewSpline scale 10 translate y*3 }
#declare AllTheSpline = object
{
#local K1 = 0.90 - (NormClock * 0.003);
#local K2 = 1.00 - K1;
#local V1 = NormClock * K1;
#local V2 = V1 + K2;
union {
object { ViewSpline }
#declare P1 = Scaler * Spline_1(V1);
#declare P2 = <1, -1.3, 0.1> + (0.95 * Scaler * Spline_1(V2));
sphere {
0, 0.06
pigment { color Blue }
translate P1
}
sphere {
0, 0.06
pigment { color Red }
translate P2
}
cylinder {
P1, P2, 0.017
pigment { color Green }
}
finish { ambient 0.15 diffuse 0.65 phong 0.4 }
}
#fopen KP "WS/spline.log" append
#write (KP, clock, " / ", NbFrames, " -> ")
#write (KP, NormClock, " ", K1, " ", K2, " = ", V1, " ", V2, "\n")
#fclose KP
}
// =======================================================
object { Repere scale 8 translate <1, 1, 1> }
#declare Flag = (mod(clock,90) < 45);
#declare Loc_cam = <29-(12*NormClock), 39, 43+(9*exp(NormClock))>;
#if ( Flag )
object { AllTheSpline scale 10 translate y*2 }
#debug " FLAG IS YES\n"
#else
#debug " FLAG IS NO\n"
#end
#local P1B = (P1 * 10) + <0, 2, 0>;
#local P2B = (P2 * 10) + <0, 2, 0>;
#if ( Flag )
#declare Loc_cam = <87-(12*NormClock), 29-NormClock, 4-(9*exp(NormClock))>;
#declare Lat_tmp = Interpolate(P1, P2, 0.50);
#declare Lat_cam = (Lat_tmp * 10) + <0, 2, 0>;
#declare Ang_cam = 105;
#else
#declare Loc_cam = P1B;
#declare Lat_cam = P2B;
#declare Ang_cam = 52;
#end
// vstr(N,A,S,L,P)
#debug concat(" LOC: ", vstr(3, Loc_cam, " ", 6, 3), "\n")
#debug concat(" LAT: ", vstr(3, Lat_cam, " ", 6, 3), "\n")
// object { Repere scale 4 translate Lat_cam }
camera {
location Loc_cam
look_at <0, 1.20, 0>
look_at Lat_cam
// focal_point <0.37, 0.0, 0>
// aperture 0.046
// blur_samples 30
angle 120
angle Ang_cam
}