当前位置: 首页>>代码示例>>C++>>正文


C++ POVMS_Object::Set方法代码示例

本文整理汇总了C++中POVMS_Object::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ POVMS_Object::Set方法的具体用法?C++ POVMS_Object::Set怎么用?C++ POVMS_Object::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在POVMS_Object的用法示例。


在下文中一共展示了POVMS_Object::Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetOptions

// Sets the options to be used on the next render. Accepts a vfeRenderOptions
// instance as its only parameter, and returns any one of a number of possible
// error codes (and sets m_LastError), as documented below:
//
//   vfeFailedToInitObject           - this is an internal error
//   vfeFailedToSetMaxThreads        - self-explanatory
//   vfeFailedToParseINI             - an INI file specified could not be parsed
//   vfeFailedToSetSource            - the source file specified could not be set
//   vfeFailedToParseCommand         - a command-line option was invalid
//   vfeNoInputFile                  - no input file specified either directly or via INI
//   vfeRenderBlockSizeTooSmall      - self-explanatory
//   vfeFailedToWriteINI             - a request to write the render options to an INI file failed
//   vfeUnsupportedOptionCombination - unsupported option combination
//
// If vfeRenderOptions explicitly specifies a source file, it will override
// any set via a parsed INI file. Furthermore, any source file set via a
// command-line option overrides both of the above.
//
// Note that it is your responsibility to add any default INI files that should
// be processed to the INI file list; neither SetOptions() nor any other part
// of the VFE or POV-Ray code will do that for you. This includes non-platform
// specific files such as a potential povray.ini in the CWD.
int vfeSession::SetOptions (vfeRenderOptions& opts)
{
  int                     err;
  UCS2                    str [MAX_PATH];
  POVMSObject             obj;
  vfeProcessRenderOptions options(this);

  m_OutputToFileSet = false;
  m_UsingAlpha = false;
  m_RenderingAnimation = false;
  m_RealTimeRaytracing = false;
  m_ClocklessAnimation = false;
  m_RenderWidth = m_RenderHeight = 0;
  ClearOptions();

  if ((err = POVMSObject_New (&obj, kPOVObjectClass_RenderOptions)) != kNoErr)
    return (m_LastError = vfeFailedToInitObject) ;

  if ((err = POVMSUtil_SetInt (&obj, kPOVAttrib_MaxRenderThreads, opts.m_ThreadCount)) != kNoErr)
    return (m_LastError = vfeFailedToSetMaxThreads) ;

  // we set this here for potential use by the IO permissions path checking code
  m_InputFilename = opts.m_SourceFile;

  // most likely povray.ini will be the first INI file processed here (as it's included by default)
  for (vector<UCS2String>::iterator i = opts.m_IniFiles.begin(); i != opts.m_IniFiles.end(); i++)
  {
    // we call TestAccessAllowed() here, even though ParseFile() will do it also, since if
    // access is denied, the reason will not be obvious (ParseFile() just returns kCannotOpenFileErr).
    if (!TestAccessAllowed (Path(*i), false))
      return (m_LastError = vfeIORestrictionDeny);

    if ((err = options.ParseFile (UCS2toASCIIString(*i).c_str(), &obj)) != kNoErr)
      return (m_LastError = vfeFailedToParseINI) ;

    // we keep this up to date since the IO permissions feature will use the current input
    // filename to determine the path for default read/write permission in the scene dir.
    int n = sizeof (str) ;
    if ((err = POVMSUtil_GetUCS2String (&obj, kPOVAttrib_InputFile, str, &n)) == kNoErr)
      if (m_InputFilename != str)
        m_InputFilename = str;
  }

  // m_SourceFile overrides any source file set by the INI files
  if (opts.m_SourceFile.empty() == false)
  {
    m_InputFilename = opts.m_SourceFile;
    if ((err = POVMSUtil_SetUCS2String (&obj, kPOVAttrib_InputFile, opts.m_SourceFile.c_str())) != kNoErr)
      return (m_LastError = vfeFailedToSetSource);
  }

  // any source file set on the command-line overrides a source file set another way
  for (vector<string>::iterator i = opts.m_Commands.begin(); i != opts.m_Commands.end(); i++)
  {
    if ((err = options.ParseString (i->c_str(), &obj)) != kNoErr)
      return (m_LastError = vfeFailedToParseCommand) ;
    int n = sizeof (str) ;
    if ((err = POVMSUtil_GetUCS2String (&obj, kPOVAttrib_InputFile, str, &n)) == kNoErr)
      if (m_InputFilename != str)
        m_InputFilename = str;
  }

  int n = sizeof (str) ;
  if ((err = POVMSUtil_GetUCS2String (&obj, kPOVAttrib_InputFile, str, &n)) != kNoErr)
    return (m_LastError = vfeNoInputFile);
  m_InputFilename = str;

  POVMSUtil_GetInt (&obj, kPOVAttrib_Width, &m_RenderWidth) ;
  POVMSUtil_GetInt (&obj, kPOVAttrib_Height, &m_RenderHeight) ;

  std::list<Path> libpaths;
  POVMS_Object ropts (obj) ;
  if (ropts.Exist (kPOVAttrib_LibraryPath))
  {
    POVMS_List pathlist;
    ropts.Get (kPOVAttrib_LibraryPath, pathlist) ;

    // we take the opportunity to remove any duplicates that are in the path list.
//.........这里部分代码省略.........
开发者ID:UberPOV,项目名称:UberPOV,代码行数:101,代码来源:vfecontrol.cpp

示例2: GetStatistics

void Scene::GetStatistics(POVMS_Object& parserStats)
{
    struct TimeData final
    {
        POV_LONG cpuTime;
        POV_LONG realTime;
        size_t samples;

        TimeData() : cpuTime(0), realTime(0), samples(0) { }
    };

    TimeData timeData[TraceThreadData::kMaxTimeType];

    for(std::vector<TraceThreadData*>::iterator i(sceneThreadData.begin()); i != sceneThreadData.end(); i++)
    {
        timeData[(*i)->timeType].realTime = max(timeData[(*i)->timeType].realTime, (*i)->realTime);
        if ((*i)->cpuTime >= 0)
            timeData[(*i)->timeType].cpuTime += (*i)->cpuTime;
        else
            timeData[(*i)->timeType].cpuTime = -1;
        timeData[(*i)->timeType].samples++;
    }

    for(size_t i = TraceThreadData::kUnknownTime; i < TraceThreadData::kMaxTimeType; i++)
    {
        if(timeData[i].samples > 0)
        {
            POVMS_Object elapsedTime(kPOVObjectClass_ElapsedTime);

            elapsedTime.SetLong(kPOVAttrib_RealTime, timeData[i].realTime);
            if (timeData[i].cpuTime >= 0)
                elapsedTime.SetLong(kPOVAttrib_CPUTime, timeData[i].cpuTime);
            elapsedTime.SetInt(kPOVAttrib_TimeSamples, POVMSInt(timeData[i].samples));

            switch(i)
            {
                case TraceThreadData::kParseTime:
                    parserStats.Set(kPOVAttrib_ParseTime, elapsedTime);
                    break;
                case TraceThreadData::kBoundingTime:
                    parserStats.Set(kPOVAttrib_BoundingTime, elapsedTime);
                    break;
            }
        }
    }

    parserStats.SetInt(kPOVAttrib_FiniteObjects, sceneData->numberOfFiniteObjects);
    parserStats.SetInt(kPOVAttrib_InfiniteObjects, sceneData->numberOfInfiniteObjects);
    parserStats.SetInt(kPOVAttrib_LightSources, POVMSInt(sceneData->lightSources.size()));
    parserStats.SetInt(kPOVAttrib_Cameras, POVMSInt(sceneData->cameras.size()));

    if(sceneData->boundingMethod == 2)
    {
        parserStats.SetInt(kPOVAttrib_BSPNodes, sceneData->nodes);
        parserStats.SetInt(kPOVAttrib_BSPSplitNodes, sceneData->splitNodes);
        parserStats.SetInt(kPOVAttrib_BSPObjectNodes, sceneData->objectNodes);
        parserStats.SetInt(kPOVAttrib_BSPEmptyNodes, sceneData->emptyNodes);
        parserStats.SetInt(kPOVAttrib_BSPMaxObjects, sceneData->maxObjects);
        parserStats.SetFloat(kPOVAttrib_BSPAverageObjects, sceneData->averageObjects);
        parserStats.SetInt(kPOVAttrib_BSPMaxDepth, sceneData->maxDepth);
        parserStats.SetFloat(kPOVAttrib_BSPAverageDepth, sceneData->averageDepth);
        parserStats.SetInt(kPOVAttrib_BSPAborts, sceneData->aborts);
        parserStats.SetFloat(kPOVAttrib_BSPAverageAborts, sceneData->averageAborts);
        parserStats.SetFloat(kPOVAttrib_BSPAverageAbortObjects, sceneData->averageAbortObjects);
    }
}
开发者ID:wfpokorny,项目名称:povray,代码行数:66,代码来源:scene.cpp


注:本文中的POVMS_Object::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。