Exemple #1
0
 private void Invalidate(ArtObjectMaterializer.InvalidationContext context)
 {
   using (IEnumerator<TrixelEmplacement> enumerator = context.Trixels.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       TrixelEmplacement trixel = enumerator.Current;
       for (int index = 0; index < 6; ++index)
       {
         FaceOrientation face = (FaceOrientation) index;
         TrixelEmplacement traversed = trixel.GetTraversal(face);
         if (this.IsBorderTrixelFace(traversed))
         {
           if (Enumerable.Any<TrixelSurface>((IEnumerable<TrixelSurface>) this.surfaces, (Func<TrixelSurface, bool>) (x =>
           {
             if (x.Orientation == face)
               return x.AnyRectangleContains(trixel);
             else
               return false;
           })))
             context.Removed.Add(new TrixelFace(trixel, face));
           if (context.TrixelsExist)
             context.Added.Add(new TrixelFace(trixel, face));
         }
         else
         {
           FaceOrientation oppositeFace = FezMath.GetOpposite(face);
           if (Enumerable.Any<TrixelSurface>((IEnumerable<TrixelSurface>) this.surfaces, (Func<TrixelSurface, bool>) (x =>
           {
             if (x.Orientation == oppositeFace)
               return x.AnyRectangleContains(traversed);
             else
               return false;
           })))
             context.Removed.Add(new TrixelFace(traversed, oppositeFace));
           if (!context.TrixelsExist)
             context.Added.Add(new TrixelFace(traversed, oppositeFace));
         }
       }
     }
   }
 }
Exemple #2
0
 public virtual void InitializeArtObjects()
 {
   foreach (ArtObject artObject in Enumerable.Distinct<ArtObject>(Enumerable.Select<ArtObjectInstance, ArtObject>((IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values, (Func<ArtObjectInstance, ArtObject>) (x => x.ArtObject))))
   {
     ArtObjectMaterializer objectMaterializer = new ArtObjectMaterializer(artObject);
     if (artObject.MissingTrixels != null)
     {
       objectMaterializer.MarkMissingCells();
       objectMaterializer.UpdateSurfaces();
     }
     if (artObject.Geometry == null)
       objectMaterializer.RebuildGeometry();
     else
       objectMaterializer.PostInitialize();
   }
   VertexGroup<FezVertexPositionNormalTexture>.Deallocate();
   foreach (ArtObjectInstance artObjectInstance in (IEnumerable<ArtObjectInstance>) this.LevelManager.ArtObjects.Values)
     artObjectInstance.Initialize();
 }