MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / FunctionFloat

Class FunctionFloat

src/main/java/net/optifine/expr/FunctionFloat.java:5–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import net.optifine.shaders.uniform.Smoother;
4
5public class FunctionFloat implements IExpressionFloat
6{
7 private FunctionType type;
8 private IExpression[] arguments;
9 private int smoothId = -1;
10
11 public FunctionFloat(FunctionType type, IExpression[] arguments)
12 {
13 this.type = type;
14 this.arguments = arguments;
15 }
16
17 public float eval()
18 {
19 IExpression[] aiexpression = this.arguments;
20
21 switch (this.type)
22 {
23 case SMOOTH:
24 IExpression iexpression = aiexpression[0];
25
26 if (!(iexpression instanceof ConstantFloat))
27 {
28 float f = evalFloat(aiexpression, 0);
29 float f1 = aiexpression.length > 1 ? evalFloat(aiexpression, 1) : 1.0F;
30 float f2 = aiexpression.length > 2 ? evalFloat(aiexpression, 2) : f1;
31
32 if (this.smoothId < 0)
33 {
34 this.smoothId = Smoother.getNextId();
35 }
36
37 float f3 = Smoother.getSmoothValue(this.smoothId, f, f1, f2);
38 return f3;
39 }
40
41 default:
42 return this.type.evalFloat(this.arguments);
43 }
44 }
45
46 private static float evalFloat(IExpression[] exprs, int index)
47 {
48 IExpressionFloat iexpressionfloat = (IExpressionFloat)exprs[index];
49 float f = iexpressionfloat.eval();
50 return f;
51 }
52
53 public ExpressionType getExpressionType()
54 {
55 return ExpressionType.FLOAT;
56 }
57
58 public String toString()
59 {
60 return "" + this.type + "()";
61 }
62}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected