Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_curves.cc
| Show First 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | CurveRGBFunction(const CurveMapping &cumap) : cumap_(cumap) | ||||
| static blender::fn::MFSignature signature = create_signature(); | static blender::fn::MFSignature signature = create_signature(); | ||||
| this->set_signature(&signature); | this->set_signature(&signature); | ||||
| } | } | ||||
| static blender::fn::MFSignature create_signature() | static blender::fn::MFSignature create_signature() | ||||
| { | { | ||||
| blender::fn::MFSignatureBuilder signature{"Curve RGB"}; | blender::fn::MFSignatureBuilder signature{"Curve RGB"}; | ||||
| signature.single_input<float>("Fac"); | signature.single_input<float>("Fac"); | ||||
| signature.single_input<blender::Color4f>("Color"); | signature.single_input<blender::ColorGeometry4f>("Color"); | ||||
| signature.single_output<blender::Color4f>("Color"); | signature.single_output<blender::ColorGeometry4f>("Color"); | ||||
| return signature.build(); | return signature.build(); | ||||
| } | } | ||||
| void call(blender::IndexMask mask, | void call(blender::IndexMask mask, | ||||
| blender::fn::MFParams params, | blender::fn::MFParams params, | ||||
| blender::fn::MFContext UNUSED(context)) const override | blender::fn::MFContext UNUSED(context)) const override | ||||
| { | { | ||||
| const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); | const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); | ||||
| const blender::VArray<blender::Color4f> &col_in = | const blender::VArray<blender::ColorGeometry4f> &col_in = | ||||
| params.readonly_single_input<blender::Color4f>(1, "Color"); | params.readonly_single_input<blender::ColorGeometry4f>(1, "Color"); | ||||
| blender::MutableSpan<blender::Color4f> col_out = | blender::MutableSpan<blender::ColorGeometry4f> col_out = | ||||
| params.uninitialized_single_output<blender::Color4f>(2, "Color"); | params.uninitialized_single_output<blender::ColorGeometry4f>(2, "Color"); | ||||
| for (int64_t i : mask) { | for (int64_t i : mask) { | ||||
| BKE_curvemapping_evaluateRGBF(&cumap_, col_out[i], col_in[i]); | BKE_curvemapping_evaluateRGBF(&cumap_, col_out[i], col_in[i]); | ||||
| if (fac[i] != 1.0f) { | if (fac[i] != 1.0f) { | ||||
| interp_v3_v3v3(col_out[i], col_in[i], col_out[i], fac[i]); | interp_v3_v3v3(col_out[i], col_in[i], col_out[i], fac[i]); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Show All 25 Lines | |||||