示例#1
0
    // Use this for initialization
    void Start()
    {
        currentIndex = minIndex;
        rangeMarker  = (GameObject)Instantiate(rangeMarker, new Vector3(), Quaternion.identity);

        audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        generalEditor = (GeneralEditorScript)GetComponent("GeneralEditorScript");
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        creditsModel = (GameObject)Instantiate(creditsModelPrefab, transform.position, transform.rotation);
        creditsModel.transform.localScale = scale;
        creditsModel.GetComponent <MeshRenderer>().enabled = false;


        audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        gameObject.AddComponent("MeshFilter");
        gameObject.AddComponent("MeshRenderer");

        mesh = GetComponent <MeshFilter>().mesh;
        meshFieldGeneratorScript = (MeshFieldGeneratorScript)GameObject.Find("MainMeshField").GetComponent("MeshFieldGeneratorScript");

        audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        gameObject.AddComponent("MeshFilter");
        gameObject.AddComponent("MeshRenderer");

        mesh = GetComponent<MeshFilter>().mesh;
        meshFieldGeneratorScript = (MeshFieldGeneratorScript)GameObject.Find("MainMeshField").GetComponent("MeshFieldGeneratorScript");

        audioDirector = (AudioDirectorScript) GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        amplitudeEditor = (AmplitudeEditorScript)GetComponent("AmplitudeEditorScript");
        frequencyEditor = (FrequencyEditorScript)GetComponent("FrequencyEditorScript");
        playerObject    = GameObject.FindWithTag("Player");

        mainFileBrowserScript = (ParametersFilesImportScript)GetComponent("ParametersFilesImportScript");

        audioDirector    = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        fpsDisplayObject = GameObject.FindWithTag("FPSDisplay");
    }
示例#6
0
    // Use this for initialization
    void Start()
    {
        //mp3Importer = (MP3Import)GetComponent("MP3Import");
        audioDirector      = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        audioListener      = (AudioListener)GameObject.FindWithTag("AudioDirector").GetComponent("AudioListener");
        genralEditorScript = (GeneralEditorScript)GetComponent("GeneralEditorScript");

        if (isActive)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        }
    }
    // Use this for initialization
    void Start()
    {
        audioDirector          = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        audioListener          = (AudioListener)GameObject.FindWithTag("AudioDirector").GetComponent("AudioListener");
        genralEditorScript     = (GeneralEditorScript)GetComponent("GeneralEditorScript");
        liveAudioInputSelector = GetComponent <LiveAudioInputSelectorScript>();
        cameraTypeSelector     = GetComponent <CameraTypeSelectorScript>();

        if (isActive)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        }
    }
示例#8
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < partsCount; i++)
        {
            positionsList.Add(new Vector3(400.0f * Mathf.Cos((Mathf.PI / 2) + (Mathf.PI / 2) * ((float)i / (float)partsCount)), 0, -800.0f * Mathf.Sin((Mathf.PI / 2) + (Mathf.PI / 2) * ((float)i / (float)partsCount))));
            rotationsList.Add(Quaternion.identity);
            //Debug.Log(positionsList[i]);
            velocitiesList.Add(new Vector3());
            GameObject tempGameObject = (GameObject)Instantiate(partPrefab, positionsList[i], Quaternion.identity);
            tempGameObject.transform.parent = transform;
            ((CreaturePartsGeneralScript)tempGameObject.GetComponent("CreaturePartsGeneralScript")).arrayIndex       = i;
            ((CreaturePartsGeneralScript)tempGameObject.GetComponent("CreaturePartsGeneralScript")).ownerArrayScript = this;
        }

        audioDirector = (AudioDirectorScript)GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
    }
    void Start()
    {
        audioDirector = GameObject.FindGameObjectWithTag("AudioDirector").GetComponent <AudioDirectorScript>();
        lmcController = new Controller();
        if (lmcController == null)
        {
            Debug.LogWarning("Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");
        }

        fingertipsPosArray = new Vector3[5];
        debugPosObjects    = new GameObject[fingertipsPosArray.Length];
        for (int i = 0; i < debugPosObjects.Length; i++)
        {
            debugPosObjects[i]                  = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            debugPosObjects[i].name             = "Debug finger: " + i.ToString();
            debugPosObjects[i].transform.parent = transform;
            debugPosObjects[i].renderer.enabled = false;
        }

        meshlinesGenerator = GetComponent <MeshLinesGenerator>();
        fingerJointsArrayStitchesPosArray = new Vector3[jointsPerFinger][];
        for (int i = 0; i < fingerJointsArrayStitchesPosArray.Length; i++)
        {
            fingerJointsArrayStitchesPosArray[i] = new Vector3[meshlinesGenerator.verticesFrequencyDepthCount];
        }

        // internal array to store just joint positions
        fingersArrayJointsPositionsPosArray = new Vector3[5][];         // 5 because there are 5 fingers
        for (int i = 0; i < fingersArrayJointsPositionsPosArray.Length; i++)
        {
            fingersArrayJointsPositionsPosArray[i] = new Vector3[jointsPerFinger];
        }

        bonesQuaternionsCacheArray = new Quaternion[25];         // 5 bones/joints (counting fingertip) for all 5 fingers
        bonesWidthsCacheArray      = new float[25];

        rotGO               = new GameObject();
        rotGO.name          = "LMC bone rot GO";
        rotTransform        = rotGO.transform;
        rotTransform.parent = transform.parent;
    }
    void Start()
    {
        audioDirector = GameObject.FindGameObjectWithTag("AudioDirector").GetComponent<AudioDirectorScript>();
        lmcController = new Controller();
        if (lmcController == null)
            Debug.LogWarning("Cannot connect to controller. Make sure you have Leap Motion v2.0+ installed");

        fingertipsPosArray = new Vector3[5];
        debugPosObjects = new GameObject[fingertipsPosArray.Length];
        for (int i = 0; i < debugPosObjects.Length; i++)
        {
            debugPosObjects[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            debugPosObjects[i].name = "Debug finger: " + i.ToString();
            debugPosObjects[i].transform.parent = transform;
            debugPosObjects[i].renderer.enabled = false;
        }

        meshlinesGenerator = GetComponent<MeshLinesGenerator>();
        fingerJointsArrayStitchesPosArray = new Vector3[jointsPerFinger][];
        for (int i = 0; i < fingerJointsArrayStitchesPosArray.Length; i++)
        {
            fingerJointsArrayStitchesPosArray[i] = new Vector3[meshlinesGenerator.verticesFrequencyDepthCount];
        }

        // internal array to store just joint positions
        fingersArrayJointsPositionsPosArray = new Vector3[5][]; // 5 because there are 5 fingers
        for (int i = 0; i < fingersArrayJointsPositionsPosArray.Length; i++)
        {
            fingersArrayJointsPositionsPosArray[i] = new Vector3[jointsPerFinger];
        }

        bonesQuaternionsCacheArray = new Quaternion[25]; // 5 bones/joints (counting fingertip) for all 5 fingers
        bonesWidthsCacheArray = new float[25];

        rotGO = new GameObject();
        rotGO.name = "LMC bone rot GO";
        rotTransform = rotGO.transform;
        rotTransform.parent = transform.parent;
    }
    // Use this for initialization
    void Start()
    {
        arraySharedMaterial = new Material(Shader.Find("Parallax Diffuse"));

        for(int i = 0; i < partsCount; i++)
        {
            positionsList.Add(new Vector3( 300.0f * Mathf.Cos( (Mathf.PI/2) + (Mathf.PI/2) * ((float)i/(float)partsCount) ), 0 , -800.0f * Mathf.Sin( (Mathf.PI/2) + (Mathf.PI/2) * ((float)i/(float)partsCount) ) ) );
            rotationsList.Add(Quaternion.identity);
            //Debug.Log(positionsList[i]);
            velocitiesList.Add(new Vector3());
            GameObject tempGameObject = (GameObject)Instantiate(partPrefab, positionsList[i], Quaternion.identity);
            tempGameObject.transform.parent = transform;
            ((CreaturePartsGeneralScript)tempGameObject.GetComponent("CreaturePartsGeneralScript")).arrayIndex = i;
            ((CreaturePartsGeneralScript)tempGameObject.GetComponent("CreaturePartsGeneralScript")).ownerArrayScript = this;

            tempGameObject.renderer.sharedMaterial = arraySharedMaterial;

            owenedPartsList.Add(tempGameObject);
            owenedPartsScriptsList.Add( (CreaturePartsGeneralScript)tempGameObject.GetComponent("CreaturePartsGeneralScript") );

        }

        audioDirector = (AudioDirectorScript) GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
    }
 void Start()
 {
     lightsArray = GameObject.FindGameObjectsWithTag("MeshLight").Select(g => g.GetComponent<Light>()).ToArray();
     audioDirector = GetComponent<AudioDirectorScript>();
     print(audioDirector);
 }
 // Use this for initialization
 void Start()
 {
     audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
     devicesArray  = Microphone.devices;
 }
 // Use this for initialization
 void Start()
 {
     audioDirector = (AudioDirectorScript) GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
     devicesArray = Microphone.devices;
 }
    // Use this for initialization
    void Start()
    {
        mp3Importer = (MP3Import)GetComponent("MP3Import");
        audioDirector = (AudioDirectorScript) GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
        audioListener = (AudioListener) GameObject.Find("AudioDirector").GetComponent("AudioListener");
        genralEditorScript = (GeneralEditorScript)GetComponent("GeneralEditorScript");

        if(isActive)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        }
    }
    // Use this for initialization
    void Start()
    {
        amplitudeEditor = (AmplitudeEditorScript)GetComponent("AmplitudeEditorScript");
        frequencyEditor = (FrequencyEditorScript)GetComponent("FrequencyEditorScript");
        playerObject = GameObject.FindWithTag("Player");

        mainFileBrowserScript = (ParametersFilesImportScript)GetComponent("ParametersFilesImportScript");

        audioDirector =  (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        fpsDisplayObject = GameObject.FindWithTag("FPSDisplay");
    }
 void Start()
 {
     audioDirector = GetComponent<AudioDirectorScript>();
 }
示例#18
0
 void Start()
 {
     skybox        = GetComponent <Skybox>();
     camera        = GetComponent <Camera>();
     audioDirector = FindObjectOfType <AudioDirectorScript>();
 }
示例#19
0
 void Start()
 {
     audioDirector = GetComponent <AudioDirectorScript>();
 }
 void Start()
 {
     skybox = GetComponent<Skybox>();
     camera = GetComponent<Camera>();
     audioDirector = FindObjectOfType<AudioDirectorScript>();
 }
    // Use this for initialization
    void Start()
    {
        audioDirector = (AudioDirectorScript) GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        GenerateCalculationsMiniMesh();

        // mesh lines (i.e. rows) setup
        vertsArrayLast2 = new Vector3[2 * verticesFrequencyDepthCount];

        meshLinesPoolArray = new GameObject[meshLinesPoolSize];
        meshLinesMeshComponentArray = new Mesh[meshLinesPoolSize];
        meshLinesPVAComponentArray = new PVA[meshLinesPoolSize];
        meshLineDataArray = new MeshLine[meshLinesPoolSize];
        for(int i = 0; i < meshLinesPoolSize; i++)
        {
            meshLinesPoolArray[i] = (GameObject)Instantiate(meshLinePrefab, transform.position, Quaternion.identity);
            meshLinesPoolArray[i].name = meshLinesPoolArray[i].name + "_" + i.ToString();
            meshLinesPoolArray[i].GetComponentInChildren<MeshRenderer>().sharedMaterial = meshMaterial;
            meshLinesMeshComponentArray[i] = meshLinesPoolArray[i].GetComponentInChildren<MeshFilter>().mesh;
            meshLinesPVAComponentArray[i] = meshLinesPoolArray[i].GetComponent<PVA>();
            // TODO  no need for PVA, will probably remove entirely later
            meshLinesPVAComponentArray[i].enabled = false;
            // left/right offset to center mesh realtive to camera
            meshLinesPoolArray[i].transform.GetChild(0).transform.localPosition = new Vector3(0.5f  * verticesFrequencyDepthCount * verticesSpread, 0, 0);
            meshLineDataArray[i] =  meshLinesPoolArray[i].transform.GetComponent<MeshLine>();
            meshLineDataArray[i].meshlineVerticesArray = new Vector3[verticesFrequencyDepthCount];
            meshLinesPoolArray[i].SetActive(false);
        }

        // do basic setup for all meshe lines / rows
        verticesArray = new Vector3[verticesFrequencyDepthCount];
        freshLineMeshNormalsArray = new Vector3[verticesFrequencyDepthCount];
        for(int i = 0; i < verticesArray.Length; i++)
            verticesArray[i] = new Vector3(i * verticesSpread , 0, 0);

        List<int> indicesList = new List<int>();
        List<Vector2> uvsLinesList = new List<Vector2>();
        List<Vector4> tangentLinesList = new List<Vector4>();
        for(int i =0; i < verticesArray.Length - 1; i++)
        {
            indicesList.Add(i);
            indicesList.Add(i +1);
            uvsLinesList.Add(new Vector2(0, 0));
            tangentLinesList.Add(new Vector4(0, 0, 0, 0));
        }
        // add final uv
        uvsLinesList.Add(new Vector2(0,0));
        tangentLinesList.Add(new Vector4(0, 0, 0, 0));
        indicesArray = indicesList.ToArray();

        for(int i = 0; i < meshLinesPoolSize; i++)
        {
            meshLinesMeshComponentArray[i].Clear();
            meshLinesMeshComponentArray[i].vertices = verticesArray;
            meshLinesMeshComponentArray[i].uv = uvsLinesList.ToArray();
            meshLinesMeshComponentArray[i].tangents = tangentLinesList.ToArray();
            meshLinesMeshComponentArray[i].SetIndices(indicesArray, MeshTopology.Lines, 0);
        }

        // mesh collumns setup
        // basic object setup
        meshCollumnsArray = new GameObject[verticesFrequencyDepthCount];
        for(int i = 0; i < meshCollumnsArray.Length; i++)
        {
            meshCollumnsArray[i] = new GameObject("MeshCollumn_" + i);
            // parenting to make sure GO stays in view and does not get culled out when moving
            //meshCollumnsArray[i].transform.parent = gameObject.transform;
            meshCollumnsArray[i].AddComponent<MeshFilter>();
            meshCollumnsArray[i].AddComponent<MeshRenderer>();
            meshCollumnsArray[i].renderer.sharedMaterial = meshMaterial;
            meshCollumnsArray[i].renderer.receiveShadows = false;
            meshCollumnsArray[i].renderer.castShadows = false;
        }

        // vertices and indices setup
        tempCollumnVerticesArray = new Vector3[collumnDepth];
        tempCollumnNormalsArray = new Vector3[collumnDepth];

        // Generate indices
        List<int> rowIndicesList = new List<int>();
        List<Vector2> uvsCollumnsList = new List<Vector2>();
        List<Vector4> tangentsCollumnsList = new List<Vector4>();
        for(int i = 0; i< tempCollumnVerticesArray.Length -1; i++)
        {
            rowIndicesList.Add(i);
            rowIndicesList.Add(i+1);
            uvsCollumnsList.Add(new Vector2(0, 0));
            tangentsCollumnsList.Add( new Vector4(0, 0, 0, 0));
        }
        // add final uv
        uvsCollumnsList.Add(new Vector2(0, 0));
        tangentsCollumnsList.Add(new Vector4(0, 0, 0, 0));

        // setup mesh component
        meshCollumnsMeshComponentArray = new Mesh[meshCollumnsArray.Length];

        // these 2D arrays will be used to locally store and manage vertices and normals, minimizing how often mesh.verties,etc gets called (which causes GC spike)
        collumnsArrayVerticesArray = new Vector3[meshCollumnsMeshComponentArray.Length][];
        collumnsArrayNormalsArray = new Vector3[meshCollumnsMeshComponentArray.Length][];

        Vector3[] emptyNormals = new Vector3[tempCollumnVerticesArray.Length];
        for(int i = 0; i < meshCollumnsMeshComponentArray.Length; i++)
        {
            meshCollumnsMeshComponentArray[i] = meshCollumnsArray[i].GetComponent<MeshFilter>().mesh;
            meshCollumnsMeshComponentArray[i].Clear();
            meshCollumnsMeshComponentArray[i].vertices = tempCollumnVerticesArray;
            meshCollumnsMeshComponentArray[i].SetIndices(rowIndicesList.ToArray(), MeshTopology.Lines,0);
            meshCollumnsMeshComponentArray[i].normals = emptyNormals;
            meshCollumnsMeshComponentArray[i].uv = uvsCollumnsList.ToArray();
            meshCollumnsMeshComponentArray[i].tangents = tangentsCollumnsList.ToArray();
            meshCollumnsMeshComponentArray[i].bounds = new Bounds(Vector3.zero, Vector3.one * 10000000.0f);

            collumnsArrayVerticesArray[i] = new Vector3[collumnDepth];
            collumnsArrayNormalsArray[i] =  new Vector3[collumnDepth];
            for(int j = 0; j < collumnDepth; j++)
            {
                collumnsArrayVerticesArray[i][j] = new Vector3(0, 0, 0);
                collumnsArrayNormalsArray[i][j] = new Vector3(0, 0, 0);
            }

        }

        stitchPosObject = new GameObject();
        stitchPosObject.transform.parent = transform;
        stitchPosObject.transform.localPosition = stitchAnchorOffset;
        tempVector = new Vector3(0, 0, 0);

        fingertipStitch = GetComponent<LMC_FingertipsStitch>();
        //  array structured so that for [i][j], i represents the joint index (ex: fingertip row) and j represents the vertices
        // see https://developer.leapmotion.com/documentation/skeletal/csharp/devguide/Intro_Skeleton_API.html
        fingerJointsArrayStitchesPosArray = new Vector3[jointsPerFinger][];
        for (int i = 0; i < fingerJointsArrayStitchesPosArray.Length; i++)
        {
            fingerJointsArrayStitchesPosArray[i] = new Vector3[verticesFrequencyDepthCount];
        }
        //stitchOriginPosArray = new Vector3[verticesFrequencyDepthCount];

        //GenerateLineMesh();
        //StitchNewRowIntoCollumns()

        activeMeshLinesList = new List<GameObject>();
    }
    // Use this for initialization
    void Start()
    {
        amplitudeEditor = (AmplitudeEditorScript)GetComponent("AmplitudeEditorScript");
        frequencyEditor = (FrequencyEditorScript)GetComponent("FrequencyEditorScript");
        playerObject = GameObject.FindGameObjectWithTag("Player");

        mainFileBrowserScript = (FileBrowserGameObjectScript)GetComponent("FileBrowserGameObjectScript");

        audioDirector =  (AudioDirectorScript)GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        originalPrefabScale = transform.localScale;

        audioDirector = (AudioDirectorScript) GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        gameObject.AddComponent("MeshFilter");
        gameObject.AddComponent("MeshRenderer");
           // gameObject.AddComponent("MeshCollider");
        mesh = GetComponent<MeshFilter>().mesh;

        List<int> trianglesList = new List<int>();
        List<Vector3> verticesList = new List<Vector3>();

        List<Vector2> uvList = new List<Vector2>();

        // initial line
        for(int j = 0; j < verticesFrequencyDepthCount; j++)
        {
            verticesList.Add( new Vector3(0,0,j * zScale) );
            uvList.Add( new Vector2(0,0) );
        }

        // populate the rest of the vertices, triangles
        // use verticesFrequencyDepthCount to shift between frewuency collumns
        for(int i = 1; i < verticesTimeDepthCount  ; i++)
        {
            for(int j = 0; j < verticesFrequencyDepthCount; j += 2)
            {
                // bottom left triangle
                verticesList.Add( new Vector3(i * xScale,0, j * zScale) );
                int currentListIndex = verticesList.Count -1;

                trianglesList.Add(currentListIndex);
                trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);
                trianglesList.Add(currentListIndex - verticesFrequencyDepthCount + 1);

                // fill triangles in between this and previous triangle below
                if( j > 0) // is not at the edge
                {
                    // bottom left triangle
                    trianglesList.Add(currentListIndex -1);
                    trianglesList.Add(currentListIndex - verticesFrequencyDepthCount -1);
                    trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);

                    // top right triangle
                    trianglesList.Add(currentListIndex);
                    trianglesList.Add(currentListIndex - 1);
                    trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);
                }

                // top right triangle
                verticesList.Add( new Vector3( i*xScale,0, (j + 1)*zScale ) );
                currentListIndex++;

                trianglesList.Add(currentListIndex);
                trianglesList.Add(currentListIndex - 1);
                trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);

                uvList.Add( new Vector2(0,0) );
                uvList.Add( new Vector2(0,0) );
            }
        }

        verticesArray = verticesList.ToArray();
        trianglesArray = trianglesList.ToArray();
        uvArray = uvList.ToArray();

        Debug.Log(trianglesList.Count);

        mesh.Clear();
        mesh.MarkDynamic();
        mesh.vertices = verticesArray;
        mesh.uv = uvArray;
        mesh.triangles = trianglesArray;
        mesh.RecalculateNormals();

        normalsArray = mesh.normals;

        GetComponent<MeshRenderer>().materials[0].color = Color.green;
        renderer.material.shader = Shader.Find("Parallax Diffuse");

        //GetComponent<MeshCollider>().sharedMesh = mesh;

        GenerateCalculationsMiniMesh();

        audioDirector = (AudioDirectorScript) GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        GenerateCalculationsMiniMesh();

        // mesh lines (i.e. rows) setup
        vertsArrayLast2 = new Vector3[2 * verticesFrequencyDepthCount];

        meshLinesPoolArray          = new GameObject[meshLinesPoolSize];
        meshLinesMeshComponentArray = new Mesh[meshLinesPoolSize];
        meshLinesPVAComponentArray  = new PVA[meshLinesPoolSize];
        meshLineDataArray           = new MeshLine[meshLinesPoolSize];
        for (int i = 0; i < meshLinesPoolSize; i++)
        {
            meshLinesPoolArray[i]      = (GameObject)Instantiate(meshLinePrefab, transform.position, Quaternion.identity);
            meshLinesPoolArray[i].name = meshLinesPoolArray[i].name + "_" + i.ToString();
            meshLinesPoolArray[i].GetComponentInChildren <MeshRenderer>().sharedMaterial = meshMaterial;
            meshLinesMeshComponentArray[i] = meshLinesPoolArray[i].GetComponentInChildren <MeshFilter>().mesh;
            meshLinesPVAComponentArray[i]  = meshLinesPoolArray[i].GetComponent <PVA>();
            // TODO  no need for PVA, will probably remove entirely later
            meshLinesPVAComponentArray[i].enabled = false;
            // left/right offset to center mesh realtive to camera
            meshLinesPoolArray[i].transform.GetChild(0).transform.localPosition = new Vector3(0.5f * verticesFrequencyDepthCount * verticesSpread, 0, 0);
            meshLineDataArray[i] = meshLinesPoolArray[i].transform.GetComponent <MeshLine>();
            meshLineDataArray[i].meshlineVerticesArray = new Vector3[verticesFrequencyDepthCount];
            meshLinesPoolArray[i].SetActive(false);
        }

        // do basic setup for all meshe lines / rows
        verticesArray             = new Vector3[verticesFrequencyDepthCount];
        freshLineMeshNormalsArray = new Vector3[verticesFrequencyDepthCount];
        for (int i = 0; i < verticesArray.Length; i++)
        {
            verticesArray[i] = new Vector3(i * verticesSpread, 0, 0);
        }

        List <int>     indicesList      = new List <int>();
        List <Vector2> uvsLinesList     = new List <Vector2>();
        List <Vector4> tangentLinesList = new List <Vector4>();

        for (int i = 0; i < verticesArray.Length - 1; i++)
        {
            indicesList.Add(i);
            indicesList.Add(i + 1);
            uvsLinesList.Add(new Vector2(0, 0));
            tangentLinesList.Add(new Vector4(0, 0, 0, 0));
        }
        // add final uv
        uvsLinesList.Add(new Vector2(0, 0));
        tangentLinesList.Add(new Vector4(0, 0, 0, 0));
        indicesArray = indicesList.ToArray();

        for (int i = 0; i < meshLinesPoolSize; i++)
        {
            meshLinesMeshComponentArray[i].Clear();
            meshLinesMeshComponentArray[i].vertices = verticesArray;
            meshLinesMeshComponentArray[i].uv       = uvsLinesList.ToArray();
            meshLinesMeshComponentArray[i].tangents = tangentLinesList.ToArray();
            meshLinesMeshComponentArray[i].SetIndices(indicesArray, MeshTopology.Lines, 0);
        }

        // mesh collumns setup
        // basic object setup
        meshCollumnsArray = new GameObject[verticesFrequencyDepthCount];
        for (int i = 0; i < meshCollumnsArray.Length; i++)
        {
            meshCollumnsArray[i] = new GameObject("MeshCollumn_" + i);
            // parenting to make sure GO stays in view and does not get culled out when moving
            //meshCollumnsArray[i].transform.parent = gameObject.transform;
            meshCollumnsArray[i].AddComponent <MeshFilter>();
            meshCollumnsArray[i].AddComponent <MeshRenderer>();
            meshCollumnsArray[i].renderer.sharedMaterial = meshMaterial;
            meshCollumnsArray[i].renderer.receiveShadows = false;
            meshCollumnsArray[i].renderer.castShadows    = false;
        }

        // vertices and indices setup
        tempCollumnVerticesArray = new Vector3[collumnDepth];
        tempCollumnNormalsArray  = new Vector3[collumnDepth];


        // Generate indices
        List <int>     rowIndicesList       = new List <int>();
        List <Vector2> uvsCollumnsList      = new List <Vector2>();
        List <Vector4> tangentsCollumnsList = new List <Vector4>();

        for (int i = 0; i < tempCollumnVerticesArray.Length - 1; i++)
        {
            rowIndicesList.Add(i);
            rowIndicesList.Add(i + 1);
            uvsCollumnsList.Add(new Vector2(0, 0));
            tangentsCollumnsList.Add(new Vector4(0, 0, 0, 0));
        }
        // add final uv
        uvsCollumnsList.Add(new Vector2(0, 0));
        tangentsCollumnsList.Add(new Vector4(0, 0, 0, 0));

        // setup mesh component
        meshCollumnsMeshComponentArray = new Mesh[meshCollumnsArray.Length];

        // these 2D arrays will be used to locally store and manage vertices and normals, minimizing how often mesh.verties,etc gets called (which causes GC spike)
        collumnsArrayVerticesArray = new Vector3[meshCollumnsMeshComponentArray.Length][];
        collumnsArrayNormalsArray  = new Vector3[meshCollumnsMeshComponentArray.Length][];

        Vector3[] emptyNormals = new Vector3[tempCollumnVerticesArray.Length];
        for (int i = 0; i < meshCollumnsMeshComponentArray.Length; i++)
        {
            meshCollumnsMeshComponentArray[i] = meshCollumnsArray[i].GetComponent <MeshFilter>().mesh;
            meshCollumnsMeshComponentArray[i].Clear();
            meshCollumnsMeshComponentArray[i].vertices = tempCollumnVerticesArray;
            meshCollumnsMeshComponentArray[i].SetIndices(rowIndicesList.ToArray(), MeshTopology.Lines, 0);
            meshCollumnsMeshComponentArray[i].normals  = emptyNormals;
            meshCollumnsMeshComponentArray[i].uv       = uvsCollumnsList.ToArray();
            meshCollumnsMeshComponentArray[i].tangents = tangentsCollumnsList.ToArray();
            meshCollumnsMeshComponentArray[i].bounds   = new Bounds(Vector3.zero, Vector3.one * 10000000.0f);

            collumnsArrayVerticesArray[i] = new Vector3[collumnDepth];
            collumnsArrayNormalsArray[i]  = new Vector3[collumnDepth];
            for (int j = 0; j < collumnDepth; j++)
            {
                collumnsArrayVerticesArray[i][j] = new Vector3(0, 0, 0);
                collumnsArrayNormalsArray[i][j]  = new Vector3(0, 0, 0);
            }
        }

        stitchPosObject = new GameObject();
        stitchPosObject.transform.parent        = transform;
        stitchPosObject.transform.localPosition = stitchAnchorOffset;
        tempVector = new Vector3(0, 0, 0);

        fingertipStitch = GetComponent <LMC_FingertipsStitch>();
        //  array structured so that for [i][j], i represents the joint index (ex: fingertip row) and j represents the vertices
        // see https://developer.leapmotion.com/documentation/skeletal/csharp/devguide/Intro_Skeleton_API.html
        fingerJointsArrayStitchesPosArray = new Vector3[jointsPerFinger][];
        for (int i = 0; i < fingerJointsArrayStitchesPosArray.Length; i++)
        {
            fingerJointsArrayStitchesPosArray[i] = new Vector3[verticesFrequencyDepthCount];
        }
        //stitchOriginPosArray = new Vector3[verticesFrequencyDepthCount];

        //GenerateLineMesh();
        //StitchNewRowIntoCollumns()

        activeMeshLinesList = new List <GameObject>();
    }
 // Use this for initialization
 void Start()
 {
     audioDirector = (AudioDirectorScript) GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
 }
示例#27
0
    // Use this for initialization
    void Start()
    {
        originalPrefabScale = transform.localScale;

        audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
    }
示例#28
0
 void Start()
 {
     lightsArray   = GameObject.FindGameObjectsWithTag("MeshLight").Select(g => g.GetComponent <Light>()).ToArray();
     audioDirector = GetComponent <AudioDirectorScript>();
     print(audioDirector);
 }
    // Use this for initialization
    void Start()
    {
        audioDirector = (AudioDirectorScript) GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
        audioListener = (AudioListener) GameObject.FindWithTag("AudioDirector").GetComponent("AudioListener");
        genralEditorScript = (GeneralEditorScript)GetComponent("GeneralEditorScript");
        liveAudioInputSelector = GetComponent<LiveAudioInputSelectorScript>();
        cameraTypeSelector = GetComponent<CameraTypeSelectorScript>();

        if(isActive)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        }
    }
示例#30
0
    // Use this for initialization
    void Start()
    {
        gameObject.AddComponent("MeshFilter");
        gameObject.AddComponent("MeshRenderer");
        // gameObject.AddComponent("MeshCollider");
        mesh = GetComponent <MeshFilter>().mesh;

        List <int>     trianglesList = new List <int>();
        List <Vector3> verticesList  = new List <Vector3>();


        List <Vector2> uvList = new List <Vector2>();


        // initial line
        for (int j = 0; j < verticesFrequencyDepthCount; j++)
        {
            verticesList.Add(new Vector3(0, 0, j * zScale));
            uvList.Add(new Vector2(0, 0));
        }

        // populate the rest of the vertices, triangles
        // use verticesFrequencyDepthCount to shift between frewuency collumns
        for (int i = 1; i < verticesTimeDepthCount; i++)
        {
            for (int j = 0; j < verticesFrequencyDepthCount; j += 2)
            {
                // bottom left triangle
                verticesList.Add(new Vector3(i * xScale, 0, j * zScale));
                int currentListIndex = verticesList.Count - 1;

                trianglesList.Add(currentListIndex);
                trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);
                trianglesList.Add(currentListIndex - verticesFrequencyDepthCount + 1);

                // fill triangles in between this and previous triangle below
                if (j > 0)         // is not at the edge
                {
                    // bottom left triangle
                    trianglesList.Add(currentListIndex - 1);
                    trianglesList.Add(currentListIndex - verticesFrequencyDepthCount - 1);
                    trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);

                    // top right triangle
                    trianglesList.Add(currentListIndex);
                    trianglesList.Add(currentListIndex - 1);
                    trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);
                }

                // top right triangle
                verticesList.Add(new Vector3(i * xScale, 0, (j + 1) * zScale));
                currentListIndex++;

                trianglesList.Add(currentListIndex);
                trianglesList.Add(currentListIndex - 1);
                trianglesList.Add(currentListIndex - verticesFrequencyDepthCount);

                uvList.Add(new Vector2(0, 0));
                uvList.Add(new Vector2(0, 0));
            }
        }

        verticesArray  = verticesList.ToArray();
        trianglesArray = trianglesList.ToArray();
        uvArray        = uvList.ToArray();

        Debug.Log(trianglesList.Count);

        mesh.Clear();
        mesh.MarkDynamic();
        mesh.vertices = verticesArray;
        mesh.uv       = uvArray;
        //mesh.triangles = trianglesArray;
        mesh.SetIndices(trianglesArray, MeshTopology.Lines, 0);
        mesh.RecalculateNormals();

        normalsArray = mesh.normals;

        //GetComponent<MeshRenderer>().materials[0].color = Color.green;
        //renderer.material.shader = Shader.Find("Parallax Diffuse");
        renderer.material = mainMeshMaterial;

        //GetComponent<MeshCollider>().sharedMesh = mesh;

        GenerateCalculationsMiniMesh();

        audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
    }
    // Use this for initialization
    void Start()
    {
        currentIndex = minIndex;
        rangeMarker = (GameObject)Instantiate(rangeMarker, new Vector3(), Quaternion.identity);

        audioDirector =  (AudioDirectorScript)GameObject.Find("AudioDirector").GetComponent("AudioDirectorScript");
        generalEditor = (GeneralEditorScript)GetComponent("GeneralEditorScript");
    }
示例#32
0
 // Use this for initialization
 void Start()
 {
     audioDirector = (AudioDirectorScript)GameObject.FindWithTag("AudioDirector").GetComponent("AudioDirectorScript");
 }