Exemple #1
0
        /// <summary>
        /// Gets the summary.
        /// </summary>
        /// <returns>MatrixList&lt;CacheContainerSummary&gt;.</returns>
        public static MatrixList <MemoryCacheContainerSummary> GetSummary()
        {
            var result = new MatrixList <MemoryCacheContainerSummary>();

            foreach (var item in containers)
            {
                result.Add(item.Key.FullName, item.Value.AsCovariance <ICacheContainer, IMemoryCacheContainer>().ToMemoryCacheContainerSummary());
            }

            return(result);
        }
Exemple #2
0
 internal static MatrixList AddMatricies(MatrixList A, MatrixList B)
 {
     int[,] C = new int[A.Count, A.Count];
     for (int i = 0; i < A.Count; i++)
     {
         for (int j = 0; j < A.Count; j++)
         {
             C[i, j] = A.ItemAt(i, j) + B.ItemAt(i, j);
         }
     }
     return(MatrixFromArray(C));
 }
Exemple #3
0
        static void FillMatricies(ref int[,] matrix, ref MatrixList matrixList)
        {
            Random r = new Random();

            for (int i = 0; i < Math.Sqrt(matrix.Length); i++)
            {
                for (int j = 0; j < Math.Sqrt(matrix.Length); j++)
                {
                    matrix[i, j] = r.Next(0, 2);
                }
            }
            matrixList = MatrixFromArray(matrix);
        }
Exemple #4
0
        internal static MatrixList TransposeMatrix(MatrixList matrix)
        {
            int m = matrix.Count;

            int[,] c = new int[m, m];
            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    c[i, j] = matrix.ItemAt(j, i);
                }
            }
            return(MatrixFromArray(c));
        }
Exemple #5
0
        internal static void Execute()
        {
            MatrixList matrixList = new MatrixList();

            int[,] matrix = new int[3, 3];
            FillMatricies(ref matrix, ref matrixList);
            Console.ForegroundColor = ConsoleColor.DarkBlue;
            matrixList.PrintMatrix();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("==========");
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            PrintArrayMatrix(matrix);
            Console.ForegroundColor = ConsoleColor.White;
            PrintArrayMatrix(TransposeMatrix(matrix));
        }
Exemple #6
0
     objectDatas[objectIndex].hidden = hidden;
            }

            // Do Work...
        }
        _threadRunning = false;
    }


    void OnDisable()
    {
        // If the thread is still running, we should shut it down,
        // otherwise it can prevent the game from exiting correctly.
        if (_threadRunning)
        {
            // This forces the while loop in the ThreadedWork function to abort.
            _threadRunning = false;

            // This waits until the thread exits,
            // ensuring any cleanup we do after this is safe. 
            _thread3.Join();
            _thread2.Join();
            _thread.Join();
        }

        // Thread is guaranteed no longer running. Do other cleanup tasks.
    }


    class LODObject
    {
        public List<LODElement> lodElements = new List<LODElement>();
    }

    class LODElement
    {
        public List<MatrixList> splinteredMatrixLists = new List<MatrixList>();
        public void AddMatrix(Matrix4x4 newMatrix, int ID)
        {

            int currentSplinter = 0;
            bool foundNewList = false;
            while (foundNewList == false)
            {
                if (splinteredMatrixLists[currentSplinter].matrixData.Count == 1010)
                {
                    currentSplinter++;
                    if ((splinteredMatrixLists.Count - 1) < currentSplinter)
                    {
                        splinteredMatrixLists.Add(new MatrixList());
                    }
                }
                else
                {
                    foundNewList = true;
                }
            }

            splinteredMatrixLists[currentSplinter].matrixData.Add(newMatrix);
            splinteredMatrixLists[currentSplinter].objectIDS.Add(ID);
        }
        public void RemoveMatrix(int id)
        {
 for (int i = 0; i < splinteredMatrixLists.Count; i++)
            {
                MatrixList matrixList = splinteredMatrixLists[i];
                List<int> alloc = matrixList.objectIDS;
                int allocSize = alloc.Count;

                for (int x = 0; x < allocSize; x++)
     {
                    if (alloc[x] == id)
         {
                        matrixList.matrixData.RemoveAt(x);
                        matrixList.objectIDS.RemoveAt(x);
                        return;
                    }
                }
 }
        }
        public LODElement()
        {
            splinteredMatrixLists.Add(new MatrixList());
        }
    }
    class MatrixList { public List<Matrix4x4> matrixData = new List<Matrix4x4>(); public List<int> objectIDS = new List<int>(); }

    public struct BetterVector3{
        public float x, y, z;
        public BetterVector3(float xx,float yy,float zz){
            x = xx;
            y = yy;
            z = zz;
        }
    }
    public class ObjectData
    {
        public Vector3 position;
        public Quaternion rotation;
        public Vector3 scale;
        public Matrix4x4 matrix;
        public int id;
        public int currentLOD;
        public bool rendering = true;
        public bool culled;
        public bool hidden;
        public float distanceFromCamera;
        public float dirX, dirY, dirZ;
        public float dirNormX, dirNormY, dirNormZ;
    }

}