예제 #1
0
        public override ContentSize Project(Node node, ContentSize size)
        {
            var rect   = (ContentRectangle)size;
            var widget = (Widget)node;
            var aabb   = CalcAABBInContainer(widget.LocalToWorldTransform, rect.Data);

            return(new ContentPlane(aabb));
        }
예제 #2
0
        public override ContentSize Project(Node node, ContentSize size)
        {
            var rect = size as ContentRectangle;

            if (rect == null)
            {
                throw new Exception($"{nameof(ViewRectProjector)} can project only {nameof(ContentRectangle)}");
            }

            var widget = (Widget)node;

            return(new ContentRectangle(CalcAABBInContainer(viewWorldToLocal, widget.LocalToWorldTransform, rect.Data)));
        }
예제 #3
0
        public RomSize(ContentSize size)
        {
            Size = size;
            OverdumpSize = 0;

            for (int i = 0; i < ValidRomSizes.Count; ++i)
            {
                ulong bytes = ValidRomSizes[i];
                if (Size.Bytes >= bytes || i == ValidRomSizes.Count - 1)
                {
                    OverdumpSize = Size.Bytes - bytes;
                    break;
                }
            }
        }
예제 #4
0
        public override ContentSize Project(Node node, ContentSize size)
        {
            var plane = size as ContentPlane;
            var box   = size as ContentBox;

            if (plane == null && box == null)
            {
                throw new Exception($"{nameof(Viewport3DProjector)} can project only {nameof(ContentPlane)} or {nameof(ContentBox)}");
            }

            Vector3[] points;
            if (plane != null)
            {
                points = plane.Data;
            }
            else
            {
                points = new[] {
                    box.Data.A,
                    new Vector3(box.Data.B.X, box.Data.A.Y, box.Data.A.Z),
                    new Vector3(box.Data.B.X, box.Data.A.Y, box.Data.B.Z),
                    new Vector3(box.Data.A.X, box.Data.A.Y, box.Data.B.Z),
                    new Vector3(box.Data.A.X, box.Data.B.Y, box.Data.A.Z),
                    new Vector3(box.Data.B.X, box.Data.B.Y, box.Data.A.Z),
                    box.Data.B,
                    new Vector3(box.Data.A.X, box.Data.B.Y, box.Data.B.Z)
                };
            }

            var node3D = (Node3D)node;
            var result = new Rectangle(float.MaxValue, float.MaxValue, float.MinValue, float.MinValue);

            for (var i = 0; i < points.Length; i++)
            {
                var worldPoint    = points[i] * node3D.GlobalTransform;
                var pt            = viewProjection.ProjectVector(worldPoint) * vector2Dto3D;
                var viewportPoint = ((Vector2)pt + Vector2.One) * halfSize;
                result = result.IncludingPoint(viewportPoint);
            }
            return(new ContentRectangle(result));
        }
예제 #5
0
        public void EndianSwap()
        {
            ContentType            = ContentType.EndianSwap();
            ContentMetadataVersion = ContentMetadataVersion.EndianSwap();
            ContentSize            = ContentSize.EndianSwap();
            ExecutionId.EndianSwap();
            Creator = Creator.EndianSwap();
            StfsVolumeDescriptor.EndianSwap();
            DataFiles     = DataFiles.EndianSwap();
            DataFilesSize = DataFilesSize.EndianSwap();
            VolumeType    = VolumeType.EndianSwap();
            OnlineCreator = OnlineCreator.EndianSwap();
            Category      = Category.EndianSwap();

            foreach (var str in DisplayName)
            {
                str.EndianSwap();
            }
            foreach (var str in Description)
            {
                str.EndianSwap();
            }
            Publisher.EndianSwap();
            TitleName.EndianSwap();

            ThumbnailSize = ThumbnailSize.EndianSwap();
            foreach (var str in DisplayNameEx)
            {
                str.EndianSwap();
            }

            TitleThumbnailSize = TitleThumbnailSize.EndianSwap();
            foreach (var str in DescriptionEx)
            {
                str.EndianSwap();
            }
        }
예제 #6
0
 public int CompareTo(ContentSize other)
 {
     return Size.CompareTo(other);
 }
예제 #7
0
 public bool Equals(ContentSize other)
 {
     return Size.Equals(other);
 }
예제 #8
0
 public abstract ContentSize Project(Node node, ContentSize size);
예제 #9
0
        public bool IsOnView(ContentSize size)
        {
            var aabb = ((ContentRectangle)size).Data;

            return(Rectangle.Intersect(Area, aabb) != Rectangle.Empty);
        }
예제 #10
0
 public override int GetHashCode()
 {
     return(AcceptRanges.GetHashCode() ^
            ContentSize.GetHashCode() ^
            ServerFileName.GetHashCode());
 }