2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 01:50:24 +00:00
|
|
|
* limitations under the License.
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 18:39:14 +00:00
|
|
|
#include "render/background.h"
|
|
|
|
#include "render/bake.h"
|
|
|
|
#include "render/camera.h"
|
|
|
|
#include "render/curves.h"
|
|
|
|
#include "device/device.h"
|
|
|
|
#include "render/film.h"
|
|
|
|
#include "render/integrator.h"
|
|
|
|
#include "render/light.h"
|
|
|
|
#include "render/mesh.h"
|
|
|
|
#include "render/object.h"
|
|
|
|
#include "render/osl.h"
|
|
|
|
#include "render/particles.h"
|
|
|
|
#include "render/scene.h"
|
|
|
|
#include "render/shader.h"
|
|
|
|
#include "render/svm.h"
|
|
|
|
#include "render/tables.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.
For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.
Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.
This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.
Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.
Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner
Reviewed By: lukasstockner97, maiself, nirved, dingto
Subscribers: brecht
Differential Revision: https://developer.blender.org/D2586
2017-03-28 18:39:14 +00:00
|
|
|
#include "util/util_foreach.h"
|
|
|
|
#include "util/util_guarded_allocator.h"
|
|
|
|
#include "util/util_logging.h"
|
|
|
|
#include "util/util_progress.h"
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
2017-10-20 21:31:13 +00:00
|
|
|
DeviceScene::DeviceScene(Device *device)
|
2017-10-20 23:09:59 +00:00
|
|
|
: bvh_nodes(device, "__bvh_nodes", MEM_TEXTURE),
|
|
|
|
bvh_leaf_nodes(device, "__bvh_leaf_nodes", MEM_TEXTURE),
|
|
|
|
object_node(device, "__object_node", MEM_TEXTURE),
|
|
|
|
prim_tri_index(device, "__prim_tri_index", MEM_TEXTURE),
|
|
|
|
prim_tri_verts(device, "__prim_tri_verts", MEM_TEXTURE),
|
|
|
|
prim_type(device, "__prim_type", MEM_TEXTURE),
|
|
|
|
prim_visibility(device, "__prim_visibility", MEM_TEXTURE),
|
|
|
|
prim_index(device, "__prim_index", MEM_TEXTURE),
|
|
|
|
prim_object(device, "__prim_object", MEM_TEXTURE),
|
|
|
|
prim_time(device, "__prim_time", MEM_TEXTURE),
|
|
|
|
tri_shader(device, "__tri_shader", MEM_TEXTURE),
|
|
|
|
tri_vnormal(device, "__tri_vnormal", MEM_TEXTURE),
|
|
|
|
tri_vindex(device, "__tri_vindex", MEM_TEXTURE),
|
|
|
|
tri_patch(device, "__tri_patch", MEM_TEXTURE),
|
|
|
|
tri_patch_uv(device, "__tri_patch_uv", MEM_TEXTURE),
|
|
|
|
curves(device, "__curves", MEM_TEXTURE),
|
|
|
|
curve_keys(device, "__curve_keys", MEM_TEXTURE),
|
|
|
|
patches(device, "__patches", MEM_TEXTURE),
|
|
|
|
objects(device, "__objects", MEM_TEXTURE),
|
2018-03-09 23:37:07 +00:00
|
|
|
object_motion_pass(device, "__object_motion_pass", MEM_TEXTURE),
|
|
|
|
object_flag(device, "__object_flag", MEM_TEXTURE),
|
2017-10-20 23:09:59 +00:00
|
|
|
attributes_map(device, "__attributes_map", MEM_TEXTURE),
|
|
|
|
attributes_float(device, "__attributes_float", MEM_TEXTURE),
|
|
|
|
attributes_float3(device, "__attributes_float3", MEM_TEXTURE),
|
|
|
|
attributes_uchar4(device, "__attributes_uchar4", MEM_TEXTURE),
|
|
|
|
light_distribution(device, "__light_distribution", MEM_TEXTURE),
|
2018-03-07 23:15:41 +00:00
|
|
|
lights(device, "__lights", MEM_TEXTURE),
|
2017-10-20 23:09:59 +00:00
|
|
|
light_background_marginal_cdf(device, "__light_background_marginal_cdf", MEM_TEXTURE),
|
|
|
|
light_background_conditional_cdf(device, "__light_background_conditional_cdf", MEM_TEXTURE),
|
|
|
|
particles(device, "__particles", MEM_TEXTURE),
|
|
|
|
svm_nodes(device, "__svm_nodes", MEM_TEXTURE),
|
2018-03-07 23:35:24 +00:00
|
|
|
shaders(device, "__shaders", MEM_TEXTURE),
|
2017-10-20 23:09:59 +00:00
|
|
|
lookup_table(device, "__lookup_table", MEM_TEXTURE),
|
|
|
|
sobol_directions(device, "__sobol_directions", MEM_TEXTURE)
|
2017-10-20 21:31:13 +00:00
|
|
|
{
|
|
|
|
memset(&data, 0, sizeof(data));
|
|
|
|
}
|
|
|
|
|
2017-10-20 03:08:26 +00:00
|
|
|
Scene::Scene(const SceneParams& params_, Device *device)
|
2017-10-20 21:31:13 +00:00
|
|
|
: device(device), dscene(device), params(params_)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
memset(&dscene.data, 0, sizeof(dscene.data));
|
|
|
|
|
|
|
|
camera = new Camera();
|
2018-01-11 23:50:34 +00:00
|
|
|
dicing_camera = new Camera();
|
2013-04-01 20:26:43 +00:00
|
|
|
lookup_tables = new LookupTables();
|
2011-04-27 11:58:34 +00:00
|
|
|
film = new Film();
|
|
|
|
background = new Background();
|
|
|
|
light_manager = new LightManager();
|
|
|
|
mesh_manager = new MeshManager();
|
|
|
|
object_manager = new ObjectManager();
|
|
|
|
integrator = new Integrator();
|
2017-10-20 03:08:26 +00:00
|
|
|
image_manager = new ImageManager(device->info);
|
2012-08-31 17:27:08 +00:00
|
|
|
particle_system_manager = new ParticleSystemManager();
|
2012-12-28 14:21:30 +00:00
|
|
|
curve_system_manager = new CurveSystemManager();
|
2014-01-02 21:05:07 +00:00
|
|
|
bake_manager = new BakeManager();
|
2012-09-04 13:29:07 +00:00
|
|
|
|
2012-12-04 07:48:09 +00:00
|
|
|
/* OSL only works on the CPU */
|
2017-10-20 03:08:26 +00:00
|
|
|
if(device->info.has_osl)
|
2012-12-04 07:48:09 +00:00
|
|
|
shader_manager = ShaderManager::create(this, params.shadingsystem);
|
|
|
|
else
|
2014-05-19 10:49:36 +00:00
|
|
|
shader_manager = ShaderManager::create(this, SHADINGSYSTEM_SVM);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Scene::~Scene()
|
|
|
|
{
|
2012-11-09 08:46:53 +00:00
|
|
|
free_memory(true);
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2012-11-09 08:46:53 +00:00
|
|
|
void Scene::free_memory(bool final)
|
|
|
|
{
|
2011-04-27 11:58:34 +00:00
|
|
|
foreach(Shader *s, shaders)
|
|
|
|
delete s;
|
|
|
|
foreach(Mesh *m, meshes)
|
|
|
|
delete m;
|
|
|
|
foreach(Object *o, objects)
|
|
|
|
delete o;
|
|
|
|
foreach(Light *l, lights)
|
|
|
|
delete l;
|
2012-08-31 17:27:08 +00:00
|
|
|
foreach(ParticleSystem *p, particle_systems)
|
|
|
|
delete p;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2013-02-14 16:11:47 +00:00
|
|
|
shaders.clear();
|
|
|
|
meshes.clear();
|
|
|
|
objects.clear();
|
|
|
|
lights.clear();
|
|
|
|
particle_systems.clear();
|
|
|
|
|
2012-11-09 08:46:53 +00:00
|
|
|
if(device) {
|
2015-10-27 08:16:04 +00:00
|
|
|
camera->device_free(device, &dscene, this);
|
2013-04-01 20:26:43 +00:00
|
|
|
film->device_free(device, &dscene, this);
|
2012-11-09 08:46:53 +00:00
|
|
|
background->device_free(device, &dscene);
|
|
|
|
integrator->device_free(device, &dscene);
|
|
|
|
|
|
|
|
object_manager->device_free(device, &dscene);
|
|
|
|
mesh_manager->device_free(device, &dscene);
|
2013-04-01 20:26:52 +00:00
|
|
|
shader_manager->device_free(device, &dscene, this);
|
2012-11-09 08:46:53 +00:00
|
|
|
light_manager->device_free(device, &dscene);
|
|
|
|
|
|
|
|
particle_system_manager->device_free(device, &dscene);
|
2012-12-28 14:21:30 +00:00
|
|
|
curve_system_manager->device_free(device, &dscene);
|
2012-11-09 08:46:53 +00:00
|
|
|
|
2014-01-02 21:05:07 +00:00
|
|
|
bake_manager->device_free(device, &dscene);
|
|
|
|
|
2013-02-14 16:48:43 +00:00
|
|
|
if(!params.persistent_data || final)
|
2017-10-20 02:20:37 +00:00
|
|
|
image_manager->device_free(device);
|
2014-05-19 12:45:52 +00:00
|
|
|
else
|
2017-10-20 02:20:37 +00:00
|
|
|
image_manager->device_free_builtin(device);
|
2013-04-01 20:26:43 +00:00
|
|
|
|
|
|
|
lookup_tables->device_free(device, &dscene);
|
2012-11-09 08:46:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(final) {
|
2013-04-01 20:26:43 +00:00
|
|
|
delete lookup_tables;
|
2012-11-09 08:46:53 +00:00
|
|
|
delete camera;
|
2018-01-11 23:50:34 +00:00
|
|
|
delete dicing_camera;
|
2012-11-09 08:46:53 +00:00
|
|
|
delete film;
|
|
|
|
delete background;
|
|
|
|
delete integrator;
|
|
|
|
delete object_manager;
|
|
|
|
delete mesh_manager;
|
|
|
|
delete shader_manager;
|
|
|
|
delete light_manager;
|
|
|
|
delete particle_system_manager;
|
2012-12-28 14:21:30 +00:00
|
|
|
delete curve_system_manager;
|
2012-11-09 08:46:53 +00:00
|
|
|
delete image_manager;
|
2014-01-02 21:05:07 +00:00
|
|
|
delete bake_manager;
|
2012-11-09 08:46:53 +00:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scene::device_update(Device *device_, Progress& progress)
|
|
|
|
{
|
|
|
|
if(!device)
|
|
|
|
device = device_;
|
2016-04-22 08:55:26 +00:00
|
|
|
|
|
|
|
bool print_stats = need_data_update();
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* The order of updates is important, because there's dependencies between
|
|
|
|
* the different managers, using data computed by previous managers.
|
|
|
|
*
|
|
|
|
* - Image manager uploads images used by shaders.
|
2014-08-02 06:53:52 +00:00
|
|
|
* - Camera may be used for adaptive subdivision.
|
2011-04-27 11:58:34 +00:00
|
|
|
* - Displacement shader must have all shader data available.
|
2014-02-06 20:09:46 +00:00
|
|
|
* - Light manager needs lookup tables and final mesh data to compute emission CDF.
|
2014-03-12 17:20:42 +00:00
|
|
|
* - Film needs light manager to run for use_light_visibility
|
|
|
|
* - Lookup tables are done a second time to handle film tables
|
2011-04-27 11:58:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
progress.set_status("Updating Shaders");
|
|
|
|
shader_manager->device_update(device, &dscene, this, progress);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2013-12-28 15:56:19 +00:00
|
|
|
progress.set_status("Updating Background");
|
|
|
|
background->device_update(device, &dscene, this);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2013-12-28 15:56:19 +00:00
|
|
|
|
2015-02-02 17:06:31 +00:00
|
|
|
progress.set_status("Updating Camera");
|
|
|
|
camera->device_update(device, &dscene, this);
|
|
|
|
|
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
|
|
|
|
2018-03-01 10:54:01 +00:00
|
|
|
mesh_manager->device_update_preprocess(device, this, progress);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-03-31 15:54:03 +00:00
|
|
|
progress.set_status("Updating Objects");
|
|
|
|
object_manager->device_update(device, &dscene, this, progress);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2018-01-19 03:40:48 +00:00
|
|
|
progress.set_status("Updating Particle Systems");
|
|
|
|
particle_system_manager->device_update(device, &dscene, this, progress);
|
|
|
|
|
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
|
|
|
|
2015-04-29 20:07:38 +00:00
|
|
|
progress.set_status("Updating Meshes");
|
|
|
|
mesh_manager->device_update(device, &dscene, this, progress);
|
2014-10-03 10:11:19 +00:00
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2014-10-03 10:11:19 +00:00
|
|
|
|
2015-04-29 20:07:38 +00:00
|
|
|
progress.set_status("Updating Objects Flags");
|
|
|
|
object_manager->device_update_flags(device, &dscene, this, progress);
|
2015-01-19 14:08:58 +00:00
|
|
|
|
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
|
|
|
|
2015-04-02 15:37:57 +00:00
|
|
|
progress.set_status("Updating Images");
|
2017-10-20 02:20:37 +00:00
|
|
|
image_manager->device_update(device, this, progress);
|
2015-04-02 15:37:57 +00:00
|
|
|
|
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
|
|
|
|
2015-02-02 17:06:31 +00:00
|
|
|
progress.set_status("Updating Camera Volume");
|
|
|
|
camera->device_update_volume(device, &dscene, this);
|
|
|
|
|
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
|
|
|
|
2012-12-28 14:21:30 +00:00
|
|
|
progress.set_status("Updating Hair Systems");
|
|
|
|
curve_system_manager->device_update(device, &dscene, this, progress);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2012-12-28 14:21:30 +00:00
|
|
|
|
2014-02-06 20:09:46 +00:00
|
|
|
progress.set_status("Updating Lookup Tables");
|
|
|
|
lookup_tables->device_update(device, &dscene);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2014-02-06 20:09:46 +00:00
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
progress.set_status("Updating Lights");
|
|
|
|
light_manager->device_update(device, &dscene, this, progress);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-04-13 08:39:21 +00:00
|
|
|
progress.set_status("Updating Integrator");
|
|
|
|
integrator->device_update(device, &dscene, this);
|
2014-03-12 17:20:42 +00:00
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2014-03-12 17:20:42 +00:00
|
|
|
|
2016-04-13 08:39:21 +00:00
|
|
|
progress.set_status("Updating Film");
|
|
|
|
film->device_update(device, &dscene, this);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-03-12 17:20:42 +00:00
|
|
|
progress.set_status("Updating Lookup Tables");
|
|
|
|
lookup_tables->device_update(device, &dscene);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2014-03-12 17:20:42 +00:00
|
|
|
|
2014-01-02 21:05:07 +00:00
|
|
|
progress.set_status("Updating Baking");
|
|
|
|
bake_manager->device_update(device, &dscene, this, progress);
|
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(progress.get_cancel() || device->have_error()) return;
|
2014-01-02 21:05:07 +00:00
|
|
|
|
2014-12-05 16:00:05 +00:00
|
|
|
if(device->have_error() == false) {
|
|
|
|
progress.set_status("Updating Device", "Writing constant memory");
|
|
|
|
device->const_copy_to("__data", &dscene.data, sizeof(dscene.data));
|
|
|
|
}
|
2015-02-14 14:39:14 +00:00
|
|
|
|
2016-04-22 08:55:26 +00:00
|
|
|
if(print_stats) {
|
2016-05-29 22:02:05 +00:00
|
|
|
size_t mem_used = util_guarded_get_mem_used();
|
|
|
|
size_t mem_peak = util_guarded_get_mem_peak();
|
|
|
|
|
2016-04-22 08:55:26 +00:00
|
|
|
VLOG(1) << "System memory statistics after full device sync:\n"
|
2016-05-29 22:02:05 +00:00
|
|
|
<< " Usage: " << string_human_readable_number(mem_used)
|
|
|
|
<< " (" << string_human_readable_size(mem_used) << ")\n"
|
|
|
|
<< " Peak: " << string_human_readable_number(mem_peak)
|
|
|
|
<< " (" << string_human_readable_size(mem_peak) << ")";
|
2016-04-22 08:55:26 +00:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2018-01-12 18:56:52 +00:00
|
|
|
Scene::MotionType Scene::need_motion()
|
2012-04-30 12:49:26 +00:00
|
|
|
{
|
|
|
|
if(integrator->motion_blur)
|
2018-01-12 18:56:52 +00:00
|
|
|
return MOTION_BLUR;
|
2012-04-30 12:49:26 +00:00
|
|
|
else if(Pass::contains(film->passes, PASS_MOTION))
|
|
|
|
return MOTION_PASS;
|
|
|
|
else
|
|
|
|
return MOTION_NONE;
|
|
|
|
}
|
|
|
|
|
2016-07-16 16:56:59 +00:00
|
|
|
float Scene::motion_shutter_time()
|
|
|
|
{
|
|
|
|
if(need_motion() == Scene::MOTION_PASS)
|
|
|
|
return 2.0f;
|
|
|
|
else
|
|
|
|
return camera->shuttertime;
|
|
|
|
}
|
|
|
|
|
2012-04-30 12:49:26 +00:00
|
|
|
bool Scene::need_global_attribute(AttributeStandard std)
|
|
|
|
{
|
|
|
|
if(std == ATTR_STD_UV)
|
|
|
|
return Pass::contains(film->passes, PASS_UV);
|
2014-05-12 08:20:20 +00:00
|
|
|
else if(std == ATTR_STD_MOTION_VERTEX_POSITION)
|
2014-03-29 12:03:46 +00:00
|
|
|
return need_motion() != MOTION_NONE;
|
2014-05-12 08:20:20 +00:00
|
|
|
else if(std == ATTR_STD_MOTION_VERTEX_NORMAL)
|
2014-03-29 12:03:46 +00:00
|
|
|
return need_motion() == MOTION_BLUR;
|
2012-04-30 12:49:26 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene::need_global_attributes(AttributeRequestSet& attributes)
|
|
|
|
{
|
|
|
|
for(int std = ATTR_STD_NONE; std < ATTR_STD_NUM; std++)
|
|
|
|
if(need_global_attribute((AttributeStandard)std))
|
|
|
|
attributes.add((AttributeStandard)std);
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
bool Scene::need_update()
|
|
|
|
{
|
|
|
|
return (need_reset() || film->need_update);
|
|
|
|
}
|
|
|
|
|
2016-04-22 08:55:26 +00:00
|
|
|
bool Scene::need_data_update()
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
return (background->need_update
|
|
|
|
|| image_manager->need_update
|
|
|
|
|| object_manager->need_update
|
|
|
|
|| mesh_manager->need_update
|
|
|
|
|| light_manager->need_update
|
2013-04-01 20:26:43 +00:00
|
|
|
|| lookup_tables->need_update
|
2011-04-27 11:58:34 +00:00
|
|
|
|| integrator->need_update
|
2012-08-31 17:27:08 +00:00
|
|
|
|| shader_manager->need_update
|
2012-12-28 14:21:30 +00:00
|
|
|
|| particle_system_manager->need_update
|
2014-01-02 21:05:07 +00:00
|
|
|
|| curve_system_manager->need_update
|
2014-10-21 12:08:05 +00:00
|
|
|
|| bake_manager->need_update
|
|
|
|
|| film->need_update);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
2016-04-22 08:55:26 +00:00
|
|
|
bool Scene::need_reset()
|
|
|
|
{
|
|
|
|
return need_data_update() || camera->need_update;
|
|
|
|
}
|
|
|
|
|
2012-11-09 08:46:53 +00:00
|
|
|
void Scene::reset()
|
|
|
|
{
|
2013-02-14 16:11:47 +00:00
|
|
|
shader_manager->reset(this);
|
2012-11-09 08:46:53 +00:00
|
|
|
shader_manager->add_default(this);
|
|
|
|
|
|
|
|
/* ensure all objects are updated */
|
|
|
|
camera->tag_update();
|
2018-01-11 23:50:34 +00:00
|
|
|
dicing_camera->tag_update();
|
2012-11-09 08:46:53 +00:00
|
|
|
film->tag_update(this);
|
|
|
|
background->tag_update(this);
|
|
|
|
integrator->tag_update(this);
|
2014-06-05 15:39:16 +00:00
|
|
|
object_manager->tag_update(this);
|
|
|
|
mesh_manager->tag_update(this);
|
|
|
|
light_manager->tag_update(this);
|
|
|
|
particle_system_manager->tag_update(this);
|
|
|
|
curve_system_manager->tag_update(this);
|
2012-11-09 08:46:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Scene::device_free()
|
|
|
|
{
|
|
|
|
free_memory(false);
|
|
|
|
}
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|