Exemplo n.º 1
0
        public static void CreateBillboard(ref FVector3 objectPosition, ref FVector3 cameraPosition,
                                           ref FVector3 cameraUpVector, FVector3?cameraForwardVector, out FMatrix result)
        {
            FVector3 translation = objectPosition - cameraPosition;
            FVector3 backwards, right, up;

            FVector3.Normalize(ref translation, out backwards);
            FVector3.Normalize(ref cameraUpVector, out up);
            FVector3.Cross(ref backwards, ref up, out right);
            FVector3.Cross(ref backwards, ref right, out up);
            result             = Identity;
            result.Backward    = backwards;
            result.Right       = right;
            result.Up          = up;
            result.Translation = translation;
        }
Exemplo n.º 2
0
        public static void CreateWorld(ref FVector3 position, ref FVector3 forward, ref FVector3 up, out FMatrix result)
        {
            FVector3 x, y, z;

            FVector3.Normalize(ref forward, out z);
            FVector3.Cross(ref forward, ref up, out x);
            FVector3.Cross(ref x, ref forward, out y);
            x.Normalize();
            y.Normalize();

            result             = new FMatrix();
            result.Right       = x;
            result.Up          = y;
            result.Forward     = z;
            result.Translation = position;
            result.M44         = 1f;
        }
Exemplo n.º 3
0
        public static void CreateLookAt(ref FVector3 cameraPosition, ref FVector3 cameraTarget, ref FVector3 cameraUpVector,
                                        out FMatrix result)
        {
            // http://msdn.microsoft.com/en-us/library/bb205343(v=VS.85).aspx

            FVector3 vz = FVector3.Normalize(cameraPosition - cameraTarget);
            FVector3 vx = FVector3.Normalize(FVector3.Cross(cameraUpVector, vz));
            FVector3 vy = FVector3.Cross(vz, vx);

            result     = Identity;
            result.M11 = vx.X;
            result.M12 = vy.X;
            result.M13 = vz.X;
            result.M21 = vx.Y;
            result.M22 = vy.Y;
            result.M23 = vz.Y;
            result.M31 = vx.Z;
            result.M32 = vy.Z;
            result.M33 = vz.Z;
            result.M41 = -FVector3.Dot(vx, cameraPosition);
            result.M42 = -FVector3.Dot(vy, cameraPosition);
            result.M43 = -FVector3.Dot(vz, cameraPosition);
        }
Exemplo n.º 4
0
        public static FMatrix CreateLookAt(FVector3 cameraPosition, FVector3 cameraTarget, FVector3 cameraUpVector)
        {
            FMatrix ret;

            CreateLookAt(ref cameraPosition, ref cameraTarget, ref cameraUpVector, out ret);
            return(ret);
        }
Exemplo n.º 5
0
 public static void CreateFromAxisAngle(ref FVector3 axis, float angle, out FMatrix result)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public static FMatrix CreateFromAxisAngle(FVector3 axis, float angle)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public static void CreateConstrainedBillboard(ref FVector3 objectPosition, ref FVector3 cameraPosition,
                                               ref FVector3 rotateAxis, FVector3?cameraForwardVector,
                                               FVector3?objectForwardVector, out FMatrix result)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
 public static FMatrix CreateConstrainedBillboard(FVector3 objectPosition, FVector3 cameraPosition,
                                                  FVector3 rotateAxis, Nullable <FVector3> cameraForwardVector,
                                                  Nullable <FVector3> objectForwardVector)
 {
     throw new NotImplementedException();
 }