예제 #1
0
파일: Mesh.cs 프로젝트: xstos/alithiatec
 void Init(P3[] relativeVertices, P3 position)
 {
     if (relativeVertices.Length < 3)
     {
         throw new Exception("need at least 3 pts for a poly");
     }
     relativeVertices      = P3.Clone(relativeVertices);
     this.relativeVertices = relativeVertices;
     this.position         = position;
     cache();
 }
예제 #2
0
파일: Mesh.cs 프로젝트: xstos/alithiatec
        public CustomVertex.TransformedColored[] ToScreen(float scaleFactor, Color color)
        {
            if (!dirty && oldScalefactor == scaleFactor)
            {
                return(cachedScreenPts);
            }
            oldScalefactor = scaleFactor;
            dirty          = false;
            int nv = vertices.Count;

            cachedScreenPts    = new CustomVertex.TransformedColored[nv + 2];          //center pt + closed poly
            cachedScreenPts[0] = Make(centerOfGravity.Clone().ScaleBy(scaleFactor), Jitter(color, 5));
            for (int i = 0; i < nv + 1; i++)
            {
                cachedScreenPts[i + 1] = Make(vertices[i % nv].Clone().ScaleBy(scaleFactor), Jitter(color, 5));
            }
            return(cachedScreenPts);
        }
예제 #3
0
파일: Mesh.cs 프로젝트: xstos/alithiatec
 public Mesh2D Clone()
 {
     trash          = new Mesh2D(P3.Clone(relativeVertices), position.Clone());
     trash.velocity = this.velocity.Clone();
     return(trash);
 }