/// <summary> /// Request a command until we get one that we recognise. /// Display brief help if we don't recognise a command. /// </summary> /// <returns></returns> private GameCommand RequestCommand() { LightLocation location = null; var firstRequest = true; while (location == null) { if (!firstRequest) { DisplayCommandSummary(); } Console.Write("Please enter a location or 'exit': "); var command = Console.ReadLine().Trim().ToLower(); var exitCommands = new List <string> { "exit", "quit", "i've had enough" }; if (exitCommands.Contains(command)) { return(new GameCommand(location: null, exit: true)); } location = ParseLocation(command); firstRequest = false; } return(new GameCommand(location, exit: false)); }
public override Result Load() { var res = base.Load(); if (res == Result.Success) { loc_mvp = GetUniformLocation("MVP"); loc_resolution = GetUniformLocation("resolution"); loc_resolutionInv = GetUniformLocation("resolutionInverse"); loc_nearfar = GetUniformLocation("nearFar"); loc_camDir = GetUniformLocation("wCamDir"); loc_camPos = GetUniformLocation("wCamPos"); loc_gAmbient = GetUniformLocation("gAmbient"); loc_ibl = GetUniformLocation("iblIntensity"); loc_fog = GetUniformLocation("fogIntensity"); loc_fogcolor = GetUniformLocation("fogColor"); loc_dirLight = new LightLocation() { dir = GetUniformLocation("wDirLight.dir"), color = GetUniformLocation("wDirLight.color"), intensity = GetUniformLocation("wDirLight.intensity"), }; } return(res); }
/// <summary> /// Calculate the distance between the effect and a light location /// </summary> /// <param name="effect"></param> /// <param name="lightLocation"></param> /// <returns></returns> public static double Distance(this BaseEffect effect, LightLocation lightLocation) { var x1 = effect.X; var y1 = effect.Y; var x2 = lightLocation.X; var y2 = lightLocation.Y; return(Math.Sqrt((Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2)))); }
private void SetPointLightParameter(LightLocation ll, PointLight light) { SetParameter(ll.pos, light.GameObject.Transform.WorldPosition); SetParameter(ll.color, light.Color); SetParameter(ll.intensity, light.Intensity); SetParameter(ll.radius, light.Radius); SetParameter(ll.min, light.ClipBounds.Min); SetParameter(ll.max, light.ClipBounds.Max); }
public void NewLightLocationTest() { var location = new LightLocation(1, 0, 0.5); Assert.IsNotNull(location); Assert.AreEqual(1, location.X); Assert.AreEqual(0, location.Y); Assert.AreEqual(0.5, location.Z); }
private static (int x, int y) MapLightLocationToImage(LightLocation location, int width, int height) { //Hue gives coordinates relative to center of room where -1 is far left and 1 is far right etc. // So we need to remap it to 0-1 range then get value relative to image. // Y also needs to be flipped as front of room is 1 which should correspond to 0 in the image var x = (int)Math.Floor((location.X - -1.0) / 2 * (width)); var y = (int)Math.Floor((1.0 - (location.Y - -1.0) / 2) * (height)); return(x, y); }
private void CopyMembers(Light other) { this.id = null; this.name = other.name; this.modes = new List <LightMode>(other.modes.Select(x => new LightMode(x, this))); this.location = other.location; this.isConnected = other.isConnected; this.batteryLevel = other.batteryLevel; this.temperature = other.temperature; this.mode = other.mode; this.requestedMode = other.requestedMode; }
private void InitializeMembers() { this.id = null; this.name = null; this.modes = new List <LightMode>(); this.location = LightLocation.Front; this.isConnected = false; this.batteryLevel = -1; this.temperature = double.NaN; this.mode = 255; this.requestedMode = 1; }
private void SetSpotLightParameter(LightLocation ll, SpotLight light) { SetParameter(ll.dir, light.WorldDirection); SetParameter(ll.pos, light.GameObject.Transform.WorldPosition); SetParameter(ll.color, light.Color); SetParameter(ll.intensity, light.Intensity); SetParameter(ll.radius, light.Radius); SetParameter(ll.min, light.ClipBounds.Min); SetParameter(ll.max, light.ClipBounds.Max); SetParameter(ll.innerAngle, light.InnerDot); SetParameter(ll.outerAngle, light.OuterDot); }
/// <summary> /// Calculate the distance between the effect and a light location /// </summary> /// <param name="effect"></param> /// <param name="lightLocation"></param> /// <returns></returns> public double Angle(LightLocation lightLocation) { return(lightLocation.Angle(this.X, this.Y)); }
/// <summary> /// Calculate the distance between the effect and a light location /// </summary> /// <param name="effect"></param> /// <param name="lightLocation"></param> /// <returns></returns> public double Distance(LightLocation lightLocation) { return(lightLocation.Distance(this.X, this.Y)); }
private static int GetMatrixPositionY(LightLocation lightLocation, int matrixSize) { double pos = ((1 - (lightLocation.Y + 1) / 2)) * matrixSize; return((int)pos); }
public override Result Load() { var res = base.Load(); if (res == Result.Success) { loc_m = GetUniformLocation("M"); loc_mit = GetUniformLocation("MIT"); loc_mvp = GetUniformLocation("MVP"); loc_camDir = GetUniformLocation("wCamDir"); loc_camPos = GetUniformLocation("wCamPos"); loc_resolution = GetUniformLocation("resolutionInverse"); loc_gAmbient = GetUniformLocation("gAmbient"); loc_ibl = GetUniformLocation("iblIntensity"); loc_dirLight = new LightLocation() { dir = GetUniformLocation("wDirLight.dir"), color = GetUniformLocation("wDirLight.color"), intensity = GetUniformLocation("wDirLight.intensity"), }; loc_pointLights = new LightLocation[PointLightNum]; for (var i = 0; i < PointLightNum; i++) { loc_pointLights[i] = new LightLocation() { color = GetUniformLocation(string.Format("wPointLights[{0}].color", i)), intensity = GetUniformLocation(string.Format("wPointLights[{0}].intensity", i)), radius = GetUniformLocation(string.Format("wPointLights[{0}].radius", i)), pos = GetUniformLocation(string.Format("wPointLights[{0}].pos", i)), min = GetUniformLocation(string.Format("wPointLights[{0}].min", i)), max = GetUniformLocation(string.Format("wPointLights[{0}].max", i)), }; } loc_spotLights = new LightLocation[SpotLightNum]; for (var i = 0; i < SpotLightNum; i++) { loc_spotLights[i] = new LightLocation() { dir = GetUniformLocation(string.Format("wSpotLights[{0}].dir", i)), color = GetUniformLocation(string.Format("wSpotLights[{0}].color", i)), intensity = GetUniformLocation(string.Format("wSpotLights[{0}].intensity", i)), radius = GetUniformLocation(string.Format("wSpotLights[{0}].radius", i)), pos = GetUniformLocation(string.Format("wSpotLights[{0}].pos", i)), min = GetUniformLocation(string.Format("wSpotLights[{0}].min", i)), max = GetUniformLocation(string.Format("wSpotLights[{0}].max", i)), innerAngle = GetUniformLocation(string.Format("wSpotLights[{0}].innerAngle", i)), outerAngle = GetUniformLocation(string.Format("wSpotLights[{0}].outerAngle", i)), }; } loc_shadowMV1 = GetUniformLocation("shadowMV1"); loc_shadowMV2 = GetUniformLocation("shadowMV2"); loc_shadowMV3 = GetUniformLocation("shadowMV3"); loc_skinning = GetUniformLocation("skinning"); loc_morphing = GetUniformLocation("morphing"); } return(res); }
// public List<Transition> Transitions { get; set; } = new List<Transition>(); public StreamingLight(string id, LightLocation location) { Id = byte.Parse(id); LightLocation = location; }
public LightPositionVm(KeyValuePair <string, LightLocation> original) { this.Id = original.Key; this.LightLocation = original.Value; }
private void SetDirectionalLightParameter(LightLocation ll, DirectionalLight light) { SetParameter(ll.dir, light.WorldDirection); SetParameter(ll.color, light.Color); SetParameter(ll.intensity, light.Intensity); }
/// <summary> /// Calculate the distance between the effect and a light location /// </summary> /// <param name="effect"></param> /// <param name="lightLocation"></param> /// <returns></returns> public double Distance(LightLocation lightLocation) { return(Math.Abs(this.X - lightLocation.X)); }
public EntertainmentLight(byte id, LightLocation location) { Id = id; LightLocation = location; }
/// <summary> /// Light location specified by user. May be null if user has specified /// something other than a move. /// </summary> /// <value></value> internal GameCommand(LightLocation location, bool exit) { this.Location = location; this.Exit = exit; }