示例#1
0
        public static SCNVector3 GetTranslation(this OpenTK.NMatrix4 self)
        {
            var translation = self.Column3;

            return(new SCNVector3(translation.X, translation.Y, translation.Z));
            //return new SCNVector3(self.Column0.Z, self.Column1.Z, self.Column2.Z);
        }
示例#2
0
        unsafe protected void ApplyTransform(Node node, OpenTK.NMatrix4 matrix)
        {
            Matrix4 urhoTransform = *(Matrix4 *)(void *)&matrix;
            var     rotation      = urhoTransform.Rotation;

            rotation.Z *= -1;
            var pos = urhoTransform.Row3;

            node.SetWorldPosition(new Vector3(pos.X, pos.Y, -pos.Z));
            node.Rotation = rotation;
        }
示例#3
0
        // Note that this just straight-across converts, does _not_ transpose, (see README.MD for discussion)
        internal static OpenTK.NMatrix4 ToNMatrix4(this SCNMatrix4 self)
        {
            var newMatrix = new OpenTK.NMatrix4(
                self.M11, self.M21, self.M31, self.M41,
                self.M12, self.M22, self.M32, self.M42,
                self.M13, self.M23, self.M33, self.M43,
                self.M14, self.M24, self.M34, self.M44
                );

            return(newMatrix);
        }
        unsafe protected void ApplyTransform(Node node, OpenTK.NMatrix4 matrix)
        {
            Matrix4 urhoTransform = *(Matrix4 *)(void *)&matrix;

            //urhoTransform = urhoTransform * Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(90));

            var rotation = urhoTransform.Rotation;

            rotation.Z *= -1;
            var pos = urhoTransform.Row3;

            node.SetWorldPosition(new Vector3(pos.X, pos.Y, -pos.Z));
            node.Rotation = rotation;
        }
示例#5
0
        unsafe public void ApplyOpenTkTransform(Node node, OpenTK.NMatrix4 matrix, bool rot = false)
        {
            Matrix4 urhoTransform = *(Matrix4 *)(void *)&matrix;
            var     rotation      = urhoTransform.Rotation;

            rotation.Z *= -1;
            var pos = urhoTransform.Row3;

            node.SetWorldPosition(new Vector3(pos.X, pos.Y, -pos.Z));
            node.Rotation = rotation;
            if (!rot)
            {
                node.Rotate(new Quaternion(0, 0, 90));
            }
        }
示例#6
0
 /// <summary>
 /// Converts an <see cref="OpenTK.NMatrix4"/> into a <see cref="Matrix"/>.
 /// </summary>
 /// <param name="glMatrix">The 4x4 matrix to be converted</param>
 /// <param name="waveMatrix">The converted matrix</param>
 internal static void ToWave(this OpenTK.NMatrix4 glMatrix, out Matrix waveMatrix)
 {
     waveMatrix.M11 = glMatrix.M11;
     waveMatrix.M12 = glMatrix.M21;
     waveMatrix.M13 = glMatrix.M31;
     waveMatrix.M14 = glMatrix.M41;
     waveMatrix.M21 = glMatrix.M12;
     waveMatrix.M22 = glMatrix.M22;
     waveMatrix.M23 = glMatrix.M32;
     waveMatrix.M24 = glMatrix.M42;
     waveMatrix.M31 = glMatrix.M13;
     waveMatrix.M32 = glMatrix.M23;
     waveMatrix.M33 = glMatrix.M33;
     waveMatrix.M34 = glMatrix.M43;
     waveMatrix.M41 = glMatrix.M14;
     waveMatrix.M42 = glMatrix.M24;
     waveMatrix.M43 = glMatrix.M34;
     waveMatrix.M44 = glMatrix.M44;
 }
示例#7
0
        private void ShowPortal(ARHitTestResult hitTestResult)
        {
            SCNScene portalScene = SCNScene.FromFile("art.scnassets/Portal.scn");
            SCNNode  portalNode  = portalScene.RootNode.FindChildNode("Portal", false);

            OpenTK.NMatrix4 transform = hitTestResult.WorldTransform;

            float planeXposition = transform.Column3.X;
            float planeYposition = transform.Column3.Y;
            float planeZposition = transform.Column3.Z;

            portalNode.Position = new SCNVector3(planeXposition, planeYposition, planeZposition);
            sceneView.Scene.RootNode.AddChildNode(portalNode);

            AddPlane("roof", portalNode, "portalTop.png");
            AddPlane("floor", portalNode, "portalBottom.png");
            AddWalls("backWall", portalNode, "portalBack.png");
            AddWalls("sideWallA", portalNode, "portalSideA.png");
            AddWalls("sideWallB", portalNode, "portalSideB.png");
            AddWalls("sideDoorA", portalNode, "portalSideDoorA.png");
            AddWalls("sideDoorB", portalNode, "portalSideDoorB.png");
        }
示例#8
0
 public static SCNMatrix4 ToSCNMatrix4(this OpenTK.NMatrix4 self)
 {
     return(new SCNMatrix4(self.Row0, self.Row1, self.Row2, self.Row3));
 }
示例#9
0
 public static SCNVector3 GetTranslation(this OpenTK.NMatrix4 matrix)
 {
     // only for column-major matrixes
     return(matrix.Column3.Xyz);
 }
示例#10
0
 public KeyPositionAnchor(UIImage image, OpenTK.NMatrix4 transform, ARWorldMappingStatus mappingStatus) : base("KeyPosition", transform)
 {
     this.Image         = image;
     this.MappingStatus = mappingStatus;
 }
示例#11
0
        /// <summary>
        /// Treats matrix as a (right-hand column-major convention) transform matrix
        /// and factors out the translation component of the transform.
        /// </summary>
        public static OpenTK.Vector3 GetTranslation(this OpenTK.NMatrix4 matrix)
        {
            var translation = matrix.Column3;

            return(new OpenTK.Vector3(translation.X, translation.Y, translation.Z));
        }