Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PhongIntensity.cs
1using SkiaSharp;
2using System;
7
9{
14 {
23 : base(new ScriptNode[] { Color }, argumentTypes1Scalar, Start, Length, Expression)
24 {
25 }
26
38 : base(new ScriptNode[] { Red, Green, Blue },
40 {
41 }
42
55 : base(new ScriptNode[] { Red, Green, Blue, Alpha },
57 {
58 }
59
63 public override string FunctionName => nameof(PhongIntensity);
64
68 public override string[] DefaultArgumentNames => new string[]
69 {
70 "Color"
71 };
72
80 {
81 switch (Arguments.Length)
82 {
83 case 1:
84 SKColor Color = Graphs.Graph.ToColor(Arguments[0].AssociatedObjectValue);
85 return new ObjectValue(new Graphs3D.PhongIntensity(
86 Color.Red, Color.Green, Color.Blue, Color.Alpha));
87
88 case 3:
89 return new ObjectValue(new Graphs3D.PhongIntensity(
90 (float)Expression.ToDouble(Arguments[0].AssociatedObjectValue),
91 (float)Expression.ToDouble(Arguments[1].AssociatedObjectValue),
92 (float)Expression.ToDouble(Arguments[2].AssociatedObjectValue),
93 255));
94
95 case 4:
96 return new ObjectValue(new Graphs3D.PhongIntensity(
97 (float)Expression.ToDouble(Arguments[0].AssociatedObjectValue),
98 (float)Expression.ToDouble(Arguments[1].AssociatedObjectValue),
99 (float)Expression.ToDouble(Arguments[2].AssociatedObjectValue),
100 (float)Expression.ToDouble(Arguments[3].AssociatedObjectValue)));
101
102 default:
103 throw new ScriptRuntimeException("Argument number mismatch.", this);
104 }
105 }
106 }
107}
Class managing a script expression.
Definition: Expression.cs:39
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
Generates a Graphs3D.PhongIntensity object.
PhongIntensity(ScriptNode Color, int Start, int Length, Expression Expression)
Generates a Graphs3D.PhongIntensity object.
PhongIntensity(ScriptNode Red, ScriptNode Green, ScriptNode Blue, int Start, int Length, Expression Expression)
Generates a Graphs3D.PhongIntensity object.
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
override string FunctionName
Name of the function
override string[] DefaultArgumentNames
Default Argument names
PhongIntensity(ScriptNode Red, ScriptNode Green, ScriptNode Blue, ScriptNode Alpha, int Start, int Length, Expression Expression)
Generates a Graphs3D.PhongIntensity object.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes3Scalar
Three scalar parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
static readonly ArgumentType[] argumentTypes4Scalar
Four scalar parameters.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20