Example #1
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;

        SetMaterial();
        pool = new List <Vector3>();

        for (int i = 0; i < 10000; i++)
        {
            pool.Add(new Vector3());
        }

        result = new List <float>();

        TextAsset    asset  = Resources.Load("positions") as TextAsset;
        Stream       s      = new MemoryStream(asset.bytes);
        BinaryReader reader = new BinaryReader(s);

//		BinaryReader reader = new BinaryReader(File.Open("positions.json", FileMode.Open));
        JSONNode ja = SimpleJSON.JSONNode.Deserialize(reader);

        for (int i = 0; i < ja.Count; i++)
        {
            Vector3 vec = UtilScript.JsonToVector3(ja[i]);

            posList.Add(vec);
        }

        pos = posList.ToArray();

        Debug.Log("Num Lines: " + pos.Length);

        CameraFrustumScript cfs = Camera.main.GetComponent <CameraFrustumScript>();

        front = cfs.GetFrontPlane();
        back  = new Vector3[4];

        for (int i = 0; i < front.Length; i++)
        {
            back[i]   = UtilScript.CloneVec3(front[i]);
            back[i].z = Camera.main.farClipPlane - Camera.main.nearClipPlane;
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
//		float input = 237.5654665f;
//
//		float part1 = GetColorPart1(input, 0, 1024);
//		float part2 = GetColorPart2(input, 0, 1024);
//
//		Debug.Log ("MAP1: " + part1);
//		Debug.Log ("MAP2: " + part2);
//		Debug.Log ("Convert: " + PartsToFloat(part1, part2, 0, 1024));

        cam = Camera.main;

        cfs = cam.GetComponent <CameraFrustumScript>();

        front = cfs.GetFrontPlane();
        back  = new Vector3[4];

        for (int i = 0; i < front.Length; i++)
        {
            back[i]   = UtilScript.CloneVec3(front[i]);
            back[i].z = cam.farClipPlane - cam.nearClipPlane;
        }

        totalWidth  = front[1].x - front[0].x;
        totalHeight = front[2].y - front[0].y;
        totalDepth  = back[0].z - front[0].z;

        camPos = cam.transform.position;

        if (lumarcaMode == LUMARCA_MODE.Dots)
        {
            GenerateDots();
        }
        else
        {
            GenerateLines();
            MakeDiscreetAndCutOutsideOfCube();
        }

        SetColorToPart();
    }