spot light map

This commit is contained in:
2023-02-14 10:43:51 +03:00
parent 36540468dc
commit 12695983d2
13 changed files with 119 additions and 62 deletions

View File

@@ -153,6 +153,9 @@ void RendererBase::reloadMaterials(Scene & scene) {
for (Material * m: scene.materials) {
m->load(textures_manager);
}
auto cone_ll = scene.lights_used.value(Light::Cone);
for (auto * l: cone_ll)
l->light_map.load(textures_manager);
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;
@@ -164,6 +167,8 @@ void RendererBase::reloadMaterials(Scene & scene) {
for (Material * m: scene.materials) {
m->setMapsLayers(textures_manager);
}
for (auto * l: cone_ll)
l->light_map.setMapLayer(textures_manager);
textures_manager->loadingDone();
QGLMaterial glm;
@@ -227,6 +232,7 @@ void RendererBase::reloadLightsParameters(const QMap<int, QList<Light *>> & ligh
so.decay_intensity[3] = l->intensity;
so.size = l->size;
so.flags = l->cast_shadow ? 1 : 0;
if (l->light_type == Light::Cone) l->light_map.copyToQGLMap(so.map);
}
buffer_lights.bind(view);
buffer_lights.resize(view, cur_lights_params_.size() * sizeof(QGLLightParameter));