HexaCone/gadgets.inc
2025-04-22 00:49:18 +02:00

109 lines
2.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
*/
#version 3.7;
// =======================================================
#macro HexaPole ()
#local R = 0.06;
#local E = 0.61;
#local H = H_cone*4;
union {
#for (A, 0, 359, 60)
#local Xp = E * cos(radians(A));
#local Zp = E * sin(radians(A));
#local Ha = rand(Rng1);
union {
cylinder { 0, y*H, R }
sphere { 0, R*2 scale <1, 0.666, 1> }
sphere { 0, R*2 scale <1, 0.666, 1> translate y*H }
#if (Ha < 0.30)
texture { T_Chrome_1A }
#elseif (Ha < 0.60)
texture { T_Chrome_4D }
#elseif (Ha < 0.90)
texture { T_Brass_2C }
#else
texture { Soft_Silver }
#end
translate <Xp, 0, Zp>
}
#end
}
#undef E
#undef H
#undef R
#end
// =======================================================
#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, Zpos> }
#end
#undef Rk
}
}
// =======================================================