// Returns the point to be shaded relative to the object box where each // component is in the range of -1 to +1. Point3 SContext::PObjRelBox(void) { Point3 q; Point3 p = PObj(); Box3 b = ObjectBox(); q.x = 2.0f*(p.x-b.pmin.x)/(b.pmax.x-b.pmin.x) - 1.0f; q.y = 2.0f*(p.y-b.pmin.y)/(b.pmax.y-b.pmin.y) - 1.0f; q.z = 2.0f*(p.z-b.pmin.z)/(b.pmax.z-b.pmin.z) - 1.0f; return q; }
void main( int argc, char *argv[] ) { #pragma on (unreferenced); uint i; uint num_files; cmdline_t *cmd; int multi_module; pobj_lib_info pli; atexit( cleanupHandler ); MemInit(); MsgInit( argv[0] ); cmd = CmdLineParse(); init(); while( cmd->action != NULL ) { ActionInit( cmd ); num_files = cmd->action->num_files; i = 0; do { ActionInfile( cmd, inputFile, i ); fileIn = ObjReadOpen( inputFile ); if( fileIn == NULL ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, inputFile ); } if( cmd->need_output ) { ActionOutfile( cmd, outputFile, i ); fileOut = ObjWriteOpen( outputFile ); if( fileOut == NULL ) { Fatal( MSG_UNABLE_TO_OPEN_FILE, outputFile ); } } else { fileOut = NULL; } if( cmd->quiet == 0 ) { char msgbuff[MAX_RESOURCE_SIZE]; MsgGet( MSG_CONVERTING, msgbuff ); PrtFmt( msgbuff, inputFile ); PrtFmt( "\n" ); } pli.is_lib = 0; do { multi_module = PObj( fileIn, fileOut, &pli ); prune(); } while( multi_module ); ObjReadClose( fileIn ); if( fileOut != NULL ) { ObjWriteClose( fileOut ); ActionRename( cmd, inputFile, outputFile, i, pli.is_lib, pli.page_len ); } ++i; } while( i < num_files ); ActionFini( cmd ); } fini(); MsgFini(); MemFini(); outputFile[0] = '\0'; exit( EXIT_SUCCESS ); }