-
Notifications
You must be signed in to change notification settings - Fork 5
/
WorldViewDisplay.cs
53 lines (44 loc) · 1.38 KB
/
WorldViewDisplay.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Tao.OpenGl;
using Tao.FreeGlut;
using System.Threading;
using las.datamanager;
using las.datamanager.structures;
using System.Diagnostics;
namespace TerraForm
{
public delegate void UpdateForms();
public partial class WorldView : Form
{
//true if scene should be redrawn
public static bool Redraw = true;
public event UpdateForms updateFormsEvent;
/// <summary>
/// Draws a frame.
/// </summary>
private void RenderScene()
{
//look at vector. Rotated only around y axis. Presumably we are looking at 0,0, -1
Vector3f eyeVect = new Vector3f();
float yrotrad = (float)(0.017453292519943295769236907684886 * (yrot + 90.0));
eyeVect.x = -(float)Math.Cos(yrotrad);
eyeVect.y = 0;
eyeVect.z = -(float)Math.Sin(yrotrad);
eyeVect.Normalize();
Gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); //clear the color of the window
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); //Clear teh Color Buffer (more buffers later on)
Gl.glLoadIdentity(); //load the Identity Matrix
camera();
if (renderEngine != null)
{
renderEngine.RenderScene(FOV/1.5f + 0.5f*FOV, nearCull, farCull, eyeVect, xpos, zpos);
}
}
}
}