public float GetLastFrameTime() { var lastPosition = ReplayPointer.GetLastStartingPositionIndex; THeader.SetPointerPosition(ReplayReader, lastPosition); ReadDeltaFrameCount(); var time = ReadFrameTime(); // first Snapshot is always at frametime = 0 FrameTime = 0; return(time); }
public override float ReadFrame(int currentFrame, int deltaFrames, float deltaTime) { var time = 0f; if (CurrentFrame + 1 == currentFrame) { CurrentFrame = currentFrame; time = ReadFrameTime(); ReadObjectsIdsAndNames(); ReadObservableEntitiesInit(deltaTime); ReadObservableEntities(true, deltaTime); } else { deltaTime = 1f / Hz; CurrentFrame = currentFrame; // Read BaseFrame THeader.SetPointerPosition(ReplayReader, currentFrame - deltaFrames); BaseFrame.ReadDeltaFrameCount(); BaseFrame.ReadFrameTime(); BaseFrame.ReadObjectsIdsAndNames(); // Only construct once BaseFrame.ReadObservableEntitiesInit(deltaTime); BaseFrame.ReadObservableEntities(false, deltaTime); // Read all deltas until currentFrame for (var i = deltaFrames - 1; i >= 0; i--) { THeader.SetPointerPosition(ReplayReader, currentFrame - i); ReadDeltaFrameCount(); time = ReadFrameTime(); ReadObjectsIdsAndNames(); ReadObservableEntities(i == 0, deltaTime); } } return(time); }
public override float ReadFrame(int currentFrame, int deltaFrames, float deltaTime) { var time = 0f; if (CurrentFrame + 1 == currentFrame) { CurrentFrame = currentFrame; time = ReadFrameTime(); ReadObjectsIdsAndNames(); // Only construct once, because delta compression method unpacks n deltaFrameCount frames ReadObservableEntitiesInit(deltaTime); ReadObservableEntities(true, deltaTime); } else { deltaTime = 1f / Hz; CurrentFrame = currentFrame; // Read BaseFrame THeader.SetPointerPosition(ReplayReader, currentFrame - deltaFrames); BaseFrame.ReadDeltaFrameCount(); BaseFrame.ReadFrameTime(); BaseFrame.ReadObjectsIdsAndNames(); // Only construct once, because delta compression method unpacks n deltaFrameCount frames BaseFrame.ReadObservableEntitiesInit(deltaTime); BaseFrame.ReadObservableEntities(false, deltaTime); THeader.SetPointerPosition(ReplayReader, currentFrame); ReadDeltaFrameCount(); time = ReadFrameTime(); ReadObjectsIdsAndNames(); ReadObservableEntities(true, deltaTime); } return(time); }