nvidia fix, soft shadows
This commit is contained in:
@@ -291,7 +291,7 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
||||
}
|
||||
fbo_ds.bindColorTextures();
|
||||
fbo_out.bind();
|
||||
tex_env.bind((int)Renderer::dbrBuffersCount + 1);
|
||||
// tex_env.bind((int)Renderer::dbrBuffersCount + 1);
|
||||
typedef QPair<Renderer::ShaderRole, Light::Type> PassPair;
|
||||
QVector<PassPair> passes;
|
||||
passes << PassPair(srLightOmniPass, Light::Omni) << PassPair(srLightSpotPass, Light::Cone);
|
||||
@@ -319,6 +319,10 @@ void Renderer::renderLight(int first_wr_buff, bool clear_only) {
|
||||
prog->setUniformValue("fog_density", view->fogDensity());
|
||||
prog->setUniformValue("view_mat", cam->viewMatrix().inverted().toGenericMatrix<3, 3>());
|
||||
prog->setUniformValue("shadow_size", view->shadow_map_size);
|
||||
prog->setUniformValue("tex_shadows_cone", (int)tarShadowsCone);
|
||||
prog->setUniformValue("soft_shadows_enabled", view->soft_shadows);
|
||||
prog->setUniformValue("soft_shadows_samples", view->soft_shadows_samples);
|
||||
shadow_maps_cone.bind(view, tarShadowsCone);
|
||||
renderQuad(prog, quad, cam);
|
||||
}
|
||||
}
|
||||
@@ -561,7 +565,8 @@ void Renderer::renderScene() {
|
||||
if (!cone_ll.isEmpty()) {
|
||||
Light * l = cone_ll[0];
|
||||
l->shadow_map.blit(0, 0, 0, l->shadow_map.rect(), l->shadow_map.rect());
|
||||
}*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void RendererBase::initTextureArrays() {
|
||||
textures_maps.init(f);
|
||||
textures_empty.init(f);
|
||||
textures_empty.resize(f, QSize(1, 1), 2);
|
||||
textures_empty.bind(f);
|
||||
textures_empty.bind(f, tarEmpty);
|
||||
QImage im(1, 1, QImage::Format_RGBA8888);
|
||||
im.fill(0xFFFFFFFF);
|
||||
textures_empty.load(f, im, emrWhite);
|
||||
@@ -153,11 +153,11 @@ void RendererBase::reloadMaterials(Scene & scene) {
|
||||
for (Material * m: scene.materials) {
|
||||
m->load(textures_manager);
|
||||
}
|
||||
uint cur_maps_hash = textures_manager->texturesHash();
|
||||
uint cur_maps_hash = textures_manager->texturesHash() ^ ((maps_size.width() << 16) | maps_size.height());
|
||||
if (maps_hash != cur_maps_hash) {
|
||||
maps_hash = cur_maps_hash;
|
||||
// textures_maps.resize(view, maps_size, textures_manager->texturesCount());
|
||||
textures_maps.bind(view);
|
||||
textures_maps.bind(view, tarMaps);
|
||||
textures_manager->loadToTexture2DArray(&textures_maps, maps_size);
|
||||
qDebug() << "loaded" << textures_maps.layersCount() << "bitmaps";
|
||||
}
|
||||
@@ -225,6 +225,7 @@ void RendererBase::reloadLightsParameters(const QMap<int, QList<Light *>> & ligh
|
||||
so.decay_intensity[1] = l->decay_linear;
|
||||
so.decay_intensity[2] = l->decay_quadratic;
|
||||
so.decay_intensity[3] = l->intensity;
|
||||
so.size = l->size;
|
||||
so.flags = l->cast_shadow ? 1 : 0;
|
||||
}
|
||||
buffer_lights.bind(view);
|
||||
@@ -260,6 +261,11 @@ void RendererBase::markReloadTextures() {
|
||||
}
|
||||
|
||||
|
||||
void RendererBase::markReloadMaterials() {
|
||||
view->scene()->need_reload_materials = true;
|
||||
}
|
||||
|
||||
|
||||
void RendererBase::setMapsSize(QSize sz) {
|
||||
maps_size = sz;
|
||||
markReloadTextures();
|
||||
|
||||
@@ -43,6 +43,7 @@ protected:
|
||||
void reloadLightsParameters(const QMap<int, QList<Light *>> & lights);
|
||||
void reloadLightsPositions(Camera * cam);
|
||||
void markReloadTextures();
|
||||
void markReloadMaterials();
|
||||
void setMapsSize(QSize sz);
|
||||
void initQuad(Mesh * mesh, QMatrix4x4 mat = QMatrix4x4());
|
||||
void renderQuad(QOpenGLShaderProgram * prog, Mesh * mesh, Camera * cam = 0, bool uniforms = true);
|
||||
|
||||
@@ -78,7 +78,8 @@ void RendererMaterial::renderMaterial(Material * m) {
|
||||
r->textures_empty.bind(f, tarEmpty);
|
||||
r->textures_maps.bind(f, tarMaps);
|
||||
Object o;
|
||||
o.material = m->_index;
|
||||
o.material = m->_index;
|
||||
o.f_accept_light = 1;
|
||||
mat_sphere->loadObject(f, o);
|
||||
mat_sphere->draw(f, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user