Skip to content

Commit 964a10f

Browse files
committed
use invalid-value constant, return proper value when Alpha is invalid
1 parent bc529de commit 964a10f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

io/MaterialTypes.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace g3
88

99
public abstract class GenericMaterial
1010
{
11+
public static readonly float Invalidf = float.MinValue;
1112
public static readonly Vector3f Invalid = new Vector3f(-1, -1, -1);
1213

1314
public string name;
@@ -64,15 +65,15 @@ public OBJMaterial()
6465
name = "///INVALID_NAME";
6566
Ka = Kd = Ks = Ke = Tf = Invalid;
6667
illum = -1;
67-
d = Ns = sharpness = Ni = Single.MinValue;
68+
d = Ns = sharpness = Ni = Invalidf;
6869
}
6970

7071
override public Vector3f DiffuseColor {
7172
get { return (Kd == Invalid) ? new Vector3f(1, 1, 1) : Kd; }
7273
set { Kd = value; }
7374
}
7475
override public float Alpha {
75-
get { return (d == -1) ? 1.0f : d; }
76+
get { return (d == Invalidf) ? 1.0f : d; }
7677
set { d = value; }
7778
}
7879

0 commit comments

Comments
 (0)