Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | switch (gradient_type_) { | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case SHD_BLEND_QUADRATIC_SPHERE: { | case SHD_BLEND_QUADRATIC_SPHERE: { | ||||
| for (int64_t i : mask) { | for (int64_t i : mask) { | ||||
| /* Bias a little bit for the case where input is a unit length vector, | /* Bias a little bit for the case where input is a unit length vector, | ||||
| * to get exactly zero instead of a small random value depending | * to get exactly zero instead of a small random value depending | ||||
| * on float precision. */ | * on float precision. */ | ||||
| const float r = std::max(0.999999f - vector[i].length(), 0.0f); | const float r = std::max(0.999999f - math::length(vector[i]), 0.0f); | ||||
| fac[i] = r * r; | fac[i] = r * r; | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case SHD_BLEND_SPHERICAL: { | case SHD_BLEND_SPHERICAL: { | ||||
| for (int64_t i : mask) { | for (int64_t i : mask) { | ||||
| /* Bias a little bit for the case where input is a unit length vector, | /* Bias a little bit for the case where input is a unit length vector, | ||||
| * to get exactly zero instead of a small random value depending | * to get exactly zero instead of a small random value depending | ||||
| * on float precision. */ | * on float precision. */ | ||||
| fac[i] = std::max(0.999999f - vector[i].length(), 0.0f); | fac[i] = std::max(0.999999f - math::length(vector[i]), 0.0f); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (compute_color) { | if (compute_color) { | ||||
| for (int64_t i : mask) { | for (int64_t i : mask) { | ||||
| r_color[i] = ColorGeometry4f(fac[i], fac[i], fac[i], 1.0f); | r_color[i] = ColorGeometry4f(fac[i], fac[i], fac[i], 1.0f); | ||||
| } | } | ||||
| Show All 31 Lines | |||||