Newer
Older
VolumeRendering_in_Unity / Assets / Scripts / load_setting.cs
//using System.Collections;
//using System.IO;
//using System.Collections.Generic;
//using UnityEngine;

//[System.Serializable]
//public class Setting
//{
//    public float x_scale;
//    public float y_scale;
//    public float z_scale;
//    public string start_point_vec;
//    public string[] center_points_vec;
//}

//public class load_setting : MonoBehaviour
//{
//    public Vector3 start_point_vec;
//    public List<Vector3> center_points_vec = new List<Vector3>();
//    public GameObject prefabOBJ;

//    // Start is called before the first frame update
//    void Start()
//    {
//        string data_str = "";
//        var reader = new StreamReader(Application.dataPath + "/setting.json"); ;
//        data_str = reader.ReadToEnd();
//        var inputJson = JsonUtility.FromJson<Setting>(data_str);
//        start_point_vec = decodeStr2Vec3(inputJson.center_points_vec[0]);

//        foreach(var points_str in inputJson.center_points_vec)
//        {
//            center_points_vec.Add(decodeStr2Vec3(points_str));
//        }
//        var abs_model_pos = GameObject.Find("Patient").transform.position;
//        Debug.Log(abs_model_pos);
//        foreach(var center_vec in center_points_vec)
//        {
//            GameObject obj = Instantiate(prefabOBJ, center_vec, Quaternion.identity);
//        }
//    }

//    // Update is called once per frame
//    void Update()
//    {
        
//    }

//    Vector3 decodeStr2Vec3(string vec_str)
//    {
//        string[] xyz_str = vec_str.Split(',');
//        return new Vector3(float.Parse(xyz_str[0]), float.Parse(xyz_str[1]), float.Parse(xyz_str[2]));
//    }
//}