-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRender3D.cs
More file actions
30 lines (25 loc) · 994 Bytes
/
Render3D.cs
File metadata and controls
30 lines (25 loc) · 994 Bytes
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
using OpenTK;
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SuperJet
{
public class Render3D
{
public static void DrawModel(int vertexArrayObject, Vector3 position, Vector3 rotation, Vector3 scale)
{
GL.BindVertexArray(vertexArrayObject);
Matrix4 model = Matrix4.CreateScale(scale) *
Matrix4.CreateRotationX(MathHelper.DegreesToRadians(rotation.X)) *
Matrix4.CreateRotationY(MathHelper.DegreesToRadians(rotation.Y)) *
Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(rotation.Z)) *
Matrix4.CreateTranslation(position);
GL.UniformMatrix4(20, false, ref model);
GL.DrawArrays(PrimitiveType.Triangles, 0, 3);
GL.BindVertexArray(0);
}
}
}