/* $Id: //depot/branches/rmanprod/docs-13.0/renderman_pro_server/prman_technical_rendering/examples/rutest.c#1 $  (Pixar - RenderMan Division)  $Date: 2007/02/28 $ */
/*
** Copyright (c) 1998 PIXAR.  All rights reserved.  This program or
** documentation contains proprietary confidential information and trade
** secrets of PIXAR.  Reverse engineering of object code is prohibited.
** Use of copyright notice is precautionary and does not imply
** publication.
**
**                      RESTRICTED RIGHTS NOTICE
**
** Use, duplication, or disclosure by the Government is subject to the
** following restrictions:  For civilian agencies, subparagraphs (a) through
** (d) of the Commercial Computer Software--Restricted Rights clause at
** 52.227-19 of the FAR; and, for units of the Department of Defense, DoD
** Supplement to the FAR, clause 52.227-7013 (c)(1)(ii), Rights in
** Technical Data and Computer Software.
**
** Pixar
** 1001 West Cutting Blvd.
** Richmond, CA  94804
*/
#include "runuquads.h"

/*
 * Example program using the runuquads routines.
 * Draws the standard RenderMan quadrics as NURBS.
 */
int
main(void)
{
    RtFloat fov = 30.0;
    RtColor color;

    RiBegin(RI_NULL);

    RiDisplay("nuquads.tif", "framebuffer", "rgba", RI_NULL);
    RiFormat(512,  384, 1.0);

    RiProjection("perspective", "fov", &fov, RI_NULL);
    RiTranslate(0.0, 0.0, 6.0);

    RiRotate(180.0, 0.0, 1.0, 0.0);

    RiWorldBegin();

      {
	RtFloat int0 = 0.05;
	RtFloat int1 = 40.0;
	RtFloat int2 = 40.0;
	RtFloat int3 = 10.0;
	static RtPoint p1 = { -4.0, -5.0,  7.0 };
	static RtPoint p2 = {  5.0,  6.0, -2.0 };
	static RtPoint p3 = {  4.0,  0.0,  6.0 };

	RiLightSource("ambientlight", "intensity", &int0, RI_NULL);
	RiLightSource("pointlight", "intensity", &int1, "from", p1, RI_NULL);
	RiLightSource("pointlight", "intensity", &int2, "from", p2, RI_NULL);
	RiLightSource("pointlight", "intensity", &int3, "from", p3, RI_NULL);
      }

      {
	char *name = "grid.tex";
	RiSurface("paintedplastic", "texturename", &name, RI_NULL);
      }

      RiTransformBegin();
	RiTranslate(0.0, 0.0, -1.6);
	RiArchiveRecord("comment", "RuNuDisk(0.0, 1.5, 360.0)");
	color[0] = 1.0; color[1] = 0.8; color[2] = 0.1;
	RiColor(color);
	RuNuDisk(0.0, 1.5, 360.0);
      RiTransformEnd();

      RiRotate(-90.0, 1., 0., 0.);

      RiTransformBegin();
	RiTranslate(-1.2, 0.0, 0.6);
	RiArchiveRecord("comment", "RuNuSphere(0.5, -0.5, 0.5, 360.0)");
	color[0] = 0.3; color[1] = 0.8; color[2] = 1.0;
	RiColor(color);
	RuNuSphere(0.5, -0.5, 0.5, 360.0);
      RiTransformEnd();

      RiTransformBegin();
	RiTranslate(0.0, 0.0, -0.1);
	RiArchiveRecord("comment", "RuNuCone(1.0, 0.5, 360.)");
	color[0] = 0.2; color[1] = 1.0; color[2] = 0.2;
	RiColor(color);
	RuNuCone(1.0, 0.5, 360.0);
      RiTransformEnd();


      RiTransformBegin();
	RiTranslate(1.2, 0.0, 0.4);
	RiArchiveRecord("comment", " RuNuCylinder(0.5, -0.5, 0.5, 360.)");
	color[0] = 1.0; color[1] = 0.1; color[2] = 0.1;
	RiColor(color);
	RuNuCylinder(0.5, -0.5, 0.5, 360.0);
      RiTransformEnd();


      RiTransformBegin();
      {
	static RtPoint point1 = { 0.4, -0.4, -0.4 };
	static RtPoint point2 = { 0.4, 0.4, 0.4 };

	RiTranslate(-1.2, 0.0, -0.8);
	RiArchiveRecord("comment", "RuNuHyperboloid(point1, point2, 360.)");
	color[0] = 0.5; color[1] = 0.5; color[2] = 1.0;
	RiColor(color);
	RuNuHyperboloid(point1, point2, 360.0);
      }
      RiTransformEnd();

      RiTransformBegin();
	RiTranslate(0.0, 0.0, -1.3);
	RiArchiveRecord("comment", " RuNuParaboloid(0.5, 0.0, 1.0, 360.)");
	color[0] = 4.0; color[1] = 1.0; color[2] = 0.7;
	RiColor(color);
	RuNuParaboloid(0.5, 0.0, 1.0, 360.0);
      RiTransformEnd();

      RiTransformBegin();
	RiTranslate(1.2, 0.0, -0.8);
	RiArchiveRecord("comment", " RuNuTorus(0.4, 0.15, 90.0, 360.0, 360.0)");
	color[0] = 1.0; color[1] = 0.3; color[2] = 0.9;
	RiColor(color);
	RuNuTorus(0.4, 0.15, 90.0, 360.0, 360.0);
      RiTransformEnd();

   RiWorldEnd();

   RiEnd();
   return(0);
}
