Move BVHType and shadingsystem enums to top-level of Cycles namespace.
authorNathan Letwory <nathan@mcneel.com>
Fri, 16 May 2014 13:43:28 +0000 (16:43 +0300)
committerNathan Letwory <nathan@mcneel.com>
Mon, 19 May 2014 11:46:57 +0000 (14:46 +0300)
Easier access of BVHType and deduplication for ShadingSystem.

Reviewers: dingto, brecht

Differential Revision: https://developer.blender.org/D534

intern/cycles/blender/blender_sync.cpp
intern/cycles/render/object.cpp
intern/cycles/render/scene.cpp
intern/cycles/render/scene.h
intern/cycles/render/session.h
intern/cycles/render/shader.cpp
intern/cycles/util/util_types.h

index 555692d9e21c30c7321bf97a79d8e239208ee698..d0eac1619f9ee3f40694b45dec7876fa7dcd8e1e 100644 (file)
@@ -35,6 +35,7 @@
 #include "util_debug.h"
 #include "util_foreach.h"
 #include "util_opengl.h"
+#include "util_types.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -362,19 +363,19 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
        const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
 
        if(shadingsystem == 0)
-               params.shadingsystem = SceneParams::SVM;
+               params.shadingsystem = ShadingSystem::SVM;
        else if(shadingsystem == 1)
-               params.shadingsystem = SceneParams::OSL;
+               params.shadingsystem = ShadingSystem::OSL;
        
        if(background)
-               params.bvh_type = SceneParams::BVH_STATIC;
+               params.bvh_type = BVHType::BVH_STATIC;
        else
-               params.bvh_type = (SceneParams::BVHType)RNA_enum_get(&cscene, "debug_bvh_type");
+               params.bvh_type = (BVHType)RNA_enum_get(&cscene, "debug_bvh_type");
 
        params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
        params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
 
-       if(background && params.shadingsystem != SceneParams::OSL)
+       if(background && params.shadingsystem != ShadingSystem::OSL)
                params.persistent_data = r.use_persistent_data();
        else
                params.persistent_data = false;
@@ -511,9 +512,9 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
        const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
 
        if(shadingsystem == 0)
-               params.shadingsystem = SessionParams::SVM;
+               params.shadingsystem = ShadingSystem::SVM;
        else if(shadingsystem == 1)
-               params.shadingsystem = SessionParams::OSL;
+               params.shadingsystem = ShadingSystem::OSL;
        
        /* color managagement */
        params.display_buffer_linear = GLEW_ARB_half_float_pixel && b_engine.support_display_space_shader(b_scene);
index 027bfd719318af5d10eb2c46ee214c683b460769..7b2ffef9b602c2853e97a386b05ab0fdd5039a58 100644 (file)
@@ -25,6 +25,7 @@
 #include "util_foreach.h"
 #include "util_map.h"
 #include "util_progress.h"
+#include "util_types.h"
 #include "util_vector.h"
 
 CCL_NAMESPACE_BEGIN
@@ -388,7 +389,7 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
 
        /* prepare for static BVH building */
        /* todo: do before to support getting object level coords? */
-       if(scene->params.bvh_type == SceneParams::BVH_STATIC) {
+       if(scene->params.bvh_type == BVHType::BVH_STATIC) {
                progress.set_status("Updating Objects", "Applying Static Transformations");
                apply_static_transforms(dscene, scene, object_flag, progress);
        }
index 4f5ad439520105044c50b7439ddefa6133dc618e..2cb8db5fd272ba50dfc3ba9434665847d553904f 100644 (file)
@@ -61,7 +61,7 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
        if(device_info_.type == DEVICE_CPU)
                shader_manager = ShaderManager::create(this, params.shadingsystem);
        else
-               shader_manager = ShaderManager::create(this, SceneParams::SVM);
+               shader_manager = ShaderManager::create(this, ShadingSystem::SVM);
 
        /* Extended image limits for CPU and GPUs */
        image_manager->set_extended_image_limits(device_info_);
index 0f0bb725823a03982c94daaa009c425fac6fa294..94fbbc44d1dfe271abaa29142c1370b551d206c0 100644 (file)
@@ -120,8 +120,8 @@ public:
 
 class SceneParams {
 public:
-       enum { OSL, SVM } shadingsystem;
-       enum BVHType { BVH_DYNAMIC, BVH_STATIC } bvh_type;
+       ShadingSystem shadingsystem;
+       BVHType bvh_type;
        bool use_bvh_cache;
        bool use_bvh_spatial_split;
        bool use_qbvh;
index 1e62515865244ea2bbd9872e663886c0e57efb08..2d29015863c05dbcf9e2b2ded6adac9d1ae27caa 100644 (file)
@@ -24,6 +24,7 @@
 #include "util_progress.h"
 #include "util_stats.h"
 #include "util_thread.h"
+#include "util_types.h"
 #include "util_vector.h"
 
 CCL_NAMESPACE_BEGIN
@@ -59,7 +60,7 @@ public:
        double reset_timeout;
        double text_timeout;
 
-       enum { OSL, SVM } shadingsystem;
+       ShadingSystem shadingsystem;
 
        SessionParams()
        {
index b25673b36c3462a4357662bf21f99095c5cb5943..14bb810f973e070bba4b753e1ab51ec94df8edbe 100644 (file)
@@ -28,6 +28,7 @@
 #include "tables.h"
 
 #include "util_foreach.h"
+#include "util_types.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -148,7 +149,7 @@ ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem)
        ShaderManager *manager;
 
 #ifdef WITH_OSL
-       if(shadingsystem == SceneParams::OSL)
+       if(shadingsystem == ShadingSystem::OSL)
                manager = new OSLShaderManager();
        else
 #endif
index bfaab3dba3beb1257a7b40c0190ffb9b8c03a167..d1c9dc8398e84d867d1f7d8ce2fa09369b5aed8c 100644 (file)
@@ -456,6 +456,15 @@ enum InterpolationType {
        INTERPOLATION_SMART = 3,
 };
 
+enum ShadingSystem {
+       OSL,
+       SVM
+};
+
+enum BVHType {
+       BVH_DYNAMIC,
+       BVH_STATIC
+};
 
 /* macros */