-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpovray.tpl
70 lines (48 loc) · 1.76 KB
/
povray.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "polyhedra_davinci.inc"
/////////////////////////////////// variables
#declare Factor = {{!factor}};
{{!array_abs}}
{{!array_P}}
{{!array_edges}}
/////////////////////////////////// CSG polyhedron
{{!davinci}}
object{
Davinci
texture{ Wood14_with_turbulence }
}
/////////////////////////////////// translucent polyhedron
object{
SolidFromFaceNormalPoints(FaceNormalPoints, RadFrame)
pigment{ color TranslucentColor }
}
/////////////////////////////////// polyhedron edges
union{
#for( Index, 0, dimension_size(P, 1) - 1 )
sphere{ P[Index], RadEdge }
#end
#for( Index, 0, dimension_size(UncoloredEdges, 1) - 1 )
#local EdgeArray = UncoloredEdges[Index];
cylinder{ P[EdgeArray[0]], P[EdgeArray[1]], RadEdge }
#end
pigment{ color EdgeColor }
}
/////////////////////////////////// face frames
union{
#for(FaceIndex, 0, dimension_size(Faces, 1)-1)
#declare FacePoints = Faces[FaceIndex]; // closed (last point is the first repeated)
#declare NumberOfFacePoints = dimension_size(FacePoints, 1); // actually one more
#declare FacePointsUnclosed = array[NumberOfFacePoints-1];
#for(PointIndex, 0, NumberOfFacePoints-2)
#declare FacePointsUnclosed[PointIndex] = FacePoints[PointIndex];
#end
#declare FramePoints = MovePolygonEdges(FacePointsUnclosed, EdgeOffset);
union{
#for(PointIndex, 0, NumberOfFacePoints-3)
cylinder{FramePoints[PointIndex], FramePoints[PointIndex+1], RadFrame }
#end
cylinder{FramePoints[NumberOfFacePoints-2], FramePoints[0], RadFrame }
translate -vnormalize(FaceNormalPoints[FaceIndex]) * (RadFrame + .001)
}
#end
pigment{ color EdgeColor }
}