home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume16 / sipp2.0 / part05 < prev    next >
Encoding:
Internet Message Format  |  1991-01-02  |  49.5 KB

  1. From: kent@sparky.IMD.Sterling.COM (Kent Landfield)
  2. Newsgroups: comp.sources.misc
  3. Subject: v16i009:  sipp 2.0 - a library for 3D graphics, Part05/06
  4. Message-ID: <1991Jan3.065916.5237@sparky.IMD.Sterling.COM>
  5. Date: 3 Jan 91 06:59:16 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: 1864d203 b0badb56 118cda33 cc4e49ef
  8.  
  9. Submitted-by: ingwa@isy.liu.se (Inge Wallin)
  10. Posting-number: Volume 16, Issue 9
  11. Archive-name: sipp2.0/part05
  12.  
  13. #!/bin/sh
  14. # This is part 05 of sipp-2.0
  15. # ============= doc/sipp.man ==============
  16. if test ! -d 'doc'; then
  17.     echo 'x - creating directory doc'
  18.     mkdir 'doc'
  19. fi
  20. if test -f 'doc/sipp.man' -a X"$1" != X"-c"; then
  21.     echo 'x - skipping doc/sipp.man (File already exists)'
  22. else
  23. echo 'x - extracting doc/sipp.man (Text)'
  24. sed 's/^X//' << 'SHAR_EOF' > 'doc/sipp.man' &&
  25. .\" Copyright 1990, Jonas Yngvesson, Inge Wallin
  26. .\" This program and documentation may be distributed freely under
  27. .\" the terms of GNU GENERAL PUBLIC LICENSE.
  28. .TH SIPP 3X "December , 1990" 3X
  29. .SH NAME
  30. sipp - simple polygon processor, a 3d-graphics library
  31. .SH SYNOPSIS
  32. \fI#include <sipp.h>\fR
  33. .sp
  34. [g]cc [\fIflags\fR] \fIfiles\fR -lsipp -lm [ \fIlibraries\fR ]
  35. .SH DESCRIPTION
  36. \fIsipp\fR is a library for creating 3-dimensional scenes and rendering them
  37. using a scan-line z-buffer algorithm. A scene is built up of objects
  38. which can be transformed with rotation, translation and scaling. The
  39. objects form hierarchies where each object can have arbitrarily many
  40. subobjects and subsurfaces. A surface is a number of connected
  41. polygons which are rendered with Phong interpolation of the surface
  42. normals.
  43. .sp
  44. The library has an internal database for the objects that is to be
  45. rendered. Objects can be installed in, and removed from, this database
  46. at any time.
  47. .sp
  48. The library also provides 3-dimensional texture mapping with automatic
  49. interpolation of texture coordinates. Simple anti-aliasing is performed
  50. through double oversampling. A scene can be illuminated by an
  51. arbitrary number of light sources. A basic shading algorithm is
  52. provided with the library, but the user can also use his own shading
  53. algorithms for each surface to produce special effects. Images are
  54. produced in the Portable Pixmap format (ppm) for which many utilities
  55. exist.
  56. X
  57. .SH USAGE
  58. Before any other function in \fIsipp\fR is used, the function
  59. \fIsipp_init()\fR must always be called. This call initiates the
  60. internal database and other global variables. The rest of this section
  61. describes the ideas behind \fIsipp\fR and outlines its usage. See the
  62. section 
  63. .B FUNCTIONS
  64. for details.
  65. .sp
  66. All objects in \fIsipp\fR are built up of polygons with 3 or more
  67. vertices. The polygons can either be concave or convex, but all
  68. vertices must lie in the same plane. No test is done to assertain
  69. this, however. A number of polygons can form a, possibly non-planar,
  70. surface that is rendered using Phong interpolation of the surface
  71. normals. Surfaces are grouped together into objects which can also
  72. have other objects as subobjects. Each object or subobject can be
  73. transformed using the standard transformations: rotation, scaling and
  74. translation. All transformations are done with respect to the parent
  75. object if the object is a subobject and the world if the object is a
  76. top level object.
  77. .sp
  78. When an object is defined, copies can be made of it and it can be
  79. installed into the internal database for rendering. The installation
  80. doesn't affect the object in any way, i.e. it can still be transformed
  81. and copied. This is useful if more pictures than one is to be created,
  82. e.g. in an animation.
  83. .sp
  84. \fIsipp\fR uses a number of stacks to create a scene. First,
  85. \fIvertices\fR of a polygon are pushed onto a \fIvertex stack\fR. When
  86. all vertices in a polygon are pushed, a \fIpolygon\fR is created from
  87. them and is pushed onto a \fIpolygon stack\fR. When a number of
  88. polygons have been pushed, a call to a function in \fIsipp\fR combine
  89. them into a \fIsurface\fR and returns a pointer to the surface. This
  90. surface can then be inserted into an \fIobject\fR together with other
  91. surfaces.  Objects can be transformed, used as subobjects in other
  92. objects and inserted into the scene database.
  93. .sp
  94. To create a polygon, two functions are used: \fIvertex_push()\fR and
  95. \fIpolygon_push()\fR. Variants of these functions exist, but these are
  96. the simple forms that are the easiest to use. A call to
  97. \fIvertex_push()\fR is done for each vertex in the polygons, going
  98. counter clockwise around the edge. The order in which the vertices are
  99. pushed is important, because this determines the front and the back
  100. face of the polygon. When all polygons are pushed onto the vertex
  101. stack, \fIpolygon_push()\fR is called. This call creates a polygon
  102. structure out of the pushed vertices, deletes them from the vertex
  103. stack, and pushes the newly created polygon onto the polygon stack.
  104. .sp
  105. When all polygons in a surface is on the polygon stack,
  106. \fIsurface_create()\fR (or one of it's variants) will create a surface
  107. out of them and empty the polygon stack for a new surface definition.
  108. \fIsurface_create()\fR returns a pointer to the created surface.
  109. .sp
  110. An object is created with the function \fIobject_create()\fR. This
  111. function returns a pointer to an empty object, i.e. it contains no
  112. surfaces or subobjects. Surfaces and subobjects are added to an object
  113. with the functions \fIobject_add_surface()\fR and \fIobject_add
  114. subobj()\fR. When all surfaces and subobjects are added to the object
  115. it can be installed in the rendering database, or removed from it,
  116. with the functions \fIobject_install()\fR and \fIobject_uninstall()\fR
  117. respectively.
  118. X
  119. .SH DATA TYPES
  120. The \fIsipp\fR library defines a number of data types in the file
  121. \fIsipp.h\fR. These data types are:
  122. .IP \fIbool\fR
  123. .br
  124. \fIbool\fR can be used as a boolean type, with values \fITRUE\fR of
  125. \fIFALSE\fR. These constants are also defined in \fIsipp.h\fR.
  126. X
  127. .IP \fIColor\fR
  128. \fIColor\fR is a struct with three members, \fIred\fR, \fIgrn\fR and
  129. \fIblu\fR.  Each member of the struct is a double that should be in
  130. the range [0,1].
  131. X
  132. .IP \fIVector\fR
  133. A \fIVector\fR is a struct with three members, \fIx\fR, \fIy\fR and
  134. \fIz\fR which are all doubles.
  135. X
  136. .IP \fITransf_mat\fR
  137. \fITransf_mat\fR is a standard 4 x 4 homogenous transformation matrix.
  138. Actually it is stored as a 4 x 3 matrix to save memory, since the
  139. rightmost column is only needed in the viewing calculation.
  140. .sp
  141. The members of a \fITransf_mat\fR should never be accessed directly, but
  142. rather through the abstract functions described in the \fBFUNCTIONS\fR
  143. section. 
  144. X
  145. .IP \fISurface\fR\ and\ \fIObject\fR
  146. \fISurface\fR and \fIObject\fR are both opaque types used by \fIsipp\fR. The
  147. actual definition of them is not important to the user.
  148. X
  149. .IP \fISurf_desc\fR
  150. A \fISurf_desc\fR is a surface description, used by the built-in shader to
  151. determine properties about a surface. The definition of \fISurf_desc\fR is as
  152. follows: 
  153. .br
  154. \fItypedef\ struct {\fR
  155. .br
  156. \fI    double\  ambient;\fR\       /* Fraction of color visible in ambient light */
  157. .br
  158. \fI    double\  specular;\fR\      /* Fraction of colour specularly reflected */
  159. .br
  160. \fI    double\  c3;\fR\            /* "Shininess" 0 = shiny,  1 = dull */
  161. .br
  162. \fI    Color\   color;\fR\         /* Colour of the surface */
  163. .br
  164. \fI}\ Surf_desc;\fR
  165. X
  166. .IP \fILightsource\fR
  167. All lightsources in the scene are kept in a linked list where the
  168. nodes are defined like this:
  169. .sp
  170. .I typedef struct lightsource {
  171. .br
  172. \fI\    double intensity;\fR
  173. .br
  174. \fI\    Vector dir;\fR
  175. .br
  176. \fI\    struct lightsource *next;\fR
  177. .br
  178. .I } Lightsource;
  179. .sp
  180. A pointer to the head of this list is sent to the shader.
  181. X
  182. .SH SHADING FUNCTIONS
  183. Each surface in a scene has a shading function associated with it.
  184. This function is called for each pixel in the surface as it is
  185. rendered. \fIsipp\fR has an internal basic shading function called
  186. \fIbasic_shader\fR that can be used in most cases. \fIbasic_shader\fR
  187. provides a somewhat modified and simplified version of Blinn's shading
  188. model, taking a \fISurf_desc\fR as a description of the surface. 
  189. .sp
  190. If the user is not satisfied with the builtin shader, he can provide
  191. his own shader and surface description struct. All shaders take
  192. the same parameters and must be defined as follows:
  193. .sp
  194. \fIvoid\ myshader(nx,\ ny,\ nz,\ \ u,\ v,\ w,\ view_vec,\fR
  195. .br
  196. \fI        lights,\ surface,\ color)\fR
  197. .br
  198. \fI    double nx, ny, nz;\fR
  199. .br
  200. \fI    double u, v, w;\fR
  201. .br
  202. \fI    Vector\ view_vec;\fR
  203. .br
  204. \fI    Lightsource *lights;\fR
  205. .br
  206. \fI    void *surface;\fR
  207. .br
  208. \fI    Color\ *color;\fR
  209. .sp
  210. \fInx, ny\fR and \fInz\fR is the \fInon-normalized\fR surface normal at the
  211. point that should be rendered.
  212. .br
  213. \fIu, v\fR and \fIw\fR are the interpolated texture coordinates at the rendered
  214. point. If no texture coordinates have been given at some vertices these
  215. values are undefined and contains garbage at best.
  216. .br
  217. \fIview_vec\fR is a normalized vector, pointing from the rendered
  218. point at the viewpoint.
  219. .br
  220. \fIlights\fR is a pointer to a linked list of lightsource descriptions. See
  221. the function \fIlightsource_push()\fR for a description of the structure of
  222. the links.
  223. .br
  224. \fIsurface\fR is the same \fIsurface\fR-pointer that was sent to the
  225. function \fIsurface_create()\fR. In the case of \fIbasic_shader\fR this is
  226. a pointer to a \fISurf_desc\fR. If the user provides his own shader, he
  227. can also provide his own surface description.
  228. .br
  229. Upon return, the shader should place the calculated rgb colour
  230. components in the areas pointed to by \fIcolor\fR. The rgb components
  231. must be values between 0 and 1.
  232. X
  233. .SH FUNCTIONS
  234. X
  235. .IP \fIvoid\ sipp_init()\fR
  236. Initializes the whole library and emptys the internal database. This
  237. function must be called before any other function in the library.
  238. X
  239. .IP \fIvoid\ vertex_push(x,\ y,\ z)\fR
  240. .br
  241. \fIdouble\ x,\ y,\ z;\fR
  242. .sp
  243. Push a vertex onto the internal vertex stack.
  244. .br
  245. Note: Vertices must be pushed on the vertex stack
  246. \fIcounterclockwize\fR when looking at the "front" face of the
  247. polygon. Otherwize the front of the surface will be defined in the
  248. wrong direction.
  249. X
  250. .IP \fIvoid\ vertex_tx_push(x,\ y,\ z,\ u,\ v,\ w)\fR
  251. .br
  252. \fIdouble\ x,\ y,\ z;\fR
  253. .br
  254. \fIdouble\ u,\ v,\ w;\fR
  255. .sp
  256. Push a vertex and it's texture coordinates onto the vertex stack. Three texture
  257. coordinates are provided to make it possible to use both 2d and solid texture.
  258. The texture coordinates are interpolated between vertices on the same object
  259. and are \fInot\fR affected by transformations of the object. The interpolated
  260. coordinates will be sent to the shader. The coordinates can of course be used
  261. to hold any attribute that one whishes to interpolate between vertices and
  262. then use in the shader.
  263. X
  264. .IP \fIvoid\ polygon_push()\fR
  265. Create a polygon from the vertices on the vertex stack and push it
  266. onto the polygon stack. The vertex stack is empty and ready for a new
  267. polygon definition after this operation.
  268. .br
  269. If a vertex in the polygon is already defined in a previous polygon
  270. that belongs to the same surface, the same vertex will be referenced,
  271. i.e. vertices shared between polygons are only stored once, but they
  272. must be repeated when defining the polygons.
  273. X
  274. .IP \fISurface\ *surface_create(surf_desc,\ shader)\fR
  275. .br
  276. \fIvoid\ *surf_desc;\fR
  277. .br
  278. \fIShader\ *shader;\fR
  279. .sp
  280. Create a surface from the polygons on the polygon stack. A pointer
  281. to the newly-created surface is returned. The polygon stack is empty
  282. afterwards. \fIshader\fR is a pointer to the shader function that
  283. will be called when a point on this surface is to be rendered. See the
  284. section \fBSHADER FUNCTIONS\fR for a declaration of the shader function.
  285. \fIsurf_desc\fR is a pointer to a static structure that contains the
  286. surface properties of the surface. The exact representation of this
  287. structure can be chosen freely by the user depending on the
  288. implementation of his shader. If the internal shader,
  289. \fIbasic_shader\fR is used, this struct is of type \fISurf_desc\fR.
  290. X
  291. .IP \fISurface\ *surface_basic_create(ambient,\ red,\ grn,\ blu,\ specular,\ c3)\fR
  292. .br
  293. \fIdouble\ ambient;\fR
  294. .br
  295. \fIdouble\ red,\ grn,\ blu;\fR
  296. .br
  297. \fIdouble\ specular;\fR
  298. .br
  299. \fIdouble\ c3;\fR
  300. .sp
  301. Create a surface from the polygons on the polygon stack.  A pointer to
  302. the newly-created surface is returned.  The surface will be shaded
  303. with the internal shader, \fIbasic_shader\fR, using the parameters as
  304. values in a \fISurf_desc\fR struct.
  305. X
  306. .IP \fIvoid\ surface_set_shader(surface,\ surf_desc,\ shader)\fR
  307. .br
  308. \fISurface\ *surface;\fR
  309. .br
  310. \fIvoid\    *surf_desc;\fR
  311. .br
  312. \fIShader\  *shader;\fR
  313. .sp
  314. Set the surface \fIsurface\fR to be shaded with the shading function
  315. \fIshader\fR. The shading information used by the shader is pointed at
  316. by \fIsurf_desc\fR.
  317. X
  318. .IP \fIvoid\ surface_basic_shader(surface,\ ambient,\ red,\ grn,\ blu,\ specular,\ c3)\fR
  319. .br
  320. \fISurface\ *surface;\fR
  321. .br
  322. \fIdouble\  ambient;\fR
  323. .br
  324. \fIdouble\  red,\ grn,\ blu;\fR
  325. .br
  326. \fIdouble\  specular;\fR
  327. .br
  328. \fIdouble\  c3;\fR
  329. .sp
  330. Set \fIsurface\fR to be shaded by the internal shader and let
  331. \fIambient\fR, \fIred\fR, \fIgrn\fR, \fIblu\fR, \fIspecular\fR and
  332. \fIc3\fR be the values stored in the \fISurf_desc\fR struct for this
  333. surface. 
  334. X
  335. .IP \fIObject\ *object_create()\fR
  336. Create an empty object, i.e. an object with no surfaces or subobjects
  337. in it. The transformation matrix in the new object will be a identity
  338. matrix initially.
  339. X
  340. .IP \fIObject\ *object_instance(obj)\fR
  341. .br
  342. \fIObject\ *obj;\fR
  343. .sp
  344. Create a new instance of a previously defined object. The lists of
  345. surfaces and subobjects in \fIobj\fR are not copied, but a new
  346. reference with its own transformation matrix is created. The matrix is
  347. set to the identity matrix. If \fIobj\fR is changed, i.e. if one of its
  348. subobjects or surfaces are transformed, one is deleted or added, the
  349. change will also be seen in the copy.
  350. X
  351. .IP \fIObject\ *object_dup(obj)\fR
  352. .br
  353. \fIObject\ *obj;\fR
  354. .sp
  355. Copy recursively an object and its subobjects. The
  356. surfaces in the object tree are not copied, only new references to them
  357. are made.
  358. X
  359. .IP \fIObject\ *object_deep_dup(obj)\fR
  360. .br
  361. \fIObject\ *obj;\fR
  362. .sp
  363. Copy the entire tree for the object \fIobj\fR, including subobjects
  364. and all surfaces, polygons and vertices. This is a costly operation if
  365. the object is complex.
  366. X
  367. .IP \fIvoid\ object_delete(obj)\fR
  368. .br
  369. \fIObject\ *obj;\fR
  370. .sp
  371. Delete the object \fIobj\fR, i.e. the memory used by \fIobj\fR and
  372. all its subobjects and surfaces is recursively freed. \fIsipp\fR keeps
  373. track of internal references so objects and surfaces referenced
  374. from somewhere else in \fIsipp\fR will not be deleted, i.e. no dangeling
  375. references are created in the data structures.
  376. X
  377. .IP \fIvoid\ object_install(obj)\fR
  378. .br
  379. \fIObject\ *obj;\fR
  380. .sp
  381. Install the object \fIobj\fR into the rendering database. This
  382. function must be called on all objects that are to be visible in the
  383. rendered image.
  384. X
  385. .IP \fIvoid\ object_uninstall(obj)\fR
  386. .br
  387. \fIObject\ *obj;\fR
  388. .sp
  389. Remove the object \fIobj\fR from the rendering database. If \fIobj\fR
  390. is not in the database to begin with, nothing happens.
  391. X
  392. .IP \fIvoid\ object_add_surface(obj,\ surf)\fR
  393. .br
  394. \fIObject\  *obj;\fR
  395. .br
  396. \fISurface\ *surf;\fR
  397. .sp
  398. Add the surface \fIsurf\fR to the object \fIobj\fR.
  399. X
  400. .IP \fIvoid\ object_add_subobj(obj,\ subobj)\fR
  401. .br
  402. \fIObject\ *obj;\fR
  403. .br
  404. \fIObject\ *subobj;\fR
  405. .sp
  406. Add the subobject \fIsubobj\fR to the object \fIobj\fR.
  407. X
  408. .IP \fIvoid\ object_set_transf(obj,\ matrix)\fR
  409. .br
  410. \fIObject\     *obj;\fR
  411. .br
  412. \fITransf_mat\ *matrix;\fR
  413. .sp
  414. Set the transformation matrix of the object \fIobj\fR to \fImatrix\fR.
  415. .br
  416. X
  417. .IP \fIvoid\ object_clear_transf(obj)\fR
  418. .br
  419. \fIObject\     *obj;\fR
  420. .sp
  421. Set the transformation matrix of the object \fIobj\fR to the unit matrix.
  422. .br
  423. X
  424. .IP \fIvoid\ object_transform(obj,\ matrix)\fR
  425. .br
  426. \fIObject\     *obj;\fR
  427. .br
  428. \fITransf_mat\ *matrix;\fR
  429. .sp
  430. Post multiply the matrix \fImatrix\fR into the transformation matrix
  431. of the object \fIobj\fR.
  432. X
  433. .br
  434. X
  435. .IP \fIvoid\ object_rot_x(obj,\ ang)\fR
  436. .br
  437. \fIObject\  *obj;\fR
  438. .br
  439. \fIdouble\  ang;\fR
  440. .sp
  441. Rotate the object \fIobj\fR the angle \fIang\fR about the X axis.
  442. \fIang\fR is expressed in radians.
  443. X
  444. .IP \fIvoid\ object_rot_y(obj,\ ang)\fR
  445. .br
  446. \fIObject\  *obj;\fR
  447. .br
  448. \fIdouble\  ang;\fR
  449. .sp
  450. Rotate the object \fIobj\fR the angle \fIang\fR about the Y axis.
  451. \fIang\fR is expressed in radians.
  452. X
  453. .IP \fIvoid\ object_rot_z(obj,\ ang)\fR
  454. .br
  455. \fIObject\  *obj;\fR
  456. .br
  457. \fIdouble\  ang;\fR
  458. .sp
  459. Rotate the object \fIobj\fR the angle \fIang\fR about the Z axis.
  460. \fIang\fR is expressed in radians.
  461. X
  462. .IP \fIvoid\ object_rot(obj,\ point,\ vec,\ ang)\fR
  463. .br
  464. \fIObject\ *obj;\fR
  465. .br
  466. \fIVector\ *point;\fR
  467. .br
  468. \fIVector\ *vec;\fR
  469. .br
  470. \fIdouble\ ang;\fR
  471. .sp
  472. Rotate the object \fIobj\fR the angle \fIang\fR about the line
  473. given by the point \fIpoint\fR and the vector \fIvec\fR starting in
  474. that point. \fIang\fR is expressed in radians.
  475. .br
  476. X
  477. .IP \fIvoid\ object_scale(obj,\ xscale,\ yscale,\ zscale)\fR
  478. .br
  479. \fIObject\ *obj;\fR
  480. .br
  481. \fIdouble\ xscale,\ yscale,\ zscale;\fR
  482. .sp
  483. Scale the object \fIobj\fR with the scaling factors \fIxscale,\
  484. yscale\fR and \fIzscale\fR in the main directions respectively.
  485. X
  486. .IP \fIvoid\ object_move(obj,\ dx,\ dy,\ dz)\fR
  487. .br
  488. \fIObject\ *obj;\fR
  489. .br
  490. \fIdouble\ dx,\ dy,\ dz;\fR
  491. .sp
  492. Move (translate) the object \fIobj\ dx,\ dy\fR and \fIdz\fR in the
  493. three main directions, respectively.
  494. X
  495. .IP \fIvoid\ lightsource_push(x,\ y,\ z,\ intensity)\fR
  496. .br
  497. \fIdouble\ x,\ y,\ z;\fR
  498. .br
  499. \fIdouble\ intensity;\fR
  500. .sp
  501. Create a new lightsource in the scene. All lightsources is considered
  502. to be at an infinit distance and to emit white light. \fIx,\ y,\ z\fR
  503. defines a vector pointing to the lightsource. \fIintensity\fR is a
  504. double between 0 and 1 that defines the intensity of the light coming
  505. from the lightsource.
  506. X
  507. .IP \fIvoid\ view_from(x,\ y,\ z)\fR
  508. .br
  509. .I double x, y, z;
  510. .sp
  511. Define the position of the viewpoint.
  512. X
  513. .IP \fIvoid\ view_at(x,\ y,\ z)\fR
  514. .br
  515. .I double x, y, z;
  516. .sp
  517. Define the viewing direction as going from the viewpoint to the point
  518. .I x, y, z.
  519. X
  520. .IP \fIvoid\ view_up(x,\ y,\ z)\fR
  521. .br
  522. .I double x, y, z;
  523. .sp
  524. Define the up vector. The only constraint on this vector is that it
  525. must not be parallel to the vector going from the viewpoint to the
  526. viewed point.  If this function is not called, the default up vector
  527. is the world Y axis.
  528. X
  529. .IP \fIvoid\ view_focal(ratio)\fR
  530. .br
  531. .I double ratio;
  532. .sp
  533. Define the focal ratio of the "camera". This is the ratio between the
  534. distance from the viewpoint to the screen and half the screen height.
  535. .sp 5
  536. X                    screen
  537. .br
  538. X                    |
  539. .br
  540. X                    | d
  541. .br
  542. .lc \ 
  543. X    viewpoint|
  544. .br
  545. .lc -
  546. X    *|
  547. .br
  548. .lc \ 
  549. X            s|
  550. .br
  551. X                    |
  552. .br
  553. X                    |
  554. .sp 2
  555. .nf
  556. X        focal_ratio = d / s
  557. .fi
  558. .sp
  559. Another way of describing the value is acrtan(v/2) where v is the opening
  560. angle of the view.
  561. .br
  562. Note: The same focal ratio is used both horizontally and vertically.
  563. If the picture is rendered with different resolution in x and y, the ratio
  564. is assumed to be related to the \fIsmallest\fR of the two.
  565. X
  566. .IP \fIviewpoint(x,\ y,\ z,\ to_x,\ to_y,\ to_z,\ up_x,\ up_y,\ up_z,\ focal_ratio)\fR
  567. .br
  568. This function is used to set all viewpoint related values in one call. All
  569. arguments are doubles.
  570. .br
  571. .I x, y, z
  572. is the position of the viewpoint as in \fIview_from()\fR.
  573. .br
  574. .I to_x, to_y, to_z
  575. defines the viewing direction as in \fIview_at()\fR.
  576. .br
  577. .I up_x, up_y, up_z
  578. defines the up vector as in \fIview_up()\fR.
  579. .br
  580. .I focal_ratio
  581. defines (guess what) the focal ratio as in \fIview_focal()\fR.
  582. X
  583. .IP \fIvoid\ render_image(xsize,\ ysize,\ outfile)\fR
  584. .br
  585. \fIint\    xsize, ysize;\fR
  586. .br
  587. \fIFILE\ *outfile;\fR
  588. .sp
  589. This function does the actual rendering of the scene. The image is
  590. created with size (\fIxsize\fR X \fIysize\fR). \fIoutfile\fR is an
  591. open file pointer to which the image will be written.  It can just as
  592. well be a pipe of course.
  593. X
  594. .IP \fIvoid\ basic_shader(nx,\ ny,\ nz,\ \ u,\ v,\ w,\ view_vec,fR
  595. .br
  596. \fI                 lights,\ surface,\ color)\fR
  597. .br
  598. \fIdouble nx, ny, nz;\fR
  599. .br
  600. \fIdouble u, v, w;\fR
  601. .br
  602. \fIVector\ view_vec;\fR
  603. .br
  604. \fILightsource *lights;\fR
  605. .br
  606. \fISurf_desc *surface;\fR
  607. .br
  608. \fI
  609. Color\ *color;\fR
  610. .sp
  611. This is the basic shader function that is provided with the library.
  612. See the section about \fBSHADING FUNCTIONS\fR for more details.
  613. X
  614. .SH SEE ALSO
  615. shaders(3X) - a number of shaders for \fIsipp\fR.
  616. .br
  617. primitives(3X) - a number of geometric primitives for \fIsipp\fR.
  618. X
  619. .SH AUTHORS
  620. Jonas Yngvesson\    \    (jonas-y@isy.liu.se)
  621. .br
  622. Inge Wallin\        (ingwa@isy.liu.se)
  623. .SH BUGS
  624. Antialiasing is rather crude. Aliasing effects is still quite obvious. It
  625. also ought to be possible to turn off antialiasing in order to get a faster
  626. "preview".
  627. .sp
  628. The viewing vector which is sent to the shader is
  629. actually only an approximation which assumes the viewpoint being at infinite
  630. distance. 
  631. .sp
  632. No information is sent to the shader about how big interpolation steps
  633. are in the texture coordinate system. This makes it impossible to use
  634. any filtering techniqe for texture mapping, e.g. summed area tables.
  635. .sp
  636. There is no way to delete a subobject from an object.
  637. SHAR_EOF
  638. chmod 0644 doc/sipp.man ||
  639. echo 'restore of doc/sipp.man failed'
  640. Wc_c="`wc -c < 'doc/sipp.man'`"
  641. test 20064 -eq "$Wc_c" ||
  642.     echo 'doc/sipp.man: original size 20064, current size' "$Wc_c"
  643. fi
  644. # ============= demo/Makefile ==============
  645. if test ! -d 'demo'; then
  646.     echo 'x - creating directory demo'
  647.     mkdir 'demo'
  648. fi
  649. if test -f 'demo/Makefile' -a X"$1" != X"-c"; then
  650.     echo 'x - skipping demo/Makefile (File already exists)'
  651. else
  652. echo 'x - extracting demo/Makefile (Text)'
  653. sed 's/^X//' << 'SHAR_EOF' > 'demo/Makefile' &&
  654. #
  655. # Makefile for the misc demos of sipp version 2.0.
  656. #
  657. X
  658. # These values are used if not overruled from the command line
  659. CC = cc
  660. CFLAGS = -O -I../libsipp
  661. X
  662. X
  663. SRCS = torustest.c cylindertest.c ellipsoid.c blocktest.c chain.c \
  664. X    teapot.c structure.c planettest.c isy90.c
  665. PROGRAMS = torustest cylindertest ellipsoid blocktest chain \
  666. X    teapot structure planettest isy90
  667. X
  668. X
  669. all:
  670. X    @echo "If you want to make only the pretty images, type 'make pretty'."
  671. X    @echo "If you want to make only the test images, type   'make tests'."
  672. X    @echo "If you want to make all images, type             'make images'."
  673. X    @echo
  674. X    @echo "If you want to make the programs, but not the images,"
  675. X    @echo "type 'make programs'."
  676. X    @echo
  677. X
  678. X
  679. # ================================================================
  680. X
  681. X
  682. programs: ../libsipp/libsipp.a $(PROGRAMS)
  683. X
  684. ../libsipp/libsipp.a:
  685. X    cd ..; $(MAKE) library
  686. X
  687. X
  688. # ================================================================
  689. X
  690. X
  691. teapot: teapot.o ../libsipp/libsipp.a
  692. X    $(CC) -o teapot teapot.o ../libsipp/libsipp.a -lm
  693. X    
  694. chain: chain.o ../libsipp/libsipp.a
  695. X    $(CC) -o chain chain.o ../libsipp/libsipp.a -lm
  696. X
  697. structure: structure.o ../libsipp/libsipp.a
  698. X    $(CC) -o structure structure.o ../libsipp/libsipp.a -lm
  699. X
  700. planettest: planettest.o ../libsipp/libsipp.a
  701. X    $(CC) -o planettest planettest.o ../libsipp/libsipp.a -lm
  702. X
  703. isy90: isy90.o ../libsipp/libsipp.a
  704. X    $(CC) -o isy90 isy90.o ../libsipp/libsipp.a -lm
  705. X
  706. ellipsoid:    ellipsoid.o ../libsipp/libsipp.a
  707. X    $(CC) -o ellipsoid ellipsoid.o ../libsipp/libsipp.a -lm
  708. X
  709. torustest: torustest.o ../libsipp/libsipp.a
  710. X    $(CC) -o torustest torustest.o ../libsipp/libsipp.a -lm
  711. X
  712. cylindertest: cylindertest.o ../libsipp/libsipp.a
  713. X    $(CC) -o cylindertest cylindertest.o ../libsipp/libsipp.a -lm
  714. X
  715. blocktest: blocktest.o ../libsipp/libsipp.a
  716. X    $(CC) -o blocktest blocktest.o ../libsipp/libsipp.a -lm
  717. X
  718. X
  719. # ================================================================
  720. X
  721. X
  722. clean:
  723. X    $(RM) *~ .*~ *.o $(PROGRAMS) *.ppm
  724. X
  725. tags:
  726. X    etags $(SRCS)
  727. X
  728. X
  729. # ================================================================
  730. X
  731. PRETTY = chain.ppm teapot.ppm structure.ppm planet.ppm isy90.ppm
  732. TESTS = torus.ppm cylinder.ppm ellipsoid.ppm block.ppm
  733. IMAGES = $(PRETTY) $(TESTS)
  734. X
  735. images: $(IMAGES)
  736. pretty: $(PRETTY)
  737. tests:  $(TESTS)
  738. X
  739. chain.ppm: chain
  740. X    chain 
  741. teapot.ppm: teapot
  742. X    teapot 
  743. structure.ppm: structure
  744. X    structure
  745. planet.ppm: planettest
  746. X    planettest
  747. isy90.ppm: isy90
  748. X    isy90
  749. torus.ppm: torustest
  750. X    torustest
  751. cylinder.ppm: cylindertest
  752. X    cylindertest
  753. ellipsoid.ppm: ellipsoid
  754. X    ellipsoid
  755. block.ppm: blocktest
  756. X    blocktest
  757. SHAR_EOF
  758. chmod 0644 demo/Makefile ||
  759. echo 'restore of demo/Makefile failed'
  760. Wc_c="`wc -c < 'demo/Makefile'`"
  761. test 2518 -eq "$Wc_c" ||
  762.     echo 'demo/Makefile: original size 2518, current size' "$Wc_c"
  763. fi
  764. # ============= demo/README ==============
  765. if test -f 'demo/README' -a X"$1" != X"-c"; then
  766.     echo 'x - skipping demo/README (File already exists)'
  767. else
  768. echo 'x - extracting demo/README (Text)'
  769. sed 's/^X//' << 'SHAR_EOF' > 'demo/README' &&
  770. This directory contains test programs and demonstration programs for
  771. the sipp library version 2.0. The images here can be divided into two
  772. categories: the mere test images (boring) and the demonstrations
  773. images (impressive).
  774. X
  775. Test image              Created by      Explanation
  776. ---------------------------------------------------
  777. torus.ppm               torustest       A plain violet torus
  778. cylinder.ppm            cylindertest    A violet, rather fat, cylinder
  779. ellipsoid.ppm           ellipsoid       A violet course ellipsoid.
  780. X                                        Note how the surface of the
  781. X                                        ellipsoid appears smooth in
  782. X                                        spite of the low number of
  783. X                                        polygons in it.
  784. block.ppm               blocktest       An orange square block.
  785. X
  786. X
  787. Demo image              Created by      Explanation
  788. ---------------------------------------------------
  789. chain.ppm               chain           A 3-D chain of torii.
  790. teapot.ppm              teapot          The standard classic Newell
  791. X                                        teapot. 
  792. structure.ppm           structure       A geometric structure,
  793. X                                        demonstrating bumpy
  794. X                                        appearance of a surface
  795. planet.ppm              planettest      A planet with fractal coasts
  796. X                                        and clouds.
  797. isy90.ppm               isy90           The cover of the 1990
  798. X                                        Activity Report at the Dept.
  799. X                                        of EE at Linkoping University.  
  800. X                                        Demonstrates a simulated
  801. X                                        granite texture.
  802. SHAR_EOF
  803. chmod 0644 demo/README ||
  804. echo 'restore of demo/README failed'
  805. Wc_c="`wc -c < 'demo/README'`"
  806. test 1771 -eq "$Wc_c" ||
  807.     echo 'demo/README: original size 1771, current size' "$Wc_c"
  808. fi
  809. # ============= demo/TAGS ==============
  810. if test -f 'demo/TAGS' -a X"$1" != X"-c"; then
  811.     echo 'x - skipping demo/TAGS (File already exists)'
  812. else
  813. echo 'x - extracting demo/TAGS (Text)'
  814. sed 's/^X//' << 'SHAR_EOF' > 'demo/TAGS' &&
  815. X
  816. torustest.c,13
  817. main(13,130
  818. X
  819. cylindertest.c,13
  820. main(12,112
  821. X
  822. ellipsoidtest.c,13
  823. main(12,112
  824. X
  825. blocktest.c,11
  826. main(9,88
  827. X
  828. chain.c,13
  829. main(13,130
  830. X
  831. teapot.c,11
  832. main(8,81
  833. X
  834. d15.c,55
  835. ellips_plate(47,931
  836. main(126,3268
  837. pixel_test(33,752
  838. X
  839. structure.c,37
  840. #define SIGNBIT(12,151
  841. main(29,383
  842. X
  843. planettest.c,13
  844. main(12,130
  845. SHAR_EOF
  846. chmod 0644 demo/TAGS ||
  847. echo 'restore of demo/TAGS failed'
  848. Wc_c="`wc -c < 'demo/TAGS'`"
  849. test 327 -eq "$Wc_c" ||
  850.     echo 'demo/TAGS: original size 327, current size' "$Wc_c"
  851. fi
  852. # ============= demo/blocktest.c ==============
  853. if test -f 'demo/blocktest.c' -a X"$1" != X"-c"; then
  854.     echo 'x - skipping demo/blocktest.c (File already exists)'
  855. else
  856. echo 'x - extracting demo/blocktest.c (Text)'
  857. sed 's/^X//' << 'SHAR_EOF' > 'demo/blocktest.c' &&
  858. #include <stdio.h>
  859. #include <math.h>
  860. X
  861. #include <sipp.h>
  862. #include <primitives.h>
  863. X
  864. X
  865. X
  866. main(argc, argv)
  867. X    int    argc;
  868. X    char **argv;
  869. {
  870. X    FILE    *fp ;
  871. X    Surf_desc surf;
  872. X    int      side;
  873. X
  874. X
  875. X    if (argc != 2) {
  876. X        side = 256;
  877. X    } else {
  878. X        side = atoi(argv[1]);
  879. X    }
  880. X
  881. X    sipp_init();
  882. X
  883. X    lightsource_push(1.0, 1.0, 1.0, 0.9);
  884. X    lightsource_push(-1.0, -1.0, 0.5, 0.4);
  885. X
  886. X    surf.ambient = 0.5;
  887. X    surf.color.red = 0.8;
  888. X    surf.color.grn = 0.5;
  889. X    surf.color.blu = 0.2;
  890. X    surf.specular = 0.6;
  891. X    surf.c3 = 0.2;
  892. X    
  893. X    object_install(sipp_block(1.0, 2.0, 3.0, &surf, basic_shader)); 
  894. X
  895. X    viewpoint(7.0, 3.0, 5.0,  0.0, 0.0, 0.0,  0.0, 0.0, 1.0,  0.4);
  896. X
  897. X    printf("Rendering, wait...");
  898. X    fflush(stdout);
  899. X
  900. X    fp = fopen("block.ppm", "w");
  901. X    render_image(side, side, fp);
  902. X    printf("Done.\n");
  903. }
  904. X
  905. SHAR_EOF
  906. chmod 0644 demo/blocktest.c ||
  907. echo 'restore of demo/blocktest.c failed'
  908. Wc_c="`wc -c < 'demo/blocktest.c'`"
  909. test 830 -eq "$Wc_c" ||
  910.     echo 'demo/blocktest.c: original size 830, current size' "$Wc_c"
  911. fi
  912. # ============= demo/chain.c ==============
  913. if test -f 'demo/chain.c' -a X"$1" != X"-c"; then
  914.     echo 'x - skipping demo/chain.c (File already exists)'
  915. else
  916. echo 'x - extracting demo/chain.c (Text)'
  917. sed 's/^X//' << 'SHAR_EOF' > 'demo/chain.c' &&
  918. #include <stdio.h>
  919. #include <math.h>
  920. X
  921. #include <sipp.h>
  922. #include <primitives.h>
  923. X
  924. X
  925. X
  926. #define SMALLRES 15
  927. #define BIGRES   40
  928. X
  929. X
  930. main(argc, argv)
  931. X    int    argc;
  932. X    char **argv;
  933. {
  934. X    Object  *torus;
  935. X    Object  *torus_pair;
  936. X    Object  *chain;
  937. X    FILE    *fp ;
  938. X    Surf_desc surf;
  939. X    int      side;
  940. X
  941. X
  942. X    if (argc != 2) {
  943. X        side = 256;
  944. X    } else {
  945. X        side = atoi(argv[1]);
  946. X    }
  947. X
  948. X    sipp_init();
  949. X
  950. X    lightsource_push(1.0, 1.0, 1.0, 0.9);
  951. X    lightsource_push(-1.0, -1.0, 0.5, 0.4);
  952. X
  953. X    surf.ambient = 0.5;
  954. X    surf.color.red = 0.8;
  955. X    surf.color.grn = 0.6;
  956. X    surf.color.blu = 0.3;
  957. X    surf.specular = 0.6;
  958. X    surf.c3 = 0.2;
  959. X    
  960. X    torus = sipp_torus(1.0, 0.23, BIGRES, SMALLRES, &surf, basic_shader);
  961. X    torus_pair = object_create();
  962. X    object_add_subobj(torus_pair, torus);
  963. X    torus = object_instance(torus);
  964. X    object_move(torus, 0.0, -1.375, 0.0);
  965. X    object_rot_y(torus, M_PI / 2.0);
  966. X    object_add_subobj(torus_pair, torus);
  967. X    
  968. X    chain = object_create();
  969. X    object_move(torus_pair, -1.375, 1.375, 0.0);
  970. X    object_add_subobj(chain, torus_pair);
  971. X    torus_pair = object_instance(torus_pair);
  972. X    object_rot_z(torus_pair, M_PI / 2.0);
  973. X    object_move(torus_pair, -1.375, -1.375, 0.0);
  974. X    object_add_subobj(chain, torus_pair);
  975. X    torus_pair = object_instance(torus_pair);
  976. X    object_rot_z(torus_pair, M_PI);
  977. X    object_move(torus_pair, 1.375, -1.375, 0.0);
  978. X    object_add_subobj(chain, torus_pair);
  979. X    torus_pair = object_instance(torus_pair);
  980. X    object_rot_z(torus_pair, 3.0 * M_PI / 2.0);
  981. X    object_move(torus_pair, 1.375, 1.375, 0.0);
  982. X    object_add_subobj(chain, torus_pair);
  983. X    
  984. X    object_install(chain);
  985. X
  986. X    view_from(5.0, -2.0, 15.0);
  987. X    view_at(0.5, 0.0, 0.0);
  988. X    view_up(0.0, 0.0, 1.0);
  989. X    view_focal(0.25);
  990. X
  991. X    printf("Rendering, wait...");
  992. X    fflush(stdout);
  993. X
  994. X    fp = fopen("chain.ppm", "w");
  995. X    render_image(side, side, fp);
  996. X    printf("Done.\n");
  997. }
  998. SHAR_EOF
  999. chmod 0644 demo/chain.c ||
  1000. echo 'restore of demo/chain.c failed'
  1001. Wc_c="`wc -c < 'demo/chain.c'`"
  1002. test 1910 -eq "$Wc_c" ||
  1003.     echo 'demo/chain.c: original size 1910, current size' "$Wc_c"
  1004. fi
  1005. # ============= demo/cylindertest.c ==============
  1006. if test -f 'demo/cylindertest.c' -a X"$1" != X"-c"; then
  1007.     echo 'x - skipping demo/cylindertest.c (File already exists)'
  1008. else
  1009. echo 'x - extracting demo/cylindertest.c (Text)'
  1010. sed 's/^X//' << 'SHAR_EOF' > 'demo/cylindertest.c' &&
  1011. #include <stdio.h>
  1012. #include <math.h>
  1013. X
  1014. #include <sipp.h>
  1015. #include <primitives.h>
  1016. X
  1017. X
  1018. X
  1019. #define RESOLUTION 40
  1020. X
  1021. X
  1022. main(argc, argv)
  1023. X    int    argc;
  1024. X    char **argv;
  1025. {
  1026. X    FILE    *fp ;
  1027. X    Surf_desc surf;
  1028. X    int      side;
  1029. X
  1030. X
  1031. X    if (argc != 2) {
  1032. X        side = 256;
  1033. X    } else {
  1034. X        side = atoi(argv[1]);
  1035. X    }
  1036. X
  1037. X    sipp_init();
  1038. X
  1039. X    lightsource_push(1.0, 1.0, 1.0, 0.9);
  1040. X    lightsource_push(-1.0, -1.0, 0.5, 0.4);
  1041. X
  1042. X    surf.ambient = 0.5;
  1043. X    surf.color.red = 0.6;
  1044. X    surf.color.grn = 0.3;
  1045. X    surf.color.blu = 0.5;
  1046. X    surf.specular = 0.6;
  1047. X    surf.c3 = 0.2;
  1048. X    
  1049. X    object_install(sipp_cylinder(1.0, 1.0, RESOLUTION, &surf, basic_shader)); 
  1050. X
  1051. X    viewpoint(3.0, 0.0, 2.0,  0.0, 0.0, 0.0,  0.0, 0.0, 1.0,  0.4);
  1052. X
  1053. X    printf("Rendering, wait...");
  1054. X    fflush(stdout);
  1055. X
  1056. X    fp = fopen("cylinder.ppm", "w");
  1057. X    render_image(side, side, fp);
  1058. X    printf("Done.\n");
  1059. }
  1060. SHAR_EOF
  1061. chmod 0644 demo/cylindertest.c ||
  1062. echo 'restore of demo/cylindertest.c failed'
  1063. Wc_c="`wc -c < 'demo/cylindertest.c'`"
  1064. test 866 -eq "$Wc_c" ||
  1065.     echo 'demo/cylindertest.c: original size 866, current size' "$Wc_c"
  1066. fi
  1067. # ============= demo/ellipsoid.c ==============
  1068. if test -f 'demo/ellipsoid.c' -a X"$1" != X"-c"; then
  1069.     echo 'x - skipping demo/ellipsoid.c (File already exists)'
  1070. else
  1071. echo 'x - extracting demo/ellipsoid.c (Text)'
  1072. sed 's/^X//' << 'SHAR_EOF' > 'demo/ellipsoid.c' &&
  1073. #include <stdio.h>
  1074. #include <math.h>
  1075. X
  1076. #include <sipp.h>
  1077. #include <primitives.h>
  1078. X
  1079. X
  1080. X
  1081. #define RESOLUTION 15
  1082. X
  1083. X
  1084. main(argc, argv)
  1085. X    int    argc;
  1086. X    char **argv;
  1087. {
  1088. X    FILE    *fp ;
  1089. X    Surf_desc surf;
  1090. X    int      side;
  1091. X
  1092. X
  1093. X    if (argc != 2) {
  1094. X        side = 256;
  1095. X    } else {
  1096. X        side = atoi(argv[1]);
  1097. X    }
  1098. X
  1099. X    sipp_init();
  1100. X
  1101. X    lightsource_push(1.0, 1.0, 1.0, 0.9);
  1102. X    lightsource_push(-1.0, -1.0, 0.5, 0.4);
  1103. X
  1104. X    surf.ambient = 0.5;
  1105. X    surf.color.red = 0.6;
  1106. X    surf.color.grn = 0.3;
  1107. X    surf.color.blu = 0.5;
  1108. X    surf.specular = 0.6;
  1109. X    surf.c3 = 0.2;
  1110. X    
  1111. X    object_install(sipp_ellipsoid(1.0, 2.0, 3.0, RESOLUTION,
  1112. X                                  &surf, basic_shader)); 
  1113. X
  1114. X    viewpoint(10.0, 0.0, 0.0,  0.0, 0.0, 0.0,  0.0, 0.0, 1.0,  0.4);
  1115. X
  1116. X    printf("Rendering, wait...");
  1117. X    fflush(stdout);
  1118. X
  1119. X    fp = fopen("ellipsoid.ppm", "w");
  1120. X    render_image(side, side, fp);
  1121. X    printf("Done.\n");
  1122. }
  1123. SHAR_EOF
  1124. chmod 0644 demo/ellipsoid.c ||
  1125. echo 'restore of demo/ellipsoid.c failed'
  1126. Wc_c="`wc -c < 'demo/ellipsoid.c'`"
  1127. test 908 -eq "$Wc_c" ||
  1128.     echo 'demo/ellipsoid.c: original size 908, current size' "$Wc_c"
  1129. fi
  1130. # ============= demo/isy90.c ==============
  1131. if test -f 'demo/isy90.c' -a X"$1" != X"-c"; then
  1132.     echo 'x - skipping demo/isy90.c (File already exists)'
  1133. else
  1134. echo 'x - extracting demo/isy90.c (Text)'
  1135. sed 's/^X//' << 'SHAR_EOF' > 'demo/isy90.c' &&
  1136. #include <math.h>
  1137. #include <stdio.h>
  1138. X
  1139. #include <sipp.h>
  1140. #include <shaders.h>
  1141. #include <primitives.h>
  1142. X
  1143. X
  1144. #define BEZ_RES        9
  1145. #define CYL_RES        40
  1146. #define LID_ROT        1.5
  1147. #define BLOCK_SIZE     1.2
  1148. #define NCYL           10
  1149. #define CYL_LEN        5.0
  1150. #define SMALL_CYL_RAD  ((BLOCK_SIZE * M_PI) / (NCYL * 2))
  1151. #define BIG_CYL_RAD    (0.5 * BLOCK_SIZE - 1.1 * SMALL_CYL_RAD)
  1152. X
  1153. X
  1154. Marble_desc teapot_surf = {
  1155. X    0.4, 
  1156. X    0.5,
  1157. X    0.05,
  1158. X    8.0, 
  1159. X    {0.90, 0.80, 0.65}, 
  1160. X    {0.30, 0.08, 0.08}
  1161. };
  1162. X
  1163. Granite_desc column_surf = {
  1164. X    0.4,
  1165. X    0.1,
  1166. X    0.4,
  1167. X    20.0,
  1168. X    {0.647, 0.565, 0.5},
  1169. X    {0.15, 0.12, 0.10}
  1170. };
  1171. X
  1172. X
  1173. main(argc, argv)
  1174. X    int argc;
  1175. X    char **argv;
  1176. {
  1177. X    Object  *column;
  1178. X    Object  *teapot;
  1179. X    Object  *handle;
  1180. X    Object  *spout;
  1181. X    Object  *body;
  1182. X    Object  *lid;
  1183. X    Object  *tmp;
  1184. X    FILE    *infile;
  1185. X    int      siz;
  1186. X    FILE    *image;
  1187. X    int      i;
  1188. X
  1189. X    if (argc > 1) {
  1190. X        siz = atoi(argv[1]);
  1191. X    } else {
  1192. X        siz = 256;
  1193. X    }
  1194. X
  1195. X    sipp_init();
  1196. X
  1197. X    infile = fopen("tpt_handle.bez", "r");
  1198. X    handle = sipp_bezier(infile, BEZ_RES, &teapot_surf, marble_shader);
  1199. X    fclose(infile);
  1200. X
  1201. X    infile = fopen("tpt_spout.bez", "r");
  1202. X    spout = sipp_bezier(infile, BEZ_RES, &teapot_surf, marble_shader);
  1203. X    fclose(infile);
  1204. X
  1205. X    infile = fopen("tpt_body.bez", "r");
  1206. X    body = sipp_bezier(infile, BEZ_RES, &teapot_surf, marble_shader);
  1207. X    fclose(infile);
  1208. X
  1209. X    infile = fopen("tpt_lid.bez", "r");
  1210. X    lid = sipp_bezier(infile, BEZ_RES, &teapot_surf, marble_shader);
  1211. X    fclose(infile);
  1212. X
  1213. X    object_rot_y(lid, LID_ROT);
  1214. X
  1215. X    teapot = object_create();
  1216. X    object_add_subobj(teapot, body);
  1217. X    object_add_subobj(teapot, lid);
  1218. X    object_add_subobj(teapot, handle);
  1219. X    object_add_subobj(teapot, spout);
  1220. X
  1221. X    object_install(teapot);
  1222. X
  1223. X    column = object_create();
  1224. X    tmp = sipp_block(BLOCK_SIZE, BLOCK_SIZE / 4.0, BLOCK_SIZE,
  1225. X                     &column_surf, granite_shader);
  1226. X    object_move(tmp, 0.0, -BLOCK_SIZE / 8.0, 0.0);
  1227. X    object_add_subobj(column, tmp);
  1228. X
  1229. X    for (i = 0; i < NCYL; i++) {
  1230. X        if (i == 0) {
  1231. X            tmp = sipp_cylinder(SMALL_CYL_RAD, CYL_LEN, CYL_RES,
  1232. X                                &column_surf, granite_shader); 
  1233. X        } else {
  1234. X            tmp = object_instance(tmp);
  1235. X        }
  1236. X        object_rot_x(tmp, M_PI / 2.0);
  1237. X        object_move(tmp, BIG_CYL_RAD * cos(i * 2.0 * M_PI / NCYL), 
  1238. X                    -0.5 * (CYL_LEN + BLOCK_SIZE / 4.0), 
  1239. X                    BIG_CYL_RAD * sin(i * 2.0 * M_PI / NCYL));
  1240. X        object_add_subobj(column, tmp);
  1241. X    }
  1242. X
  1243. X    object_install(column);
  1244. X        
  1245. X    
  1246. X    lightsource_push(1.0, 1.0, 0.5, 0.85);
  1247. X    lightsource_push(-1.0, 0.5, 0.5, 0.25);
  1248. X    view_from(2.0, 1.5, 4.0);
  1249. X    view_at(0.0, 0.1, 0.0);
  1250. X    view_up(0.0, 1.0, 0.0);
  1251. X    view_focal(0.2);
  1252. X    image = fopen("isy90.ppm", "w");
  1253. X    render_image(siz, siz, image);
  1254. }
  1255. SHAR_EOF
  1256. chmod 0644 demo/isy90.c ||
  1257. echo 'restore of demo/isy90.c failed'
  1258. Wc_c="`wc -c < 'demo/isy90.c'`"
  1259. test 2837 -eq "$Wc_c" ||
  1260.     echo 'demo/isy90.c: original size 2837, current size' "$Wc_c"
  1261. fi
  1262. # ============= demo/planettest.c ==============
  1263. if test -f 'demo/planettest.c' -a X"$1" != X"-c"; then
  1264.     echo 'x - skipping demo/planettest.c (File already exists)'
  1265. else
  1266. echo 'x - extracting demo/planettest.c (Text)'
  1267. sed 's/^X//' << 'SHAR_EOF' > 'demo/planettest.c' &&
  1268. #include <stdio.h>
  1269. #include <math.h>
  1270. X
  1271. #include <sipp.h>
  1272. #include <primitives.h>
  1273. #include <shaders.h>
  1274. X
  1275. X
  1276. X
  1277. #define SUBDIVS  20
  1278. X
  1279. main(argc, argv)
  1280. X    int    argc;
  1281. X    char **argv;
  1282. {
  1283. X    Surf_desc   planet_surface;
  1284. X    Object     *planet;
  1285. X    FILE       *outfile;
  1286. X    int         size;
  1287. X
  1288. X    if (argc == 2) {
  1289. X        size = atoi(argv[1]);
  1290. X    } else {
  1291. X        size = 256;
  1292. X    }
  1293. X    
  1294. X    planet_surface.ambient = 0.4;
  1295. X    planet_surface.specular = 0.0;
  1296. X    planet_surface.c3 = 0.5;
  1297. X    planet_surface.color.red = 1.0;
  1298. X    planet_surface.color.grn = 0.0;
  1299. X    planet_surface.color.blu = 0.0;
  1300. X
  1301. X    sipp_init();
  1302. X
  1303. X    lightsource_push(1.0, 1.0, 1.0, 1.0);
  1304. X
  1305. X    object_install(sipp_sphere(1.0, SUBDIVS, &planet_surface, planet_shader)); 
  1306. X
  1307. X    viewpoint(0.0, 2.0, 0.0,  0.0, 0.0, 0.0,  0.0, 0.0, 1.0,  0.75);
  1308. X
  1309. X    outfile = fopen("planet.ppm", "w");
  1310. X    render_image(size, size, outfile);
  1311. }
  1312. X
  1313. SHAR_EOF
  1314. chmod 0644 demo/planettest.c ||
  1315. echo 'restore of demo/planettest.c failed'
  1316. Wc_c="`wc -c < 'demo/planettest.c'`"
  1317. test 878 -eq "$Wc_c" ||
  1318.     echo 'demo/planettest.c: original size 878, current size' "$Wc_c"
  1319. fi
  1320. # ============= demo/structure.c ==============
  1321. if test -f 'demo/structure.c' -a X"$1" != X"-c"; then
  1322.     echo 'x - skipping demo/structure.c (File already exists)'
  1323. else
  1324. echo 'x - extracting demo/structure.c (Text)'
  1325. sed 's/^X//' << 'SHAR_EOF' > 'demo/structure.c' &&
  1326. #include <stdio.h>
  1327. #include <math.h>
  1328. X
  1329. #include <sipp.h>
  1330. #include <primitives.h>
  1331. #include <shaders.h>
  1332. X
  1333. X
  1334. #define SPHERERES 40
  1335. #define CYLRES    40
  1336. X
  1337. #define SIGNBIT(bit, i)   (((i >> bit) & 1) ? -1.0 : 1.0)
  1338. X
  1339. Surf_desc surf = {
  1340. X    0.4,
  1341. X    0.7, 
  1342. X    0.1, 
  1343. X    {0.8, 0.6, 0.3}
  1344. X    };
  1345. X    
  1346. Bumpy_desc bumpy_surf = {
  1347. X    basic_shader, 
  1348. X    &surf, 
  1349. X    14.0, 
  1350. X    FALSE, 
  1351. X    TRUE
  1352. };
  1353. X
  1354. main(argc, argv)
  1355. X    int    argc;
  1356. X    char **argv;
  1357. {
  1358. X    Object  *sphere;
  1359. X    Object  *cyl;
  1360. X    Object  *structure;
  1361. X    FILE    *fp ;
  1362. X    Surf_desc cyl_surf;
  1363. X    int      size;
  1364. X    int      i;
  1365. X
  1366. X
  1367. X    if (argc != 2) {
  1368. X        size = 256;
  1369. X    } else {
  1370. X        size = atoi(argv[1]);
  1371. X    }
  1372. X
  1373. X    sipp_init();
  1374. X
  1375. X    lightsource_push(1.0, 1.0, 1.0, 0.9);
  1376. X    lightsource_push(-1.0, -1.0, 0.5, 0.4);
  1377. X
  1378. X    cyl_surf.ambient = 0.5;
  1379. X    cyl_surf.color.red = 0.5;
  1380. X    cyl_surf.color.grn = 0.6;
  1381. X    cyl_surf.color.blu = 0.8;
  1382. X    cyl_surf.specular = 0.4;
  1383. X    cyl_surf.c3 = 0.3;
  1384. X    
  1385. X    structure = object_create();
  1386. X
  1387. X    sphere = sipp_sphere(1.0, SPHERERES, &bumpy_surf, bumpy_shader);
  1388. X    for (i = 0; i < 8; i++) {
  1389. X        if (i) {
  1390. X            sphere = object_instance(sphere);
  1391. X        }
  1392. X        object_move(sphere, 2.0 * SIGNBIT(2, i), 2.0 * SIGNBIT(1, i), 
  1393. X                    2.0 * SIGNBIT(0, i));
  1394. X        object_add_subobj(structure, sphere);
  1395. X    }
  1396. X
  1397. X    cyl = sipp_cylinder(0.25, 4.0, CYLRES, &cyl_surf, basic_shader);
  1398. X    for (i = 0; i < 4; i++) {
  1399. X        if (i) {
  1400. X            cyl = object_instance(cyl);
  1401. X        }
  1402. X        object_move(cyl, 2.0 * SIGNBIT(1, i), 2.0 * SIGNBIT(0, i), 0.0);
  1403. X        object_add_subobj(structure, cyl);
  1404. X    }
  1405. X    for (i = 0; i < 4; i++) {
  1406. X        cyl = object_instance(cyl);
  1407. X        object_rot_x(cyl, M_PI / 2.0);
  1408. X        object_move(cyl, 2.0 * SIGNBIT(1, i), 0.0, 2.0 * SIGNBIT(0, i));
  1409. X        object_add_subobj(structure, cyl);
  1410. X    }
  1411. X    for (i = 0; i < 4; i++) {
  1412. X        cyl = object_instance(cyl);
  1413. X        object_rot_y(cyl, M_PI / 2.0);
  1414. X        object_move(cyl, 0.0, 2.0 * SIGNBIT(1, i), 2.0 * SIGNBIT(0, i));
  1415. X        object_add_subobj(structure, cyl);
  1416. X    }
  1417. X    
  1418. X    object_install(structure);
  1419. X
  1420. X    view_from(10.0, -5.0, 15.0);
  1421. X    view_at(0.0, 0.0, 0.0);
  1422. X    view_up(0.0, 0.0, 1.0);
  1423. X    view_focal(0.25);
  1424. X
  1425. X    printf("Rendering, wait...");
  1426. X    fflush(stdout);
  1427. X
  1428. X    fp = fopen("structure.ppm", "w");
  1429. X    render_image(size, size, fp);
  1430. X    printf("Done.\n");
  1431. }
  1432. X
  1433. SHAR_EOF
  1434. chmod 0644 demo/structure.c ||
  1435. echo 'restore of demo/structure.c failed'
  1436. Wc_c="`wc -c < 'demo/structure.c'`"
  1437. test 2360 -eq "$Wc_c" ||
  1438.     echo 'demo/structure.c: original size 2360, current size' "$Wc_c"
  1439. fi
  1440. # ============= demo/teapot.c ==============
  1441. if test -f 'demo/teapot.c' -a X"$1" != X"-c"; then
  1442.     echo 'x - skipping demo/teapot.c (File already exists)'
  1443. else
  1444. echo 'x - extracting demo/teapot.c (Text)'
  1445. sed 's/^X//' << 'SHAR_EOF' > 'demo/teapot.c' &&
  1446. #include <stdio.h>
  1447. X
  1448. #include <sipp.h>
  1449. #include <primitives.h>
  1450. X
  1451. X
  1452. #define RESOLUTION 9
  1453. X
  1454. Surf_desc teapot_surf = {
  1455. X    0.4, 
  1456. X    0.5,
  1457. X    0.1, 
  1458. X    {0.9, 0.6, 0.6}
  1459. };
  1460. X
  1461. X
  1462. main(argc, argv)
  1463. X    int argc;
  1464. X    char **argv;
  1465. {
  1466. X    Object  *teapot;
  1467. X    Object  *handle;
  1468. X    Object  *spout;
  1469. X    Object  *body;
  1470. X    Object  *lid;
  1471. X    FILE    *infile;
  1472. X    int      siz;
  1473. X    FILE    *image;
  1474. X
  1475. X    if (argc > 1) {
  1476. X        siz = atoi(argv[1]);
  1477. X    } else {
  1478. X        siz = 256;
  1479. X    }
  1480. X
  1481. X    sipp_init();
  1482. X
  1483. X    infile = fopen("tpt_handle.bez", "r");
  1484. X    handle = sipp_bezier(infile, RESOLUTION, &teapot_surf, basic_shader);
  1485. X    fclose(infile);
  1486. X
  1487. X    infile = fopen("tpt_spout.bez", "r");
  1488. X    spout = sipp_bezier(infile, RESOLUTION, &teapot_surf, basic_shader);
  1489. X    fclose(infile);
  1490. X
  1491. X    infile = fopen("tpt_body.bez", "r");
  1492. X    body = sipp_bezier(infile, RESOLUTION, &teapot_surf, basic_shader);
  1493. X    fclose(infile);
  1494. X
  1495. X    infile = fopen("tpt_lid.bez", "r");
  1496. X    lid = sipp_bezier(infile, RESOLUTION, &teapot_surf, basic_shader);
  1497. X    fclose(infile);
  1498. X
  1499. X    teapot = object_create();
  1500. X    object_add_subobj(teapot, body);
  1501. X    object_add_subobj(teapot, lid);
  1502. X    object_add_subobj(teapot, handle);
  1503. X    object_add_subobj(teapot, spout);
  1504. X
  1505. X    object_install(teapot);
  1506. X
  1507. X    lightsource_push(1.0, 1.0, 1.0, 1.0);
  1508. /*    lightsource_push(-1.0, 1.0, -1.0, 1.0);*/
  1509. X    view_from(0.75, 1.5, 3.5);
  1510. X    view_at(0.0, 0.4, 0.0);
  1511. X    view_up(0.0, 1.0, 0.0);
  1512. X    view_focal(0.25);
  1513. X    image = fopen("teapot.ppm", "w");
  1514. X    render_image(siz, siz, image);
  1515. }
  1516. SHAR_EOF
  1517. chmod 0644 demo/teapot.c ||
  1518. echo 'restore of demo/teapot.c failed'
  1519. Wc_c="`wc -c < 'demo/teapot.c'`"
  1520. test 1505 -eq "$Wc_c" ||
  1521.     echo 'demo/teapot.c: original size 1505, current size' "$Wc_c"
  1522. fi
  1523. # ============= demo/torustest.c ==============
  1524. if test -f 'demo/torustest.c' -a X"$1" != X"-c"; then
  1525.     echo 'x - skipping demo/torustest.c (File already exists)'
  1526. else
  1527. echo 'x - extracting demo/torustest.c (Text)'
  1528. sed 's/^X//' << 'SHAR_EOF' > 'demo/torustest.c' &&
  1529. #include <stdio.h>
  1530. #include <math.h>
  1531. X
  1532. #include <sipp.h>
  1533. #include <primitives.h>
  1534. X
  1535. X
  1536. X
  1537. #define SMALLRES 15
  1538. #define BIGRES   40
  1539. X
  1540. X
  1541. main(argc, argv)
  1542. X    int    argc;
  1543. X    char **argv;
  1544. {
  1545. X    FILE    *fp ;
  1546. X    Surf_desc surf;
  1547. X    int      side;
  1548. X
  1549. X
  1550. X    if (argc != 2) {
  1551. X        side = 256;
  1552. X    } else {
  1553. X        side = atoi(argv[1]);
  1554. X    }
  1555. X
  1556. X    sipp_init();
  1557. X
  1558. X    lightsource_push(1.0, 1.0, 1.0, 0.9);
  1559. X    lightsource_push(-1.0, -1.0, 0.5, 0.4);
  1560. X
  1561. X    surf.ambient = 0.5;
  1562. X    surf.color.red = 0.6;
  1563. X    surf.color.grn = 0.3;
  1564. X    surf.color.blu = 0.5;
  1565. X    surf.specular = 0.6;
  1566. X    surf.c3 = 0.2;
  1567. X    
  1568. X    object_install(sipp_torus(1.0, 0.4, BIGRES, SMALLRES, &surf,
  1569. X                              basic_shader)); 
  1570. X
  1571. X    viewpoint(2.0, 0.0, 7.0,  0.5, 0.0, 0.0,  0.0, 0.0, 1.0,  0.4);
  1572. X
  1573. X    printf("Rendering, wait...");
  1574. X    fflush(stdout);
  1575. X
  1576. X    fp = fopen("torus.ppm", "w");
  1577. X    render_image(side, side, fp);
  1578. X    printf("Done.\n");
  1579. }
  1580. SHAR_EOF
  1581. chmod 0644 demo/torustest.c ||
  1582. echo 'restore of demo/torustest.c failed'
  1583. Wc_c="`wc -c < 'demo/torustest.c'`"
  1584. test 914 -eq "$Wc_c" ||
  1585.     echo 'demo/torustest.c: original size 914, current size' "$Wc_c"
  1586. fi
  1587. # ============= demo/tpt_body.bez ==============
  1588. if test -f 'demo/tpt_body.bez' -a X"$1" != X"-c"; then
  1589.     echo 'x - skipping demo/tpt_body.bez (File already exists)'
  1590. else
  1591. echo 'x - extracting demo/tpt_body.bez (Text)'
  1592. sed 's/^X//' << 'SHAR_EOF' > 'demo/tpt_body.bez' &&
  1593. # Bezier curves (rotational body) for teapot body.
  1594. X
  1595. bezier_curves:
  1596. X
  1597. vertices: 10
  1598. vertex_list:
  1599. X    3.500000E-01    5.625000E-01    0.000000E+00
  1600. X    3.343750E-01    5.953125E-01    0.000000E+00
  1601. X    3.593750E-01    5.953125E-01    0.000000E+00
  1602. X    3.750000E-01    5.625000E-01    0.000000E+00
  1603. X    4.375000E-01    4.312500E-01    0.000000E+00
  1604. X    5.000000E-01    3.000000E-01    0.000000E+00
  1605. X    5.000000E-01    1.875000E-01    0.000000E+00
  1606. X    5.000000E-01    7.500000E-02    0.000000E+00
  1607. X    3.750000E-01    1.875000E-02    0.000000E+00
  1608. X    3.750000E-01    0.000000E+00    0.000000E+00
  1609. X
  1610. curves:    3
  1611. curve_list:
  1612. X
  1613. X  1 2 3 4
  1614. X
  1615. X  4 5 6 7
  1616. X
  1617. X  7 8 9 10
  1618. SHAR_EOF
  1619. chmod 0644 demo/tpt_body.bez ||
  1620. echo 'restore of demo/tpt_body.bez failed'
  1621. Wc_c="`wc -c < 'demo/tpt_body.bez'`"
  1622. test 644 -eq "$Wc_c" ||
  1623.     echo 'demo/tpt_body.bez: original size 644, current size' "$Wc_c"
  1624. fi
  1625. # ============= demo/tpt_handle.bez ==============
  1626. if test -f 'demo/tpt_handle.bez' -a X"$1" != X"-c"; then
  1627.     echo 'x - skipping demo/tpt_handle.bez (File already exists)'
  1628. else
  1629. echo 'x - extracting demo/tpt_handle.bez (Text)'
  1630. sed 's/^X//' << 'SHAR_EOF' > 'demo/tpt_handle.bez' &&
  1631. # Bezier patches defining the teapot handle.
  1632. X
  1633. bezier_patches:
  1634. X
  1635. X
  1636. vertices: 42
  1637. vertex_list:
  1638. X
  1639. X   -3.750000E-01    5.250000E-01    0.000000E+00
  1640. X   -6.250000E-01    5.250000E-01    0.000000E+00
  1641. X   -7.500000E-01    5.250000E-01    0.000000E+00
  1642. X   -7.500000E-01    4.125000E-01    0.000000E+00
  1643. X   -7.500000E-01    3.000000E-01    0.000000E+00
  1644. X   -6.625000E-01    1.968750E-01    0.000000E+00
  1645. X   -4.750000E-01    1.125000E-01    0.000000E+00
  1646. X   -3.750000E-01    5.250000E-01   -7.500000E-02
  1647. X   -6.250000E-01    5.250000E-01   -7.500000E-02
  1648. X   -7.500000E-01    5.250000E-01   -7.500000E-02
  1649. X   -7.500000E-01    4.125000E-01   -7.500000E-02
  1650. X   -7.500000E-01    3.000000E-01   -7.500000E-02
  1651. X   -6.625000E-01    1.968750E-01   -7.500000E-02
  1652. X   -4.750000E-01    1.125000E-01   -7.500000E-02
  1653. X   -4.000000E-01    4.687500E-01   -7.500000E-02
  1654. X   -5.750000E-01    4.687500E-01   -7.500000E-02
  1655. X   -6.750000E-01    4.687500E-01   -7.500000E-02
  1656. X   -6.750000E-01    4.125000E-01   -7.500000E-02
  1657. X   -6.750000E-01    3.562500E-01   -7.500000E-02
  1658. X   -6.250000E-01    2.437500E-01   -7.500000E-02
  1659. X   -5.000000E-01    1.875000E-01   -7.500000E-02
  1660. X   -4.000000E-01    4.687500E-01    0.000000E+00
  1661. X   -5.750000E-01    4.687500E-01    0.000000E+00
  1662. X   -6.750000E-01    4.687500E-01    0.000000E+00
  1663. X   -6.750000E-01    4.125000E-01    0.000000E+00
  1664. X   -6.750000E-01    3.562500E-01    0.000000E+00
  1665. X   -6.250000E-01    2.437500E-01    0.000000E+00
  1666. X   -5.000000E-01    1.875000E-01    0.000000E+00
  1667. X   -4.000000E-01    4.687500E-01    7.500000E-02
  1668. X   -5.750000E-01    4.687500E-01    7.500000E-02
  1669. X   -6.750000E-01    4.687500E-01    7.500000E-02
  1670. X   -6.750000E-01    4.125000E-01    7.500000E-02
  1671. X   -6.750000E-01    3.562500E-01    7.500000E-02
  1672. X   -6.250000E-01    2.437500E-01    7.500000E-02
  1673. X   -5.000000E-01    1.875000E-01    7.500000E-02
  1674. X   -3.750000E-01    5.250000E-01    7.500000E-02
  1675. X   -6.250000E-01    5.250000E-01    7.500000E-02
  1676. X   -7.500000E-01    5.250000E-01    7.500000E-02
  1677. X   -7.500000E-01    4.125000E-01    7.500000E-02
  1678. X   -7.500000E-01    3.000000E-01    7.500000E-02
  1679. X   -6.625000E-01    1.968750E-01    7.500000E-02
  1680. X   -4.750000E-01    1.125000E-01    7.500000E-02
  1681. X
  1682. patches:   4
  1683. patch_list:
  1684. X
  1685. X 1  2  3  4
  1686. 36 37 38 39
  1687. 29 30 31 32
  1688. 22 23 24 25
  1689. X
  1690. 22 23 24 25
  1691. 15 16 17 18
  1692. X 8  9 10 11
  1693. X 1  2  3  4
  1694. X
  1695. X 4  5  6  7
  1696. 39 40 41 42
  1697. 32 33 34 35
  1698. 25 26 27 28
  1699. X
  1700. X 7  6  5  4
  1701. 14 13 12 11
  1702. 21 20 19 18
  1703. 28 27 26 25
  1704. SHAR_EOF
  1705. chmod 0644 demo/tpt_handle.bez ||
  1706. echo 'restore of demo/tpt_handle.bez failed'
  1707. Wc_c="`wc -c < 'demo/tpt_handle.bez'`"
  1708. test 2371 -eq "$Wc_c" ||
  1709.     echo 'demo/tpt_handle.bez: original size 2371, current size' "$Wc_c"
  1710. fi
  1711. # ============= demo/tpt_lid.bez ==============
  1712. if test -f 'demo/tpt_lid.bez' -a X"$1" != X"-c"; then
  1713.     echo 'x - skipping demo/tpt_lid.bez (File already exists)'
  1714. else
  1715. echo 'x - extracting demo/tpt_lid.bez (Text)'
  1716. sed 's/^X//' << 'SHAR_EOF' > 'demo/tpt_lid.bez' &&
  1717. # Bezier curves (rotational body) for teapot lid.
  1718. X
  1719. bezier_curves:
  1720. X
  1721. vertices: 7
  1722. vertex_list:
  1723. X
  1724. X    0.000000e+00    7.500000e-01    0.000000e+00
  1725. X    2.000000E-01    7.500000E-01    0.000000E+00
  1726. X    0.000000E+00    6.750000E-01    0.000000E+00
  1727. X    5.000000E-02    6.375000E-01    0.000000E+00
  1728. X    1.000000E-01    6.000000E-01    0.000000E+00
  1729. X    3.250000E-01    6.000000E-01    0.000000E+00
  1730. X    3.375000E-01    5.625000E-01    0.000000E+00
  1731. X
  1732. curves:   2
  1733. curve_list:
  1734. X
  1735. X 1 2 3 4
  1736. X
  1737. X 4 5 6 7
  1738. SHAR_EOF
  1739. chmod 0644 demo/tpt_lid.bez ||
  1740. echo 'restore of demo/tpt_lid.bez failed'
  1741. Wc_c="`wc -c < 'demo/tpt_lid.bez'`"
  1742. test 481 -eq "$Wc_c" ||
  1743.     echo 'demo/tpt_lid.bez: original size 481, current size' "$Wc_c"
  1744. fi
  1745. true || echo 'restore of demo/tpt_spout.bez failed'
  1746. echo End of part 5, continue with part 6
  1747. exit 0
  1748.  
  1749. -- 
  1750. Inge Wallin               | Thus spake the master programmer:               |
  1751.                           |      "After three days without programming,     |
  1752. ingwa@isy.liu.se          |       life becomes meaningless."                |
  1753.                           | Geoffrey James: The Tao of Programming.         |
  1754.  
  1755.  
  1756. exit 0 # Just in case...
  1757. -- 
  1758. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1759. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1760. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1761. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1762.