Код: Выделить всё
namespace FVProductions.Base
{
public struct Color
{
public byte B, G, R, A;
public Color(float r, float g, float b, float a)
{
R = (byte)(Math.Min(1.0f, Math.Max(0.0f, r)) * 255);
G = (byte)(Math.Min(1.0f, Math.Max(0.0f, g)) * 255);
B = (byte)(Math.Min(1.0f, Math.Max(0.0f, b)) * 255);
A = (byte)(Math.Min(1.0f, Math.Max(0.0f, a)) * 255);
}
public Color(Vector3 rgb)
:this(rgb.X,rgb.Y,rgb.Z,1)
{
}
}
}
namespace FVProductions.Base.Graphics
{
public class ShaderParameter
{
private T Value;
public T GetValue() { return Value; }
}
}
namespace FVProductions.NewGame
{
public class TerrainShader : Shader, IFullTextured, IStandardLit
{
private ShaderParameter epAmbient;
public FVProductions.Base.Color AmbientColor
{
get { return new FVProductions.Base.Color(epAmbient.GetValue()); }
set { epAmbient.SetValue(value.ToVector3()); }
}
}
}
ошибка CS0012: тип «System.Drawing.Color» определен в сборке, которая не упоминается. Необходимо добавить ссылку на сборку «System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a».
Это в строке TerrainShader.AmbientColor get{}, в ключевом слове return. Зачем компилятору предполагать, что явно объявленный тип является другим?
Подробнее здесь: https://stackoverflow.com/questions/995 ... ed-and-ref
Мобильная версия