Files
HexaCone/essai.pov
2026-03-14 14:38:41 +01:00

459 lines
11 KiB
POVRay

/*
* H E X A C O N E - E S S A I
* nouveau projet du Thu Dec 5 11:37:05 AM UTC 2024
*/
#version 3.7;
// #declare DEBUG_LEVEL = 1; // un nouveau test ?
#include "globals.inc"
#declare NO_DYNAMIC = 1;
#include "all.inc"
/*
* il faut faire le tri ici !
-* __________________________
*/
// =======================================================
// nouveau du 25 février 2026
#macro Un_Autre_Cube (Ratio)
difference {
#local D = 1.000000;
box { <-D, -D, -D>, <D, D, D> }
#local V = Ratio * D;
#local M = D * 1.1;
box { <-M, -V, -V>, <M, V, V> }
box { <-V, -M, -V>, <V, M, V> }
box { <-V, -V, -M>, <V, V, M> }
texture { Flashy scale 4 }
}
#end
// =======================================================
// nouveau du 10 février 2026
//
#macro Anemone_A (E, H)
union {
#for (foo, 0, 5)
#local A = (NormClock*3) + (0.5*radians(foo*60));
#local DX = (E+rand(Rng1)) * sin(A);
#local DZ = (E+rand(Rng1)) * cos(A);
cone {
y*(H/(5+rand(Rng1))), 0.01, <DX, H, DZ>, 0.001
#local Rv = 0.7 + (0.2*rand(Rng1));
#local Gv = 0.6 + (0.3*rand(Rng1));
#local Bv = 0.6 + (0.4*rand(Rng1));
texture {
pigment { rgb <Rv, Gv, Bv> }
normal { dents 6.66 scale 0.03+(0.12*rand(Rng1)) }
finish { phong 0.51 reflection 0.08 }
}
}
sphere { 0, 0.45 scale <1, 0.717, 1> texture { T_WIP_color } }
#end // for
}
#end // macro
#declare Des_Anemones = object
{
union {
object { Anemone_A (3.00-NormClock, 1.50+NormClock)
translate < 4, 0, 0> }
object { Anemone_A (2.40-NormClock, 2.50+NormClock)
translate <-4, 0, 0> }
object { Anemone_A (1.40+NormClock, 1.50*NormClock)
translate < 0, 0, -4> }
object { Anemone_A (1.40+NormClock, 1.50-NormClock)
translate < 0, 0, 4> }
}
}
// =======================================================
/*
* new Thu Dec 18 01:14:19 AM UTC 2025
* 14 janvier 2026, j'ajoute un truc pour {enfin} gérer
* un DEBUG_LEVEL correct.
*/
#macro Le_ConeStack ()
#ifdef (DEBUG_LEVEL)
#debug "Cone Stack : DEBUG_LEVEL activated\n"
#fopen Log "WS/log.essai" write
#end // debug level
union {
#local Hcs = 0.550;
#local Rco = R_basecone * 3.333;
#for (Foo, 0, 5)
#local Dx = 0.385 * sin(Foo+NormClock);
#local Dy = Foo * (Hcs + 0.0333);
#local Dz = 0.385 * cos(Foo+NormClock);
#local DV = <Dx, Dy, Dz>;
#ifdef (DEBUG_LEVEL)
#write (Log, Foo, " ", DV, "\n")
#end
union {
cone { 0, Rco, <0, Hcs, 0>, 0.001
#if (rand(Rng1) < 0.50) texture { Y_Texture }
#else texture { M_Texture }
#end // if rand
}
cylinder { 0, -0.08*y, Rco
#if (rand(Rng1) < 0.50) texture { R_Texture }
#else texture { G_Texture }
#end // if rand
}
translate DV
}
#end // for Foo
}
#ifdef (DEBUG_LEVEL)
#fclose Log
#end // debug level
#end // macro
// =======================================================
#macro HexoFlash_body (Ra, He)
merge {
cylinder { 0, y*He, Ra }
sphere { y*He, Ra }
/* XXX
* faire la place pour la lampe
*/
texture { LeGris }
}
#end // macro
#macro HexoFlash_light (Ra, Val)
difference {
sphere { 0, Ra*1.46 }
#local WB = 0.08;
#local H1 = -0.10;
#local H2 = 0.10;
union {
box { <-1, H1, -WB>, <1, H2, WB> }
box { <-WB, H1, -1>, <WB, H2, 1> }
}
texture {
#if (rand(Rng1) < 0.70) pigment { color Orange }
#else pigment { color Orange }
#end
finish { emission 0.8 }
}
scale <1, 1.2, 1>
}
#end // macro
#macro HexoFlash (Ra, He)
union {
#local Ha = 2+rand(Rng1);
#local Hb = Ha * 0.8;
object { HexoFlash_body (Ra, Ha) }
object { HexoFlash_light (Ra, Ha)
translate y*Hb }
}
#end // macro
// =======================================================
/*
* nouveau du 25 octobre 2025
*/
#declare Obj_BasicTexture = object
{
#local R = 0.385;
#local H = 1.51;
merge {
cylinder { 0, y*H, R }
sphere { 0, R scale <1, 0.50, 1> translate y*H }
difference {
#local R1 = R+0.46;
#local R2 = R+0.63;
box { <-0.19, 0, -0.17>, <R+0.4, H*0.48, R+0.6> }
cylinder { <R1, -1, R2>, <R1, 1, R2>, 0.33 }
}
}
}
// ------------------------------------
#declare Texture_du_Vase = texture
{
pigment {
gradient y
color_map {
[ 0.000 color Green ]
[ 0.333 color Gray ]
[ 0.500 color Orange ]
[ 0.666 color Gray50 ]
[ 1.000 color Green ]
}
turbulence 1.24 // piturb :)
scale <1, 0.25, 1>
rotate <10, 0, 4>
}
finish { phong 0.25 }
}
// -------------------------------------------------------
// the place to try new textures
#declare ProtoTextures = object
{
#local TX = 2.55;
#local TZ = 2.95;
#local Kro = 32 + (NormClock * 77);
union {
object { Obj_BasicTexture texture { R_Texture }
rotate y * (rand(Rng1)*Kro)
translate <TX, 0, -TZ> }
object { Obj_BasicTexture texture { Texture_du_Vase }
rotate y * (rand(Rng1)*Kro)
translate <TX, 0, 0> }
object { Obj_BasicTexture texture { B_Texture }
rotate y * (rand(Rng1)*Kro)
translate <TX, 0, TZ> }
object { Obj_BasicTexture texture { T_WIP_dents }
rotate y * (rand(Rng1)*Kro)
translate <-TX, 0, TZ> }
object { Obj_BasicTexture texture { T_WIP_rasta }
rotate y * (rand(Rng1)*Kro)
translate <-TX, 0, 0> }
object { Obj_BasicTexture texture { T_WIP_bluewave }
rotate y * (rand(Rng1)*Kro)
translate <-TX, 0, -TZ> }
object { Repere scale 1.5 translate y*0.5 }
}
}
// =======================================================
/* Les choses, c'est l'espèce de vase avec des tiges
qui bougent, je devrais trouver un nom plus parlant.
- - - - -
Mieux, on garde la chose mais on en dérive le vase
*/
// ------------------------------------
#macro Vase_le_corps_a ()
intersection {
box { <-5, -5, -5>, <5, 0, 5> }
difference {
sphere { 0, 0.34 }
sphere { 0, 0.30 }
scale <1, 1.60, 1>
}
#local R = rand(Rng1);
#if (R < 0.75)
texture { Texture_du_Vase rotate y*(clock*3) }
#else
texture { T_WIP_redwave scale 0.15 + 0.333*rand(Rng1)
rotate <75*rand(Rng1), 75*rand(Rng1), 75*rand(Rng1)>
}
#end
}
#end
// ------------------------------------
// des poignées sur le haut du vase
// XXX pas vraiment au point !
#macro Vase_le_corps_b ()
union {
#for (foo, 0, 359.999, 60)
#local Dx = 0.33 * sin(radians(foo));
#local Dz = 0.32 * cos(radians(foo));
torus { 0.025, 0.015 scale <1, 1.2, 4>
rotate z*42 rotate y*(foo-90)
translate <Dx, 0, Dz>
} // torus
#end // end for (foo
texture { G_Texture }
}
#end // end macro
// ------------------------------------
// ASSEMBLER LE CORPS
#macro Vase_le_corps ()
union {
object { Vase_le_corps_a () }
object { Vase_le_corps_b () }
// this 'translate' must be computed ?
translate y*0.95
}
#end
// ------------------------------------
// LE PIED
#macro Vase_le_pied ()
union {
cylinder { 0, y*0.80, 0.08 }
cylinder { 0, y*0.08, 0.20 }
sphere { 0, 0.20 scale <1, 0.15, 1> translate y*0.08 }
texture { T_WIP_dents scale 0.15 }
}
#end
// ------------------------------------
// LES TIGES
#macro Vase_les_tiges ()
union {
#local CK = NormClock * (7.876+rand(Rng1));
#for (Foo, 0, 9)
// tout cela est bien tortueux !
#local CK2 = CK + Foo;
#local C2X = (R_C + 0.051) * sin(CK2+rand(Rng1)) * sin(CK*3);
#local C2Z = (R_C + 0.051) * (sin(-CK2+rand(Rng1)) *
cos(CK*(rand(Rng1))));
#local Rt = 0.02+(0.02*Cos_010(NormClock))-0.03*rand(Rng1);
#local H = 0.38 + 0.65*rand(Rng1);
union {
cylinder { 0, <C2X, H, C2Z>, Rt }
sphere { <C2X, H, C2Z>, Rt }
#local R = rand(Rng1);
#if (R < 0.25) texture { tPlasticOrange }
#elseif (R < 0.50) texture { tPlasticBlue }
#elseif (R < 0.65) texture { tPlasticPrune }
#else texture { tPlasticGreen }
#end // if
}
#end // for
translate y*0.87
}
// #debug "== Fin Vase les tiges\n"
#end // macro
// ------------------------------------
// ------------------------------------
#macro Vase ()
union {
Vase_le_pied ()
Vase_le_corps ()
Vase_les_tiges ()
}
#end // macro
// ------------------------------------
// =======================================================
#declare Des_Choses = object
{
union {
object { Vase () scale 2 translate < 2.2, 0, 2.52> }
object { Vase () scale 1.4 translate <-2.9, 0, 3.91> }
object { Chose () scale 2 translate < 2.9, 0, -4.07> }
object { Vase () translate <-4.5, 0, -4> }
object { Repere translate 0.15*y }
}
}
// =======================================================
// =======================================================
#declare GyroTrucs = object
{
union {
#for (I, 0, 359, 20)
#declare E = 12 + (3*rand(Rng1));
#declare Dx = E * sin(radians(I));
#declare Dz = E * cos(radians(I));
#local R = rand(Rng1);
#if (R > 0.82)
object { GyroPhare () translate <Dx, 0, Dz> }
#elseif (R > 0.65)
object { Obj_BasicTexture
texture { T_WIP_redwave }
scale 0.75
rotate y * (5*(.5-rand(Rng1))*clock)
translate <Dx, 0, Dz> }
#else
object { HexoFlash (0.16, 2.01)
translate <Dx, 0, Dz> }
#end
#end // for
}
}
object { GyroTrucs }
// ========================================================##
#declare Architecture = object
{
union {
object { Portique_A () translate z*6.5 }
object { Portique_A () scale 1.6 translate z*2 }
object { Portique_A () scale 1.2 }
object { Portique_A () scale 1.4 translate -z*3 }
object { Portique_A () rotate y*9 translate -z*6.5 }
// object { Fleche translate y }
}
}
// ------------------------------------------------------ ##
#debug " !!! ACTION !!!\n"
#local Rv = 0.5 + (0.1*sin(clock*0.113));
#local Gv = 0.21;
#local Bv = 0.25 * abs(sin(clock*0.014));
light_source {
<-32, 40, -7>
colour <Rv, Gv, Bv>
parallel
point_at 0
}
// ------------------------------------------------------ ##
#declare Selector = int(clock/90);
#debug concat("Selector = ", str(Selector, 6, 0), "\n")
#declare AngleCam = 27 - 3*Cos_01(NormClock);
#switch (Selector)
#case (0)
object { Des_Choses }
#local AngleCam = 17;
#break
#case (1)
object { Des_Anemones }
object { Repere translate y*0.08 }
#break
#case (2)
object { HoleBorder_B (2.222) }
object { ProtoTextures }
#break
#case (3)
object { HorlogeDouble scale 2 rotate -y*(6*clock) }
// object { Repere translate y*1 }
#break
#case (4)
object { Un_Autre_Cube (0.666) rotate y*42 translate <3, 1.8, 0> }
object { Un_Autre_Cube (0.888) translate <0, 1.8, 2> }
#break
#end // switch selector
plane {
y, 0
texture { Ground_Texture }
}
// =======================================================
#local CamX = -2.7 + (1.8*Cos_010(NormClock));
#local CamY = 0.61 + (0.9*exp(NormClock));
#local CamZ = -5.777 + (1.2*Cos_01(NormClock));
#local K = 8.6;
#local CamX = CamX * K;
#local CamY = CamY * K * 0.41;
#local CamZ = CamZ * K;
camera {
orthographic
location <CamX, CamY, CamZ>
look_at <0, 1.5, 0>
right <image_width/image_height, 0, 0>
angle AngleCam
}