public static void UpdateLevel(OpenGlRenderer renderer, List <GameObject>[] level)
 {
     //Console.WriteLine(renderer.level.Length);
     Modell combined = CombineModells.Combine(CombineModells.GameObjectToModellArray(Init.ChunksToGameObjects(Init.NearChunck(level.ToArray(), renderer.player_pos, 50)).ToArray()));
     //Console.WriteLine(combined.vertices.Length);
     //Console.WriteLine(combined.uv.Length);
     //Console.WriteLine(combined.normal.Length);
     //renderer.UpdateBuffers(combined.vertices, combined.uv, combined.normal);
 }
Beispiel #2
0
        public IDisposable DisplayUndoable(IModelDoc2 modelDoc, double framerate = 30, int layer = 0)
        {
            OnStart(DateTime.Now);

            var d = new CompositeDisposable();

            OpenGlRenderer.DisplayUndoable(this, modelDoc, layer).DisposeWith(d);
            Redraw(modelDoc, framerate).DisposeWith(d);
            return(d);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Modell     mesh   = LoadResources.ReadModell(Directory.GetCurrentDirectory() + @"\Mods\Default\Modells\cube.obj");//LoadObj.LoadModellFromObj(Directory.GetCurrentDirectory()+@"\Mods\Default\Modells\cube.obj");
            GameWindow window = new GameWindow(640, 480);

            List <GameObject>[] localLevel = LevelGenerator.GenerateTerrain3D(20, 20, 20, .05f, 0, .5f);
            OpenGlRenderer      renderer   = new OpenGlRenderer(window);

            renderer.ImmediateRendering = false;
            renderer.Quad = false;
            GameObject obj = new GameObject("test", new Vector3(1, 3, 2), Vector3.Zero, Vector3.One, mesh);

            renderer.level = localLevel;
            //Console.WriteLine(renderer.level.Length);
            Modell combined = CombineModells.Combine(CombineModells.GameObjectToModellArray(ChunksToGameObjects(NearChunck(renderer.level.ToArray(), renderer.player_pos, 9999)).ToArray()));

            //Console.WriteLine(combined.vertices.Length);
            //Console.WriteLine(combined.uv.Length);
            //Console.WriteLine(combined.normal.Length);
            renderer.UpdateBuffers(combined.vertices, combined.uv, combined.normal, combined.textures, combined.colors);
            window.Run(1 / DisplayDevice.Default.RefreshRate);
        }