Example #1
0
 public void Translate(Vector3 v)
 {
     for (int index = 0; index < vertices.Length; index++)
     {
         vertices[index] = new Vector3Ext(Vector3.Add(vertices[index].Position, v));
     }
 }
Example #2
0
 public TriangleExt(Vector3 v1, Vector3 v2, Vector3 v3)
 {
     vertices     = new Vector3Ext[3];
     this.vertex1 = new Vector3Ext(v1);
     this.vertex2 = new Vector3Ext(v2);
     this.vertex3 = new Vector3Ext(v3);
 }
Example #3
0
        public void AddMesh(MeshIndexed sourceMesh, Color color)
        {
            int vertIndex = Vertices.Count;

            foreach (Vector3Ext point in sourceMesh.Vertices)
            {
                //
                Vector3Ext vector = new Vector3Ext(point.Position);

                vector.Position = Mult(ref rotationMatrix, point.Position);
                Vertices.Add(vector);
            }

            foreach (GlPolyIndex poly in sourceMesh.Polygons)
            {
                GlPolyIndex polyIndex = new GlPolyIndex();

                polyIndex.PointIndex = new int[poly.VertexCount];
                for (int j = 0; j < poly.VertexCount; j++)
                {
                    polyIndex.PointIndex[j] = vertIndex + poly.PointIndex[j];
                }

                if (poly.Attributes.HasColor)
                {
                    polyIndex.Attributes.Color = poly.Attributes.Color;
                }
                else
                {
                    polyIndex.Attributes.Color = color;
                }

                Polygons.Add(polyIndex);
            }
        }
Example #4
0
 public TriangleExt(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
 {
     vertices              = new Vector3Ext[3];
     this.vertex1          = new Vector3Ext(v1);
     this.vertex2          = new Vector3Ext(v2);
     this.vertex3          = new Vector3Ext(v3);
     this.Attributes.Color = color;
 }
Example #5
0
        public void ReverseOrder()
        {
            Vector3Ext[] new_vert = new Vector3Ext[vertices.Length];

            for (int j = 0; j < vertices.Length; j++)
            {
                new_vert[vertices.Length - 1 - j] = vertices[j];
            }

            vertices = new_vert;
        }
Example #6
0
        public virtual void RotateY(float angle)
        {
            double ang = Math.PI * angle / 180;

            for (int index = 0; index < vertices.Length; index++)
            {
                vertices[index] = new Vector3Ext(
                    (float)(vertices[index].Position.X * Math.Cos(ang) + vertices[index].Position.Z * Math.Sin(ang)),
                    vertices[index].Position.Y,
                    (float)(-vertices[index].Position.X * Math.Sin(ang) + vertices[index].Position.Z * Math.Cos(ang))
                    );
            }
        }
Example #7
0
        public void AddFacet(Facet facet)
        {
            int         vertIndex = Vertices.Count;
            GlPolyIndex polyIndex = new GlPolyIndex();

            foreach (Point3DF point in facet.Points)
            {
                //
                Vector3Ext vector = new Vector3Ext(point);

                vector.Position = Mult(ref rotationMatrix, point);
                Vertices.Add(vector);
            }

            polyIndex.PointIndex = new int[facet.Points.Length];
            for (int j = 0; j < facet.Points.Length; j++)
            {
                polyIndex.PointIndex[j] = vertIndex + j;
            }

            Polygons.Add(polyIndex);
        }
Example #8
0
 public Vector3Ext(Vector3Ext vector, Color color)
 {
     this.Position         = vector.Position;
     this.Attributes       = new Attributes();
     this.Attributes.Color = color;
 }
Example #9
0
 //
 public Vector3Ext(Vector3Ext vector)
 {
     this.Position   = vector.Position;
     this.Attributes = new Attributes();
 }
Example #10
0
 //
 public TriangleExt()
 {
     vertices = new Vector3Ext[3];
 }