OpenBve.Renderer.HideObject C# (CSharp) Méthode

HideObject() static private méthode

static private HideObject ( int ObjectIndex ) : void
ObjectIndex int
Résultat void
        internal static void HideObject(int ObjectIndex)
        {
            if (ObjectManager.Objects[ObjectIndex] == null) return;
            int k = ObjectManager.Objects[ObjectIndex].RendererIndex - 1;
            if (k >= 0)
            {
                // remove faces
                for (int i = 0; i < ObjectList[k].FaceListIndices.Length; i++)
                {
                    int h = ObjectList[k].FaceListIndices[i];
                    int hi = h >> 2;
                    switch (h & 3)
                    {
                        case 0:
                            // opaque
                            OpaqueList[hi] = OpaqueList[OpaqueListCount - 1];
                            OpaqueListCount--;
                            ObjectList[OpaqueList[hi].ObjectListIndex].FaceListIndices[OpaqueList[hi].FaceIndex] = h;
                            break;
                        case 1:
                            // transparent color
                            TransparentColorList[hi] = TransparentColorList[TransparentColorListCount - 1];
                            TransparentColorListCount--;
                            ObjectList[TransparentColorList[hi].ObjectListIndex].FaceListIndices[TransparentColorList[hi].FaceIndex] = h;
                            break;
                        case 2:
                            // alpha
                            AlphaList[hi] = AlphaList[AlphaListCount - 1];
                            AlphaListCount--;
                            ObjectList[AlphaList[hi].ObjectListIndex].FaceListIndices[AlphaList[hi].FaceIndex] = h;
                            break;
                        case 3:
                            // overlay
                            OverlayList[hi] = OverlayList[OverlayListCount - 1];
                            OverlayListCount--;
                            ObjectList[OverlayList[hi].ObjectListIndex].FaceListIndices[OverlayList[hi].FaceIndex] = h;
                            break;
                    }
                }
                // remove object
                if (k == ObjectListCount - 1)
                {
                    ObjectListCount--;
                }
                else
                {
                    ObjectList[k] = ObjectList[ObjectListCount - 1];
                    ObjectListCount--;
                    for (int i = 0; i < ObjectList[k].FaceListIndices.Length; i++)
                    {
                        int h = ObjectList[k].FaceListIndices[i];
                        int hi = h >> 2;
                        switch (h & 3)
                        {
                            case 0:
                                OpaqueList[hi].ObjectListIndex = k;
                                break;
                            case 1:
                                TransparentColorList[hi].ObjectListIndex = k;
                                break;
                            case 2:
                                AlphaList[hi].ObjectListIndex = k;
                                break;
                            case 3:
                                OverlayList[hi].ObjectListIndex = k;
                                break;
                        }
                    }
                    ObjectManager.Objects[ObjectList[k].ObjectIndex].RendererIndex = k + 1;
                }
                ObjectManager.Objects[ObjectIndex].RendererIndex = 0;
            }
        }

Usage Example

Exemple #1
0
 internal void ChangeSection(int SectionIndex)
 {
     if (CarSections.Length == 0)
     {
         CurrentCarSection = -1;
         //Hack: If no bogie objects are defined, just return
         return;
     }
     for (int i = 0; i < CarSections.Length; i++)
     {
         for (int j = 0; j < CarSections[i].Elements.Length; j++)
         {
             int o = CarSections[i].Elements[j].ObjectIndex;
             Renderer.HideObject(o);
         }
     }
     if (SectionIndex >= 0)
     {
         CarSections[SectionIndex].Initialize(CurrentlyVisible);
         for (int j = 0; j < CarSections[SectionIndex].Elements.Length; j++)
         {
             int o = CarSections[SectionIndex].Elements[j].ObjectIndex;
             Renderer.ShowObject(o, ObjectType.Dynamic);
         }
     }
     CurrentCarSection = SectionIndex;
     UpdateObjects(0.0, true);
 }
All Usage Examples Of OpenBve.Renderer::HideObject