big refactoring: step 1

This commit is contained in:
Tonton Th 2024-12-29 04:56:10 +01:00
parent adf59ceff6
commit 090981d84c
13 changed files with 150 additions and 63 deletions

View File

@ -1,12 +1,16 @@
POVOPT = +q9 +a0.02 -d
POVDEP = contexte.inc elements.inc datas/hf.png
POVDEP = contexte.inc elements.inc \
globals.inc datas/hf.png
PNG: essai.png scene.png
PNG: essai.png scene.png topview.png
topview.png: topview.pov Makefile $(POVDEP)
povray $(POVOPT) -K200 -W1280 -H1024 -i$< -o$@
essai.png: essai.pov Makefile $(POVDEP)
povray $(POVOPT) -W800 -H600 -i$< -o$@

View File

@ -2,6 +2,43 @@
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
#declare Rng2 = seed(now*24*60*60);
#declare foo = rand(Rng2);
/* ------------------------------------------------------------ */
#declare Rhxba = 0.30;
#declare R2hxba = Rhxba * 0.48;
#declare HexaBalls = object
{
merge {
sphere { 0, Rhxba }
#local E = Rhxba * 1.260;
sphere { 0, R2hxba translate <-E, 0, 0> }
sphere { 0, R2hxba translate < E, 0, 0> }
sphere { 0, R2hxba translate < 0, -E, 0> }
sphere { 0, R2hxba translate < 0, E, 0> }
sphere { 0, R2hxba translate < 0, 0, -E> }
sphere { 0, R2hxba translate < 0, 0, E> }
}
}
object { HexaBalls
texture { Lightning1 scale 0.33 }
rotate <clock/3, clock/6, clock/9>
translate <3, 0.72, 5>
}
object { HexaBalls
texture { Lightning2 scale 0.33 }
rotate <-clock, clock*0.62, clock>
translate <5, 0.92, -4>
}
/* ------------------------------------------------------------ */
height_field {
png "datas/hf.png"
smooth
@ -44,15 +81,15 @@ light_source {
#if (1)
light_source {
<-5, 5.50, 8>
<-5, 5.60, 8>
#if ( (clock > 290) & (clock<344) )
#local Couleur = rgb <0.20, 0.20, 0.80>;
#local Couleur = rgb <0.20, 0.20, 0.90>;
#else
#local Couleur = rgb <0.80, 0.80, 0.70>;
#end
color Couleur
spotlight
radius 8
radius 9
falloff 10
tightness 5
point_at <0, 0.95, -0.22>

View File

@ -35,11 +35,11 @@ union {
}
// clignotement de la lumiere \o/
#local kR = 0.083;
#local xR = (rand(R2)-0.5000) * kR;
#local yR = (rand(R2)-0.5000) * kR;
#local zR = (rand(R2)-0.5000) * kR;
#local Red = abs(sin(NormClock * 65.536));
#local Red = Red * rand(R2);
#local xR = (rand(Rng2)-0.5000) * kR;
#local yR = (rand(Rng2)-0.5000) * kR;
#local zR = (rand(Rng2)-0.5000) * kR;
#local Red = abs(sin(NormClock * 55.536));
#local Red = Red * rand(Rng2);
light_source { <xR, yR, xR>, rgb <Red, 0.03, 0.03>
fade_distance 0.99
fade_power 1.58
@ -198,7 +198,7 @@ texture { T_Brass_1C }
{
union {
object { Tuyere }
object { Le_rotor rotate x*(clock*3) translate -0.08*x }
object { Le_rotor rotate x*(clock*3.8) translate -0.06*x }
}
}
@ -225,5 +225,5 @@ union {
object { HexaCone_derives translate <0, 0, -0.67> }
object { Les_Reacteurs translate -0.18*y }
}
rotate <-3, 0, -4>
rotate < 3, 0, -4>
}

View File

@ -2,4 +2,4 @@
source ./fonctions.sh
ff_encodage
ff_encodage essai wip.mp4

View File

@ -1,17 +1,11 @@
/*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
#version 3.7;
global_settings {
assumed_gamma 1.0
ambient_light 0
max_trace_level 10
}
#declare R2 = seed(clock);
#declare foo = rand(R2);
#include "globals.inc"
#include "colors.inc"
#include "metals.inc"
@ -23,16 +17,21 @@ global_settings {
// =======================================================
// =======================================================
object { HexaBalls
#local SC = 0.10 + abs(sin(NormClock * 3.14159));
texture { Lightning2 scale SC }
translate <0, 1, 0> }
// =======================================================
object { Reacteur translate <0, 1, 0> }
light_source { <-6, 7, -4>, rgb <0.81, 0.65, 0.40> }
light_source { <-6, 7, 4>, rgb <0.31, 0.65, 0.80> }
light_source { <-6, 7, -5>, rgb <0.81, 0.65, NormClock> }
light_source { <-6, 7, 5>, rgb <0.31, NormClock, 0.80> }
light_source { < 6, 7, 4>, rgb <1-NormClock, 0.28, 0.80> }
camera {
location <-0.91, 1.01, 0.20>
location <-1.20, 1.81, 1.59>
look_at <0, 1.0, 0>
angle 32
angle 90
}

View File

@ -3,14 +3,20 @@ set -eu
ff_encodage()
{
ffmpeg -nostdin \
-y -r 30 -f image2 -i frames/%05d.png \
-metadata artist='--[ tTh ]--' \
-metadata title='-- HexaCone --' \
-c:v libx264 \
-pix_fmt yuv420p \
-tune film \
wip.mp4
SRCDIR="$1"
FILMNAME="$2"
ffmpeg -nostdin \
-y -r 30 -f image2 -i frames/${SRCDIR}/%05d.png \
-metadata artist='--[ tTh ]--' \
-metadata title='-- HexaCone --' \
-c:v libx264 \
-pix_fmt yuv420p \
-tune film \
$FILMNAME
echo "$SRCDIR encoded to $FILNAME" | tee -a WS/log
wc -c full.mp4 | tee -a WS/log
}
mp_encodage()

6
globals.inc Normal file
View File

@ -0,0 +1,6 @@
global_settings {
assumed_gamma 1.0
ambient_light rgb <0.18, 0.14, 0.17>
max_trace_level 10
}

37
linkfarmer.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
set -e ; set -u
source ./fonctions.sh
IDX=0
SPOOL="frames/Spool"
linkfarm ()
{
SRC="frames/$1"
echo "linkfarm $SRC" | tee -a WS/log
for src in "$SRC"/*
do
dstname=$(printf "%s/%05d.png" $SPOOL $IDX)
echo "$src -> $dstname"
# ln --force --symbolic $src $dstname
cp -f $src $dstname
IDX=$(( IDX + 1 ))
done
sync
}
linkfarm topview
linkfarm passage
linkfarm scene
linkfarm essai
ff_encodage Spool full.mp4

View File

@ -5,27 +5,28 @@ source fonctions.sh
set -e ; set -u
TYPE="mp4"
SEQNAME="$1"
NBFRAMES=360
case $TYPE in
"gif89a") DIMS="-W640 -H480" ;;
"mp4") DIMS="-W1024 -H768" ;;
esac
POVOPT="+q9 +a0.02 -d ${DIMS} -WT8"
POVOPT="+q9 +a0.02 -d ${DIMS} -WT6"
echo $POVOPT ; echo ; sleep 2
TMPIMG=/dev/shm/tmpimg.png
TMPIMG=/dev/shm/${SEQNAME}-tmp.png
for frame in $(seq 0 $((NBFRAMES-1)))
do
img=$(printf "frames/%05d.png" $frame)
img=$(printf "frames/%s/%05d.png" $SEQNAME $frame)
debut=$(date +%s)
set +e
povray ${POVOPT} +K${frame} -iscene.pov -o${TMPIMG}
povray ${POVOPT} +K${frame} -i${SEQNAME}.pov -o${TMPIMG}
err=$?
if [ $err != 0 ] ; then
echo "fail $frame" >> WS/log
echo "$SEQNAME fail $frame" >> WS/log
sleep 4
continue
fi
@ -33,7 +34,7 @@ do
txt=$(printf "#%03d" $frame)
echo $frame $img $txt
convert ${TMPIMG} \
-pointsize 24 \
-pointsize 16 \
-fill orange \
-gravity south \
-annotate +0+0 "$txt" \
@ -49,7 +50,5 @@ echo
case $TYPE in
"gif89a") convert -delay 8 -dither none \
-colors 102 frames/* foo.gif ;;
"mp4") ff_encodage ;;
"mp4") ff_encodage $SEQNAME wip-${SEQNAME}.mp4 ;;
esac
ls -lh foo.gif

View File

@ -1,4 +1,5 @@
/*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
@ -17,17 +18,17 @@
// ---------------------------------------
#declare PosX = 0;
#declare PosY = 1.40;
#declare PosZ = (NormClock-0.5) * 7.54;
#declare PosY = 1.20 + (NormClock*0.20);
#declare PosZ = (NormClock-0.5) * 8.44;
object { HexaCone translate <PosX, PosY, PosZ> }
camera {
location <-2, 1.23, 9>
location <-1.50, 1.23, 9>
look_at <PosX, 1.50, PosZ>
// focal_point <0, 1, 0>
// aperture 0.046
// blur_samples 30
angle 40 + (NormClock * 22)
angle 36
}

View File

@ -18,14 +18,13 @@ BEGIN { \
count[$1]++; \
if (mini[$1] > $2) mini[$1] = $2; \
if (maxi[$1] < $2) maxi[$1] = $2; \
last[$1] = $2; \
} \
END { \
for (foo=0; foo<nbrames; foo++) { \
if (count[foo] > 0) { \
mean = accu[foo] / count[foo]; \
printf "%4d %4f %4d %4d %4d\n", foo, mean, \
mini[foo], maxi[foo], last[foo]; \
printf "%4d %4f %4d %4d\n", foo, mean, \
mini[foo], maxi[foo]; \
} \
}
} \
@ -40,8 +39,7 @@ gnuplot << __EOC__
set title "HexaCone : temps de tracé vs. numéro de séquence"
set xlabel "numéro de la trame"
set ylabel "temps en secondes"
plot "/dev/shm/plot-timing.tmp" u 1:2 w l t "moyenne", \
plot "/dev/shm/plot-timing.tmp" u 1:4 w l t "maximum", \
"/dev/shm/plot-timing.tmp" u 1:3 w l t "minimum", \
"/dev/shm/plot-timing.tmp" u 1:4 w l t "maximum", \
"/dev/shm/plot-timing.tmp" u 1:5 w l t "dernier"
"/dev/shm/plot-timing.tmp" u 1:2 w l t "moyenne",
__EOC__

View File

@ -1,22 +1,16 @@
/*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
#version 3.7;
global_settings {
assumed_gamma 1.0
ambient_light rgb <0.04, 0.07, 0.04>
max_trace_level 10
}
#include "globals.inc"
#include "colors.inc"
#include "metals.inc"
#include "textures.inc"
#declare R2 = seed(now*24*60*60);
#declare foo = rand(R2);
#declare NormClock = clock / 360.0;
#include "contexte.inc"
#include "elements.inc"

View File

@ -1,4 +1,5 @@
/*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
@ -16,7 +17,12 @@
light_source { <-16, 17, -24>, rgb <0.51, 0.65, 0.40> }
object { HexaCone rotate y*clock translate y*1.11 }
#declare TrX = 2 * sqrt(NormClock);
#declare TrY = 1.11 + (5 * sqrt(NormClock));
#declare TrZ = 3 * sqrt(NormClock);
#declare TrH = <TrX, TrY, TrZ>;
object { HexaCone translate TrH }
camera {
location <-3.60, 19.60-NormClock, 21.09>