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:
authorOmar Emara <mail@OmarEmara.dev>2022-08-23 10:24:25 +0300
committerOmar Emara <mail@OmarEmara.dev>2022-08-23 10:24:25 +0300
commit655e9eabc3fe7d6ce868325999847823c86303ca (patch)
tree7e1438fa57ea1ada7770bdd94f1412265a6d8a45 /source/blender/nodes/composite
parent78061e6c3e74e932218fec0bad2911cc550ad41c (diff)
Cleanup: Turn filter node methods into an Enum
This patch turns the filter node methods into an enum and renames the members from FILT into FILTER for easier writing.
Diffstat (limited to 'source/blender/nodes/composite')
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc
index 6551114a60c..250b3b468c3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc
@@ -64,9 +64,9 @@ class FilterOperation : public NodeOperation {
GPU_shader_unbind();
}
- int get_filter_method()
+ CMPNodeFilterMethod get_filter_method()
{
- return bnode().custom1;
+ return (CMPNodeFilterMethod)bnode().custom1;
}
float3x3 get_filter_kernel()
@@ -75,41 +75,41 @@ class FilterOperation : public NodeOperation {
* return the kernel in the X direction, while the kernel in the Y direction will be computed
* inside the shader by transposing the kernel in the X direction. */
switch (get_filter_method()) {
- case CMP_FILT_SOFT: {
+ case CMP_NODE_FILTER_SOFT: {
const float kernel[3][3] = {{1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f},
{2.0f / 16.0f, 4.0f / 16.0f, 2.0f / 16.0f},
{1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f}};
return float3x3(kernel);
}
- case CMP_FILT_SHARP_BOX: {
+ case CMP_NODE_FILTER_SHARP_BOX: {
const float kernel[3][3] = {
{-1.0f, -1.0f, -1.0f}, {-1.0f, 9.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}};
return float3x3(kernel);
}
- case CMP_FILT_LAPLACE: {
+ case CMP_NODE_FILTER_LAPLACE: {
const float kernel[3][3] = {{-1.0f / 8.0f, -1.0f / 8.0f, -1.0f / 8.0f},
{-1.0f / 8.0f, 1.0f, -1.0f / 8.0f},
{-1.0f / 8.0f, -1.0f / 8.0f, -1.0f / 8.0f}};
return float3x3(kernel);
}
- case CMP_FILT_SOBEL: {
+ case CMP_NODE_FILTER_SOBEL: {
const float kernel[3][3] = {{1.0f, 0.0f, -1.0f}, {2.0f, 0.0f, -2.0f}, {1.0f, 0.0f, -1.0f}};
return float3x3(kernel);
}
- case CMP_FILT_PREWITT: {
+ case CMP_NODE_FILTER_PREWITT: {
const float kernel[3][3] = {{1.0f, 0.0f, -1.0f}, {1.0f, 0.0f, -1.0f}, {1.0f, 0.0f, -1.0f}};
return float3x3(kernel);
}
- case CMP_FILT_KIRSCH: {
+ case CMP_NODE_FILTER_KIRSCH: {
const float kernel[3][3] = {
{5.0f, -3.0f, -2.0f}, {5.0f, -3.0f, -2.0f}, {5.0f, -3.0f, -2.0f}};
return float3x3(kernel);
}
- case CMP_FILT_SHADOW: {
+ case CMP_NODE_FILTER_SHADOW: {
const float kernel[3][3] = {{1.0f, 2.0f, 1.0f}, {0.0f, 1.0f, 0.0f}, {-1.0f, -2.0f, -1.0f}};
return float3x3(kernel);
}
- case CMP_FILT_SHARP_DIAMOND: {
+ case CMP_NODE_FILTER_SHARP_DIAMOND: {
const float kernel[3][3] = {
{0.0f, -1.0f, 0.0f}, {-1.0f, 5.0f, -1.0f}, {0.0f, -1.0f, 0.0f}};
return float3x3(kernel);
@@ -124,15 +124,15 @@ class FilterOperation : public NodeOperation {
const char *get_shader_name()
{
switch (get_filter_method()) {
- case CMP_FILT_LAPLACE:
- case CMP_FILT_SOBEL:
- case CMP_FILT_PREWITT:
- case CMP_FILT_KIRSCH:
+ case CMP_NODE_FILTER_LAPLACE:
+ case CMP_NODE_FILTER_SOBEL:
+ case CMP_NODE_FILTER_PREWITT:
+ case CMP_NODE_FILTER_KIRSCH:
return "compositor_edge_filter";
- case CMP_FILT_SOFT:
- case CMP_FILT_SHARP_BOX:
- case CMP_FILT_SHADOW:
- case CMP_FILT_SHARP_DIAMOND:
+ case CMP_NODE_FILTER_SOFT:
+ case CMP_NODE_FILTER_SHARP_BOX:
+ case CMP_NODE_FILTER_SHADOW:
+ case CMP_NODE_FILTER_SHARP_DIAMOND:
default:
return "compositor_filter";
}