git-svn-id: svn://db.shs.com.ru/libs@617 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-10-11 14:27:13 +00:00
parent a8d5bbf1ab
commit ca3fe6e788
4 changed files with 1106 additions and 1108 deletions

View File

@@ -228,9 +228,9 @@ void setUniformLight(QOpenGLShaderProgram * prog, Light * light, QString ulightn
if (!prog) return; if (!prog) return;
if (!prog->isLinked()) return; if (!prog->isLinked()) return;
QMatrix4x4 m = mat * light->worldTransform(); QMatrix4x4 m = mat * light->worldTransform();
QVector4D pos(0, 0, 0, 1.), dir(light->direction);//, dir0(light->dir0), dir1(light->dir1); QVector4D pos(0, 0, 0, 1.), dir(light->direction, 1);//, dir0(light->dir0), dir1(light->dir1);
pos = m * pos; pos = m * pos;
dir = (mat * dir).normalized(); dir = ((m * dir) - pos).normalized();
float ang_start = light->angle_start / 2.f, ang_end = light->angle_end / 2.f; float ang_start = light->angle_start / 2.f, ang_end = light->angle_end / 2.f;
if (light->light_type == Light::Omni) if (light->light_type == Light::Omni)
ang_start = ang_end = 180.; ang_start = ang_end = 180.;

View File

@@ -14,8 +14,12 @@
<string>QGLView converter</string> <string>QGLView converter</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1"> <layout class="QVBoxLayout" name="verticalLayout_10">
<item> <item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="widget_2" native="true"> <widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
@@ -433,7 +437,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>294</width> <width>358</width>
<height>737</height> <height>737</height>
</rect> </rect>
</property> </property>
@@ -1058,7 +1062,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>333</width> <width>397</width>
<height>853</height> <height>853</height>
</rect> </rect>
</property> </property>
@@ -1117,12 +1121,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="GLWidget" name="view"> <widget class="GLWidget" name="view">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">

View File

@@ -342,7 +342,7 @@ void RendererDeferredShading::renderScene() {
shader_ssr_merge->setUniformValue("tg1", 1); shader_ssr_merge->setUniformValue("tg1", 1);
shader_ssr_merge->setUniformValue("ts", 2); shader_ssr_merge->setUniformValue("ts", 2);
fbo_out.setWriteBuffer(ri); fbo_out.setWriteBuffer(ri);
glDrawQuad(shader_ssr_blur); glDrawQuad(shader_ssr_merge);
wi = ri; wi = ri;
ri = 1 - ri; ri = 1 - ri;
//piSwap<int>(wi, ri); //piSwap<int>(wi, ri);

View File

@@ -41,7 +41,7 @@ void calcLight(in int index, in vec3 n, in vec3 v, in vec4 v2) {
float scos = max(dot(-ldir, qgl_Light[index].direction.xyz), 0.); float scos = max(dot(-ldir, qgl_Light[index].direction.xyz), 0.);
spot *= scos * step(qgl_Light[index].endAngleCos, scos); spot *= scos * step(qgl_Light[index].endAngleCos, scos);
spot *= smoothstep(qgl_Light[index].endAngleCos, qgl_Light[index].startAngleCos, scos); spot *= smoothstep(qgl_Light[index].endAngleCos, qgl_Light[index].startAngleCos, scos);
lwdir = mat3(mat_viewi) * qgl_Light[index].direction.xyz; //lwdir = /*mat3(mat_viewi) * */qgl_Light[index].direction.xyz;
//bn = normalize(cross(lwdir, vec3(1, 0, 0))); //bn = normalize(cross(lwdir, vec3(1, 0, 0)));
//bn2 = normalize(cross(lwdir, bn)); //bn2 = normalize(cross(lwdir, bn));
float ds = ldist/200.;//max(abs(sdist) / 5000, 0.02); float ds = ldist/200.;//max(abs(sdist) / 5000, 0.02);