using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;

namespace MEMS_Visualizer
{
    class HandModel
    {
        private GeometryModel3D handModel = new GeometryModel3D();
        public GeometryModel3D Model
        {
            get
            {
                return handModel;
            }
        }

        private GeometryModel3D thumbModel = new GeometryModel3D();
        public GeometryModel3D ThumbModel
        {
            get
            {
                return thumbModel;
            }
        }

        private MeshGeometry3D handMesh = new MeshGeometry3D();
        private MeshGeometry3D thumbMesh = new MeshGeometry3D();

        public HandModel()
        {
            loadFromObj();
        }

        // load model from obj file
        private void loadFromObj()
        {
            ObjFIleReader file = new ObjFIleReader();
            handMesh.Positions = file.HandVs;
            handMesh.TriangleIndices = file.HandFs;
            
            thumbMesh.Positions = file.ThumbVs;
            thumbMesh.TriangleIndices = file.ThumbFs;

            handModel.Geometry = handMesh;
            thumbModel.Geometry = thumbMesh;

            // set material
            DiffuseMaterial mat = new DiffuseMaterial(Brushes.Aqua);;
            handModel.Material = mat;
            thumbModel.Material = mat;
        }
    }
}
