Esempio n. 1
0
        private void prepareMemory(int MH, int MV)
        {
            int totalSize = ((MH + 1) * (MV + 1));

            memory.requestSize(totalSize);

            //Iterate one time less, since the last vertex on each buffer will be written by the following buffer as first
            for (int i = 0; i < MH; i++)
            {
                //First Buffer
                memory.vertices[i] = buffer0.vertices[i];
                memory.uv[i]       = buffer0.uvs[i];

                //Third Buffer
                int backIndex = totalSize - 1 - i;
                memory.vertices[backIndex] = buffer2.vertices[i];
                memory.uv[backIndex]       = buffer2.uvs[i];
            }

            for (int i = 0; i < MV; i++)
            {
                //First Buffer
                int frontIndex = (i + 1) * (MH + 1) - 1;
                memory.vertices[frontIndex] = buffer1.vertices[i];
                memory.uv[frontIndex]       = buffer1.uvs[i];

                //Third Buffer
                int backIndex = (MV - i) * (MH + 1);
                memory.vertices[backIndex] = buffer3.vertices[i];
                memory.uv[backIndex]       = buffer3.uvs[i];
            }
        }
        private void prepareMemory(int M, int countProperties)
        {
            int totalSize = ((M + 1) * (M + 2)) >> 1;

            memory.requestSize(totalSize);

            //Iterate one time less, since the last vertex on each buffer will be written by the following buffer as first
            for (int i = 0; i < M; i++)
            {
                //First Buffer
                memory.vertices[i] = buffer0.vertices[i];
                memory.uv[i]       = buffer0.uvs[i];

                //Second Buffer
                int iSubtract = ((i) * (i - 1)) >> 1;
                int index     = (i + 1) * M - iSubtract;
                memory.vertices[index] = buffer1.vertices[i];
                memory.uv[index]       = buffer1.uvs[i];

                //Third Buffer
                iSubtract = ((i + 1) * (i + 2)) >> 1;
                index     = totalSize - iSubtract;
                memory.vertices[index] = buffer2.vertices[i];
                memory.uv[index]       = buffer2.uvs[i];
            }
        }
        private void prepareMemory(int M, CPNSideEdge[] guides, OutputMesh mesh)
        {
            int triangleSize = ((M)*(M + 1)) >> 1;
            int totalSize    = (triangleSize) * sides + 1;

            memory.requestSize(totalSize);

            for (int i = 0; i < sides; i++)
            {
                int relativePosition = triangleSize * (sides - 1 - i);

                bufferTemp.requestSize(M + 1);
                bufferTemp.writeWithGuideBack(guides[i], M, mesh, evaluator);

                for (int j = 0; j < M; j++)
                {
                    memory.vertices[relativePosition + j] = bufferTemp.vertices[j];
                    memory.uv[relativePosition + j]       = bufferTemp.uvs[j];
                }
            }
        }