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


C++ POVMS_Attribute类代码示例

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


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

示例1: Get

std::vector<POVMSType> POVMS_Object::GetTypeVector(POVMSType key)
{
    POVMS_Attribute attr;

    Get(key, attr);

    return attr.GetTypeVector();
}
开发者ID:wfpokorny,项目名称:povray,代码行数:8,代码来源:povmscpp.cpp

示例2: Set

void POVMS_Object::Set(POVMSType key, POVMS_Attribute& attr)
{
	int err;

	err = POVMSObject_Set(&data, &attr.data, key);
	if(err != kNoErr)
		throw err;

	attr.DetachData();
}
开发者ID:ClementLeBihan,项目名称:CelluleFlexible,代码行数:10,代码来源:povmscpp.cpp

示例3: SetNth

void POVMS_List::SetNth(int index, POVMS_Attribute& item)
{
	int err;

	err = POVMSAttrList_SetNth(&data, index, &item.data);
	if(err != kNoErr)
		throw err;

	item.DetachData();
}
开发者ID:ClementLeBihan,项目名称:CelluleFlexible,代码行数:10,代码来源:povmscpp.cpp

示例4: Append

void POVMS_List::Append(POVMS_Attribute& item)
{
	int err;

	err = POVMSAttrList_Append(&data, &item.data);
	if(err != kNoErr)
		throw err;

	item.DetachData();
}
开发者ID:ClementLeBihan,项目名称:CelluleFlexible,代码行数:10,代码来源:povmscpp.cpp

示例5: Set

void POVMS_Object::Set(POVMSType key, POVMS_Attribute& attr)
{
    int err;

    err = POVMSObject_Set(&data, &attr.data, key);
    if(err != pov_base::kNoErr)
        throw POV_EXCEPTION_CODE(err);

    attr.DetachData();
}
开发者ID:wfpokorny,项目名称:povray,代码行数:10,代码来源:povmscpp.cpp

示例6: SetNth

void POVMS_List::SetNth(int index, POVMS_Attribute& item)
{
    int err;

    err = POVMSAttrList_SetNth(&data, index, &item.data);
    if(err != pov_base::kNoErr)
        throw POV_EXCEPTION_CODE(err);

    item.DetachData();
}
开发者ID:wfpokorny,项目名称:povray,代码行数:10,代码来源:povmscpp.cpp

示例7: Append

void POVMS_List::Append(POVMS_Attribute& item)
{
    int err;

    err = POVMSAttrList_Append(&data, &item.data);
    if(err != pov_base::kNoErr)
        throw POV_EXCEPTION_CODE(err);

    item.DetachData();
}
开发者ID:wfpokorny,项目名称:povray,代码行数:10,代码来源:povmscpp.cpp

示例8: FindFile

bool FileMessageHandler::FindFile(const list<Path>& lps, POVMS_Object& msg, POVMS_Object& result)
{
	POVMS_List files;
	Path path;

	msg.Get(kPOVAttrib_ReadFile, files);

	for(int i = 1; i <= files.GetListSize(); i++)
	{
		POVMS_Attribute attr;

		files.GetNth(i, attr);

		path = FindFilePath(lps, Path(attr.GetUCS2String()));

		if(path.Empty() == false)
			break;
	}

	result.SetUCS2String(kPOVAttrib_ReadFile, path().c_str());

	return (path.Empty() == false);
}
开发者ID:acekiller,项目名称:povray,代码行数:23,代码来源:filemessagehandler.cpp

示例9: DrawPixelRowSet

            break;
        case kPOVMsgIdent_PixelRowSet:
            DrawPixelRowSet(sd, vd, msg, final);
            break;
        case kPOVMsgIdent_RectangleFrameSet:
            DrawRectangleFrameSet(sd, vd, msg, final);
            break;
        case kPOVMsgIdent_FilledRectangleSet:
            DrawFilledRectangleSet(sd, vd, msg, final);
            break;
    }
}

void ImageMessageHandler::DrawPixelSet(const SceneData& sd, const ViewData& vd, POVMS_Object& msg, bool final)
{
    POVMS_Attribute pixelposattr;
    POVMS_Attribute pixelcolattr;
    unsigned int psize(msg.GetInt(kPOVAttrib_PixelSize));

    msg.Get(kPOVAttrib_PixelPositions, pixelposattr);
    msg.Get(kPOVAttrib_PixelColors, pixelcolattr);

    vector<POVMSInt> pixelpositions(pixelposattr.GetIntVector());
    vector<POVMSFloat> pixelcolors(pixelcolattr.GetFloatVector());

    if((pixelpositions.size() / 2) != (pixelcolors.size() / 5))
        throw POV_EXCEPTION(kInvalidDataSizeErr, "Number of pixel colors and pixel positions does not match!");

    for(int i = 0, ii = 0; (i < pixelcolors.size()) && (ii < pixelpositions.size()); i += 5, ii += 2)
    {
        RGBTColour col(pixelcolors[i], pixelcolors[i + 1], pixelcolors[i + 2], pixelcolors[i + 4]); // NB pixelcolors[i + 3] is an unused channel
开发者ID:wfpokorny,项目名称:povray,代码行数:31,代码来源:imagemessagehandler.cpp

示例10: options


//.........这里部分代码省略.........
        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.
    // it's cleaner to do that here, rather than in the INI parser, since it's table-
    // driven and doesn't have an explicit function for adding library paths per se.
    //
    // we use the Path equivalence operator rather than a string compare since
    // using Path should handle platform-specific issues like case-sensitivity (or,
    // rather, lack thereof). note that at the time of writing, the Path class did
    // not yet implement case-insensitive comparisions.
    //
    // NB while it would of course be more efficient to sort the list so searches are
    // faster, we'd have to make a copy of it to do that, as we can't change the order
    // of existing entries (that would change the include path search order). it's not
    // common to have a lot of include paths, so we just use linear searches.
    for (int i = 1; i <= pathlist.GetListSize(); i++)
    {
      POVMS_Attribute lp;

      pathlist.GetNth(i, lp);
      Path path(lp.GetUCS2String());
      if (find(libpaths.begin(), libpaths.end(), path) == libpaths.end())
        libpaths.push_back(path);
    }
  }

  if (opts.m_LibraryPaths.empty() == false)
  {
    for (vector<UCS2String>::const_iterator i = opts.m_LibraryPaths.begin(); i != opts.m_LibraryPaths.end(); i++)
    {
      Path path(*i);

      if (find(libpaths.begin(), libpaths.end(), path) == libpaths.end())
        libpaths.push_back(path);
    }
  }

  if (libpaths.empty() == false)
  {
    POVMS_List pathlist;
    for (list<Path>::iterator i = libpaths.begin(); i != libpaths.end(); i++)
    {
      POVMS_Attribute attr((*i)().c_str());
      pathlist.Append(attr);
    }
    ropts.Set (kPOVAttrib_LibraryPath, pathlist) ;
  }

  if (ropts.TryGetBool(kPOVAttrib_RealTimeRaytracing, false) == true)
    ropts.SetBool(kPOVAttrib_OutputToFile, false);
开发者ID:UberPOV,项目名称:UberPOV,代码行数:67,代码来源:vfecontrol.cpp

示例11: clip

void Scene::StartParser(POVMS_Object& parseOptions)
{
    size_t seed = 0; // TODO

    // A scene can only be parsed once
    if (parserControlThread == nullptr)
        parserControlThread = new std::thread(boost::bind(&Scene::ParserControlThread, this));
    else
        return;

    if (parseOptions.Exist(kPOVAttrib_Version))
    {
        sceneData->languageVersion = clip(int(parseOptions.GetFloat(kPOVAttrib_Version) * 100.0f + .5f), 100, 10000);
        sceneData->languageVersionSet = true;
    }

    sceneData->warningLevel = clip(parseOptions.TryGetInt(kPOVAttrib_WarningLevel, 9), 0, 9);

    sceneData->inputFile = parseOptions.TryGetUCS2String(kPOVAttrib_InputFile, "object.pov");
    sceneData->headerFile = parseOptions.TryGetUCS2String(kPOVAttrib_IncludeHeader, "");

    DBL outputWidth  = parseOptions.TryGetFloat(kPOVAttrib_Width, 160);
    DBL outputHeight = parseOptions.TryGetFloat(kPOVAttrib_Height, 120);
    sceneData->aspectRatio = outputWidth / outputHeight;

    sceneData->defaultFileType = parseOptions.TryGetInt(kPOVAttrib_OutputFileType, DEFAULT_OUTPUT_FORMAT); // TODO - should get DEFAULT_OUTPUT_FORMAT from the front-end
    sceneData->clocklessAnimation = parseOptions.TryGetBool(kPOVAttrib_ClocklessAnimation, false); // TODO - experimental code

    sceneData->splitUnions = parseOptions.TryGetBool(kPOVAttrib_SplitUnions, false);
    sceneData->removeBounds = parseOptions.TryGetBool(kPOVAttrib_RemoveBounds, true);
    sceneData->boundingMethod = clip<int>(parseOptions.TryGetInt(kPOVAttrib_BoundingMethod, 1), 1, 2);
    if(parseOptions.TryGetBool(kPOVAttrib_Bounding, true) == false)
        sceneData->boundingMethod = 0;

    sceneData->outputAlpha = parseOptions.TryGetBool(kPOVAttrib_OutputAlpha, false);
    if (!sceneData->outputAlpha)
        // if we're not outputting an alpha channel, precompose the scene background against a black "background behind the background"
        // (NB: Here, background color is still at its default of <0,0,0,0,1> = full transparency; we're changing that to opaque black.)
        sceneData->backgroundColour.Clear();

    // NB a value of '0' for any of the BSP parameters tells the BSP code to use its internal default
    sceneData->bspMaxDepth = parseOptions.TryGetInt(kPOVAttrib_BSP_MaxDepth, 0);
    sceneData->bspObjectIsectCost = clip<float>(parseOptions.TryGetFloat(kPOVAttrib_BSP_ISectCost, 0.0f), 0.0f, HUGE_VAL);
    sceneData->bspBaseAccessCost = clip<float>(parseOptions.TryGetFloat(kPOVAttrib_BSP_BaseAccessCost, 0.0f), 0.0f, HUGE_VAL);
    sceneData->bspChildAccessCost = clip<float>(parseOptions.TryGetFloat(kPOVAttrib_BSP_ChildAccessCost, 0.0f), 0.0f, HUGE_VAL);
    sceneData->bspMissChance = clip<float>(parseOptions.TryGetFloat(kPOVAttrib_BSP_MissChance, 0.0f), 0.0f, 1.0f - EPSILON);

    sceneData->realTimeRaytracing = parseOptions.TryGetBool(kPOVAttrib_RealTimeRaytracing, false);

    if(parseOptions.Exist(kPOVAttrib_Declare) == true)
    {
        POVMS_List ds;

        parseOptions.Get(kPOVAttrib_Declare, ds);
        for(int i = 1; i <= ds.GetListSize(); i++)
        {
            std::ostringstream sstr;
            POVMS_Attribute a;
            POVMS_Object d;

            ds.GetNth(i, d);
            d.Get(kPOVAttrib_Value, a);
            switch (a.Type())
            {
                case kPOVMSType_CString:
                    sstr << "\"" + d.TryGetString(kPOVAttrib_Value, "") + "\"";
                    break;

                case kPOVMSType_Float:
                    sstr << d.TryGetFloat(kPOVAttrib_Value, 0.0);
                    break;

                default:
                    // shouldn't happen unless we make a coding error
                    throw POV_EXCEPTION(kParamErr, "Invalid type passed in declare list");
            }

            sceneData->declaredVariables.insert(make_pair(d.GetString(kPOVAttrib_Identifier), sstr.str()));
        }
    }

    // do parsing
    sceneThreadData.push_back(dynamic_cast<TraceThreadData *>(parserTasks.AppendTask(new ParserTask(
        sceneData, pov_parser::ParserOptions(bool(parseOptions.Exist(kPOVAttrib_Clock)), parseOptions.TryGetFloat(kPOVAttrib_Clock, 0.0), seed)
        ))));

    // wait for parsing
    parserTasks.AppendSync();

    // do bounding - we always call this even if the bounding is turned off
    // because it also generates object statistics
    sceneThreadData.push_back(dynamic_cast<TraceThreadData *>(parserTasks.AppendTask(new BoundingTask(
        sceneData,
        clip<int>(parseOptions.TryGetInt(kPOVAttrib_BoundingThreshold, DEFAULT_AUTO_BOUNDINGTHRESHOLD),1,SIGNED16_MAX),
        seed
        ))));

    // wait for bounding
    parserTasks.AppendSync();

//.........这里部分代码省略.........
开发者ID:wfpokorny,项目名称:povray,代码行数:101,代码来源:scene.cpp


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