public Colour256(double r, double g, double b, double a) { this.R = RayMath.Clamp(r, MinValue, MaxValue); this.G = RayMath.Clamp(g, MinValue, MaxValue); this.B = RayMath.Clamp(b, MinValue, MaxValue); this.A = RayMath.Clamp(a, MinValue, MaxValue); }
public Colour32(int r, int g, int b, int a) { this.R = (byte)RayMath.Clamp(r, MinValue, MaxValue); this.G = (byte)RayMath.Clamp(g, MinValue, MaxValue); this.B = (byte)RayMath.Clamp(b, MinValue, MaxValue); this.A = (byte)RayMath.Clamp(a, MinValue, MaxValue); }
public Colour32 this[int x, int y, int z] { get { return(this.Colours[RayMath.FlatTo3D(this.Size, new int3(x, y, z))]); } set { //Log.Print(new int3(x, y, z) + " => " + RayMath.FlatTo3D(this.Size, new int3(x, y, z))); this.Colours[RayMath.FlatTo3D(this.Size, new int3(x, y, z))] = value; } }
protected internal override void FixedUpdate() { //Angle += DegPerSec * Time.FixedDeltaTime; Quaternion rot = Quaternion.CreateFromAxisAngle((Vector3)RotationAxis, (float)(Angle * 0.0174533D)); this.Malleable.Rotation = rot; Vector3D sunDir = this.Malleable.Forward; double SunAltitude = 1D; bool negative = sunDir.Y < 0; SunAltitude = Math.Abs(sunDir.Y); if (!negative) { this.Colour = RayMath.Lerp(SunSetColour, SunDayColour, Math.Sqrt(SunAltitude * 2)); } else { this.Colour = RayMath.Lerp(SunSetColour, NightColour, SunAltitude * 10); } }