POVMS_List::POVMS_List() { int err; err = POVMSAttrList_New(&data); if(err != pov_base::kNoErr) throw POV_EXCEPTION_CODE(err); }
POVMS_List::POVMS_List() { int err; err = POVMSAttrList_New(&data); if(err != kNoErr) throw err; }
void Send_InitInfo() { POVMSAttributeList attrlist; POVMSAttribute attr; POVMSObject msg; int err = kNoErr; if(err == kNoErr) err = POVMSObject_New(&msg, kPOVMSType_WildCard); if(err == kNoErr) err = POVMSUtil_SetString(&msg, kPOVAttrib_PlatformName, POVRAY_PLATFORM_NAME); if(err == kNoErr) err = POVMSUtil_SetFormatString(&msg, kPOVAttrib_CoreVersion, "Persistence of Vision(tm) Ray Tracer Version %s%s", POV_RAY_VERSION, COMPILER_VER); if(err == kNoErr) err = POVMSUtil_SetString(&msg, kPOVAttrib_EnglishText, DISTRIBUTION_MESSAGE_1 "\n" DISTRIBUTION_MESSAGE_2 "\n" DISTRIBUTION_MESSAGE_3 "\nPOV-Ray is based on DKBTrace 2.12 by David K. Buck & Aaron A. Collins\n" POV_RAY_COPYRIGHT); if(err == kNoErr) err = POVMSUtil_SetBool(&msg, kPOVAttrib_Official, POV_RAY_IS_OFFICIAL); if(err == kNoErr) err = POVMSAttrList_New(&attrlist); if(err == kNoErr) { for(int i = 0; Primary_Developers[i] != NULL; i++) { err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, Primary_Developers[i], strlen(Primary_Developers[i]) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&attrlist, &attr); else err = POVMSAttr_Delete(&attr); } } } if(err == kNoErr) err = POVMSObject_Set(&msg, &attrlist, kPOVAttrib_PrimaryDevs); if(err == kNoErr) err = POVMSAttrList_New(&attrlist); if(err == kNoErr) { for(int i = 0; Contributing_Authors[i] != NULL; i++) { err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, Contributing_Authors[i], strlen(Contributing_Authors[i]) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&attrlist, &attr); else err = POVMSAttr_Delete(&attr); } } } if(err == kNoErr) err = POVMSObject_Set(&msg, &attrlist, kPOVAttrib_ContributingDevs); if(err == kNoErr) err = POVMSAttrList_New(&attrlist); #ifndef DONT_SHOW_IMAGE_LIB_VERSIONS // ZLib library version and copyright notice if(err == kNoErr) { err = POVMSAttr_New(&attr); if(err == kNoErr) { const char *tempstr = pov_tsprintf("ZLib %s, Copyright 1995-1998 Jean-loup Gailly and Mark Adler", Extract_Version(zlibVersion())); err = POVMSAttr_Set(&attr, kPOVMSType_CString, (void *)tempstr, strlen(tempstr) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&attrlist, &attr); else err = POVMSAttr_Delete(&attr); } } // LibPNG library version and copyright notice if(err == kNoErr) { err = POVMSAttr_New(&attr); if(err == kNoErr) { const char *tempstr = pov_tsprintf("LibPNG %s, Copyright 1998-2002 Glenn Randers-Pehrson", Extract_Version(png_get_libpng_ver(NULL))); err = POVMSAttr_Set(&attr, kPOVMSType_CString, (void *)tempstr, strlen(tempstr) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&attrlist, &attr); else err = POVMSAttr_Delete(&attr); } } // LibJPEG library version and copyright notice if(err == kNoErr) { err = POVMSAttr_New(&attr); if(err == kNoErr) { const char *tempstr = pov_tsprintf("LibJPEG %s, Copyright 1998 Thomas G. Lane", Extract_Version(JVERSION)); err = POVMSAttr_Set(&attr, kPOVMSType_CString, (void *)tempstr, strlen(tempstr) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&attrlist, &attr); else err = POVMSAttr_Delete(&attr); } } // LibTIFF library version and copyright notice if(err == kNoErr) { err = POVMSAttr_New(&attr); if(err == kNoErr) { const char *tempstr = pov_tsprintf("LibTIFF %s, Copyright 1988-1997 Sam Leffler, 1991-1997 SGI", Extract_Version(TIFFGetVersion())); err = POVMSAttr_Set(&attr, kPOVMSType_CString, (void *)tempstr, strlen(tempstr) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&attrlist, &attr); else err = POVMSAttr_Delete(&attr); } } #endif if(err == kNoErr) err = POVMSObject_Set(&msg, &attrlist, kPOVAttrib_ImageLibVersions); if(err == kNoErr) err = POVMSMsg_SetupMessage(&msg, kPOVMsgClass_Miscellaneous, kPOVMsgIdent_InitInfo); if(err == kNoErr) err = POVMSMsg_SetDestinationAddress(&msg, FRONTEND_ADDRESS); if(err == kNoErr) err = POVMS_Send(POVMS_Render_Context, &msg, NULL, kPOVMSSendMode_NoReply); if(err != 0) (void)POVMS_ASSERT_OUTPUT("Sending InitInfo failed!", "povmsend.cpp", 0); }
void init_vars() { Stage=STAGE_INIT; opts.Abort_Test_Counter = Abort_Test_Every ; Abort_Test_Every = 1; opts.AntialiasDepth = 3; opts.Antialias_Threshold = 0.3; opts.BBox_Threshold = 25; Color_Bits = 8; opts.DisplayFormat = '0'; Display_Started = false; opts.First_Column = 0; opts.First_Column_Percent = 0.0; opts.First_Line = 0; opts.First_Line_Percent = 0.0; Frame.Screen_Height = 100; Frame.Screen_Width = 100; Root_Object = NULL; free_istack = NULL; opts.JitterScale = 1.0; opts.Language_Version = OFFICIAL_VERSION_NUMBER; opts.Last_Column = -1; opts.Last_Column_Percent = 1.0; opts.Last_Line = -1; opts.Last_Line_Percent = 1.0; opts.PreviewGridSize_Start = 1; opts.PreviewGridSize_End = 1; opts.Library_Paths[0] = NULL; opts.Library_Path_Index = 0; Max_Intersections = 64; /*128*/ Number_Of_Files = 0; Number_of_istacks = 0; opts.Options = USE_VISTA_BUFFER + USE_LIGHT_BUFFER + JITTER + DISKWRITE + REMOVE_BOUNDS; opts.OutputFormat = DEFAULT_OUTPUT_FORMAT; opts.OutputQuality = 8; Output_File = NULL; opts.Output_Numbered_Name[0]='\0'; opts.Output_File_Name[0]='\0'; opts.Output_Path[0]='\0'; opts.Output_File_Type=0; opts.PaletteOption = '3'; opts.Quality = 9; opts.Quality_Flags = QUALITY_9; opts.DisplayGamma = DEFAULT_DISPLAY_GAMMA; opts.Header_File_Name[0] = '\0'; /* * If DisplayGamma == 2.2, then GammaFactor == .45, which is what we want. */ opts.GammaFactor = DEFAULT_ASSUMED_GAMMA/opts.DisplayGamma; opts.FrameSeq.FrameType = FT_SINGLE_FRAME; opts.FrameSeq.Clock_Value = 0.0; opts.FrameSeq.InitialFrame = 1; opts.FrameSeq.InitialClock = 0.0; opts.FrameSeq.FinalFrame = INT_VALUE_UNSET; opts.FrameSeq.FrameNumWidth = 0; opts.FrameSeq.FinalClock = 1.0; opts.FrameSeq.SubsetStartFrame = INT_VALUE_UNSET; opts.FrameSeq.SubsetStartPercent = DBL_VALUE_UNSET; opts.FrameSeq.SubsetEndFrame = INT_VALUE_UNSET; opts.FrameSeq.SubsetEndPercent = DBL_VALUE_UNSET; opts.FrameSeq.Field_Render_Flag = false; opts.FrameSeq.Odd_Field_Flag = false; /* NK rad - these default settings are low quality for relatively high quality, use opts.Radiosity_Nearest_Count = 8; opts.Radiosity_Count = 100; opts.Radiosity_Recursion_Limit = 5; Only these variables should need adjustment */ opts.Radiosity_Brightness = 1.0; opts.Radiosity_Count = 35; opts.Radiosity_Dist_Max = 0.0; /* NK rad - dist_max is always computed on the fly now - FYI */ opts.Radiosity_Error_Bound = 1.8; opts.Radiosity_Gray = 0.0; /* degree to which gathered light is grayed */ opts.Radiosity_Low_Error_Factor = 0.5; opts.Radiosity_Min_Reuse = 0.015; opts.Radiosity_Nearest_Count = 5; opts.Radiosity_Recursion_Limit = 3; opts.Radiosity_Quality = 6; /* Q-flag value for light gathering */ opts.Radiosity_File_ReadOnContinue = 1; opts.Radiosity_File_SaveWhileRendering = 1; opts.Radiosity_File_AlwaysReadAtStart = 0; opts.Radiosity_File_KeepOnAbort = 1; opts.Radiosity_File_KeepAlways = 0; opts.Maximum_Sample_Brightness = -1.0; /* default max brightness allows any */ opts.Radiosity_ADC_Bailout = 0.01; /* use a fairly high default adc_bailout for rad */ opts.Radiosity_Use_Normal = false; opts.Radiosity_Use_Media = false; opts.radPretraceStart = 0.08; opts.radPretraceEnd = 0.04; opts.Radiosity_Load_File_Name = NULL; opts.Radiosity_Save_File_Name = NULL; opts.Radiosity_Add_On_Final_Trace = true; opts.Radiosity_Enabled = false; Current_Line_Number = 0; init_statistics(stats); init_statistics(totalstats); strcpy (opts.Input_File_Name, "OBJECT.POV"); opts.Scene_Name[0]='\0'; opts.Ini_Output_File_Name[0]='\0'; opts.Use_Slabs=true; Num_Echo_Lines = POV_NUM_ECHO_LINES; /* May make user setable later - CEY*/ closed_flag = false; Stop_Flag = false; trender = trender_frame = trender_total = 0.0; tparse = tparse_frame = tparse_total = 0.0; tphoton = tphoton_frame = tphoton_total = 0.0; histogram_grid = NULL; opts.histogram_on = false; opts.histogram_type = NONE; opts.histogram_file_type=0; opts.Histogram_File_Name[0] = '\0'; Histogram_File = NULL; /* * Note that late initialization of the histogram_x and histogram_y * variables is done in fix_up_rendering_window, if they aren't specified * on the command line. This is because they are based on the image * dimensions, and we can't be certain that we have this info at the * time we parse the histogram options in optin.c. [AED] */ opts.histogram_x = opts.histogram_y = 0; max_histogram_value = 0; opts.Tracing_Method = 1; Experimental_Flag = 0; Make_Pigment_Entries(); opts.Preview_RefCon = 0; opts.Warning_Level = 10; // all warnings opts.String_Encoding = 0; // ASCII (void)POVMSAttrList_New(&opts.Declared_Variables); // we have to be careful... [trf] /* NK phmap */ backtraceFlag=0; photonOptions.photonsEnabled = 0; InitBacktraceWasCalled=false; photonOptions.photonMap.head = NULL; photonOptions.photonMap.numPhotons = 0; photonOptions.photonMap.numBlocks = 0; photonOptions.photonMap.gatherNumSteps = 2; photonOptions.photonMap.minGatherRad = -1.0; photonOptions.photonMap.minGatherRadMult = 1.0; #ifdef GLOBAL_PHOTONS photonOptions.globalPhotonMap.gatherNumSteps = 1; photonOptions.globalPhotonMap.minGatherRad = -1.0; photonOptions.globalPhotonMap.minGatherRadMult = 1.0; #endif photonOptions.mediaPhotonMap.gatherNumSteps = 1; photonOptions.mediaPhotonMap.minGatherRad = -1.0; photonOptions.mediaPhotonMap.minGatherRadMult = 1.0; photonOptions.minGatherCount = 20; photonOptions.maxGatherCount = 100; photonOptions.ADC_Bailout = -1; /* use the normal adc bailout */ photonOptions.Max_Trace_Level = -1; /* use the normal max_trace_level */ photonOptions.jitter = 0.4; photonOptions.autoStopPercent = 0.5; photonOptions.expandTolerance = 0.2; photonOptions.minExpandCount = 35; photonOptions.fileName = NULL; photonOptions.loadFile = false; disp_elem = 0; /* for dispersion */ disp_nelems = 0; /* reset this for next pixel's tracing */ photonOptions.photonGatherList = NULL; photonOptions.photonDistances = NULL; #ifdef GLOBAL_PHOTONS /* global photon map */ photonOptions.globalGatherRad = 10.0; photonOptions.globalPhotonsToShoot = 0; #endif photonOptions.surfaceSeparation = 1.0; photonOptions.globalSeparation = 1.0; photonOptions.photonMap.head = NULL; photonOptions.photonMap.numPhotons = 0; photonOptions.photonMap.numBlocks = 0; #ifdef GLOBAL_PHOTONS photonOptions.globalPhotonMap.head = NULL; photonOptions.globalPhotonMap.numPhotons = 0; photonOptions.globalPhotonMap.numBlocks = 0; #endif photonOptions.mediaPhotonMap.head = NULL; photonOptions.mediaPhotonMap.numPhotons = 0; photonOptions.mediaPhotonMap.numBlocks = 0; photonOptions.maxMediaSteps = 0; /* disable media photons by default */ photonOptions.mediaSpacingFactor = 1.0; photonOptions.photonReflectionBlur = false; /* off by default */ photonOptions.surfaceCount = 0; photonOptions.globalCount = 0; Highest_Trace_Level = 0 ; /* NK 1999 - bugfix */ Trace_Level = 0; // [trf] Total_Depth = 0.0; Radiosity_Trace_Level = 1; warpNormalTextures = 0; opts.Noise_Generator = 2; /* default is the range-corrected noise, since the perlin noise (gen 3) seems buggy */ ADC_Bailout = 1.0/255.0; SuperSampleCount = 0; RadiosityCount = 0; MosaicPreviewSize = 0; }
int BuildRenderStatistics(POVMSObjectPtr msg, COUNTER *pstats) { POVMSAttributeList list; int err = kNoErr; if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Height, Frame.Screen_Height); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Width, Frame.Screen_Width); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_Pixels, &pstats[Number_Of_Pixels]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PixelSamples, &pstats[Number_Of_Samples]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_Rays, &pstats[Number_Of_Rays]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_RaysSaved, &pstats[ADC_Saves]); if(err == kNoErr) err = POVMSAttrList_New(&list); if(err == kNoErr) { int i; for(i = 0; intersection_stats[i].infotext != NULL; i++) { err = AddOIStatistic(&list, i, pstats); if(err != kNoErr) break; } } if(err == kNoErr) err = POVMSObject_Set(msg, &list, kPOVAttrib_ObjectIStats); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_ShadowTest, &pstats[Shadow_Ray_Tests]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_ShadowTestSuc, &pstats[Shadow_Rays_Succeeded]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_IsoFindRoot, &pstats[Ray_IsoSurface_Find_Root]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_FunctionVMCalls, &pstats[Ray_Function_VM_Calls]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_FunctionVMInstrEst, &pstats[Ray_Function_VM_Instruction_Est]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PolynomTest, &pstats[Polynomials_Tested]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_RootsEliminated, &pstats[Roots_Eliminated]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_CallsToNoise, &pstats[Calls_To_Noise]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_CallsToDNoise, &pstats[Calls_To_DNoise]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_MediaSamples, &pstats[Media_Samples]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_MediaIntervals, &pstats[Media_Intervals]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_ReflectedRays, &pstats[Reflected_Rays_Traced]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_InnerReflectedRays, &pstats[Internal_Reflected_Rays_Traced]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_RefractedRays, &pstats[Refracted_Rays_Traced]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_TransmittedRays, &pstats[Transmitted_Rays_Traced]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_IStackOverflow, &pstats[Istack_overflows]); #if defined(MEM_STATS) Long_To_Counter(mem_stats_smallest_alloc(), pstats[MemStat_Smallest_Alloc]); Long_To_Counter(mem_stats_largest_alloc(), pstats[MemStat_Largest_Alloc]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_MinAlloc, &pstats[MemStat_Smallest_Alloc]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_MaxAlloc, &pstats[MemStat_Largest_Alloc]); #if (MEM_STATS>=2) Long_To_Counter(mem_stats_total_allocs(), pstats[MemStat_Total_Allocs]); Long_To_Counter(mem_stats_total_frees(), pstats[MemStat_Total_Frees]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_CallsToAlloc, &pstats[MemStat_Total_Allocs]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_CallsToFree, &pstats[MemStat_Total_Frees]); #endif Long_To_Counter(mem_stats_largest_mem_usage(), pstats[MemStat_Largest_Mem_Usage]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PeakMemoryUsage, &pstats[MemStat_Largest_Mem_Usage]); #endif if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_TraceLevel, Highest_Trace_Level); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_MaxTraceLevel, Max_Trace_Level); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_RadGatherCount, ra_gather_count); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_RadReuseCount, ra_reuse_count); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PhotonsShot, &pstats[Number_Of_Photons_Shot]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PhotonsStored, &pstats[Number_Of_Photons_Stored]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_GlobalPhotonsStored, &pstats[Number_Of_Global_Photons_Stored]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_MediaPhotonsStored, &pstats[Number_Of_Media_Photons_Stored]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PhotonsPriQInsert, &pstats[Priority_Queue_Add]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_PhotonsPriQRemove, &pstats[Priority_Queue_Remove]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_GatherPerformedCnt, &pstats[Gather_Performed_Count]); if(err == kNoErr) err = AddStatistic(msg, kPOVAttrib_GatherExpandedCnt, &pstats[Gather_Expanded_Count]); return 0; }
int BuildRenderOptions(POVMSObjectPtr msg) { POVMSAttribute attr; int err = kNoErr; if(msg == NULL) return kParamErr; if(err == kNoErr) err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_WildCard, (void *)(&opts.Preview_RefCon), sizeof(unsigned long)); if(err == kNoErr) err = POVMSObject_Set(msg, &attr, kPOVAttrib_PreviewRefCon); } if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Height, Frame.Screen_Height); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Width, Frame.Screen_Width); if(err == kNoErr) { if (opts.First_Column == -1) err = POVMSUtil_SetFloat(msg, kPOVAttrib_StartColumn, opts.First_Column_Percent); else err = POVMSUtil_SetFloat(msg, kPOVAttrib_StartColumn, opts.First_Column); } if(err == kNoErr) { if (opts.Last_Column == -1) err = POVMSUtil_SetFloat(msg, kPOVAttrib_EndColumn, opts.Last_Column_Percent); else err = POVMSUtil_SetFloat(msg, kPOVAttrib_EndColumn, opts.Last_Column); } if(err == kNoErr) { if (opts.First_Line == -1) err = POVMSUtil_SetFloat(msg, kPOVAttrib_StartRow, opts.First_Line_Percent); else err = POVMSUtil_SetFloat(msg, kPOVAttrib_StartRow, opts.First_Line); } if(err == kNoErr) { if (opts.Last_Line == -1) err = POVMSUtil_SetFloat(msg, kPOVAttrib_EndRow, opts.Last_Line_Percent); else err = POVMSUtil_SetFloat(msg, kPOVAttrib_EndRow, opts.Last_Line); } if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_TestAbort, (opts.Options & EXITENABLE) != 0); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_TestAbortCount, opts.Abort_Test_Counter); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_ContinueTrace, (opts.Options & CONTINUE_TRACE) != 0); if(err == kNoErr) err = POVMSUtil_SetString(msg, kPOVAttrib_CreateIni, opts.Ini_Output_File_Name); if(err == kNoErr) err = POVMSUtil_SetFloat(msg, kPOVAttrib_Clock, opts.FrameSeq.Clock_Value); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_InitialFrame, max(opts.FrameSeq.InitialFrame, 1)); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_FinalFrame, max(opts.FrameSeq.FinalFrame, 1)); if(err == kNoErr) err = POVMSUtil_SetFloat(msg, kPOVAttrib_InitialClock, opts.FrameSeq.InitialClock); if(err == kNoErr) { if(opts.FrameSeq.FinalFrame <= 1) err = POVMSUtil_SetFloat(msg, kPOVAttrib_FinalClock, 1.0); else err = POVMSUtil_SetFloat(msg, kPOVAttrib_FinalClock, opts.FrameSeq.FinalClock); } if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_SubsetStartFrame, max(opts.FrameSeq.SubsetStartFrame, 1)); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_SubsetEndFrame, max(opts.FrameSeq.SubsetEndFrame, 1)); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_CyclicAnimation, (opts.Options & CYCLIC_ANIMATION) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_FieldRender, opts.FrameSeq.Field_Render_Flag); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_OddField, opts.FrameSeq.Odd_Field_Flag); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_PauseWhenDone, (opts.Options & PROMPTEXIT) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_Verbose, (opts.Options & VERBOSE) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_DrawVistas, (opts.Options & USE_VISTA_DRAW) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_Display, (opts.Options & DISPLAY) != 0); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_VideoMode, opts.DisplayFormat); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Palette, opts.PaletteOption); if(err == kNoErr) err = POVMSUtil_SetFloat(msg, kPOVAttrib_DisplayGamma, opts.DisplayGamma); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_PreviewStartSize, opts.PreviewGridSize_Start); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_PreviewEndSize, opts.PreviewGridSize_End); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_OutputToFile, (opts.Options & DISKWRITE) != 0); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_OutputFileType, opts.OutputFormat); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Compression, opts.OutputQuality); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_OutputAlpha, (opts.Options & OUTPUT_ALPHA) != 0); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_BitsPerColor, opts.OutputQuality); if(err == kNoErr) err = POVMSUtil_SetString(msg, kPOVAttrib_OutputFile, opts.Output_File_Name); if(err == kNoErr) err = POVMSUtil_SetString(msg, kPOVAttrib_OutputPath, opts.Output_Path); #if PRECISION_TIMER_AVAILABLE if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_CreateHistogram, opts.histogram_on != 0); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_HistogramFileType, opts.histogram_type); if(err == kNoErr) err = POVMSUtil_SetString(msg, kPOVAttrib_HistogramFile, opts.Histogram_File_Name); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_HistogramGridSizeX, opts.histogram_x); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_HistogramGridSizeY, opts.histogram_y); #endif /* PRECISION_TIMER_AVAILABLE */ if(err == kNoErr) err = BuildCommand(msg, kPOVAttrib_PreSceneCommand, &opts.Shellouts[PRE_SCENE_SHL]); if(err == kNoErr) err = BuildCommand(msg, kPOVAttrib_PreFrameCommand, &opts.Shellouts[PRE_FRAME_SHL]); if(err == kNoErr) err = BuildCommand(msg, kPOVAttrib_PostSceneCommand, &opts.Shellouts[POST_SCENE_SHL]); if(err == kNoErr) err = BuildCommand(msg, kPOVAttrib_PostFrameCommand, &opts.Shellouts[POST_FRAME_SHL]); if(err == kNoErr) err = BuildCommand(msg, kPOVAttrib_UserAbortCommand, &opts.Shellouts[USER_ABORT_SHL]); if(err == kNoErr) err = BuildCommand(msg, kPOVAttrib_FatalErrorCommand, &opts.Shellouts[FATAL_SHL]); if(err == kNoErr) err = POVMSUtil_SetString(msg, kPOVAttrib_InputFile, opts.Input_File_Name); if(err == kNoErr) { POVMSAttributeList list; err = POVMSAttrList_New(&list); if(err == kNoErr) { int ii; for(ii = 0; ii < opts.Library_Path_Index; ii++) { err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, opts.Library_Paths[ii], strlen(opts.Library_Paths[ii]) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&list, &attr); else err = POVMSAttr_Delete(&attr); } } if(err == kNoErr) err = POVMSObject_Set(msg, &list, kPOVAttrib_LibraryPath); } } if(err == kNoErr) { POVMSFloat f = opts.Language_Version / 100.0; err = POVMSUtil_SetFloat(msg, kPOVAttrib_Version, f); } /* FIXME if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_DebugConsole, Stream_Info[DEBUG_STREAM]->console != NULL); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_FatalConsole, Stream_Info[FATAL_STREAM]->console != NULL); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_RenderConsole, Stream_Info[RENDER_STREAM]->console != NULL); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_StatisticsConsole, Stream_Info[STATISTIC_STREAM]->console != NULL); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_WarningConsole, Stream_Info[WARNING_STREAM]->console != NULL); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_AllConsole, Stream_Info[ALL_STREAM]->console != NULL); if((err == kNoErr) && (Stream_Info[DEBUG_STREAM]->name != NULL)) err = POVMSUtil_SetString(msg, kPOVAttrib_DebugFile, Stream_Info[DEBUG_STREAM]->name); if((err == kNoErr) && (Stream_Info[FATAL_STREAM]->name != NULL)) err = POVMSUtil_SetString(msg, kPOVAttrib_FatalFile, Stream_Info[FATAL_STREAM]->name); if((err == kNoErr) && (Stream_Info[RENDER_STREAM]->name != NULL)) err = POVMSUtil_SetString(msg, kPOVAttrib_RenderFile, Stream_Info[RENDER_STREAM]->name); if((err == kNoErr) && (Stream_Info[STATISTIC_STREAM]->name != NULL)) err = POVMSUtil_SetString(msg, kPOVAttrib_StatisticsFile, Stream_Info[STATISTIC_STREAM]->name); if((err == kNoErr) && (Stream_Info[WARNING_STREAM]->name != NULL)) err = POVMSUtil_SetString(msg, kPOVAttrib_WarningFile, Stream_Info[WARNING_STREAM]->name); if((err == kNoErr) && (Stream_Info[ALL_STREAM]->name != NULL)) err = POVMSUtil_SetString(msg, kPOVAttrib_AllFile, Stream_Info[ALL_STREAM]->name); */ if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_Quality, opts.Quality); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_Bounding, opts.Use_Slabs); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_BoundingThreshold, opts.BBox_Threshold); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_LightBuffer, (opts.Options & USE_LIGHT_BUFFER) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_VistaBuffer, (opts.Options & USE_VISTA_BUFFER) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_RemoveBounds, (opts.Options & REMOVE_BOUNDS) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_SplitUnions, (opts.Options & SPLIT_UNION) != 0); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_Antialias, (opts.Options & ANTIALIAS) != 0); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_SamplingMethod, opts.Tracing_Method); if(err == kNoErr) err = POVMSUtil_SetFloat(msg, kPOVAttrib_AntialiasThreshold, opts.Antialias_Threshold); if(err == kNoErr) err = POVMSUtil_SetInt(msg, kPOVAttrib_AntialiasDepth, opts.AntialiasDepth); if(err == kNoErr) err = POVMSUtil_SetBool(msg, kPOVAttrib_Jitter, (opts.Options & JITTER) != 0); if(err == kNoErr) err = POVMSUtil_SetFloat(msg, kPOVAttrib_JitterAmount, opts.JitterScale); if(err == kNoErr) err = POVMSUtil_SetString(msg, kPOVAttrib_IncludeHeader, opts.Header_File_Name); return err; }
int ProcessRenderOptions::ProcessUnknownString(char *str, POVMSObjectPtr obj) { POVMSAttributeList list; POVMSAttribute attr; int state = 0; // INI file int err = kNoErr; if(str == NULL) { ParseError("Expected filename, nothing was found."); return kParseErr; } // add filename or path // see if it is a POV file if(state == 0) { char *ptr = strrchr(str, '.'); if(ptr != NULL) { if(pov_stricmp(ptr, ".pov") == 0) state = 1; // POV file } } // see if it is a path if(state == 0) { if(strlen(str) > 0) { if(str[strlen(str) - 1] == FILENAME_SEPARATOR) state = 2; // library path } } switch(state) { // INI file case 0: // parse INI file (recursive) err = ParseFile(str, obj); if(err == kNoErr) { // create list if it isn't there if(POVMSObject_Exist(obj, kPOVAttrib_IncludeIni) == kFalseErr) err = POVMSAttrList_New(&list); else if(POVMSObject_Exist(obj, kPOVAttrib_IncludeIni) != kNoErr) err = kObjectAccessErr; else err = POVMSObject_Get(obj, &list, kPOVAttrib_IncludeIni); } // add INI file to list if(err == kNoErr) err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, str, strlen(str) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&list, &attr); else err = POVMSAttr_Delete(&attr); } if(err == kNoErr) err = POVMSObject_Set(obj, &list, kPOVAttrib_IncludeIni); break; // POV file case 1: // set POV file err = POVMSUtil_SetString(obj, kPOVAttrib_InputFile, str); break; // library path case 2: // create list if it isn't there if(POVMSObject_Exist(obj, kPOVAttrib_LibraryPath) == kFalseErr) err = POVMSAttrList_New(&list); else if(POVMSObject_Exist(obj, kPOVAttrib_LibraryPath) != kNoErr) err = kObjectAccessErr; else err = POVMSObject_Get(obj, &list, kPOVAttrib_LibraryPath); // add librarypath to list if(err == kNoErr) err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, str, strlen(str) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&list, &attr); else err = POVMSAttr_Delete(&attr); } if(err == kNoErr) err = POVMSObject_Set(obj, &list, kPOVAttrib_LibraryPath); break; } return err; }
int ProcessRenderOptions::ReadSpecialSwitchHandler(Cmd_Parser_Table *option, char *param, POVMSObjectPtr obj, bool) { int intval = 0; int intval2 = 0; int err = 0; char chr = 0; switch(option->key) { case kPOVAttrib_Display: if(param[0] != '\0') { err = POVMSUtil_SetInt(obj, kPOVAttrib_VideoMode, (int)toupper(param[0])); if((param[1] != '\0') && (err == 0)) err = POVMSUtil_SetInt(obj, kPOVAttrib_Palette, (int)toupper(param[1])); } break; case kPOVAttrib_HistogramGridSizeX: if(sscanf(param, "%d.%d", &intval, &intval2) == 2) { err = POVMSUtil_SetInt(obj, kPOVAttrib_HistogramGridSizeX, intval); if(err == kNoErr) err = POVMSUtil_SetInt(obj, kPOVAttrib_HistogramGridSizeY, intval2); } else { ParseError("Invalid histogram grid size '%s'.", param); err = kParseErr; } break; case kPOVAttrib_OutputFileType: if(strchr(Output_File_Types, *param) == NULL) ParseError("Unrecognized output file format %c.", *param); err = POVMSUtil_SetInt(obj, option->key, tolower(*param)); param++; if((err == kNoErr) && (*param > ' ')) { if(isdigit(*param) != 0) { if(sscanf(param, "%d", &intval) == 1) err = POVMSUtil_SetInt(obj, kPOVAttrib_BitsPerColor, intval); else { ParseError("Invalid bits per color '%s'.", param); err = kParseErr; } } else { ParseError("Missing bits per color, '%s' found instead.", param); err = kParseErr; } } break; case kPOVAttrib_HistogramFileType: if(strchr(Output_File_Types, *param) == NULL) { ParseError("Unrecognized output file format %c.", *param); err = kParseErr; } else { chr = tolower(*param); err = POVMSUtil_SetInt(obj, option->key, chr); } break; case kPOVAttrib_LibraryPath: POVMSAttributeList list; POVMSAttribute attr; if(err == kNoErr) { // create list if it isn't there if(POVMSObject_Exist(obj, option->key) == kFalseErr) err = POVMSAttrList_New(&list); else if(POVMSObject_Exist(obj, option->key) != kNoErr) err = kObjectAccessErr; else err = POVMSObject_Get(obj, &list, option->key); } else { ParseError("File name or path parameter expected for switch '%s', found '%s'.", option->command, param); err = kParseErr; } // add path or file to list if(err == kNoErr) err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, (void *)param, strlen(param) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&list, &attr); else err = POVMSAttr_Delete(&attr); } if(err == kNoErr) err = POVMSObject_Set(obj, &list, option->key); break; case kPOVAttrib_TestAbortCount: if((*param) == 0) break; if(sscanf(param, "%d", &intval) == 1) err = POVMSUtil_SetInt(obj, option->key, intval); else { ParseError("No or integer parameter expected for switch '%s', found '%s'.", option->command, param); err = kParseErr; } break; } return err; }
int ProcessRenderOptions::ReadSpecialOptionHandler(INI_Parser_Table *option, char *param, POVMSObjectPtr obj) { POVMSAttributeList list; double floatval = 0.0; int intval = 0; int intval2 = 0; int err = kNoErr; switch(option->key) { case kPOVAttrib_HistogramGridSizeX: if(sscanf(param, "%d.%d", &intval, &intval2) == 2) { err = POVMSUtil_SetInt(obj, kPOVAttrib_HistogramGridSizeX, intval); if(err == kNoErr) err = POVMSUtil_SetInt(obj, kPOVAttrib_HistogramGridSizeY, intval2); } else { ParseError("Invalid histogram grid size '%s'.", param); err = kParseErr; } break; case kPOVAttrib_Palette: case kPOVAttrib_VideoMode: while(isspace(*param)) param++; err = POVMSUtil_SetInt(obj, option->key, tolower(*param)); break; case kPOVAttrib_HistogramFileType: case kPOVAttrib_OutputFileType: while(isspace(*param)) param++; if(strchr(Output_File_Types, *param) == NULL) ParseError("Unrecognized output file format %c.", *param); err = POVMSUtil_SetInt(obj, option->key, tolower(*param)); break; case kPOVAttrib_IncludeIni: case kPOVAttrib_LibraryPath: POVMSAttribute attr; if(err == kNoErr) { // parse INI file (recursive) if(option->key == kPOVAttrib_IncludeIni) err = ParseFile(param, obj); // create list if it isn't there if(err == kNoErr) { if(POVMSObject_Exist(obj, option->key) == kFalseErr) err = POVMSAttrList_New(&list); else if(POVMSObject_Exist(obj, option->key) != kNoErr) err = kObjectAccessErr; else err = POVMSObject_Get(obj, &list, option->key); } } else { ParseError("File name or path parameter expected for option '%s', found '%s'.", option->keyword, param); err = kParseErr; } // add path or file to list if(err == kNoErr) err = POVMSAttr_New(&attr); if(err == kNoErr) { err = POVMSAttr_Set(&attr, kPOVMSType_CString, (void *)param, strlen(param) + 1); if(err == kNoErr) err = POVMSAttrList_Append(&list, &attr); else err = POVMSAttr_Delete(&attr); } if(err == kNoErr) err = POVMSObject_Set(obj, &list, option->key); break; case kPOVAttrib_Declare: POVMSObject decobj; // create list if it isn't there if(POVMSObject_Exist(obj, option->key) == kFalseErr) err = POVMSAttrList_New(&list); else if(POVMSObject_Exist(obj, option->key) != kNoErr) err = kObjectAccessErr; else err = POVMSObject_Get(obj, &list, option->key); // add value to list if(err == kNoErr) err = POVMSObject_New(&decobj, kPOVMSType_WildCard); if(err == kNoErr) { char *ptr = NULL; err = POVMSUtil_SetString(&decobj, kPOVAttrib_Identifier, strtok(param, "=")); if(err == kNoErr) { ptr = strtok(NULL, ""); if(ptr == NULL) err = kParseErr; } if(err == kNoErr) { if(strchr(ptr, '"') != NULL) { ptr = strchr(ptr, '"') + 1; strtok(ptr, "\""); err = POVMSUtil_SetString(&decobj, kPOVAttrib_Value, ptr); } else err = POVMSUtil_SetFloat(&decobj, kPOVAttrib_Value, atof(ptr)); } if(err == kNoErr) err = POVMSAttrList_Append(&list, &decobj); else err = POVMSObject_Delete(&decobj); } if(err == kNoErr) err = POVMSObject_Set(obj, &list, option->key); break; case kPOVAttrib_FatalErrorCommand: case kPOVAttrib_PostFrameCommand: case kPOVAttrib_PostSceneCommand: case kPOVAttrib_PreFrameCommand: case kPOVAttrib_PreSceneCommand: case kPOVAttrib_UserAbortCommand: POVMSObject cmdobj; if(POVMSObject_Exist(obj, option->key) == kNoErr) err = POVMSObject_Get(obj, &cmdobj, option->key); else err = POVMSObject_New(&cmdobj, kPOVMSType_WildCard); if(toupper(*(option->keyword + strlen(option->keyword) - 1)) == 'D') { if(err == kNoErr) err = POVMSUtil_SetString(&cmdobj, kPOVAttrib_CommandString, param); } else { if(err == kNoErr) { int i = 0; if((*param == '-') || (*param == '!')) i = tolower(*(param + 1)); else i = tolower(*param); err = POVMSUtil_SetInt(&cmdobj, kPOVAttrib_ReturnAction, i); } } if(err == kNoErr) err = POVMSObject_Set(obj, &cmdobj, option->key); break; } return err; }