|
|
Hello Everybody!
I trying to arrange labelled balls on a grid (see subsequent code). The
problem is that the balls look like pool balls. To become more reliable I
would like use uni-colored balls labelled with black text.
error.
In the web I just found examples with text in a glass ball or text growing
out from a ball. Unfortunately all my attempts to modify failed.
Thanks in advance!
Ralf
// Persistence Of Vision raytracer version 3.5 file.
// by Ralf
// 03-06-2004
#include "colors.inc"
#include "functions.inc"
#include "stones.inc"
global_settings {
assumed_gamma 1.8
max_trace_level 32
}
camera {location <7.5,17.5,7.5> look_at <7.5,0,7.5>}
light_source {<7.5,20,7.5> color White}
/* *********************************************************** */
#macro MakeBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
#local Mn = min_extent(Text);
#local Mx = max_extent(Text);
#local PatternObj =
union {
object {Text
translate -Mn - 0.5*(Mx-Mn)
scale x + y + z*1/(Mx.z - Mn.z)
scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -
<Mn.x, Mn.y, 0>) + z
translate -z*1
}
#debug "n"
#debug str((Mx.z - Mn.z),0,0)
#debug "n"
object {Text
translate -Mn - 0.5*(Mx-Mn)
scale -x + y + z*1/(Mx.z - Mn.z)
scale (x+y)*(SpotSize-SpotClearance)/vlength(<Mx.x, Mx.y, 0> -
<Mn.x, Mn.y, 0>) + z
translate z*1
}
difference {
cylinder {-z*2, z*2, 5}
cylinder {-z*2, z*2, SpotSize/2}
}
}
sphere {< 0, 0, 0>, 1
texture {
object {PatternObj texture {WhiteTex}, texture {ColorTex}}
}
}
#end
#macro MakeTextBall(Text, SpotSize, SpotClearance, ColorTex, WhiteTex)
#local TextObj =
text {ttf "crystal.ttf", Text, 1, 0 /* pigment { Black } */
}
MakeBall(TextObj, SpotSize, SpotClearance, ColorTex, WhiteTex)
#end
#declare RedTex =
texture {
pigment {color Red}
}
#declare WhiteTex =
texture {
pigment {color White}
}
#declare BlackTex =
texture {
pigment {color Black}
}
#declare GreenTex =
texture {
pigment {color Green}
}
#declare BlueTex =
texture {
pigment {color Blue}
}
#declare YellowTex =
texture {
pigment {color Yellow}
}
/* Grid */
cylinder {<0, 0, 0>, <15, 0, 0>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 2.5>, <15, 0, 2.5>, 0.05 open texture { T_Stone25 scale
4 }}
cylinder {<0, 0, 5>, <15, 0, 5>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 7.5>, <15, 0, 7.5>, 0.05 open texture { T_Stone25 scale
4 }}
cylinder {<0, 0, 10>, <15, 0, 10>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 12.5>, <15, 0, 12.5>, 0.05 open texture { T_Stone25
scale 4 }}
cylinder {<0, 0, 15>, <15, 0, 15>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<0, 0, 0>, <0, 0, 15>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<2.5, 0, 0>, <2.5, 0, 15>, 0.05 open texture { T_Stone25 scale
4 }}
cylinder {<5, 0, 0>, <5, 0, 15>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<7.5, 0, 0>, <7.5, 0, 15>, 0.05 open texture { T_Stone25 scale
4 }}
cylinder {<10, 0, 0>, <10, 0, 15>, 0.05 open texture { T_Stone25 scale 4
}}
cylinder {<12.5, 0, 0>, <12.5, 0, 15>, 0.05 open texture { T_Stone25
scale 4 }}
cylinder {<15, 0, 0>, <15, 0, 15>, 0.05 open texture { T_Stone25 scale 4
}}
object {MakeTextBall("NM_8", 1.5, 0, GreenTex, WhiteTex)
rotate x*100
rotate z*350
translate z*0
translate y*0
translate x*0
}
object {MakeTextBall("NM_2", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*100
translate z*0
translate y*0
translate x*2.5
}
object {MakeTextBall("DM_10", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*95
rotate z*350
translate z*2.5
translate y*0
translate x*0
}
object {MakeTextBall("DM_4", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
rotate z*350
translate z*5
translate y*0
translate x*0
}
object {MakeTextBall("DM_6", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
translate z*7.5
rotate z*350
translate y*0
translate x*0
}
object {MakeTextBall("TM_2", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
rotate z*350
translate z*10
translate y*0
translate x*0
}
object {MakeTextBall("NM_5", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*85
rotate z*350
translate z*12.5
translate y*0
translate x*0
}
object {MakeTextBall("IM_10", 1.5, 0.1, RedTex, WhiteTex)
rotate x*80
rotate z*350
translate z*15
translate y*0
translate x*0
}
object {MakeTextBall("IM_3", 1.5, 0.1, RedTex, WhiteTex)
rotate x*80
translate z*15
translate y*0
translate x*2.5
}
object {MakeTextBall("IT_3", 1.5, 0.1, YellowTex, BlackTex)
rotate x*85
translate z*12.5
translate y*0
translate x*2.5
}
object {MakeTextBall("TM_1", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
translate z*10
translate y*0
translate x*2.5
}
object {MakeTextBall("DM_3", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
translate z*7.5
translate y*0
translate x*2.5
}
object {MakeTextBall("TM_10", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
translate z*5
translate y*0
translate x*2.5
}
object {MakeTextBall("IT_8", 1.5, 0.1, YellowTex, BlackTex)
rotate x*95
translate z*2.5
translate y*0
translate x*2.5
}
object {MakeTextBall("IT_7", 1.5, 0.1, YellowTex, BlackTex)
rotate x*100
translate z*0
translate y*0
translate x*5
}
object {MakeTextBall("IT_9", 1.5, 0.1, YellowTex, BlackTex)
rotate x*95
translate z*2.5
translate y*0
translate x*5
}
object {MakeTextBall("DM_7", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
translate z*5
translate y*0
translate x*5
}
object {MakeTextBall("TM_6", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
translate z*7.5
translate y*0
translate x*5
}
object {MakeTextBall("DM_9", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
translate z*10
translate y*0
translate x*5
}
object {MakeTextBall("IM_2", 1.5, 0.1, RedTex, WhiteTex)
rotate x*85
translate z*12.5
translate y*0
translate x*5
}
object {MakeTextBall("IT_5", 1.5, 0.1, YellowTex, BlackTex)
rotate x*80
translate z*15
translate y*0
translate x*5
}
object {MakeTextBall("NM_4", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*80
translate z*15
translate y*0
translate x*7.5
}
object {MakeTextBall("IM_9", 1.5, 0.1, RedTex, WhiteTex)
rotate x*85
translate z*12.5
translate y*0
translate x*7.5
}
object {MakeTextBall("NM_10", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*90
translate z*10
translate y*0
translate x*7.5
}
object {MakeTextBall("TM_4", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
translate z*7.5
translate y*0
translate x*7.5
}
object {MakeTextBall("IT_4", 1.5, 0.1, YellowTex, BlackTex)
rotate x*90
translate z*5
translate y*0
translate x*7.5
}
object {MakeTextBall("IT_10", 1.5, 0.1, YellowTex, BlackTex)
rotate x*95
translate z*2.5
translate y*0
translate x*7.5
}
object {MakeTextBall("IT_3", 1.5, 0.1, YellowTex, BlackTex)
rotate x*100
translate z*0
translate y*0
translate x*7.5
}
object {MakeTextBall("NM_9", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*100
translate z*0
translate y*0
translate x*10
}
object {MakeTextBall("TM_9", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*95
translate z*2.5
translate y*0
translate x*10
}
object {MakeTextBall("DM_8", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
translate z*5
translate y*0
translate x*10
}
object {MakeTextBall("TM_5", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
translate z*7.5
translate y*0
translate x*10
}
object {MakeTextBall("NM_6", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*90
translate z*10
translate y*0
translate x*10
}
object {MakeTextBall("IM_8", 1.5, 0.1, RedTex, WhiteTex)
rotate x*85
translate z*12.5
translate y*0
translate x*10
}
object {MakeTextBall("IM_7", 1.5, 0.1, RedTex, WhiteTex)
rotate x*80
translate z*15
translate y*0
translate x*10
}
object {MakeTextBall("IM_4", 1.5, 0.1, RedTex, WhiteTex)
rotate x*80
translate z*15
translate y*0
translate x*12.5
}
object {MakeTextBall("IT_1", 1.5, 0.1, YellowTex, BlackTex)
rotate x*85
translate z*12.5
translate y*0
translate x*12.5
}
object {MakeTextBall("IM_4", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
translate z*10
translate y*0
translate x*12.5
}
object {MakeTextBall("NM_7", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*90
translate z*7.5
translate y*0
translate x*12.5
}
object {MakeTextBall("IM_5", 1.5, 0.1, RedTex, WhiteTex)
rotate x*90
translate z*5
translate y*0
translate x*12.5
}
object {MakeTextBall("NM_3", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*95
translate z*2.5
translate y*0
translate x*12.5
}
object {MakeTextBall("DM_5", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*100
translate z*0
translate y*0
translate x*12.5
}
object {MakeTextBall("TM_8", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*100
rotate z*10
translate z*0
translate y*0
translate x*15
}
object {MakeTextBall("IM_8", 1.5, 0.1, RedTex, WhiteTex)
rotate x*95
rotate z*10
translate z*2.5
translate y*0
translate x*15
}
object {MakeTextBall("DM_1", 1.5, 0.1, BlueTex, WhiteTex)
rotate x*90
rotate z*10
translate z*5
translate y*0
translate x*15
}
object {MakeTextBall("IT_2", 1.5, 0.1, YellowTex, BlackTex)
rotate x*90
rotate z*10
translate z*7.5
translate y*0
translate x*15
}
object {MakeTextBall("TM_3", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*90
rotate z*10
translate z*10
translate y*0
translate x*15
}
object {MakeTextBall("TM_7", 1.5, 0.1, BlackTex, WhiteTex)
rotate x*85
rotate z*10
translate z*12.5
translate y*0
translate x*15
}
object {MakeTextBall("NM_1", 1.5, 0.1, GreenTex, WhiteTex)
rotate x*80
rotate z*10
translate z*15
translate y*0
translate x*15
}
plane {<0,1,0 >,-1 pigment {color White} finish {ambient .5}}
/* Eof */
Post a reply to this message
|
|