Commit 8427fe96 authored by Jan Möbius's avatar Jan Möbius

- Front to back peeling back to work

- User can switch between dual peeling and front to back peeling via options menu
- Post-processor support: Output of front depth layers in hardware depth buffer

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18242 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f3477fcf
This diff is collapsed.
......@@ -81,6 +81,7 @@ public slots:
QString renderObjectsInfo(bool _outputShaderInfo) { return dumpCurrentRenderObjectsToString(&sortedObjects_[0],_outputShaderInfo); };
QAction* optionsAction();
private slots:
......@@ -95,6 +96,7 @@ private slots:
QString checkOpenGL();
void slotModeChanged( QAction * );
private:
......@@ -106,20 +108,16 @@ private:
/// peel the scene with dual depth peeling, two layers per pass
void renderDualPeeling(ACG::GLState* _glState, Viewer::ViewerProperties& _properties);
/// copies a texture containing depth values to the back buffer depth channel
void copyDepthsToInput(GLuint _depthTex, float _sign = 1.0f);
// single layer depth peeling
struct PeelLayer
{
/// target framebuffer for colorTex and depthBuf
GLuint fbo;
/// color rendertarget
GLuint colorTex;
/// hardware depth buffer
GLuint depthBuf;
/// depth-buffer rendertarget
GLuint depthTex; // encountered gpu-model specific problems when reading from depthBuf directly
};
/// mode: 0 -> front to back peeling, 1 -> dual peeling
int peelMode_;
bool copyFrontDepth_;
/// max peel count
int maxPeelCount_;
/// blends one depth-layer into the current scene target
GLSL::Program* peelBlend_;
......@@ -127,12 +125,6 @@ private:
/// final copy into back-buffer
GLSL::Program* peelFinal_;
/**
Copy depth-texture of first layer into hardware z-buffer.
This is needed for post-processing or renderobjects with low priority.
*/
GLSL::Program* peelDepthCopy_;
/// occlusion query determining end of peeling (last layer)
GLuint peelQueryID_;
......@@ -142,28 +134,34 @@ private:
GLSL::Program* peelFinalDual_;
/// shader copies depth of the first front layer to the back buffer
GLSL::Program* depthCopy_;
/// Collection of framebuffers for each viewport
struct ViewerResources
{
ViewerResources();
~ViewerResources();
// resize textures
void resize(bool _dualPeeling, unsigned int _width, unsigned int _height);
/// viewer window width
unsigned int glWidth_;
unsigned int width_;
/// viewer window height
unsigned int glHeight_;
unsigned int height_;
// depth peeling textures
// single layer depth peeling textures (front to back peeling)
// ping-pong buffer for (depth, front) targets
GLuint singleDepthTex_[2]; // float1: minDepth
GLuint singleFrontTex_[2]; // rgba: color of front-peeled layer
GLuint singleBlendTex_; // rgba: color accumulation buffer
/// ping pong between two consecutive layers
PeelLayer peelTargets_[2];
ACG::FBO* singleFbo_; // targets: {depth0, front0, depth1, front1, blend}
GLuint peelBlendTex_;
GLuint peelBlendFbo_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment