Пример #1
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            var watch = new Util.StopWatchMilliseconds();

            base.OnUpdateFrame(e);
            StateMaschine.Input();
            StateMaschine.Update(e);

            LastFrameUpdateTime = Convert.ToSingle(watch.Result());
        }
Пример #2
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            var watch = new Util.StopWatchMilliseconds();

            GL.Enable(EnableCap.DepthTest);
            GL.DepthMask(true);
            base.OnRenderFrame(e);
            _controller.Update(this, (float)e.Time);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
            StateMaschine.Render();
            _controller.Render();
            SwapBuffers();
            LastFrameRenderTime = Convert.ToSingle(watch.Result());
            GenerateAverageFrameRenderTime();
        }
        void Generate()
        {
            if (lastscale != Scale || lastsurface != SurfaceLevel || lastDivider != Divider || lastSeed != Seed)
            {
                var watch = new Util.StopWatchMilliseconds();
                lastscale   = Scale;
                lastsurface = SurfaceLevel;
                lastDivider = Divider;
                lastSeed    = Seed;
                foreach (var chunk in _chunks)
                {
                    chunk.Scale        = Scale;
                    chunk.Divider      = Divider;
                    chunk.SurfaceLevel = SurfaceLevel;
                    chunk.Generate();
                }

                Console.WriteLine("Generated " + _chunks.Count + " Chunks.Took: " + watch.Result() + "ms");
            }
        }
Пример #4
0
        /// <summary>
        /// </summary>
        /// <param name="path">Path from the Models Directory</param>
        public OBJLoader(string path, ShaderLoader loader)
        {
            Util.StopWatchMilliseconds watch = new Util.StopWatchMilliseconds();
            Vertices         = new List <Vector3>();
            Normals          = new List <Vector3>();
            ColorPerIndex    = new List <Vector3>();
            NormalIndices    = new List <int>();
            Indices          = new List <int>();
            MaterialsIndices = new Dictionary <string, int>();
            Materials        = new Dictionary <string, Vector3>();
            Loader           = loader;
            ReadMaterials(path);
            ReadOBJ(path);
            GenerateFinalVertexArray();

            Console.WriteLine("Model " + path + " constructed. Vertices:" + FinalVertexArray.Count + " Time:" + watch.Result() + " ms");
        }