public void UpdateRenderObject(bool visible) { if (false == Visible) { return; } if (!Entity.InScene && visible) { return; } if (visible) { var hierarchyComponent = Entity.Hierarchy; if (Visible && (hierarchyComponent.Parent == null || hierarchyComponent.Parent.Entity.Visible) /* && m_frustumCheckBeforeDrawEnabled*/) { if (CanBeAddedToRender()) { if (!IsRenderObjectAssigned(0)) { AddRenderObjects(); } else { UpdateRenderObjectVisibility(visible); } } } } else { if (m_renderObjectIDs[0] != VRageRender.MyRenderProxy.RENDER_ID_UNASSIGNED) { UpdateRenderObjectVisibility(visible); } RemoveRenderObjects(); } foreach (var child in this.Entity.Hierarchy.Children) { MyRenderComponentBase renderComponent = null; if (child.CurrentContainer.TryGet(out renderComponent)) { renderComponent.UpdateRenderObject(visible); } } }
public static MyModel GetModel(this MyRenderComponentBase obj) { return((MyModel)obj.ModelStorage); }