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: ...@@ -81,6 +81,7 @@ public slots:
QString renderObjectsInfo(bool _outputShaderInfo) { return dumpCurrentRenderObjectsToString(&sortedObjects_[0],_outputShaderInfo); }; QString renderObjectsInfo(bool _outputShaderInfo) { return dumpCurrentRenderObjectsToString(&sortedObjects_[0],_outputShaderInfo); };
QAction* optionsAction();
private slots: private slots:
...@@ -95,6 +96,7 @@ private slots: ...@@ -95,6 +96,7 @@ private slots:
QString checkOpenGL(); QString checkOpenGL();
void slotModeChanged( QAction * );
private: private:
...@@ -106,20 +108,16 @@ private: ...@@ -106,20 +108,16 @@ private:
/// peel the scene with dual depth peeling, two layers per pass /// peel the scene with dual depth peeling, two layers per pass
void renderDualPeeling(ACG::GLState* _glState, Viewer::ViewerProperties& _properties); 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 /// mode: 0 -> front to back peeling, 1 -> dual peeling
struct PeelLayer int peelMode_;
{
/// target framebuffer for colorTex and depthBuf bool copyFrontDepth_;
GLuint fbo;
/// max peel count
/// color rendertarget int maxPeelCount_;
GLuint colorTex;
/// hardware depth buffer
GLuint depthBuf;
/// depth-buffer rendertarget
GLuint depthTex; // encountered gpu-model specific problems when reading from depthBuf directly
};
/// blends one depth-layer into the current scene target /// blends one depth-layer into the current scene target
GLSL::Program* peelBlend_; GLSL::Program* peelBlend_;
...@@ -127,12 +125,6 @@ private: ...@@ -127,12 +125,6 @@ private:
/// final copy into back-buffer /// final copy into back-buffer
GLSL::Program* peelFinal_; 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) /// occlusion query determining end of peeling (last layer)
GLuint peelQueryID_; GLuint peelQueryID_;
...@@ -142,28 +134,34 @@ private: ...@@ -142,28 +134,34 @@ private:
GLSL::Program* peelFinalDual_; GLSL::Program* peelFinalDual_;
/// shader copies depth of the first front layer to the back buffer
GLSL::Program* depthCopy_;
/// Collection of framebuffers for each viewport /// Collection of framebuffers for each viewport
struct ViewerResources struct ViewerResources
{ {
ViewerResources(); ViewerResources();
~ViewerResources();
// resize textures // resize textures
void resize(bool _dualPeeling, unsigned int _width, unsigned int _height); void resize(bool _dualPeeling, unsigned int _width, unsigned int _height);
/// viewer window width /// viewer window width
unsigned int glWidth_; unsigned int width_;
/// viewer window height /// 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 ACG::FBO* singleFbo_; // targets: {depth0, front0, depth1, front1, blend}
PeelLayer peelTargets_[2];
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