overte-HifiExperiments/interface/src/renderer/TextureCache.h
Andrzej Kapolka 22598ceb4f Optimizations for occlusion blur (the main one being that we only need to
sample the texture four, not sixteen, times if we turn on linear filtering
and sample between the texels).
2013-08-20 11:52:43 -07:00

59 lines
2 KiB
C++

//
// TextureCache.h
// interface
//
// Created by Andrzej Kapolka on 8/6/13.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
#ifndef __interface__TextureCache__
#define __interface__TextureCache__
#include <QObject>
#include "InterfaceConfig.h"
class QOpenGLFramebufferObject;
/// Stored cached textures, including render-to-texture targets.
class TextureCache : public QObject {
public:
TextureCache();
~TextureCache();
/// Returns the ID of the permutation/normal texture used for Perlin noise shader programs. This texture
/// has two lines: the first, a set of random numbers in [0, 255] to be used as permutation offsets, and
/// the second, a set of random unit vectors to be used as noise gradients.
GLuint getPermutationNormalTextureID();
/// Returns a pointer to the primary framebuffer object. This render target includes a depth component, and is
/// used for scene rendering.
QOpenGLFramebufferObject* getPrimaryFramebufferObject();
/// Returns the ID of the primary framebuffer object's depth texture. This contains the Z buffer used in rendering.
GLuint getPrimaryDepthTextureID();
/// Returns a pointer to the secondary framebuffer object, used as an additional render target when performing full
/// screen effects.
QOpenGLFramebufferObject* getSecondaryFramebufferObject();
/// Returns a pointer to the tertiary framebuffer object, used as an additional render target when performing full
/// screen effects.
QOpenGLFramebufferObject* getTertiaryFramebufferObject();
virtual bool eventFilter(QObject* watched, QEvent* event);
private:
QOpenGLFramebufferObject* createFramebufferObject();
GLuint _permutationNormalTextureID;
QOpenGLFramebufferObject* _primaryFramebufferObject;
GLuint _primaryDepthTextureID;
QOpenGLFramebufferObject* _secondaryFramebufferObject;
QOpenGLFramebufferObject* _tertiaryFramebufferObject;
};
#endif /* defined(__interface__TextureCache__) */