// Functions //-------------------------------------- public void SetMeshGroup(apMeshGroup meshGroup) { if (meshGroup == null) { _childMeshGroup = null; //ID를 반납하자 if (_childMeshGroupTransform != null) { //_portrait.PushUniqueID_Transform(_childMeshGroupTransform._transformUniqueID); _portrait.PushUnusedID(apIDManager.TARGET.Transform, _childMeshGroupTransform._transformUniqueID); _childMeshGroupTransform = null; } _renderUnit = null; } if (meshGroup != null) { _childMeshGroup = meshGroup; bool resetMeshGroupTransform = false; if (_childMeshGroupTransform == null) { resetMeshGroupTransform = true; } else if (_childMeshGroupTransform._meshGroupUniqueID != meshGroup._uniqueID) { //_portrait.PushUniqueID_Transform(_childMeshGroupTransform._transformUniqueID); _portrait.PushUnusedID(apIDManager.TARGET.Transform, _childMeshGroupTransform._transformUniqueID); _childMeshGroupTransform = null; resetMeshGroupTransform = true; } if (resetMeshGroupTransform) { //Root는 별도의 Transform_MeshGroup을 가진다. //새로운 ID로 Transform을 만들자 //_childMeshGroupTransform = new apTransform_MeshGroup(_portrait.MakeUniqueID_Transform()); _childMeshGroupTransform = new apTransform_MeshGroup(_portrait.MakeUniqueID(apIDManager.TARGET.Transform)); _childMeshGroupTransform._meshGroupUniqueID = meshGroup._uniqueID; _childMeshGroupTransform._nickName = meshGroup._name; _childMeshGroupTransform._meshGroup = meshGroup; _childMeshGroupTransform._matrix = new apMatrix(); _childMeshGroupTransform._isVisible_Default = true; _childMeshGroupTransform._depth = 1; //추가 //Root Transform_MeshGroup에 해당하는 RenderUnit _renderUnit = new apRenderUnit(_portrait, "Root"); _renderUnit.SetGroup(meshGroup, _childMeshGroupTransform, null); _renderUnit._childRenderUnits.Add(meshGroup._rootRenderUnit); } else { _childMeshGroupTransform._meshGroup = meshGroup; //Link만 하자 if (_renderUnit == null) { _renderUnit = new apRenderUnit(_portrait, "Root"); _renderUnit.SetGroup(meshGroup, _childMeshGroupTransform, null); _renderUnit._childRenderUnits.Add(meshGroup._rootRenderUnit); } else { _renderUnit._meshGroupTransform = _childMeshGroupTransform; _renderUnit._meshGroup = meshGroup; _renderUnit._childRenderUnits.Clear(); _renderUnit._childRenderUnits.Add(meshGroup._rootRenderUnit); } } } }