//saves all images stored in tileMasks to file
    public void saveAllImages()
    {
        Camera cam = GameObject.FindObjectOfType <Camera>();

        for (int i = 0; i < tileMasks.Length; i++)
        {
            int index_tmp = (int)(i / Pipeline_OSS.sceneObjects.Count);
            int objId     = i % Pipeline_OSS.sceneObjects.Count;
            Pipeline_OSS.SaveTexture("SecondTest\\" + name + "\\" + Pipeline_OSS.TILE_SIZE + "\\" + cam.pixelWidth + "x" + cam.pixelHeight + "\\" + index_tmp + "_object" + objId, tileMasks[i]);
        }
    }
    void Start()
    {
        name      = isSponza ? nameSponza : nameLostEmpire;
        positions = isSponza ? positionsSponza : positionsLostEmpire;
        rotations = isSponza ? rotationsSponza : rotationsLostEmpire;

        //set starting position
        transform.SetPositionAndRotation(positions[0], Quaternion.Euler(rotations[0]));

        //reset log file
        Pipeline_OSS.ResetLog();
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        //if end of path is reached
        if (index == positions.Length)
        {
            Debug.Break();
            if (loop)   //return to start if loop is enabled
            {
                transform.SetPositionAndRotation(positions[0], Quaternion.Euler(rotations[0]));
                index = 1;
            }
            else
            {
                return;
            }
        }

        //statistics
        if (Time.frameCount >= 100 && Time.frameCount <= 120 || Time.frameCount >= 300 && Time.frameCount <= 320 || Time.frameCount >= 500 && Time.frameCount <= 520)
        {
            Camera cam = GameObject.FindObjectOfType <Camera>();
            foreach (Pipeline_OSS.ObjData obj in Pipeline_OSS.sceneObjects)
            {
                int           id       = obj.obj.GetComponent <Renderer>().material.GetInt("_ID");
                RenderTexture tileMask = new RenderTexture(obj.tileMask.width, obj.tileMask.height, 0, RenderTextureFormat.ARGB32);
                tileMask.Create();
                Graphics.Blit(obj.tileMask, tileMask);
                string n = Pipeline_OSS.TILE_SIZE + "\\" + cam.pixelWidth + "x" + cam.pixelHeight + "\\" + Time.frameCount + "_object" + id;
                Pipeline_OSS.SaveTexture("ThirdTest\\LostEmpire\\" + n, tileMask);
                //Debug.Log("Saved "+ n);
            }
        }

        //calculate new position
        Vector3 newPos = Vector3.Lerp(positions[index - 1], positions[index], progress);
        Vector3 newRot = Vector3.Lerp(rotations[index - 1], rotations[index], progress);

        transform.SetPositionAndRotation(newPos, Quaternion.Euler(newRot));

        progress += speed / distances[index - 1] * 1 / 30; //speed depending on framerate

        if (progress > 1)                                  //move to next waypoint if current one is reached
        {
            progress = 0;
            index++;
        }
    }
    // Update is called once per frame
    void Update()
    {
        //log statistics
        Pipeline_OSS.LogPixelStats();

        //if end of path is reached
        if (index == positions.Length)
        {
            //save logs
            Pipeline_OSS.SaveLogCSV(name + " FirstTest");
            Debug.Break();
            if (loop)   //return to start if loop is enabled
            {
                transform.SetPositionAndRotation(positions[0], Quaternion.Euler(rotations[0]));
                index = 1;
            }
            else
            {
                return;
            }
        }

        //calculate new position
        Vector3 newPos = Vector3.Lerp(positions[index - 1], positions[index], progress);
        Vector3 newRot = Vector3.Lerp(rotations[index - 1], rotations[index], progress);

        transform.SetPositionAndRotation(newPos, Quaternion.Euler(newRot));

        progress += speed / distances[index - 1] * 1 / 30; //speed depending on framerate

        if (progress > 1)                                  //move to next waypoint if current one is reached
        {
            progress = 0;
            index++;
        }
    }