HexaCone/gadgets.inc
2025-05-09 20:06:14 +02:00

153 lines
3.3 KiB
PHP

/*
* H E X A C O N E - G A D G E T S
* nouveau projet du Thu Dec 5 11:37:05 AM UTC 2024
*/
/* ======================================================= */
#declare Horloge = object
{
#local Texte = str(NormClock, 6, 4);
#debug concat("Texte horloge ", Texte, "\n\n")
text {
ttf "datas/DSEG7Classic-Regular.ttf" Texte 0.1, 0
texture { T_WIP_alert }
}
scale 3.00
rotate 90*x
translate <-4.5, 0.02, 0>
}
// =======================================================
#macro Base_hexapole ()
prism {
linear_sweep
linear_spline
0, // sweep the following shape from here ...
1, // ... up through here
7, // the number of points making up the shape ...
<3,5>, <-3,5>, <-5,0>, <-3,-5>, <3, -5>, <5,0>, <3,5>
#if (rand(Rng1) < 0.5)
texture { T_Beton_1 }
#else
texture { T_Beton_2 }
#end // if
}
#end // macro
// ------------------------------------------------------ ##
#macro HexaPole_tubes ()
#local R = 0.06;
#local E = 0.666666;
#local H = H_cone*3;
union {
#for (A, 0, 359, 60)
#local Xp = E * cos(radians(A));
#local Zp = E * sin(radians(A));
union {
#local H2 = H + rand(Rng1) + rand(Rng1);
cylinder { 0, y*H2, R }
sphere { 0, R*2 scale <1, 0.666, 1> }
sphere { 0, R*2 scale <1, 0.666, 1> translate y*H2 }
#local Ra = rand(Rng1);
#if (Ra < 0.30)
texture { T_Chrome_1A }
#elseif (Ra < 0.60)
texture { T_Chrome_4D }
#elseif (Ra < 0.90)
texture { T_Brass_2C }
#else
texture { Soft_Silver }
#end
translate <Xp, 0, Zp>
}
#end
}
#undef E
#undef H
#undef R
#end
// ------------------------------------------------------ ##
#macro HexaPole ()
union {
object { Base_hexapole () scale <0.33, 0.2, 0.33> }
object { HexaPole_tubes () translate y*0.2 }
rotate y*(33*rand(Rng1))
}
#end // macro
// =======================================================
#declare OpenBox = object
{
union {
#local R = 0.010;
/* les verticales */
cylinder { <-1, -1, -1>, <-1, 1, -1>, R }
cylinder { < 1, -1, -1>, < 1, 1, -1>, R }
cylinder { <-1, -1, 1>, <-1, 1, 1>, R }
cylinder { < 1, -1, 1>, < 1, 1, 1>, R }
/* en bas */
cylinder { < 1, -1, 1>, <-1, -1, 1>, R }
cylinder { < 1, -1, -1>, <-1, -1, -1>, R }
cylinder { <-1, -1, 1>, <-1, -1, -1>, R }
cylinder { < 1, -1, 1>, < 1, -1, -1>, R }
/* en haut */
cylinder { < 1, 1, 1>, <-1, 1, 1>, R }
cylinder { < 1, 1, -1>, <-1, 1, -1>, R }
cylinder { <-1, 1, 1>, <-1, 1, -1>, R }
cylinder { < 1, 1, 1>, < 1, 1, -1>, R }
#undef R
texture { Soft_Silver scale 6.50 }
}
}
// =======================================================
/*
* first written macro for testing the generation of
* differente instances of the same shape.
*/
#macro Bubble ()
sphere {
0, 0.070
#local R = rand(Rng1);
#if ( R < 0.333 )
texture { Ruby_Glass }
#elseif ( R < 0.666 )
texture { Orange_Glass }
#else
texture { Gold_Nugget }
#end
#undef R
scale <1.414, 1.000, 1.414>
}
#end
#macro Un_Machin ()
union {
#for (Y, 1, 8, 1)
object { Bubble() translate y*Y*0.11 }
#end
}
#end
#declare Les_Machins = object
{
union {
#local Rk = 3.90 + NormClock;
#for (foo, 0, 359, 45)
#local Xpos = Rk * sin(radians(foo));
#local Zpos = Rk * cos(radians(foo));
object { Un_Machin () translate <Xpos, 0.20, Zpos> }
#end
#undef Rk
}
}
// =======================================================