[Bf-blender-cvs] [e5a51d2] openvdb: Cleanup.

Kévin Dietrich noreply at git.blender.org
Mon Jan 25 16:15:34 CET 2016


Commit: e5a51d2818a7de202f61e7b65495105dddb45d97
Author: Kévin Dietrich
Date:   Mon Jan 25 12:52:03 2016 +0100
Branches: openvdb
https://developer.blender.org/rBe5a51d2818a7de202f61e7b65495105dddb45d97

Cleanup.

===================================================================

M	intern/cycles/util/util_volume.cpp
M	intern/cycles/util/util_volume.h

===================================================================

diff --git a/intern/cycles/util/util_volume.cpp b/intern/cycles/util/util_volume.cpp
index b7a4535..19de461 100644
--- a/intern/cycles/util/util_volume.cpp
+++ b/intern/cycles/util/util_volume.cpp
@@ -79,19 +79,10 @@ void create_samplers_threads(unordered_map<pthread_t, SamplerType *> &sampler_ma
 
 vdb_float_volume::vdb_float_volume(openvdb::FloatGrid::Ptr grid)
     : transform(&grid->transform())
+    , uniform_voxels(grid->hasUniformVoxels())
+    , main_isector(uniform_voxels ? new isector_t(*grid, 1) : NULL)
 {
 	accessor = new openvdb::FloatGrid::ConstAccessor(grid->getConstAccessor());
-
-	/* only grids with uniform voxels can be used with VolumeRayIntersector */
-	if(grid->hasUniformVoxels()) {
-		uniform_voxels = true;
-		/* 1 = size of the largest sampling kernel radius (BoxSampler) */
-		main_isector = new isector_t(*grid, 1);
-	}
-	else {
-		uniform_voxels = false;
-		main_isector = NULL;
-	}
 }
 
 vdb_float_volume::~vdb_float_volume()
@@ -125,20 +116,11 @@ void vdb_float_volume::create_threads_utils(const vector<pthread_t> &thread_ids)
 
 vdb_float3_volume::vdb_float3_volume(openvdb::Vec3SGrid::Ptr grid)
     : transform(&grid->transform())
+    , uniform_voxels(grid->hasUniformVoxels())
+    , staggered(grid->getGridClass() == openvdb::GRID_STAGGERED)
+    , main_isector(uniform_voxels ? new isector_t(*grid, 1) : NULL)
 {
 	accessor = new openvdb::Vec3SGrid::ConstAccessor(grid->getConstAccessor());
-	staggered = (grid->getGridClass() == openvdb::GRID_STAGGERED);
-
-	/* only grids with uniform voxels can be used with VolumeRayIntersector */
-	if(grid->hasUniformVoxels()) {
-		uniform_voxels = true;
-		/* 1 = size of the largest sampling kernel radius (BoxSampler) */
-		main_isector = new isector_t(*grid, 1);
-	}
-	else {
-		uniform_voxels = false;
-		main_isector = NULL;
-	}
 }
 
 vdb_float3_volume::~vdb_float3_volume()
diff --git a/intern/cycles/util/util_volume.h b/intern/cycles/util/util_volume.h
index feaa269..6d7570d 100644
--- a/intern/cycles/util/util_volume.h
+++ b/intern/cycles/util/util_volume.h
@@ -102,13 +102,15 @@ class vdb_float_volume : public float_volume {
 	openvdb::FloatGrid::ConstAccessor *accessor;
 	openvdb::math::Transform *transform;
 
+	/* only grids with uniform voxels can be used with VolumeRayIntersector, so
+	 * we keep track of this for ray marching */
+	bool uniform_voxels;
+
 	/* Main intersector, its purpose is to initialize the voxels' bounding box
 	 * so the ones for the various threads do not do this, rather they are
 	 * generated from a copy of it */
 	isector_t *main_isector;
 
-	bool uniform_voxels;
-
 public:
 	vdb_float_volume(openvdb::FloatGrid::Ptr grid);
 	~vdb_float_volume();
@@ -216,13 +218,16 @@ class vdb_float3_volume : public float3_volume {
 	openvdb::Vec3SGrid::ConstAccessor *accessor;
 	openvdb::math::Transform *transform;
 
+	/* only grids with uniform voxels can be used with VolumeRayIntersector, so
+	 * we keep track of this for ray marching */
+	bool uniform_voxels;
+	bool staggered;
+
 	/* Main intersector, its purpose is to initialize the voxels' bounding box
 	 * so the ones for the various threads do not do this, rather they are
 	 * generated from a copy of it. */
 	isector_t *main_isector;
 
-	bool uniform_voxels, staggered;
-
 public:
 	vdb_float3_volume(openvdb::Vec3SGrid::Ptr grid);
 	~vdb_float3_volume();




More information about the Bf-blender-cvs mailing list