SARE
BatcRen uses this class for renderin the project files. For more information, see inc/real/batchrenw/r3batchrenw.h class.
An example how to use the SARE class below. Note: sake of simplicity error handling is skipped.
R3OBJ *sare, *progress;
R3BOOL playanimation = FALSE; // or TRUE
R3RegisterSAREClass(app);
// create stand alone renderer
sare = R3New(R3CLID_SARE,
R3SAREA_Width, 200,
R3SAREA_Height, 200,
R3SAREA_FrSpecName, "my rendering configuration",
R3SAREA_OutputName, "myimage",
R3SAREA_Hosts, "mysgi;mymac;myintel",
R3TAG_END);
R3DoA(sare, R3RM_REF, NULL);
// load project and initialize renderer
R3DoA3(sare, R3SAREM_LOADPROJECT, (void *)~0, (void *)TRUE, "myproject.r3d")) {
R3DoA(sare, R3SAREM_INITRENDER, NULL);
if(playanimation) // render frames 0 ... 20
R3DoA2(sare, R3SAREM_PLAYRANGE, (void *)0, (void*)20);
else // render the current frame
R3DoA(sare, R3SAREM_RENDER, NULL)) {
// we could now do something else while the
// renderer is rendering the image on another thread, threads or workstations
// no better things to do so let's just wait the renderer and
// show simple progress status using printf()
R3GetAttrs(sare, R3SAREA_Progress, &progress, R3TAG_END);
while(!R3DoA(sare, R3SAREM_WAIT, (void*)TRUE)) {
R3FLOAT rel;
R3GetAttrs(progress, R3PROGREA_TotalRelative, &rel, R3TAG_END);
printf("Rendering %d %%\r", (int)(100 * rel));
}
printf("done\n");
R3DoA(sare, R3RM_UNREF, NULL);