/// <summary> /// Called when it is time to draw a frame. /// </summary> public override void Draw() { // Clears the background Display.ClearBuffers(); Vector3 target = Vector3.Add(CameraPostion, new Vector3(0.0f, 0.0f, -1.0f)); Vector4 lightPos = new Vector4(0.0f, 1.0f, 0.0f, 0.0f); Vector4 diffuseColor = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); // Bind the shader and the texture Display.Shader = Shader; Shader.SetUniform("textureUnit0", 0); Shader.SetUniform("diffuseColor", diffuseColor); #region Mirror // ModelViewProjection matrix ModelViewMatrix = Matrix4.CreateTranslation(0.0f, 1.7f, 0.0f) * Matrix4.Scale(1.0f, -1.0f, 1.0f) * Matrix4.LookAt(CameraPostion, target, Vector3.UnitY); Matrix4 mvp = ModelViewMatrix * ProjectionMatrix; Shader.SetUniform("mvMatrix", ModelViewMatrix); // Tranform light position Shader.SetUniform("lightPosition", Vector4.Transform(lightPos, ModelViewMatrix)); Display.RenderState.FrontFace = FrontFace.ClockWise; Display.Texture = Mars; Shader.SetUniform("mvpMatrix", Torus.Matrix * mvp); Shader.SetUniform("color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f)); Torus.Draw(); Display.Texture = Moon; Shader.SetUniform("mvpMatrix", Matrix4.CreateTranslation(Sphere.Position) * Matrix4.CreateRotationY(Sphere.Rotation.Y) * mvp); Sphere.Draw(); Display.RenderState.FrontFace = FrontFace.CounterClockWise; #endregion #region Normal view ModelViewMatrix = Matrix4.LookAt(CameraPostion, target, Vector3.UnitY); mvp = ModelViewMatrix * ProjectionMatrix; // Tranform light position Shader.SetUniform("lightPosition", Vector4.Transform(lightPos, ModelViewMatrix)); Display.RenderState.Blending = true; Display.BlendingFunction(BlendingFactorSource.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); Display.Texture = Marble; Shader.SetUniform("mvpMatrix", Floor.Matrix * mvp); Shader.SetUniform("color", new Vector4(1.0f, 1.0f, 1.0f, 0.75f)); Floor.Draw(); Display.RenderState.Blending = false; Shader.SetUniform("color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f)); Display.Texture = Mars; Shader.SetUniform("mvpMatrix", Torus.Matrix * mvp); Torus.Draw(); Display.Texture = Moon; Shader.SetUniform("mvpMatrix", Matrix4.CreateTranslation(Sphere.Position) * Matrix4.CreateRotationY(Sphere.Rotation.Y) * mvp); Sphere.Draw(); #endregion Batch.Begin(); Batch.DrawString(Font, new Vector2(10, 50), Color.White, "Camera position : {0}", CameraPostion.ToString()); Batch.End(); }
public Task <IActionResult> SetCameraPositionBatch([FromBody] CameraPostion position) { return(null); }
public Task <IActionResult> SetCameraCheckFrequencyBatch([FromBody] CameraPostion frequency) { return(null); }
public async Task <IActionResult> SetCameraPosition([FromRoute] string id, [FromRoute] int index, [FromBody] CameraPostion position) { position.CameraIndex = index; VedioChannelTypeEnum type = VedioChannelTypeEnum.OutNot; switch (position.Postion) { case Postion.OutNot: default: type = VedioChannelTypeEnum.OutNot; break; case Postion.Output1: type = VedioChannelTypeEnum.Output1; break; case Postion.Output2: type = VedioChannelTypeEnum.Output2; break; case Postion.AC220V: type = VedioChannelTypeEnum.AC220V; break; } return(await ExecFunction(id, device => _skynetTerminalClient.WdVedioAssign(position.CameraIndex, type, device.EquipNum), "mountPort")); }