File: rib.cmd

package info (click to toggle)
evolver 2.70+ds-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 17,148 kB
  • sloc: ansic: 127,395; makefile: 209; sh: 98
file content (118 lines) | stat: -rw-r--r-- 4,444 bytes parent folder | download | duplicates (2)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// rib.cmd
// Surface Evolver command to write RenderMan RIB file for surface
// Usage: rib >>> "filename.rib"

// This version does facets only, on a light blue background.
// Viewpoint is the same as 's' command.  Orthogonal projection.

// Programmer: Ken Brakke, brakke@susqu.edu, http://www.susqu.edu/brakke

rib := {

  // Check assumptions
  if torus then
  { errprintf "Cannot run 'rib' command in torus mode. Do 'detorus' first.\n";
    abort;
  };

  if symmetry_group then
  { errprintf "Cannot run 'rib' command in symmetry group mode. Do 'detorus' first.\n";
    abort;
  };

  if space_dimension != 3 then
  { errprintf "The 'rib' command must be run in three-dimensional space.\n";
    abort;
  };

  if surface_dimension == 1 then
  { errprintf "The 'rib' command is not meant for the string model.\n";
    abort;
  };

  if simplex_representation then
  { errprintf "The 'rib' command is not meant for the simplex model.\n";
    abort;
  };

  if lagrange_order >= 2 then
  { errprintf "The 'rib' command is meant for the linear model, not quadratic or Lagrange.\n";
    abort;
  };
  if rgb_colors then
  { errprintf "The 'rib' command does not do RGB colors; do rgb_colors off.\n";
    abort;
  };


  printf"##RenderMan RIB-Structure 1.0\n";
  printf "version 3.03\n";
  printf "\n";
  printf "Option \"searchpath\" \"shader\" [\".:../shaders:&\"]\n";
  printf "Display \"%s.tif\" \"file\" \"rgba\"\n",datafilename;
  printf "Format 512 512 -1\n";
  printf "PixelSamples 1 1\n";
  printf "Orientation \"rh\"\n";
  printf "Clipping 0.1 10.0\n";
  printf "\n";

  printf "WorldBegin\n";
  printf "\n";

  printf "Surface \"constant\"\n";  /* blue background */
  printf "Color [ 0.3 0.8 1.0 ]\n";
  printf "Polygon \"P\" [ 1 1 9  -1 1 9  -1 -1 9  1 -1 9]\n";
  printf "\n";

  printf "Translate 0 0 5 \n";
  printf "Rotate 240 1 1 1 \n";
  printf "Scale -1 1 1 \n";
  printf "Scale .66667 .66667 .66667 \n";
  printf "ConcatTransform [ %f %f %f %f\n", 
    view_matrix[1][1],view_matrix[2][1],view_matrix[3][1],view_matrix[4][1];
  printf "            %f %f %f %f\n",
    view_matrix[1][2],view_matrix[2][2],view_matrix[3][2],view_matrix[4][2];
  printf "            %f %f %f %f\n",
    view_matrix[1][3],view_matrix[2][3],view_matrix[3][3],view_matrix[4][3];
  printf "            %f %f %f %f ]\n",
    view_matrix[1][4],view_matrix[2][4],view_matrix[3][4],view_matrix[4][4];

  printf "LightSource \"ambientlight\" 1 \"intensity\" 0.30\n";
  printf "LightSource \"distantlight\" 1 \"from\" [1 0 1] \"to\" [0 0 0] \"intensity\" 0.7\n";
  printf "\n";
  printf "AttributeBegin\n";
  printf "  Surface \"constant\"\n";
  foreach facet ff where show do {
     if ( ff.color == CLEAR ) then continue;
     if ( ff.color == WHITE ) then printf "  Color [ 1.0 1.0 1.0 ]\n"
     else if ( ff.color == WHITE ) then printf "  Color [ 1.0 1.0 1.0 ]\n"
     else if ( ff.color == BLACK ) then printf "  Color [ 0.0 0.0 0.0 ]\n"
     else if ( ff.color == BLUE ) then printf "  Color [ 0.0 0.0 1. ]\n"
     else if ( ff.color == GREEN ) then printf "  Color [ 0.0 1. 0.0 ]\n"
     else if ( ff.color == CYAN ) then printf "  Color [ 0.0 1. 1. ]\n"
     else if ( ff.color == RED ) then printf "  Color [ 1. 0.0 0.0 ]\n"
     else if ( ff.color == MAGENTA ) then printf "  Color [ 1. 0.0 1. ]\n"
     else if ( ff.color == BROWN ) then printf "  Color [ 1. 0.5 0. ]\n"
     else if ( ff.color == LIGHTGRAY ) then printf "  Color [ .6 .6 .6 ]\n"
     else if ( ff.color == DARKGRAY ) then printf "  Color [ .3 .3 .3 ]\n"
     else if ( ff.color == LIGHTBLUE ) then printf "  Color [ .5 .5 1. ]\n"
     else if ( ff.color == LIGHTGREEN ) then printf "  Color [ .5 1. .5 ]\n"
     else if ( ff.color == LIGHTCYAN ) then printf "  Color [ .5 1. 1. ]\n"
     else if ( ff.color == LIGHTRED ) then printf "  Color [ 1. .5 .5 ]\n"
     else if ( ff.color == LIGHTMAGENTA ) then printf "  Color [ 1. .5 1. ]\n"
     else if ( ff.color == YELLOW ) then printf "  Color [ 1. 1. .0 ]\n";
     printf "  Polygon \"P\" [ %f %f %f  %f %f %f  %f %f %f ]\n",
     ff.vertex[1].x,ff.vertex[1].y,ff.vertex[1].z,
     ff.vertex[2].x,ff.vertex[2].y,ff.vertex[2].z,
     ff.vertex[3].x,ff.vertex[3].y,ff.vertex[3].z;
  };
  printf "AttributeEnd\n";
  printf "\n";
  printf "WorldEnd\n";
}


// End rib.cmd

// Usage: rib >>> "filename.rib"