public World() { var vertex = Assembly.GetExecutingAssembly().GetManifestResourceStream("Zombie2.Shaders.Vertex.glsl"); var fragment = Assembly.GetExecutingAssembly().GetManifestResourceStream("Zombie2.Shaders.Fragment.glsl"); var renderer = new Renderer(new TriangleProgram(vertex, fragment)); RenderManager.Instance.SetRenderer(renderer); m_camera = new Camera(); m_camera.Bounds = new Box2(0, 0, 1000, 1000); RenderManager.Instance.AddLayer("Floor"); RenderManager.Instance.AddLayer("Test"); m_triangles = new List<Triangle>(); var random = new Random(); for (var i = 0; i < 10000; i++) { var x = random.Next(-1000, 1000); var y = random.Next(-1000, 1000); var pos1 = new Vector2(x, y); var pos2 = new Vector2(x + 100, y); var pos3 = new Vector2(x, y + 100); var t = new Triangle() { Position = new Vector2[]{ pos1, pos2, pos3 }, Color = new Color4ub( (byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255), 255) }; m_triangles.Add(t); } s_instance = this; }
public void SetRenderer(Renderer renderer) { m_renderer = renderer; }