Adding ViroKit. Needs AWSCore :(

This commit is contained in:
John Lyon-Smith
2018-03-27 17:46:15 -07:00
parent 2ab15e7dc1
commit 02e06dface
844 changed files with 86921 additions and 21 deletions

View File

@@ -0,0 +1,70 @@
//
// VROFrameTimer.h
// ViroRenderer
//
// Created by Raj Advani on 4/5/17.
// Copyright © 2017 Viro Media. All rights reserved.
//
#ifndef VROFrameTimer_h
#define VROFrameTimer_h
#include "VROTime.h"
/*
Startup frames have unlimited processing time; process-only
frames are frames in which we only process and do not render.
*/
enum class VROFrameType {
Normal,
Startup,
ProcessOnly
};
/*
Tracks how much time remains in the current frame for processing
tasks.
*/
class VROFrameTimer {
public:
VROFrameTimer(VROFrameType frameType, double timeForProcessing, double lastFrameEndTime) :
_frameType(frameType),
_timeForProcessing(timeForProcessing),
_lastFrameEndTime(lastFrameEndTime) {
}
/*
Returns true if there is time remaining for any processing operations in the
current frame.
*/
bool isTimeRemainingInFrame() const {
return _frameType == VROFrameType::Startup || getTimeRemainingInFrame() > 0;
}
double getTimeRemainingInFrame() const {
return _timeForProcessing - (VROTimeCurrentMillis() - _lastFrameEndTime);
}
private:
/*
The frame 'type'. Startup frames have unlimited processing time; process-only
frames are frames in which we only process() and do not render().
*/
const VROFrameType _frameType;
/*
The time available for processing this frame, in ms.
*/
const double _timeForProcessing;
/*
The end time of the last frame, in ms.
*/
const double _lastFrameEndTime;
};
#endif /* VROFrameTimer_h */