Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 03:15:02 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 06:54:05 +0300
commit6c4ddfc5d9833b6c4f0ae3da93645556fee97caf (patch)
treea6daff84b99e62ed5022284d5b7b8042ea9e2a3b
parentb66efbecf4780c65833f72ac8de5d18b5bca7e15 (diff)
Code refactor: don't expose UpdateObjectTransformState in header.
-rw-r--r--intern/cycles/render/object.cpp66
-rw-r--r--intern/cycles/render/object.h44
2 files changed, 55 insertions, 55 deletions
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index 92c7e9cf1b8..b9702cfe531 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -33,6 +33,48 @@
CCL_NAMESPACE_BEGIN
+/* Global state of object transform update. */
+
+struct UpdateObjectTransformState {
+ /* Global state used by device_update_object_transform().
+ * Common for both threaded and non-threaded update.
+ */
+
+ /* Type of the motion required by the scene settings. */
+ Scene::MotionType need_motion;
+
+ /* Mapping from particle system to a index in packed particle array.
+ * Only used for read.
+ */
+ map<ParticleSystem*, int> particle_offset;
+
+ /* Mesh area.
+ * Used to avoid calculation of mesh area multiple times. Used for both
+ * read and write. Acquire surface_area_lock to keep it all thread safe.
+ */
+ map<Mesh*, float> surface_area_map;
+
+ /* Packed object arrays. Those will be filled in. */
+ uint *object_flag;
+ KernelObject *objects;
+ Transform *objects_vector;
+
+ /* Flags which will be synchronized to Integrator. */
+ bool have_motion;
+ bool have_curves;
+
+ /* ** Scheduling queue. ** */
+
+ Scene *scene;
+
+ /* Some locks to keep everything thread-safe. */
+ thread_spin_lock queue_lock;
+ thread_spin_lock surface_area_lock;
+
+ /* First unused object index in the queue. */
+ int queue_start_object;
+};
+
/* Object */
NODE_DEFINE(Object)
@@ -475,7 +517,6 @@ void ObjectManager::device_update_object_transform_task(
void ObjectManager::device_update_transforms(DeviceScene *dscene,
Scene *scene,
- uint *object_flag,
Progress& progress)
{
UpdateObjectTransformState state;
@@ -485,14 +526,13 @@ void ObjectManager::device_update_transforms(DeviceScene *dscene,
state.scene = scene;
state.queue_start_object = 0;
- state.object_flag = object_flag;
state.objects = dscene->objects.alloc(scene->objects.size());
+ state.object_flag = dscene->object_flag.alloc(scene->objects.size());
+ state.objects_vector = NULL;
+
if(state.need_motion == Scene::MOTION_PASS) {
state.objects_vector = dscene->objects_vector.alloc(OBJECT_VECTOR_SIZE*scene->objects.size());
}
- else {
- state.objects_vector = NULL;
- }
/* Particle system device offsets
* 0 is dummy particle, index starts at 1.
@@ -554,12 +594,9 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
if(scene->objects.size() == 0)
return;
- /* object info flag */
- uint *object_flag = dscene->object_flag.alloc(scene->objects.size());
-
/* set object transform matrices, before applying static transforms */
progress.set_status("Updating Objects", "Copying Transformations to device");
- device_update_transforms(dscene, scene, object_flag, progress);
+ device_update_transforms(dscene, scene, progress);
if(progress.get_cancel()) return;
@@ -567,7 +604,7 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
/* todo: do before to support getting object level coords? */
if(scene->params.bvh_type == SceneParams::BVH_STATIC) {
progress.set_status("Updating Objects", "Applying Static Transformations");
- apply_static_transforms(dscene, scene, object_flag, progress);
+ apply_static_transforms(dscene, scene, progress);
}
}
@@ -586,9 +623,10 @@ void ObjectManager::device_update_flags(Device *,
if(scene->objects.size() == 0)
return;
- /* object info flag */
+ /* Object info flag. */
uint *object_flag = dscene->object_flag.data();
+ /* Object volume intersection. */
vector<Object *> volume_objects;
bool has_volume_objects = false;
foreach(Object *object, scene->objects) {
@@ -642,7 +680,7 @@ void ObjectManager::device_update_flags(Device *,
++object_index;
}
- /* allocate object flag */
+ /* Copy object flag. */
dscene->object_flag.copy_to_device();
}
@@ -690,7 +728,7 @@ void ObjectManager::device_free(Device *, DeviceScene *dscene)
dscene->object_flag.free();
}
-void ObjectManager::apply_static_transforms(DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress)
+void ObjectManager::apply_static_transforms(DeviceScene *dscene, Scene *scene, Progress& progress)
{
/* todo: normals and displacement should be done before applying transform! */
/* todo: create objects/meshes in right order! */
@@ -714,6 +752,8 @@ void ObjectManager::apply_static_transforms(DeviceScene *dscene, Scene *scene, u
if(progress.get_cancel()) return;
+ uint *object_flag = dscene->object_flag.data();
+
/* apply transforms for objects with single user meshes */
foreach(Object *object, scene->objects) {
/* Annoying feedback loop here: we can't use is_instanced() because
diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h
index 59c1d916595..3f6d120b372 100644
--- a/intern/cycles/render/object.h
+++ b/intern/cycles/render/object.h
@@ -35,6 +35,7 @@ class ParticleSystem;
class Progress;
class Scene;
struct Transform;
+struct UpdateObjectTransformState;
/* Object */
@@ -95,7 +96,6 @@ public:
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
void device_update_transforms(DeviceScene *dscene,
Scene *scene,
- uint *object_flag,
Progress& progress);
void device_update_flags(Device *device,
@@ -109,49 +109,9 @@ public:
void tag_update(Scene *scene);
- void apply_static_transforms(DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress);
+ void apply_static_transforms(DeviceScene *dscene, Scene *scene, Progress& progress);
protected:
- /* Global state of object transform update. */
- struct UpdateObjectTransformState {
- /* Global state used by device_update_object_transform().
- * Common for both threaded and non-threaded update.
- */
-
- /* Type of the motion required by the scene settings. */
- Scene::MotionType need_motion;
-
- /* Mapping from particle system to a index in packed particle array.
- * Only used for read.
- */
- map<ParticleSystem*, int> particle_offset;
-
- /* Mesh area.
- * Used to avoid calculation of mesh area multiple times. Used for both
- * read and write. Acquire surface_area_lock to keep it all thread safe.
- */
- map<Mesh*, float> surface_area_map;
-
- /* Packed object arrays. Those will be filled in. */
- uint *object_flag;
- KernelObject *objects;
- Transform *objects_vector;
-
- /* Flags which will be synchronized to Integrator. */
- bool have_motion;
- bool have_curves;
-
- /* ** Scheduling queue. ** */
-
- Scene *scene;
-
- /* Some locks to keep everything thread-safe. */
- thread_spin_lock queue_lock;
- thread_spin_lock surface_area_lock;
-
- /* First unused object index in the queue. */
- int queue_start_object;
- };
void device_update_object_transform(UpdateObjectTransformState *state,
Object *ob,
const int object_index);