added texture atlas
This commit is contained in:
@@ -9,7 +9,8 @@ namespace Voxel
|
||||
public static float Pitch = 0f;
|
||||
public static float Yaw = -90f;
|
||||
public static float FOV = 70f;
|
||||
public static float Speed = 0.5f;
|
||||
public static float Speed = 5f;
|
||||
public static float ShiftSpeed = 20f;
|
||||
|
||||
public static Matrix4 view =>
|
||||
Matrix4.LookAt(Position, Position + Front, Vector3.UnitY);
|
||||
@@ -33,7 +34,7 @@ namespace Voxel
|
||||
float moveSpeed = Speed * time;
|
||||
if (Input.GetKey(OpenTK.Windowing.GraphicsLibraryFramework.Keys.LeftShift))
|
||||
{
|
||||
moveSpeed *= 10;
|
||||
moveSpeed = ShiftSpeed * time;
|
||||
}
|
||||
if (Input.GetKey(OpenTK.Windowing.GraphicsLibraryFramework.Keys.W))
|
||||
{
|
||||
|
||||
43
Triangle.cs
43
Triangle.cs
@@ -1,43 +0,0 @@
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
|
||||
namespace Voxel
|
||||
{
|
||||
|
||||
public class Triangle
|
||||
{
|
||||
private int _vao;
|
||||
private Shader _shader;
|
||||
|
||||
public Triangle()
|
||||
{
|
||||
string vertexPath = "Shaders/shader.vert";
|
||||
string fragmentPath = "Shaders/shader.frag";
|
||||
_shader = new Shader(vertexPath, fragmentPath);
|
||||
|
||||
float[] vertices =
|
||||
{
|
||||
-0.0f, 0.5f, 0.0f, //top
|
||||
0.5f, -0.5f, 0.0f, // bottom right
|
||||
-0.5f, -0.5f, 0.0f // bottom left
|
||||
};
|
||||
|
||||
_vao = GL.GenVertexArray();
|
||||
GL.BindVertexArray(_vao);
|
||||
|
||||
int vbo = GL.GenBuffer();
|
||||
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
|
||||
GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.StaticDraw);
|
||||
|
||||
GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 3 * sizeof(float), 0);
|
||||
GL.EnableVertexAttribArray(0);
|
||||
|
||||
_shader.Use();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
GL.BindVertexArray(_vao);
|
||||
GL.DrawArrays(PrimitiveType.Triangles, 0, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user