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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-10-22 18:17:03 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-10-22 18:17:03 +0400
commit1be189f000242db37c074599e75761669b1afc58 (patch)
tree6805495ef24b96462a393037a16363c93af06391 /intern/cycles/render
parentd2d1b19170c5790b2ef971f5d825d3c36e008513 (diff)
Cycles: Get rid of hardcoded enum values in the code
Still need to keep enum definition in sync with the python code, but the code itself is a bit more clear to understand now.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/shader.cpp10
-rw-r--r--intern/cycles/render/shader.h14
2 files changed, 18 insertions, 6 deletions
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index b960dfa3861..2a3969b6188 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -138,8 +138,8 @@ Shader::Shader()
use_mis = true;
use_transparent_shadow = true;
heterogeneous_volume = true;
- volume_sampling_method = 0;
- volume_interpolation_method = 0;
+ volume_sampling_method = VOLUME_SAMPLING_DISTANCE;
+ volume_interpolation_method = VOLUME_INTERPOLATION_LINEAR;
has_surface = false;
has_surface_transparent = false;
@@ -353,11 +353,11 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
flag |= SD_HAS_BSSRDF_BUMP;
if(shader->has_converter_blackbody)
has_converter_blackbody = true;
- if(shader->volume_sampling_method == 1)
+ if(shader->volume_sampling_method == VOLUME_SAMPLING_EQUIANGULAR)
flag |= SD_VOLUME_EQUIANGULAR;
- if(shader->volume_sampling_method == 2)
+ if(shader->volume_sampling_method == VOLUME_SAMPLING_MULTIPLE_IMPORTANCE)
flag |= SD_VOLUME_MIS;
- if(shader->volume_interpolation_method == 1)
+ if(shader->volume_interpolation_method == VOLUME_INTERPOLATION_CUBIC)
flag |= SD_VOLUME_CUBIC;
/* regular shader */
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 0eef62a1c61..b267731abe5 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -44,6 +44,18 @@ enum ShadingSystem {
SHADINGSYSTEM_SVM
};
+/* Keep those in sync with the python-defined enum. */
+enum VolumeSampling {
+ VOLUME_SAMPLING_DISTANCE = 0,
+ VOLUME_SAMPLING_EQUIANGULAR = 1,
+ VOLUME_SAMPLING_MULTIPLE_IMPORTANCE = 2,
+};
+
+enum VolumeInterpolation {
+ VOLUME_INTERPOLATION_LINEAR = 0,
+ VOLUME_INTERPOLATION_CUBIC = 1,
+};
+
/* Shader describing the appearance of a Mesh, Light or Background.
*
* While there is only a single shader graph, it has three outputs: surface,
@@ -68,7 +80,7 @@ public:
bool use_mis;
bool use_transparent_shadow;
bool heterogeneous_volume;
- int volume_sampling_method;
+ VolumeSampling volume_sampling_method;
int volume_interpolation_method;
/* synchronization */