コード例 #1
0
    static void Render_scenes()
    {
        Scene aS = SceneManager.GetActiveScene();

        GameObject[] go_array = aS.GetRootGameObjects();

        List <String> pathList = readTextFile(Application.dataPath + "/SceneData/imageNames.txt");

        string sd_path = Application.dataPath + "/SceneData/";
        string target  = sd_path + pathList[4] + ".json";

        if (File.Exists(target))
        {
            // Read the json from the file into a string
            string dataAsJson = File.ReadAllText(target);
            // Pass the json to JsonUtility, and tell it to create a GameData object from it
            SceneData loadedData = JsonUtility.FromJson <SceneData>(dataAsJson);

            m_camera   = loadedData.GetCamera(m_camera);
            m_obj      = loadedData.GetObject(m_obj);
            m_light    = loadedData.GetLight(m_light);
            m_cylinder = loadedData.GetCylinder(m_cylinder);


            Debug.Log("First Image");
            ir();
            Octane.Renderer.SaveImage(Octane.RenderPassId.RENDER_PASS_BEAUTY,
                                      sd_path + "irpv.exr",
                                      Octane.ImageSaveType.IMAGE_SAVE_TYPE_EXR16,
                                      true);

            Debug.Log("Second Image");
            irpv();
            Octane.Renderer.SaveImage(Octane.RenderPassId.RENDER_PASS_BEAUTY,
                                      sd_path + "ir.exr",
                                      Octane.ImageSaveType.IMAGE_SAVE_TYPE_EXR16,
                                      true);
        }
        else
        {
            Debug.Log(target);
            Debug.LogError("Cannot load game data!");
        }
    }
コード例 #2
0
    /*
     * Sets the current scene, varies with i_img
     */
    private void setScene()
    {
        // Get the object that is specified for this scene
        m_obj = FindInCOArrayByName(paramList[0].objName);

        // and set it as active, while inactivating the rest of composition objects
        foreach (GameObject go in compositionObjectArray)
        {
            if (go.name == m_obj.name)
            {
                go.SetActive(true);
            }
            else
            {
                go.SetActive(false);
            }
        }

        target = sd_path + paramList[i_img].imgName + ".json";

        // Then retrieve the scene's parameters from its JSON file
        if (File.Exists(target))
        {
            // Read the json from the file into a string
            string dataAsJson = File.ReadAllText(target);
            // Pass the json to JsonUtility, and tell it to create a GameData object from it
            SceneData loadedData = JsonUtility.FromJson <SceneData>(dataAsJson);

            CheckObjectsSet();
            CheckObjectsNotNull();

            m_camera  = loadedData.GetCamera(m_camera);
            m_obj     = loadedData.GetObject(m_obj);
            m_light   = loadedData.GetLight(m_light);
            m_surface = loadedData.GetCylinder(m_surface);
        }
        else
        {
            Debug.Log(target);
            Debug.LogError("Cannot load game data!");
        }
    }
コード例 #3
0
    static void Load_scene()
    {
        Scene aS = SceneManager.GetActiveScene();

        GameObject[] go_array = aS.GetRootGameObjects();

        List <String> pathList = readTextFile(Application.dataPath + "/SceneData/imageNames.txt");


        string sd_path = Application.dataPath + "/SceneData/";
        string target  = sd_path + pathList[4] + ".json";

        if (File.Exists(target))
        {
            // Read the json from the file into a string
            string dataAsJson = File.ReadAllText(target);
            // Pass the json to JsonUtility, and tell it to create a GameData object from it
            SceneData loadedData = JsonUtility.FromJson <SceneData>(dataAsJson);



            GameObject camera   = GameObject.Find("PBR Render Target");
            GameObject obj      = GameObject.FindWithTag("CompositionObject");
            GameObject light    = GameObject.Find("Directional Light");
            GameObject cylinder = GameObject.Find("Cylinder");

            camera   = loadedData.GetCamera(camera);
            obj      = loadedData.GetObject(obj);
            light    = loadedData.GetLight(light);
            cylinder = loadedData.GetCylinder(cylinder);
        }
        else
        {
            Debug.Log(target);
            Debug.LogError("Cannot load game data!");
        }
    }