public override void Update() { if (GameEngine.Input.WasPressed(Keys.D1)) { MessageRenderer.Instance.PostHeaderMessage("Adding new pedestrian", 3); _currentPath = new List <Vector3>(); _currentPath.Add(Race.Current.PlayerVehicle.GetBodyBottom()); } else if (GameEngine.Input.WasPressed(Keys.D2)) { _currentPath.Add(Race.Current.PlayerVehicle.GetBodyBottom()); } else if (GameEngine.Input.WasPressed(Keys.D3)) { _currentPath.Add(Race.Current.PlayerVehicle.GetBodyBottom()); StringBuilder sb = new StringBuilder(); sb.AppendLine("1 // Ref num"); sb.AppendLine(_currentPath.Count + 1 + " // instructions"); sb.AppendLine("1 // initial instruction"); foreach (Vector3 pos in _currentPath) { sb.AppendLine("point"); sb.AppendLine((pos / 6).ToShortString()); } sb.AppendLine("reverse"); File.AppendAllText("ped-edit.txt", sb.ToString()); } _view.Update(); }
public override void Draw(GameTime gameTime, IDrawContext drawContext) { base.Draw(gameTime, drawContext); if (Workspace.SelectedMaterial == null) { return; } var bounds = new Rect(0, 0, RenderSize.Width, RenderSize.Height); using (var draw3d = drawContext.BeginDraw3D()) using (var localViewport = drawContext.BeginViewport(bounds)) using (var localClipping = drawContext.BeginNewClip(bounds)) { var graphicsDevice = Screen.GraphicsDevice; graphicsDevice.BlendState = BlendState.Opaque; graphicsDevice.DepthStencilState = DepthStencilState.Default; // View を更新します。 view.Update(); // Projection を更新します。 projection.AspectRatio = graphicsDevice.Viewport.AspectRatio; projection.Update(); var material = Workspace.SelectedMaterial; var effect = cubeMesh.Effect; effect.View = view.Matrix; effect.Projection = projection.Matrix; effect.DiffuseColor = material.DiffuseColor.ToVector3(); effect.EmissiveColor = material.EmissiveColor.ToVector3(); effect.SpecularColor = material.SpecularColor.ToVector3(); effect.SpecularPower = material.SpecularPower; cubeMesh.Draw(); } }