Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    void Start()
    {
        //Screen.showCursor = false;

        Cursor.visible = false;

        wgController = Camera.main.GetComponent <waveguideController> ();

        Renderer rend = GetComponent <Renderer>();

        // duplicate the original texture and assign to the material
        tex = rend.material.mainTexture as Texture2D;
        tex.Resize(200, 100);
        //tex.Resize (100, 50);
        //tex.Resize (w, h);
        rend.material.mainTexture = tex;

        //koa =rend.material.mainTexture as Texture2D;
        koa.Resize(200, 100);
        //koa.Resize (100, 50);
        //koa.Resize (w, h);
        //rend.material.mainTexture = koa;

        // colors used to tint the first 3 mip levels
        Color[] colors = new Color[3];
        colors[0] = Color.red;
        colors[1] = Color.green;
        colors[2] = Color.blue;
        mipCount  = Mathf.Min(3, tex.mipmapCount);

        // tint each mip level

        /*
         * for( var mip = 0; mip < mipCount; ++mip ) {
         *      var cols = tex.GetPixels( mip );
         *      for( var i = 0; i < cols.Length; ++i ) {
         *              cols[i] = new Color(Random.value,Random.value,Random.value);
         *      }
         *      tex.SetPixels( cols, mip );
         * }*/

        // actually apply all SetPixels, don't recalculate mip levels
        //tex.Apply(false);
        int length = tex.GetPixels().Length;

        wat = new float[length];          //
        for (int i = 0; i < wat.Length; i++)
        {
            wat [i] = Random.value;
        }


        int koaLength = koa.GetPixels().Length;

        koalaMatrix = new float[koaLength];

        Color [] graypix = koa.GetPixels();

        for (int i = 0; i < koaLength; i++)
        {
            koalaMatrix [i] = graypix[i].grayscale;
        }

        //print (graypix.Length);



        Debug.Log("n minmaps: " + mipCount);
        solver = new LorenzSolver();
        //for(int i =0; i< wa

        this.GetComponent <AudioSource> ().clip.GetData(buffer, 0);
        //decimate stereo to mono
        int count = 0;;

        mainBuffer = new float[buffer.Length / 2];
        for (int i = 0; i < buffer.Length; i += 2)
        {
            mainBuffer[count] = buffer[i];
            count++;
        }

        bufRead = 0;
        ready   = true;
    }
Ejemplo n.º 2
0
    void Start()
    {
        //Screen.showCursor = false;

        Cursor.visible = false;

        wgController = Camera.main.GetComponent<waveguideController> ();

        Renderer rend = GetComponent<Renderer>();

        // duplicate the original texture and assign to the material
        tex =rend.material.mainTexture as Texture2D;
        tex.Resize (200, 100);
        //tex.Resize (100, 50);
        //tex.Resize (w, h);
        rend.material.mainTexture = tex;

        //koa =rend.material.mainTexture as Texture2D;
        koa.Resize (200, 100);
        //koa.Resize (100, 50);
        //koa.Resize (w, h);
        //rend.material.mainTexture = koa;

        // colors used to tint the first 3 mip levels
        Color[] colors = new Color[3];
        colors[0] = Color.red;
        colors[1] = Color.green;
        colors[2] = Color.blue;
        mipCount = Mathf.Min(3, tex.mipmapCount);

        // tint each mip level
        /*
        for( var mip = 0; mip < mipCount; ++mip ) {
            var cols = tex.GetPixels( mip );
            for( var i = 0; i < cols.Length; ++i ) {
                cols[i] = new Color(Random.value,Random.value,Random.value);
            }
            tex.SetPixels( cols, mip );
        }*/

        // actually apply all SetPixels, don't recalculate mip levels
        //tex.Apply(false);
        int length = tex.GetPixels ().Length;
        wat = new float[length];  //
        for (int i =0; i< wat.Length; i++)
            wat [i] = Random.value;

        int koaLength = koa.GetPixels ().Length;

        koalaMatrix = new float[koaLength];

        Color [] graypix = koa.GetPixels ();

        for (int i =0; i< koaLength; i++) {
            koalaMatrix [i] = graypix[i].grayscale;

        }

        //print (graypix.Length);

        Debug.Log ("n minmaps: " + mipCount);
        solver = new LorenzSolver ();
        //for(int i =0; i< wa

        this.GetComponent<AudioSource> ().clip.GetData (buffer, 0);
        //decimate stereo to mono
        int count = 0;;
        mainBuffer = new float[buffer.Length / 2];
        for (int i =0; i<buffer.Length; i+=2) {
            mainBuffer[count] = buffer[i];
            count++;
        }

        bufRead = 0;
        ready = true;
    }