コード例 #1
0
 void Start()
 {
     Debug.Log(TAG + " Start() thread ID is " + Thread.CurrentThread.ManagedThreadId);
     udpKeyboard = GetComponent <UDPKeyboardInput>();
     frameSaver  = GetComponent <FrameSaver>();
     Application.targetFrameRate = 60;
     captureStatus = CaptureStatus.Clean;
     InitializeMediaCaptureAsyncWrapper();
 }
コード例 #2
0
    void Start()
    {
        Debug.Log(TAG + " Start() thread ID is " + Thread.CurrentThread.ManagedThreadId);
        udpKeyboard = GetComponent <UDPKeyboardInput>();
        frameSaver  = GetComponent <FrameSaver>();
        Application.targetFrameRate = 60;
        captureStatus = CaptureStatus.Clean;
        InitializeMediaCaptureAsyncWrapper();

        // Cache values to target width and height from media capture
        // profiles enum.
        switch (mediaCaptureProfiles)
        {
        case MediaCaptureProfiles.HL1_1280x720:
            _targetVideoWidth  = 1280;
            _targetVideoHeight = 720;
            break;

        case MediaCaptureProfiles.HL1_1408x792:
            _targetVideoWidth  = 1408;
            _targetVideoHeight = 792;
            break;

        case MediaCaptureProfiles.HL1_1344x756:
            _targetVideoWidth  = 1344;
            _targetVideoHeight = 756;
            break;

        case MediaCaptureProfiles.HL1_896x504:
            _targetVideoWidth  = 896;
            _targetVideoHeight = 504;
            break;

        case MediaCaptureProfiles.HL2_2272x1278:
            _targetVideoWidth  = 2272;
            _targetVideoHeight = 1278;
            break;

        case MediaCaptureProfiles.HL2_896x504:
            _targetVideoWidth  = 896;
            _targetVideoHeight = 504;
            break;

        default:
            break;
        }
    }
コード例 #3
0
    /// <summary>
    /// Use this method to start FireBolt.
    /// </summary>
    /// <param name="newInputSet">specify input file locations in an InputSet.  accepts null and
    /// uses the default paths and names.</param>
    /// <param name="timeUpdateIncrement">optional. defaults null.  specifies number of milliseconds
    /// to force the execution to jump everyframe.  Uses Time.deltaTime if null.</param>
    /// <param name="forceFullReload">optional, defaults false.  true ignores timestamps on input files
    /// and reloads the whole shebang...almost like you would expect.</param>
    /// <param name="generateKeyframes">optional default false. makes keyframes for display over scrubber.
    /// locks down the UI for some time at startup to execute whole cinematic once all speedy like</param>
    public void Init(bool logDebug        = false, InputSet newInputSet   = null, VideoInputSet videoInputSet = null,
                     bool forceFullReload = false, bool generateKeyframes = false, bool implicitActorCreation = false, bool logStatistics = false,
                     string statFile      = null)
    {
        if (videoInputSet != null)
        {
            this.timeUpdateIncrement = (uint?)(1000f / (float?)videoInputSet.FrameRate);
            this.generateVideoFrames = true;
            frameSaver = gameObject.AddComponent <FrameSaver>();
            frameSaver.Initialize(videoInputSet);
        }

        this.generateKeyframes     = generateKeyframes;
        this.implicitActorCreation = implicitActorCreation;
        this.logDebugStatements    = logDebug;
        this.logStatistics         = logStatistics;
        this.statFile = statFile;

        if (logStatistics)
        {
            Extensions.InitStatFile();
        }

        if (generateVideoFrames)
        {
            // Find the canvase game object.
            GameObject canvasGO = GameObject.Find("Canvas");

            // Get the canvas component from the game object.
            Canvas canvas = canvasGO.GetComponent <Canvas>();

            // Toggle the canvas display off.
            canvas.enabled = false;
        }
        if (whereWeAt == null) //if there is no slider to display them on, don't generate keyframes
        {
            this.generateKeyframes = false;
        }

        //if we didn't get handed one, generate an input set with the default paths
        if (newInputSet == null)
        {
            newInputSet = new InputSet();
        }

        //don't have to do file modification timestamp compares.  just set all the load flags to reload everything
        if (forceFullReload || currentInputSet == null)
        {
            reloadStoryPlan                 = true;
            reloadCameraPlan                = true;
            reloadCinematicModel            = true;
            reloadActorsAndAnimationsBundle = true;
            reloadTerrainBundle             = true;
        }
        else //we actually should figure out what's changed so we can reload only those required inputs
        {
            reloadStoryPlan                 = requiresReload(currentInputSet.StoryPlanPath, newInputSet.StoryPlanPath, storyPlanLastReadTimeStamp);
            reloadCameraPlan                = requiresReload(currentInputSet.CameraPlanPath, newInputSet.CameraPlanPath, cameraPlanLastReadTimeStamp);
            reloadCinematicModel            = requiresReload(currentInputSet.CinematicModelPath, newInputSet.CinematicModelPath, cinematicModelPlanLastReadTimeStamp);
            reloadActorsAndAnimationsBundle = requiresReload(currentInputSet.ActorsAndAnimationsBundlePath, newInputSet.ActorsAndAnimationsBundlePath, actorsAndAnimationsBundleLastReadTimeStamp);
            reloadTerrainBundle             = requiresReload(currentInputSet.TerrainBundlePath, newInputSet.TerrainBundlePath, terrainBundleLastReadTimeStamp);
        }

        if (createdGameObjects != null)
        {
            createdGameObjects.Destroy("InstantiatedObjects");
        }
        if (reloadTerrainBundle && createdGameObjects != null)
        {
            createdGameObjects.Destroy("Terrain");
        }
        initialized     = false;
        initTriggered   = true;
        currentInputSet = newInputSet;
    }
コード例 #4
0
 public void SaveFile(string fileName)
 {
     FrameSaver.Save(fileName, Frameable);
 }