1 / 4

Understanding the Cloning Process in NiObject and NiAVObject

This documentation provides an in-depth overview of the cloning process within the NiObject and NiAVObject classes. It details the methods responsible for cloning objects, including `Clone()`, `CopyMembers()`, and `CloneProperties()`, as well as how the cloning process is managed through `NiCloningProcess`. The information highlights the importance of sharing properties among multiple NiAVObjects and explains how properties are cloned using shared references to optimize efficiency in 3D rendering applications.

tejana
Télécharger la présentation

Understanding the Cloning Process in NiObject and NiAVObject

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CloningNiObject NiObject* NiObject::Clone() { NiCloningProcess kCloning; NiObject* pClone = CreateClone(kCloning); ProcessClone(kCloning); return pClone; } NiObject* NiObject::Clone(NiCloningProcess& kCloning) { NiObject* pClone = CreateClone(kCloning); ProcessClone(kCloning); return pClone; }

  2. Cloning (cont.)NiObject void NiObject::CopyMembers(NiObject* pDest, NiCloningProcess& kCloning) { kCloning.m_pkCloneMap->SetAt(this, pDest); } NiObject* NiObject::CreateSharedClone(NiCloningProcess& kCloning) { NiObject* pkClone; if (kCloning.m_pkCloneMap->GetAt(this, pkClone)) return pkClone; else return CreateClone(kCloning); }

  3. Cloning (cont.)NiAVObject • NiCloningProcess가 필요한 이유 • Property를 다수의 NiAVObject가 공유할 수 있기 때문 void NiAVObject::CloneProperties(NiAVObject* pkDest, NiPropertyList* pkList, NiCloningProcess& kCloning) { NiTListIterator kPos = pkList->GetTailPos(); while (kPos) { NiProperty* pkProperty = pkList->GetPrev(kPos); pkDest->AttachProperty((NiProperty*)pkProperty->CreateSharedClone( kCloning)); } }

  4. Clone (cont.)NiNode void NiNode::ProcessClone( NiCloningProcess& kCloning) { NiAVObject::ProcessClone(kCloning); NiObject* pkClone; bool bCloned = kCloning.m_pkCloneMap->GetAt(this, pkClone); NiNode* pkNode = (NiNode*) pkClone; const NiDynamicEffectList *pkList = &GetEffectList(); if (!pkList->IsEmpty()) pkNode->CopyEffectListClones(pkList, kCloning); … }

More Related