示例#1
0
    void Awake()
    {
#if UNITY_EDITOR
#else
        modelRootDirectories.Clear();
        worldRootDirectories.Clear();
        fileRootDirectories.Clear();

        var separator = new char[] { ':' };

        var filePathEnv = Environment.GetEnvironmentVariable("CLOISIM_FILES_PATH");
        var filePaths   = filePathEnv.Split(separator, StringSplitOptions.RemoveEmptyEntries);
        fileRootDirectories.AddRange(filePaths);

        var modelPathEnv = Environment.GetEnvironmentVariable("CLOISIM_MODEL_PATH");
        var modelPaths   = modelPathEnv.Split(separator, StringSplitOptions.RemoveEmptyEntries);
        modelRootDirectories.AddRange(modelPaths);

        var worldPathEnv = Environment.GetEnvironmentVariable("CLOISIM_WORLD_PATH");
        var worldPaths   = worldPathEnv.Split(separator, StringSplitOptions.RemoveEmptyEntries);
        worldRootDirectories.AddRange(worldPaths);
#endif

        // Load Library for Assimp
#if UNITY_EDITOR
        var assimpLibraryPath = "./Assets/Plugins/AssimpNet.4.1.0/runtimes/linux-x64/native";
#else
        var assimpLibraryPath = "./CLOiSim_Data/Plugins";
#endif
        Assimp.Unmanaged.AssimpLibrary.Instance.LoadLibrary(assimpLibraryPath + "/libassimp");

        Application.targetFrameRate = 61;

        mainCamera = Camera.main;
        mainCamera.depthTextureMode = DepthTextureMode.None;
        mainCamera.allowHDR         = true;
        mainCamera.allowMSAA        = true;

        modelsRoot = GameObject.Find("Models");

        var UIRoot = GameObject.Find("UI");
        followingList     = UIRoot.GetComponentInChildren <FollowingTargetList>();
        simulationDisplay = UIRoot.GetComponentInChildren <SimulationDisplay>();
        transformGizmo    = UIRoot.GetComponentInChildren <RuntimeGizmos.TransformGizmo>();

        clock = DeviceHelper.GetGlobalClock();

        ResetRootModelsTransform();
    }
示例#2
0
    void Awake()
    {
        GetResourcesPaths();

        // Load Library for Assimp
#if UNITY_EDITOR
        var assimpLibraryPath = "./Assets/Plugins/AssimpNet.4.1.0/runtimes/linux-x64/native";
#else
        var assimpLibraryPath = "./CLOiSim_Data/Plugins";
#endif
        Assimp.Unmanaged.AssimpLibrary.Instance.LoadLibrary(assimpLibraryPath + "/libassimp");

        Application.targetFrameRate = 61;

        var mainCamera = Camera.main;
        mainCamera.depthTextureMode = DepthTextureMode.None;
        mainCamera.allowHDR         = true;
        mainCamera.allowMSAA        = true;

        modelsRoot = GameObject.Find("Models");

        lightsRoot = GameObject.Find("Lights");

        var UIRoot = GameObject.Find("UI");

        followingList     = UIRoot.GetComponentInChildren <FollowingTargetList>();
        simulationDisplay = UIRoot.GetComponentInChildren <SimulationDisplay>();
        transformGizmo    = UIRoot.GetComponentInChildren <RuntimeGizmos.TransformGizmo>();

        clock = GetComponent <Clock>();
        DeviceHelper.SetGlobalClock(clock);

        var sphericalCoordinates = GetComponent <SphericalCoordinates>();
        DeviceHelper.SetGlobalSphericalCoordinates(sphericalCoordinates);

        ResetRootModelsTransform();
    }