Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Released to the public domain. Use, modify and relicense at will.
- using System;
- using System.Drawing;
- using OpenTK;
- using OpenTK.Graphics;
- using OpenTK.Graphics.OpenGL;
- using OpenTK.Audio;
- using OpenTK.Audio.OpenAL;
- using OpenTK.Input;
- using Wrak.Objects;
- using System.Globalization;
- using System.Threading;
- using Wrak.Objects.Particles;
- namespace Wrak
- {
- class Wrak : GameWindow
- {
- public static KeyboardDevice keyboard;
- public static MouseDevice mouse;
- /// <summary>Creates a 800x600 window with the specified title.</summary>
- public Wrak()
- : base(800, 600, GraphicsMode.Default, "Wizualizacja Danych Przestrzennych: Wrak")
- {
- VSync = VSyncMode.On;
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- }
- /// <summary>Load resources here.</summary>
- /// <param name="e">Not used.</param>
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- keyboard = Keyboard;
- mouse = Mouse;
- World.Initialize();
- GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- GL.Enable(EnableCap.DepthTest);
- // LAB 1
- World.Add(new Triangle());
- World.Add(new Spring(new Vector3(1,1,1),1));
- World.Add(new Quad(new Vector3(1, 1, 1)));
- World.Add(new CUbe(new Vector3(0,0,0)));
- // LAB 2
- //for (int i=0; i<10;i++)
- // World.Add(new PointSet("../../../cleona.txt", new Vector3(10.0f,0,0)));
- //World.Add(new Wykres(new Vector3(1, 1, 1),40,40,1,1));
- //World.Add(new Pole(new Vector3(5, 5, -3), 500, 10, 10, 2, 5));
- //World.Add(new ProgramableTextureQuad(new Vector3(1, 1, 1),"../../shaders/PTQKolo_VS.glsl", "../../shaders/PTQKolo_FS.glsl"));
- //World.Add(new ProgramableTextureQuad(new Vector3(5, 3, 1),"../../shaders/PTQWykres_VS.glsl", "../../shaders/PTQWykres_FS.glsl"));
- //LAB 3
- //World.Add(new Weather());
- //World.Add(new Fire(new Vector3(0, 0, 0), 10, 500));
- //World.Add(new Quad(new Vector3(0, 0, 0), "", "../../shaders/Texture_Nothing_VS.glsl", "../../shaders/Texture_Edge_FS.glsl"));
- //World.Add(new Quad(new Vector3(0, 0, 0), "", "../../shaders/Texture_Nothing_VS.glsl", "../../shaders/Texture_Smooth_FS.glsl"));
- //World.Add(new Quad(new Vector3(0, 0, 0), "", "../../shaders/Texture_Nothing_VS.glsl", "../../shaders/Texture_Random_FS.glsl"));
- //World.Add(new Quad(new Vector3(0, 0, 0), "", "../../shaders/Texture_Nothing_VS.glsl", "../../shaders/Texture_Mand_FS.glsl"));
- //World.Add(new Quad(new Vector3(0, 0, 0), "", "../../shaders/Texture_Nothing_VS.glsl", "../../shaders/Texture_Swirl_FS.glsl"));
- }
- /// <summary>
- /// Called when your window is resized. Set your viewport here. It is also
- /// a good place to set up your projection matrix (which probably changes
- /// along when the aspect ratio of your window).
- /// </summary>
- /// <param name="e">Not used.</param>
- protected override void OnResize(EventArgs e)
- {
- base.OnResize(e);
- GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
- Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI / 4, Width / (float)Height, 1.0f, 256.0f);
- GL.MatrixMode(MatrixMode.Projection);
- GL.LoadMatrix(ref projection);
- }
- /// <summary>
- /// Called when it is time to setup the next frame. Add you game logic here.
- /// </summary>
- /// <param name="e">Contains timing information for framerate independent logic.</param>
- protected override void OnUpdateFrame(FrameEventArgs e)
- {
- base.OnUpdateFrame(e);
- World.Run();
- if (Keyboard[Key.Escape])
- Exit();
- }
- /// <summary>
- /// Called when it is time to render the next frame. Add your rendering code here.
- /// </summary>
- /// <param name="e">Contains timing information.</param>
- protected override void OnRenderFrame(FrameEventArgs e)
- {
- base.OnRenderFrame(e);
- GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
- World.Draw();
- SwapBuffers();
- }
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- // [STAThread]
- static void Main()
- {
- // The 'using' idiom guarantees proper resource cleanup.
- // We request 30 UpdateFrame events per second, and unlimited
- // RenderFrame events (as fast as the computer can handle).
- using (Wrak glw = new Wrak())
- {
- glw.Run(30.0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement