Ejemplo n.º 1
0
        public static SCNPhysicsShape Create(SCNPhysicsShape [] shapes, SCNMatrix4 [] transforms)
        {
            if (shapes == null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentException(nameof(shapes));
            }

            if (transforms == null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentException(nameof(transforms));
            }

            var t = new NSValue [transforms.Length];

            for (var i = 0; i < t.Length; i++)
            {
                t [i] = NSValue.FromSCNMatrix4(transforms [i]);
            }

            return(Create(shapes, t));
        }
Ejemplo n.º 2
0
        public static SCNPhysicsShape Create(SCNPhysicsShape [] shapes, SCNMatrix4 [] transforms)
        {
            if (shapes == null)
            {
                throw new ArgumentNullException("shapes");
            }

            if (transforms == null)
            {
                throw new ArgumentNullException("transforms");
            }

            var t = new NSValue [transforms.Length];

            for (var i = 0; i < t.Length; i++)
            {
                t [i] = NSValue.FromSCNMatrix4(transforms [i]);
            }

            return(Create(shapes, t));
        }
Ejemplo n.º 3
0
        static NSArray ToNSArray(SCNMatrix4 []?items)
        {
            if (items is null)
            {
                return(new NSArray());
            }

            var count = items.Length;
            var buf   = Marshal.AllocHGlobal((IntPtr)(count * IntPtr.Size));

            for (nint i = 0; i < count; i++)
            {
                var item = NSValue.FromSCNMatrix4(items [i]);
                var h    = item == null ? NSNull.Null.Handle : item.Handle;
                Marshal.WriteIntPtr(buf, (int)(i * IntPtr.Size), h);
            }

            var nsa = new NSArray(NSArray.FromObjects(buf, count));

            Marshal.FreeHGlobal(buf);

            return(nsa);
        }