nvidia fix, soft shadows

This commit is contained in:
2023-02-13 18:35:25 +03:00
parent c8dcd5e9c0
commit 36540468dc
17 changed files with 358 additions and 107 deletions

View File

@@ -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();