Esempio n. 1
0
        /// <summary>
        /// Transforms the model from local to world space
        /// </summary>
        public void BuildPolygon(ModelPolygon _poly, Vector3 position, Quaternion orientation, float scalar = 1.0f)
        {
            Vertices = new List <Vector3>();

            // build the matrix transform
            var transform = Matrix4x4.CreateScale(scalar) * Matrix4x4.CreateFromQuaternion(orientation) * Matrix4x4.CreateTranslation(position);

            // transform the vertices
            // from local object to world space
            foreach (var vertex in _poly.Vertices)
            {
                Vertices.Add(Vector3.Transform(vertex.ToVector(), transform));
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructs a new polygon from a frame and scale
 /// </summary>
 public Polygon(ModelPolygon _poly, Frame frame, float scale = 1.0f)
 {
     BuildPolygon(_poly, frame.Origin, frame.Orientation, scale);
 }
Esempio n. 3
0
 /// <summary>
 /// Constructs a new polygon from a position, rotation, and scale
 /// </summary>
 public Polygon(ModelPolygon _poly, Vector3 position, Quaternion orientation, float scale = 1.0f)
 {
     BuildPolygon(_poly, position, orientation, scale);
 }