Commit: dabc9d1ee9bfc4858aa90bb5433203c3a367e2a4
Author: Kévin Dietrich
Date:   Sat May 23 02:28:47 2015 +0200
Branches: openvdb
https://developer.blender.org/rBdabc9d1ee9bfc4858aa90bb5433203c3a367e2a4

Cycles: rename OpenVDBManager -> VolumeManager, et simili.

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

M       intern/cycles/kernel/kernel.cpp
M       intern/cycles/kernel/kernel_globals.h
M       intern/cycles/kernel/svm/svm_openvdb.h
M       intern/cycles/render/nodes.cpp
M       intern/cycles/render/nodes.h
M       intern/cycles/render/openvdb.cpp
M       intern/cycles/render/openvdb.h
M       intern/cycles/render/scene.cpp
M       intern/cycles/render/scene.h
M       intern/cycles/render/svm.cpp
M       intern/cycles/render/svm.h

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

diff --git a/intern/cycles/kernel/kernel.cpp b/intern/cycles/kernel/kernel.cpp
index 6ec209a..5512c18 100644
--- a/intern/cycles/kernel/kernel.cpp
+++ b/intern/cycles/kernel/kernel.cpp
@@ -33,12 +33,10 @@ void kernel_const_copy(KernelGlobals *kg, const char *name, 
void *host, size_t s
 {
        if(strcmp(name, "__data") == 0)
                memcpy(&kg->__data, host, size);
-#ifdef __OPENVDB__
-       else if(strcmp(name, "__float_volume_sampler") == 0)
-               kg->float_volume_samplers[size] = (float_volume_sampler *)host;
-       else if(strcmp(name, "__float3_volume_sampler") == 0)
-               kg->float3_volume_samplers[size] = (float3_volume_sampler 
*)host;
-#endif
+       else if(strcmp(name, "__float_volume") == 0)
+               kg->float_volumes[size] = (float_volume *)host;
+       else if(strcmp(name, "__float3_volume") == 0)
+               kg->float3_volumes[size] = (float3_volume *)host;
        else
                assert(0);
 }
diff --git a/intern/cycles/kernel/kernel_globals.h 
b/intern/cycles/kernel/kernel_globals.h
index 479baaf..2ec08c4 100644
--- a/intern/cycles/kernel/kernel_globals.h
+++ b/intern/cycles/kernel/kernel_globals.h
@@ -31,22 +31,16 @@ struct OSLThreadData;
 struct OSLShadingSystem;
 #endif
 
-#define MAX_BYTE_IMAGES     1024
-#define MAX_FLOAT_IMAGES    1024
-#define MAX_VOLUME_SAMPLERS 1024
+#define MAX_BYTE_IMAGES  1024
+#define MAX_FLOAT_IMAGES 1024
+#define MAX_VOLUME       1024
 
 typedef struct KernelGlobals {
        texture_image_uchar4 texture_byte_images[MAX_BYTE_IMAGES];
        texture_image_float4 texture_float_images[MAX_FLOAT_IMAGES];
 
-#ifdef __OPENVDB__
-       vdb_fsampler_p *vdb_float_samplers_p[MAX_VOLUME_SAMPLERS];
-       vdb_fsampler_b *vdb_float_samplers_b[MAX_VOLUME_SAMPLERS];
-       vdb_vsampler_p *vdb_float3_samplers_p[MAX_VOLUME_SAMPLERS];
-       vdb_vsampler_b *vdb_float3_samplers_b[MAX_VOLUME_SAMPLERS];
-       float_volume_sampler *float_volume_samplers[MAX_VOLUME_SAMPLERS];
-       float3_volume_sampler *float3_volume_samplers[MAX_VOLUME_SAMPLERS];
-#endif
+       float_volume *float_volumes[MAX_VOLUME];
+       float3_volume *float3_volumes[MAX_VOLUME];
 
 #define KERNEL_TEX(type, ttype, name) ttype name;
 #define KERNEL_IMAGE_TEX(type, ttype, name)
diff --git a/intern/cycles/kernel/svm/svm_openvdb.h 
b/intern/cycles/kernel/svm/svm_openvdb.h
index 01c8162..c711f6c 100644
--- a/intern/cycles/kernel/svm/svm_openvdb.h
+++ b/intern/cycles/kernel/svm/svm_openvdb.h
@@ -34,29 +34,14 @@ ccl_device void svm_node_openvdb(KernelGlobals *kg, 
ShaderData *sd, float *stack
        co = transform_point(&tfm, co);
 
        if(type == NODE_VDB_FLOAT) {
-               float out = kg->float_volume_samplers[slot]->sample(sampling, 
co);
-//             if(sampling == OPENVDB_SAMPLE_POINT) {
-//                     out = 
kg->vdb_float_samplers_p[slot]->wsSample(openvdb::Vec3d(co.x, co.y, co.z));
-//             }
-//             else {
-//                     out = 
kg->vdb_float_samplers_b[slot]->wsSample(openvdb::Vec3d(co.x, co.y, co.z));
-//             }
+               float out = kg->float_volumes[slot]->sample(sampling, co);
 
                if(stack_valid(out_offset)) {
                        stack_store_float(stack, out_offset, out);
                }
        }
        else if(type == NODE_VDB_FLOAT3) {
-//             openvdb::Vec3s r;
-//             if(sampling == OPENVDB_SAMPLE_POINT) {
-//                     r = 
kg->vdb_float3_samplers_p[slot]->wsSample(openvdb::Vec3d(co.x, co.y, co.z));
-//             }
-//             else {
-//                     r = 
kg->vdb_float3_samplers_b[slot]->wsSample(openvdb::Vec3d(co.x, co.y, co.z));
-//             }
-
-//             float3 out = make_float3(r.x(), r.y(), r.z());
-               float3 out = kg->float3_volume_samplers[slot]->sample(sampling, 
co);
+               float3 out = kg->float3_volumes[slot]->sample(sampling, co);
 
                if(stack_valid(out_offset)) {
                        stack_store_float3(stack, out_offset, out);
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 540a8e9..0740e457 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -4370,7 +4370,7 @@ OpenVDBNode::OpenVDBNode()
 : ShaderNode("openvdb")
 {
        filename = "";
-       vdb_manager = NULL;
+       volume_manager = NULL;
        sampling = OPENVDB_SAMPLE_POINT;
 
        tfm = transform_identity();
@@ -4389,7 +4389,7 @@ void OpenVDBNode::attributes(Shader *shader, 
AttributeRequestSet *attributes)
 void OpenVDBNode::compile(SVMCompiler &compiler)
 {
        ShaderInput *vector_in = input("Vector");
-       vdb_manager = compiler.vdb_manager;
+       volume_manager = compiler.volume_manager;
 
        compiler.stack_assign(vector_in);
 
@@ -4406,7 +4406,7 @@ void OpenVDBNode::compile(SVMCompiler &compiler)
                        type = NODE_VDB_FLOAT3;
                }
 
-               grid_slot = vdb_manager->add_volume(filename.string(),
+               grid_slot = volume_manager->add_volume(filename.string(),
                                                    output_names[i].string(),
                                                    sampling, type);
 
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 22fd898..74d0c2b 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -24,8 +24,8 @@
 CCL_NAMESPACE_BEGIN
 
 class ImageManager;
-class OpenVDBManager;
 class Shader;
+class VolumeManager;
 
 /* Texture Mapping */
 
@@ -672,7 +672,7 @@ public:
        bool has_spatial_varying() { return true; }
 
        ustring filename;
-       OpenVDBManager *vdb_manager;
+       VolumeManager *volume_manager;
 
        int grid_slot;
        int sampling;
diff --git a/intern/cycles/render/openvdb.cpp b/intern/cycles/render/openvdb.cpp
index 7e39cad..0d61209 100644
--- a/intern/cycles/render/openvdb.cpp
+++ b/intern/cycles/render/openvdb.cpp
@@ -23,28 +23,28 @@ CCL_NAMESPACE_BEGIN
 
 #ifdef WITH_OPENVDB
 
-#define MAX_VOLUME_SAMPLERS 1024
+#define MAX_VOLUME 1024
 
-OpenVDBManager::OpenVDBManager()
+VolumeManager::VolumeManager()
 {
        openvdb::initialize();
 
        scalar_grids.reserve(64);
        vector_grids.reserve(64);
        current_grids.reserve(64);
-       float_volume_samplers.reserve(64);
-       float3_volume_samplers.reserve(64);
+       float_volumes.reserve(64);
+       float3_volumes.reserve(64);
 
        need_update = true;
 }
 
-OpenVDBManager::~OpenVDBManager()
+VolumeManager::~VolumeManager()
 {
        scalar_grids.clear();
        vector_grids.clear();
        current_grids.clear();
-       float_volume_samplers.clear();
-       float3_volume_samplers.clear();
+       float_volumes.clear();
+       float3_volumes.clear();
 }
 
 static inline void catch_exceptions()
@@ -57,7 +57,7 @@ static inline void catch_exceptions()
        }
 }
 
-int OpenVDBManager::add_volume(const string &filename, const string &name, int 
sampling, int grid_type)
+int VolumeManager::add_volume(const string &filename, const string &name, int 
sampling, int grid_type)
 {
        using namespace openvdb;
        size_t slot = -1;
@@ -72,11 +72,11 @@ int OpenVDBManager::add_volume(const string &filename, 
const string &name, int s
 
                if(grid_type == NODE_VDB_FLOAT) {
                        FloatGrid::Ptr grid = 
gridPtrCast<FloatGrid>(file.readGrid(name));
-                       slot = add_scalar_grid(grid, sampling);
+                       slot = add_scalar_grid(grid);
                }
                else if(grid_type == NODE_VDB_FLOAT3) {
                        Vec3SGrid::Ptr grid = 
gridPtrCast<Vec3SGrid>(file.readGrid(name));
-                       slot = add_vector_grid(grid, sampling);
+                       slot = add_vector_grid(grid);
                }
 
                add_grid_description(filename, name, sampling, slot);
@@ -92,7 +92,7 @@ int OpenVDBManager::add_volume(const string &filename, const 
string &name, int s
        return slot;
 }
 
-int OpenVDBManager::find_existing_slot(const string &filename, const string 
&name, int sampling, int grid_type)
+int VolumeManager::find_existing_slot(const string &filename, const string 
&name, int sampling, int grid_type)
 {
        for(size_t i = 0; i < current_grids.size(); ++i) {
                GridDescription grid = current_grids[i];
@@ -104,12 +104,12 @@ int OpenVDBManager::find_existing_slot(const string 
&filename, const string &nam
                        else {
                                /* sampling was changed, remove the sampler */
                                if(grid_type == NODE_VDB_FLOAT) {
-                                       delete float_volume_samplers[grid.slot];
-                                       float_volume_samplers[grid.slot] = NULL;
+                                       delete float_volumes[grid.slot];
+                                       float_volumes[grid.slot] = NULL;
                                }
                                else {
-                                       delete 
float3_volume_samplers[grid.slot];
-                                       float3_volume_samplers[grid.slot] = 
NULL;
+                                       delete float3_volumes[grid.slot];
+                                       float3_volumes[grid.slot] = NULL;
                                }
 
                                /* remove the grid description too */
@@ -135,9 +135,9 @@ size_t find_empty_slot(Container container)
        }
 
        if(slot == container.size()) {
-               if(slot == MAX_VOLUME_SAMPLERS) {
-                       printf("OpenVDBManager::add_volume: volume sampler 
limit reached %d!\n",
-                              MAX_VOLUME_SAMPLERS);
+               if(slot == MAX_VOLUME) {
+                       printf("VolumeManager::add_volume: volume sampler limit 
reached %d!\n",
+                              MAX_VOLUME);
                        return -1;
                }
 
@@ -147,35 +147,35 @@ size_t find_empty_slot(Container container)
        return slot;
 }
 
-size_t OpenVDBManager::add_scalar_grid(openvdb::FloatGrid::Ptr grid, int 
sampling)
+size_t VolumeManager::add_scalar_grid(openvdb::FloatGrid::Ptr grid)
 {
-       size_t slot = find_empty_slot(float_volume_samplers);
+       size_t slot = find_empty_slot(float_volumes);
 
        if(slot == -1) return -1;
 
-       vdb_float_sampler *sampler = new vdb_float_sampler(grid);
+       vdb_float_volume *sampler = new vdb_float_volume(grid);
 
-       float_volume_samplers.insert(float_volume_samplers.begin() + slot, 
sampler);
+       float_volumes.insert(float_volumes.begin() + slot, sampler);
        scalar_grids.push_back(grid);
 
        return slot;
 }
 
-size_t OpenVDBManager::add_vector_grid(openvdb::Vec3SGrid::Ptr grid, int 
sampling)
+size_t VolumeManager::add_vector_grid(openvdb::Vec3SGrid::Ptr grid)
 {
-       size_t slot = find_empty_slot(float3_volume_samplers);
+       size_t slot = find_empty_slot(float3_volumes);
 
        if(slot == -1) return -1;
 
-       vdb_float3_sampler *sampler = new vdb_float3_sampler(grid);
+       vdb_float3_volume *sampler = new vdb_float3_volume(grid);
 
-       float3_volume_samplers.insert(float3_volume_samplers.begin() + slot, 
sampler);
+       float3_volumes.insert(float3_volumes.begin() + slot, sampler);
        vector_grids.push_back(grid);
 
        return slot;
 }
 
-void OpenVDBManager::add_grid_description(const string &filename, const string 
&name, int sampling, int slot)
+void VolumeManager::add_grid_description(const string &filename, const string 
&name, int sampling, int slot)
 {
        GridDescription descr;
        descr.filename = filename;
@@ -186,7 +186,7 @@ void OpenVDBManager::add_grid_description(const string 
&filename, const string &
        current_grids.push_back(descr);
 }
 
-void OpenVDBManager::device_update(Device *device, DeviceScene *dscene, Scene 
*scene, Progress &progress

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to