本文整理汇总了C++中ObjectPtr::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr::Copy方法的具体用法?C++ ObjectPtr::Copy怎么用?C++ ObjectPtr::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPtr
的用法示例。
在下文中一共展示了ObjectPtr::Copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy_Object
ObjectPtr Copy_Object (ObjectPtr Old)
{
ObjectPtr New;
if(Old == NULL)
return NULL;
New = Old->Copy();
/*
* The following copying of OBJECT_FIELDS is redundant if Copy
* did *New = *Old but we cannot assume it did. It is safe for
* Copy to do *New = *Old but it should not otherwise
* touch OBJECT_FIELDS.
*/
New->Type = Old->Type;
New->Bound = Old->Bound;
New->Clip = Old->Clip;
New->BBox = Old->BBox;
New->Flags = Old->Flags;
New->Ph_Density = Old->Ph_Density;
New->RadiosityImportance = Old->RadiosityImportance;
// TODO FIXME - An explanation WHY this is important would be nice [CLi]
New->LLights.clear(); // important
New->Texture = Copy_Textures (Old->Texture);
New->Interior_Texture = Copy_Textures (Old->Interior_Texture);
if(Old->interior != NULL)
New->interior = new Interior(*(Old->interior));
else
New->interior = NULL;
/* NK 1998 */
New->UV_Trans = Copy_Transform(Old->UV_Trans);
/* NK ---- */
// TODO: we really ought to decide whether or not it's useful to maintain
// the overhead of having multiple clip and bound objects ... it is
// after all possible for the user to use CSG and give us one object
// meaning we could use a plain pointer here.
if (Old->Bound.empty() == false)
New->Bound = Copy_Objects(Old->Bound);
if (Old->Clip.empty() == false)
{
// note that in this case the objects are shared and should only be
// destroyed the once !!! ... to be frank POV really needs a reference-
// counted system for sharing objects with copy-on-write semantics.
if(Old->Bound != Old->Clip)
New->Clip = Copy_Objects(Old->Clip);
else
New->Clip = New->Bound;
}
return New;
}