[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/libs/kgllib/extras/kgllib
From: Rivo Laks <rivolaks () hot ! ee>
Date: 2009-08-07 17:59:43
Message-ID: 1249667983.175850.28590.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1008524 by rivol:
- Clear the scene renderbuffer if automatic clearing is turned on.
- Add range for automatic exposure calculation: the exposure will change only in the given range
and won't get too small/big.
M +13 -3 hdrglwidget.cpp
M +5 -0 hdrglwidget.h
--- trunk/playground/libs/kgllib/extras/kgllib/hdrglwidget.cpp #1008523:1008524
@@ -75,6 +75,8 @@
mAutoExposure = false;
mAutoExposureTarget = 0.3;
mAutoExposureSpeed = 0.5;
+ mAutoExposureMin = 0.25;
+ mAutoExposureMax = 4.0;
mBloomEnabled = true;
mBloomAfterTonemapping = false;
mBloomDownsize = 2;
@@ -173,8 +175,6 @@
void HdrGLWidget::render()
{
- GLWidget::render();
-
// If HDR rendering isn't active, just render the scene as usual and return
if (!hdrRenderingActive()) {
renderScene();
@@ -187,6 +187,15 @@
mSceneRenderTarget = new RenderTarget(width(), height(), true, GL_RGBA16F_ARB);
}
activateRenderTarget(mSceneRenderTarget);
+ if (automaticClear()) {
+ setClearColor(clearColor());
+ if (context()->format().depth()) {
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ } else {
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+ }
+
renderScene();
deactivateRenderTarget(mSceneRenderTarget);
@@ -278,7 +287,8 @@
// Set exposure
float targetexposure = mAutoExposureTarget / avgluminance;
float oldc = powf(mAutoExposureSpeed, fpsCounter()->timeElapsed());
- setExposure(exposure() * oldc + targetexposure * (1-oldc));
+ float e = exposure() * oldc + targetexposure * (1-oldc);
+ setExposure(qBound(mAutoExposureMin, e, mAutoExposureMax));
// Clean up
delete[] buffer;
--- trunk/playground/libs/kgllib/extras/kgllib/hdrglwidget.h #1008523:1008524
@@ -61,6 +61,8 @@
float autoExposureSpeed() const { return mAutoExposureSpeed; }
float autoExposureTarget() const { return mAutoExposureTarget; }
+ float autoExposureMin() const { return mAutoExposureMin; }
+ float autoExposureMax() const { return mAutoExposureMax; }
bool bloomEnabled() const { return mBloomEnabled; }
@@ -106,6 +108,7 @@
void setAutoExposureSpeed(float s) { mAutoExposureSpeed = s; }
void setAutoExposureTarget(float t) { mAutoExposureTarget = t; }
+ void setAutoExposureRange(float a, float b) { mAutoExposureMin = a; mAutoExposureMax = b; }
void setBloomEnabled(bool e) { mBloomEnabled = e; }
void setBloomAfterTonemapping(bool e) { mBloomAfterTonemapping = e; }
@@ -151,6 +154,8 @@
bool mAutoExposure;
float mAutoExposureSpeed;
float mAutoExposureTarget;
+ float mAutoExposureMin;
+ float mAutoExposureMax;
bool mBloomEnabled;
bool mBloomAfterTonemapping;
int mBloomDownsize;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic