git-svn-id: svn://db.shs.com.ru/libs@49 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -74,6 +74,8 @@ private slots:
|
||||
void on_spinCubemapSize_valueChanged(double val) {view->setDynamicReflectionsMapSize(val);}
|
||||
void on_spinShadowmapSize_valueChanged(double val) {view->setShadowMapSize(val);}
|
||||
void on_spinHaloFillAlpha_valueChanged(double val) {view->setSelectionHaloFillAlpha(val);}
|
||||
void on_spinMotionBlurFactor_valueChanged(double val) {view->setMotionBlurFactor(val);}
|
||||
void on_spinMotionBlurSteps_valueChanged(int val) {view->setMotionBlurSteps(val);}
|
||||
//void on_spinSliderShine_valueChanged(double val) {obj->material().shine_strength = val; obj->setMaterial(obj->material(), true);}
|
||||
//void on_spinSliderRough_valueChanged(double val) {obj->material().shine = val; obj->setMaterial(obj->material(), true);}
|
||||
void on_pushButton_clicked() {view->removeLight(view->lightsCount() - 1); setWindowTitle(QString::number(view->lightsCount()));}
|
||||
@@ -92,6 +94,7 @@ private slots:
|
||||
void on_checkShadows_toggled(bool val) {view->setShadowsEnabled(val);}
|
||||
void on_checkSoftShadows_toggled(bool val) {view->setSoftShadowsEnabled(val);}
|
||||
void on_checkCameraOrbit_toggled(bool val) {view->setCameraOrbit(val);}
|
||||
void on_checkMotionBlur_toggled(bool val) {view->setMotionBlurEnabled(val);}
|
||||
void on_colorAmbient_colorChanged(QColor color) {view->setAmbientColor(color);}
|
||||
void on_colorHalo_colorChanged(QColor color) {view->setSelectionHaloColor(color);}
|
||||
void on_view_glKeyPressEvent(QKeyEvent * e);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1246</width>
|
||||
<height>856</height>
|
||||
<height>851</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -53,13 +53,21 @@
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>FOV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="SpinSlider" name="spinFOV">
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
@@ -72,14 +80,49 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>accomodation time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>accomodation max speed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>dynamic cubemap size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>shadowmap size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>motion blur factor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>motion blur steps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="SpinSlider" name="spinAccom">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
@@ -95,14 +138,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>accomodation max speed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="1">
|
||||
<widget class="SpinSlider" name="spinAccomMS">
|
||||
<property name="minimum">
|
||||
<double>0.010000000000000</double>
|
||||
@@ -127,14 +163,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>dynamic cubemap size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="1">
|
||||
<widget class="SpinSlider" name="spinCubemapSize">
|
||||
<property name="minimum">
|
||||
<double>16.000000000000000</double>
|
||||
@@ -159,14 +188,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>shadowmap size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="4" column="1">
|
||||
<widget class="SpinSlider" name="spinShadowmapSize">
|
||||
<property name="minimum">
|
||||
<double>16.000000000000000</double>
|
||||
@@ -191,6 +213,58 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="SpinSlider" name="spinMotionBlurFactor">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="squareScale">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="SpinSlider" name="spinMotionBlurSteps">
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>128.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>8.000000000000000</double>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<double>4.000000000000000</double>
|
||||
</property>
|
||||
<property name="squareScale">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
@@ -363,6 +437,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkMotionBlur">
|
||||
<property name="text">
|
||||
<string>motion blur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkFXAA">
|
||||
<property name="text">
|
||||
@@ -502,6 +583,7 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<zorder>tabWidget</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -561,12 +643,12 @@
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>92</x>
|
||||
<y>580</y>
|
||||
<x>112</x>
|
||||
<y>611</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>91</x>
|
||||
<y>605</y>
|
||||
<x>111</x>
|
||||
<y>632</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -577,12 +659,12 @@
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>147</x>
|
||||
<y>580</y>
|
||||
<x>167</x>
|
||||
<y>611</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>143</x>
|
||||
<y>630</y>
|
||||
<x>163</x>
|
||||
<y>653</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -593,12 +675,12 @@
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>106</x>
|
||||
<y>705</y>
|
||||
<x>126</x>
|
||||
<y>737</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>108</x>
|
||||
<y>730</y>
|
||||
<x>128</x>
|
||||
<y>758</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
||||
@@ -57,8 +57,11 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
|
||||
cur_luminance = 1.;
|
||||
accom_time = 16.;
|
||||
accom_max_speed = 0.2;
|
||||
m_motionBlurFactor = 1.;
|
||||
m_motionBlurSteps = 8;
|
||||
mouse_first = mouseSelect_ = accomodation_ = hoverHalo_ = selectionHalo_ = true;
|
||||
fogEnabled_ = is_init = grabMouse_ = mouseRotate_ = mouseThis_ = shaders_bind = shadows_ = shadows_soft = dynamic_reflections = hdr_ = bloom_ = msaa_ = fxaa_ = changed_ = false;
|
||||
fogEnabled_ = is_init = grabMouse_ = mouseRotate_ = mouseThis_ = shaders_bind = m_motionBlurEnabled =
|
||||
shadows_ = shadows_soft = dynamic_reflections = hdr_ = bloom_ = msaa_ = fxaa_ = changed_ = false;
|
||||
rmode = GLObjectBase::Fill;
|
||||
sel_mode = QGLView::SingleSelection;
|
||||
sel_pen = QPen(Qt::black, 1, Qt::DashLine);
|
||||
|
||||
@@ -80,6 +80,9 @@ class QGLView: public QGraphicsView, public QGLViewBase
|
||||
Q_PROPERTY (bool accomodationEnabled READ isAccomodationEnabled WRITE setAccomodationEnabled)
|
||||
Q_PROPERTY (double accomodationTime READ accomodationTime WRITE setAccomodationTime)
|
||||
Q_PROPERTY (double accomodationMaxSpeed READ accomodationMaxSpeed WRITE setAccomodationMaxSpeed)
|
||||
Q_PROPERTY (bool motionBlurEnabled READ isMotionBlurEnabled WRITE setMotionBlurEnabled)
|
||||
Q_PROPERTY (double motionBlurFactor READ motionBlurFactor WRITE setMotionBlurFactor)
|
||||
Q_PROPERTY (int motionBlurSteps READ motionBlurSteps WRITE setMotionBlurSteps)
|
||||
Q_PROPERTY (Qt::MouseButton selectionButton READ selectionButton WRITE setSelectionButton)
|
||||
Q_PROPERTY (Qt::KeyboardModifier selectionModifier READ selectionModifier WRITE setSelectionModifier)
|
||||
Q_PROPERTY (SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
|
||||
@@ -138,6 +141,7 @@ public:
|
||||
bool isSelectionHaloEnabled() const {return selectionHalo_;}
|
||||
QColor selectionHaloColor() const {return selectionHaloColor_;}
|
||||
double selectionHaloFillAlpha() const {return selectionHaloFill_;}
|
||||
bool isMotionBlurEnabled() const {return m_motionBlurEnabled;}
|
||||
bool isShadowsEnabled() const {return shadows_;}
|
||||
bool isSoftShadowsEnabled() const {return shadows_soft;}
|
||||
bool isDynamicReflectionsEnabled() const {return dynamic_reflections;}
|
||||
@@ -152,6 +156,8 @@ public:
|
||||
|
||||
double accomodationTime() const {return accom_time;}
|
||||
double accomodationMaxSpeed() const {return accom_max_speed;}
|
||||
double motionBlurFactor() const {return m_motionBlurFactor;}
|
||||
int motionBlurSteps() const {return m_motionBlurSteps;}
|
||||
|
||||
void addObject(QGraphicsItem * o) {scene()->addItem(o);}
|
||||
void addObject(QWidget * o, Qt::WindowFlags f = Qt::Widget);
|
||||
@@ -256,11 +262,12 @@ private:
|
||||
Qt::KeyboardModifier sel_mod;
|
||||
GLRendererBase::RenderingParameters start_rp;
|
||||
double lineWidth_, linearFiltering_, accom_time, accom_max_speed, cur_luminance;
|
||||
double fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_;
|
||||
int timer, fps_cnt, sh_id_loc, shadow_map_size, dynamic_cubemap_size;
|
||||
double fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor;
|
||||
int timer, fps_cnt, sh_id_loc, shadow_map_size, dynamic_cubemap_size, motion_blur_steps, m_motionBlurSteps;
|
||||
bool is_init, fogEnabled_, lightEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_;
|
||||
bool shaders_supported, changed_, cameraOrbit_;
|
||||
bool hoverHalo_, selectionHalo_, mouseThis_, shaders_bind, shadows_, shadows_soft, selecting_;
|
||||
bool shaders_supported, dynamic_reflections, hdr_, bloom_, msaa_, fxaa_, accomodation_, changed_, cameraOrbit_;
|
||||
bool dynamic_reflections, hdr_, bloom_, msaa_, fxaa_, accomodation_, m_motionBlurEnabled;
|
||||
|
||||
public slots:
|
||||
void setBackColor(const QColor & arg) {backColor_ = arg;}
|
||||
@@ -302,6 +309,9 @@ public slots:
|
||||
void setMultisamplingEnabled(const bool & arg) {msaa_ = arg;}
|
||||
void setFXAAEnabled(const bool & arg) {fxaa_ = arg;}
|
||||
void setAccomodationEnabled(const bool & arg) {accomodation_ = arg;}
|
||||
void setMotionBlurEnabled(bool motionBlurEnabled) {m_motionBlurEnabled = motionBlurEnabled;}
|
||||
void setMotionBlurFactor(double motionBlurFactor) {m_motionBlurFactor = motionBlurFactor;}
|
||||
void setMotionBlurSteps(int motionBlurSteps) {m_motionBlurSteps = motionBlurSteps;}
|
||||
|
||||
void reloadShaders() {if (renderer_ != 0) renderer_->reloadShaders(); reloadThisShaders();}
|
||||
void deselect() {sel_obj = 0;}
|
||||
|
||||
@@ -195,6 +195,7 @@ void RendererDeferredShading::renderScene() {
|
||||
piSwap<int>(wi, ri);
|
||||
}
|
||||
|
||||
if (view.isMotionBlurEnabled()) {
|
||||
fbo_out.setWriteBuffer(wi);
|
||||
glActiveTextureChannel(1);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_g.colorTexture(4));
|
||||
@@ -203,10 +204,13 @@ void RendererDeferredShading::renderScene() {
|
||||
shader_motion_blur->setUniformValue("dt", QVector2D(1. / fbo_out.width(), 1. / fbo_out.height()));
|
||||
shader_motion_blur->setUniformValue("t0", 0);
|
||||
shader_motion_blur->setUniformValue("ts", 1);
|
||||
shader_motion_blur->setUniformValue("factor", GLfloat(view.motionBlurFactor()));
|
||||
shader_motion_blur->setUniformValue("steps", view.motionBlurSteps());
|
||||
glDrawQuad(shader_motion_blur);
|
||||
glActiveTextureChannel(0);
|
||||
glBindTexture(GL_TEXTURE_2D, fbo_out.colorTexture(wi));
|
||||
piSwap<int>(wi, ri);
|
||||
}
|
||||
|
||||
glReleaseShaders();
|
||||
fbo_out.release();
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
uniform sampler2D t0, ts;
|
||||
uniform vec2 dt;
|
||||
uniform float factor;
|
||||
uniform int steps = 16;
|
||||
uniform float factor = 1.;
|
||||
uniform int steps = 8;
|
||||
|
||||
void main(void) {
|
||||
vec2 cdt = dt / steps;
|
||||
vec2 ct = qgl_FragTexture.xy;
|
||||
vec3 speed = texture(ts, ct).rgb*1024;
|
||||
vec3 speed = texture(ts, ct).rgb * 256 * factor;
|
||||
int hsteps = steps / 2;
|
||||
ct -= speed.xy * cdt * hsteps;
|
||||
vec3 scol = vec3(0);//texture(t0, ct).rgb;
|
||||
|
||||
Reference in New Issue
Block a user