Removed unneeded usings

This commit is contained in:
2017-02-27 02:37:55 -05:00
parent 33a6a670b2
commit 6385f62e20
13 changed files with 12 additions and 37 deletions

View File

@@ -1,15 +1,4 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Diamond.Buffers;
using Newtonsoft.Json;
using OpenTK;
namespace hexworld
namespace hexworld
{
public class Driver
{

View File

@@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Drawing;
using System.IO;
using Diamond;
using Diamond.Buffers;
using Diamond.Shaders;
using Diamond.Textures;

View File

@@ -1,78 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Tasks;
using Diamond.Buffers;
using Diamond.Shaders;
using Newtonsoft.Json;
using OpenTK.Graphics.OpenGL4;
namespace hexworld
{
public class Mesh<T> where T : struct
{
public SubArray<T> Vertices;
public PrimitiveType Primitive;
private static VertexDataInfo tVdi;
private static List<VertexPointerAttribute> attribs;
static Mesh()
{
tVdi = VertexDataInfo.GetInfo<T>();
}
public Mesh(T[] vertices, PrimitiveType primitive = PrimitiveType.Triangles)
: this(new SubArray<T>(vertices), primitive)
{
}
public Mesh(SubArray<T> vertices, PrimitiveType primitive = PrimitiveType.Triangles)
{
Vertices = vertices;
Primitive = primitive;
}
public void Draw()
{
tVdi.EnableVertexPointers();
GL.DrawArrays(Primitive, Vertices.Offset, Vertices.Length);
tVdi.DisableVertexPointers();
}
public void DrawInstanced<TI>(SubArray<TI> instanceArray) where TI : struct
{
var tiVdi = VertexDataInfo.GetInfo<TI>();
tVdi.EnableVertexPointers();
tiVdi.EnableVertexPointers();
GL.DrawArraysInstancedBaseInstance(Primitive, Vertices.Offset, Vertices.Length, instanceArray.Length,
instanceArray.Offset);
tVdi.DisableVertexPointers();
tiVdi.DisableVertexPointers();
}
}
public static class Mesh
{
public static Mesh<T> FromJson<T>(string json) where T : struct
{
var vertices = JsonConvert.DeserializeObject<T[]>(json);
return new Mesh<T>(vertices);
}
public static T[] Join<T>(params Mesh<T>[] meshes) where T : struct => Join((IEnumerable<Mesh<T>>) meshes);
public static T[] Join<T>(IEnumerable<Mesh<T>> meshes) where T : struct
{
return SubArray.Join(meshes.Select(x => x.Vertices));
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following

View File

@@ -51,7 +51,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Mesh.cs" />
<Compile Include="Tile.cs" />
<Compile Include="Vertex.cs" />
<Compile Include="HexRender.cs" />
@@ -86,6 +85,7 @@
<None Include="res\data_tile_grass.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="res\sides.obj" />
</ItemGroup>
<ItemGroup>
<Content Include="res\grass.png">