Exemplo n.º 1
0
        internal void OnDeserialized(StreamingContext context)
        {
            Edges.ForEach(e => e.Brep = this);
            Loops.ForEach(l => l.Brep = this);
            Trims.ForEach(t => t.Brep = this);
            Faces.ForEach(f => f.Brep = this);

            //TODO: all the data props to the real props
        }
Exemplo n.º 2
0
 public void Serialize(BinaryWriter writer)
 {
     Header.Serialize(writer);
     Vertices.ForEach(vertex => vertex.Serialize(writer));
     Normals.ForEach(normal => normal.Serialize(writer));
     Faces.ForEach(face => face.Serialize(writer));
     SubObjects.ForEach(subObject => subObject.Serialize(writer));
     PartAnimations?.ForEach(partAnimation => partAnimation.Serialize(writer));
     CollisionPlaneVectors.ForEach(plane => plane.Serialize(writer));
     CollisionVolumes.ForEach(volume => volume.Serialize(writer));
     Materials.ForEach(material => material.Serialize(writer));
 }
Exemplo n.º 3
0
        public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags)
        {
            Faces.ForEach(f => f.Transform(transform, flags));

            // Handle flip transforms / negative scales
            var origin = GetOrigin();

            if (Faces.All(x => x.Plane.OnPlane(origin) >= 0))
            {
                // All planes are facing inwards - flip them all
                Faces.ForEach(x => x.Flip());
            }

            base.Transform(transform, flags);
        }
Exemplo n.º 4
0
        private int CalculateLength()
        {
            using (MemoryStream buffer = new MemoryStream())
                using (BinaryWriter writer = new BinaryWriter(buffer))
                {
                    Vertices.ForEach(vertex => vertex.Serialize(writer));
                    Normals.ForEach(normal => normal.Serialize(writer));
                    Faces.ForEach(face => face.Serialize(writer));
                    SubObjects.ForEach(subObject => subObject.Serialize(writer));
                    CollisionPlaneVectors.ForEach(collisionPlane => collisionPlane.Serialize(writer));
                    CollisionVolumes.ForEach(collisionVolume => collisionVolume.Serialize(writer));
                    Materials.ForEach(material => material.Serialize(writer));

                    return((int)buffer.Length);
                }
        }
Exemplo n.º 5
0
        public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags)
        {
            Coordinate newStart = transform.Transform(BoundingBox.Start);
            Coordinate newEnd   = transform.Transform(BoundingBox.End);

            if ((newStart - newEnd).VectorMagnitude() > 1000000m)
            {
                return;
            }

            Faces.ForEach(f => f.Transform(transform, flags));

            // Handle flip transforms / negative scales
            var origin = GetOrigin();

            if (Faces.All(x => x.Plane.OnPlane(origin) >= 0))
            {
                // All planes are facing inwards - flip them all
                Faces.ForEach(x => x.Flip());
            }

            base.Transform(transform, flags);
        }
Exemplo n.º 6
0
 protected Solid(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     Faces = ((Face[])info.GetValue("Faces", typeof(Face[]))).ToList();
     Faces.ForEach(x => x.Parent = this);
 }
Exemplo n.º 7
0
 public void SetHighlights()
 {
     Faces.ForEach(f => f.SetHighlights((UInt32)Flags));
 }