Example #1
0
        /// <summary>
        /// Apply the transform to the ORIGINAL mesh that was created. Multiple
        /// calls are NOT cumulative.
        /// </summary>
        /// <param name="transform"></param>
        public override void ApplyTransform(Matrix4x4 transform)
        {
            {
                var list = new TriangleWithNormals[_OriginalTriangleVerticies.Count];

                list.Length
                .ParallelChunked((lower, upper) =>
                {
                    for (int i1 = lower; i1 < upper; i1++)
                    {
                        list[i1] = _OriginalTriangleVerticies[i1].ApplyTransform(transform);
                    }
                });

                TrianglesWithNormals = list;
            }
            {
                var list = new Edge3[_OriginalEdgeVertices.Count];

                list.Length
                .ParallelChunked((lower, upper) =>
                {
                    for (int i = lower; i < upper; i++)
                    {
                        list[i] = _OriginalEdgeVertices[i].ApplyTransform(transform);
                    }
                });

                Edges = list;
            }
            UpdateBoundingSphere();
        }
Example #2
0
        private static TriangleWithNormals[] TransformTriangles(MeshData data, Matrix4x4 transform)
        {
            var list = new TriangleWithNormals[data.Triangles.Count];

            list.Length
            .ParallelChunked((lower, upper) =>
            {
                for (int i1 = lower; i1 < upper; i1++)
                {
                    list[i1] = data.Triangles[i1].ApplyTransform(transform);
                }
            });
            return(list);
        }
 public static void GLVertexAndNormal(this TriangleWithNormals @this)
 {
     @this.A.GLVertex3AndNormal3();
     @this.B.GLVertex3AndNormal3();
     @this.C.GLVertex3AndNormal3();
 }