protected override void OnLoad(EventArgs e) { Console.WriteLine("LOAD <3d street viewer> "); Console.Title = "GoogleHacks [Streetview 3D] - © 2016 RealityDaemon"; int[] t = new int[2]; GL.GetInteger(GetPName.MajorVersion, out t[0]); GL.GetInteger(GetPName.MinorVersion, out t[1]); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("OpenGL Version " + t[0] + "." + t[1]); // Initilise OpenGL GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W); GL.ClearDepth(1.0f); // Depth Buffer Setup GL.Enable(EnableCap.DepthTest); // Enables Depth Testing GL.DepthFunc(DepthFunction.Lequal); // The Type Of Depth Testing To Do GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); // Really Nice Perspective Calculations // Panorama Panorama.Initilize(ActiveCamera); // Minimap map = new Minimap(size: new Vector3(1.0f, 1.0f, 1.0f), position: new Vector3(0.5f, 0.5f, -1.0f)); map.Initilize(ActiveCamera); textBasedView.Initilize(); this.Title = "GoogleHacks Streetview Hacker Collection - © 2016 RealityDaemon"; }
protected override void OnRenderFrame(FrameEventArgs e) { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W); GL.Enable(EnableCap.DepthTest); GL.DepthMask(true); GL.DepthFunc(DepthFunction.Lequal); GL.PointSize(6.0f); RenderingContext rc = new RenderingContext(); rc.View = View.CreateViewFromWindow(this); rc.Time = e.Time; rc.matricies.worldview = Matrix4.Identity; rc.matricies.projection = ActiveCamera.Projection; rc.matricies.modelview = Matrix4.Identity; rc.matricies.orientation = Quaternion.Identity; rc.cam = ActiveCamera; rc.Keyboard = this.Keyboard; //Console.WriteLine(rc.cam.camera_pitch + ", " + rc.cam.camera_yaw); float distFromPos = (rc.cam.Position - Panorama.LastPosition).Length; if (distFromPos > 0.5f) { // there is a substantial enough of a change from the previous location //Panorama.Move(rc.cam.Direction, rc.cam.Position); } Panorama.camera = ActiveCamera; // Panorama Panorama.Render(rc); // Minimap map.Render(rc); if (FilterMode == ViewFilterMode.TextBased) { textBasedView.PipeToConsole(rc, () => { Panorama.Render(rc); map.Render(rc); }); } SwapBuffers(); }
protected void Restart() { Panorama.Unload(); Panorama.Initilize(ActiveCamera); Panorama.Reset(ActiveCamera); }