- refactored common sources into common
git-svn-id: http://moon:8086/svn/mips@197 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
/* Copyrighted Pixar 1989 */
|
||||
/* From the RenderMan Companion p. 168 */
|
||||
/* Listing 8.5 An improved boilerplate viewing program */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <jman/ri.h>
|
||||
#include <jman/camset.h>
|
||||
#include <jman/patches.h>
|
||||
|
||||
#define NFRAMES 25
|
||||
|
||||
/* viewbasics.c: file compiling view options into a rendering shell. */
|
||||
|
||||
#define DATATYPE RI_RGBA /* Pixels have RGB and coverage */
|
||||
#define SHADINGRATE 20.0
|
||||
#define PICXRES 800.0 /* Horizontal output resolution */
|
||||
#define PICYRES 600.0 /* Vertical output resolution */
|
||||
|
||||
#define CROPMINX 0.0 /* RiCropWindow() parameters */
|
||||
#define CROPMAXX 1.0
|
||||
#define CROPMINY 0.0
|
||||
#define CROPMAXY 1.0
|
||||
#define CAMXFROM 0.0 /* Camera position */
|
||||
#define CAMYFROM 1.0
|
||||
#define CAMZFROM -4.0
|
||||
|
||||
#define CAMXTO 0.0 /* Camera direction */
|
||||
#define CAMYTO -2.0
|
||||
#define CAMZTO 10.0
|
||||
#define CAMROLL 0.0 /* Camera roll */
|
||||
|
||||
#define CAMZOOM 1.0 /* Camera zoom rate */
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
#define NPOINTS 10
|
||||
Point2D points[NPOINTS] = {
|
||||
{.0000,1.5000},
|
||||
{.0703,1.5000},
|
||||
{.1273,1.4293},
|
||||
{.1273,1.3727},
|
||||
{.1273,1.2300},
|
||||
{.0899,1.1600},
|
||||
{.0899,1.0000},
|
||||
{.0899,0.7500},
|
||||
{.4100,0.6780},
|
||||
{.1250,0.0000},
|
||||
};
|
||||
|
||||
RtColor color = {.9,.9,.5};
|
||||
Go() {
|
||||
RiColor(color);
|
||||
RiRotate(-90.0, 1.0, 0.0, 0.0);
|
||||
SurfOR(points, NPOINTS);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
RtPoint CameraFrom = { CAMXFROM, CAMYFROM, CAMZFROM },
|
||||
CameraTo = { CAMXTO, CAMYTO, CAMZTO };
|
||||
|
||||
static RtColor Color = { .6, .8, .2 };
|
||||
RtPoint Square[4] = { {.5,.5,0}, {.5,-.5,0}, {-.5,-.5,0}, {-.5,.5,0} };
|
||||
|
||||
typedef struct _testi
|
||||
{
|
||||
RtInt dummy;
|
||||
RtPointer p;
|
||||
} testi;
|
||||
|
||||
main()
|
||||
{
|
||||
RtInt frame, i;
|
||||
char filename[256];
|
||||
RtToken my_var;
|
||||
|
||||
RtLightHandle lighthnd;
|
||||
|
||||
RiBegin(RI_NULL); /* As always */
|
||||
|
||||
my_var = RiDeclare("Jens", "uniform string");
|
||||
|
||||
/* Output image characteristics */
|
||||
RiShadingRate(SHADINGRATE);
|
||||
RiFormat((RtInt)PICXRES, (RtInt)PICYRES, -1.0); /* Image resolution */
|
||||
|
||||
RiTransformBegin();
|
||||
lighthnd = RiLightSource( "distantlight", RI_NULL);
|
||||
RiTransformEnd();
|
||||
RiIlluminate(lighthnd, RI_TRUE);
|
||||
|
||||
/* Region of image rendered */
|
||||
RiCropWindow(CROPMINX, CROPMAXX, CROPMINY, CROPMAXY);
|
||||
FrameCamera2(PICXRES*CAMZOOM, PICXRES, PICYRES);
|
||||
|
||||
RiClipping(1E-3, RI_INFINITY); /* Clipping planes*/
|
||||
|
||||
/* Now describe the world */
|
||||
for (frame=0; frame < NFRAMES; frame++)
|
||||
{
|
||||
RiFrameBegin(frame);
|
||||
sprintf(filename, "R:\\ri%.3d.tif", frame);
|
||||
RiDisplay(RI_NULL, RI_FRAMEBUFFER, DATATYPE, RI_NULL);
|
||||
|
||||
// Camera position and orientation
|
||||
PlaceCamera(CameraFrom, CameraTo, CAMROLL);
|
||||
// CameraFrom[0] += 2.0/NFRAMES;
|
||||
|
||||
RiWorldBegin();
|
||||
|
||||
// ...Your scene here...
|
||||
RiSurface("matte", RI_NULL);
|
||||
RiRotate((360.0*frame)/NFRAMES, 0, 1, 0);
|
||||
Go();
|
||||
// jstats();
|
||||
RiColor(Color); // Declare the color
|
||||
RiTransformBegin();
|
||||
RiTranslate(0, 0.5, 0);
|
||||
// RiRotate(90, 1, 0, 0);
|
||||
// RiRotate(45, 0, 1, 0);
|
||||
RiDisplacement("dented", RI_NULL);
|
||||
RiSphere(0.5, -0.5, 0.5, 360, RI_NULL);
|
||||
RiTransformEnd();
|
||||
// RiPolygon(4, RI_P, (RtPointer)Square, RI_NULL);
|
||||
|
||||
RiWorldEnd();
|
||||
RiFrameEnd();
|
||||
}
|
||||
|
||||
RiEnd();
|
||||
jstats();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user