overte-lubosz/libraries/gpu/src/gpu/Frame.h
2019-04-11 13:22:51 -07:00

58 lines
1.7 KiB
C++

//
// Created by Bradley Austin Davis on 2016/07/26
// Copyright 2013-2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_gpu_Frame_h
#define hifi_gpu_Frame_h
#include <functional>
#include <queue>
#include "Forward.h"
#include "Batch.h"
#include "Resource.h"
namespace gpu {
class Frame {
friend class Context;
public:
Frame();
virtual ~Frame();
using Batches = std::vector<BatchPointer>;
using FramebufferRecycler = std::function<void(const FramebufferPointer&)>;
using OverlayRecycler = std::function<void(const TexturePointer&)>;
StereoState stereoState;
uint32_t frameIndex{ 0 };
/// The view matrix used for rendering the frame, only applicable for HMDs
Mat4 view;
/// The sensor pose used for rendering the frame, only applicable for HMDs
Mat4 pose;
/// The collection of batches which make up the frame
Batches batches;
/// The main thread updates to buffers that are applicable for this frame.
BufferUpdates bufferUpdates;
/// The destination framebuffer in which the results will be placed
FramebufferPointer framebuffer;
/// How to process the framebuffer when the frame dies. MUST BE THREAD SAFE
FramebufferRecycler framebufferRecycler;
std::queue<std::pair<std::function<void(const QImage&)>, float>> snapshotOperators;
protected:
friend class Deserializer;
// Should be called once per frame, on the recording thred
void finish();
void preRender();
};
};
#endif