static void Main() { Console.WriteLine("starting example"); using (Ottd3DWindow win = new Ottd3DWindow( )) { win.Run(30.0); } }
public void Update(Ottd3DWindow win, bool updateCache = false) { if (updateCache) gridCacheIsUpToDate = false; switch (CurrentState) { case State.Play: if (win.CrowInterface.hoverWidget != null) break; break; case State.HMEdition: if (win.CrowInterface.hoverWidget != null) break; if (win.Mouse [OpenTK.Input.MouseButton.Left]) { hmGenerator.Color = new Vector4 (0f, 1f / 255f, 0f, 1f); updateHeightMap (); } else if (win.Mouse [OpenTK.Input.MouseButton.Right]) { hmGenerator.Color = new Vector4 (0f, -1f / 255f, 0f, 1f); updateHeightMap (); } if (!heightMapIsUpToDate) updateHeightMap (); break; case State.ClearHM: hmGenerator.Clear (); getHeightMapData (); gridShader.DisplacementMap = hmGenerator.OutputTex; gridCacheIsUpToDate = false; CurrentState = State.HMEdition; break; case State.ClearSplatting: splattingBrushShader.Clear (); gridShader.SplatTexture = splattingBrushShader.OutputTex; gridCacheIsUpToDate = false; CurrentState = State.GroundTexturing; break; case State.LoadMap: initGridMaps (); gridCacheIsUpToDate = false; currentState = State.Play; break; case State.GroundTexturing: updateCount++; if (updateCount < 5) break; updateCount = 0; if (win.CrowInterface.hoverWidget != null) break; if (win.Mouse [OpenTK.Input.MouseButton.Left]) { splattingBrushShader.Color = splatBrush; updateSplatting (); } else if (win.Mouse [OpenTK.Input.MouseButton.Right]) { splattingBrushShader.Color = new Vector4 (splatBrush.X, -splatBrush.Y, 0f, 1f); updateSplatting (); } break; } if (!gridCacheIsUpToDate) updateGridFbo (); }
public void Update(Ottd3DWindow win, bool updateCache = false) { if (updateCache) { gridCacheIsUpToDate = false; } switch (CurrentState) { case State.Play: if (win.CrowInterface.hoverWidget != null) { break; } break; case State.HMEdition: if (win.CrowInterface.hoverWidget != null) { break; } if (win.Mouse [OpenTK.Input.MouseButton.Left]) { hmGenerator.Color = new Vector4(0f, 1f / 255f, 0f, 1f); updateHeightMap(); } else if (win.Mouse [OpenTK.Input.MouseButton.Right]) { hmGenerator.Color = new Vector4(0f, -1f / 255f, 0f, 1f); updateHeightMap(); } if (!heightMapIsUpToDate) { updateHeightMap(); } break; case State.ClearHM: hmGenerator.Clear(); getHeightMapData(); gridShader.DisplacementMap = hmGenerator.OutputTex; gridCacheIsUpToDate = false; CurrentState = State.HMEdition; break; case State.ClearSplatting: splattingBrushShader.Clear(); gridShader.SplatTexture = splattingBrushShader.OutputTex; gridCacheIsUpToDate = false; CurrentState = State.GroundTexturing; break; case State.LoadMap: initGridMaps(); gridCacheIsUpToDate = false; currentState = State.Play; break; case State.GroundTexturing: updateCount++; if (updateCount < 5) { break; } updateCount = 0; if (win.CrowInterface.hoverWidget != null) { break; } if (win.Mouse [OpenTK.Input.MouseButton.Left]) { splattingBrushShader.Color = splatBrush; updateSplatting(); } else if (win.Mouse [OpenTK.Input.MouseButton.Right]) { splattingBrushShader.Color = new Vector4(splatBrush.X, -splatBrush.Y, 0f, 1f); updateSplatting(); } break; } if (!gridCacheIsUpToDate) { updateGridFbo(); } }
static void Main () { Console.WriteLine ("starting example"); using (Ottd3DWindow win = new Ottd3DWindow( )) { win.Run (30.0); } }