Value() public static method

Create or update a parameter that should be displayed in the debug log
public static Value ( string key, object value ) : void
key string
value object
return void
Esempio n. 1
0
 private void UpdateLog()
 {
     Logger.Value("scale", scale);
     Logger.Value("camera", camera);
     Logger.Value("rotation", model.Rotation);
     Logger.Value("position", model.Position);
     Logger.Value("pivot", model.Pivot);
 }
Esempio n. 2
0
        /// <summary>
        /// Draw the screenbuffer and update fps count
        /// </summary>
        public new void Update()
        {
            FPS = 1000 / (int)swUpdate.ElapsedMilliseconds;
            Logger.Value("FPS", FPS);

            swUpdate.Restart();

            base.Invalidate();
            base.Update();
        }
Esempio n. 3
0
        private void BackfaceCulling()
        {
            foreach (Triangle triangle in Triangles)
            {
                Vector3 n = triangle.SurfaceNormal().Normalize();
                triangle.IsBackFaced = Math.Round(n.Z, 1) >= 0;
            }

            //Logger.Value("culled triangles", Triangles.Count(x => x.IsBackFaced));
            Logger.Value("valid triangles", Triangles.Count(x => !x.IsBackFaced));
        }
        /// <summary>
        /// Draw a mesh model after it has been processed (transformed and projected)
        /// </summary>
        /// <param name="model"></param>
        public void DrawModel(Model model)
        {
            //foreach (Vertex v in model.Vertices)
            //{
            //    DrawPixel(v.Projected, Color.Red.ToArgb());
            //}

            int c = 0;

            foreach (Triangle t in model.Triangles.Where(x => !x.IsBackFaced))
            {
                DrawTriangle(model, t);
                c++;
            }

            Logger.Value("triangles drawn", c);
        }
Esempio n. 5
0
        private void Render()
        {
            var sw = Stopwatch.StartNew();

            frame.Clear();
            frame.DrawModel(model);
            Logger.Value("frame.DrawModel()", sw.ElapsedMilliseconds);

            sw.Restart();
            renderer.SetBackbuffer(frame);
            Logger.Value("renderer.SetBackbuffer()", sw.ElapsedMilliseconds);

            sw.Restart();
            renderer.SwapBuffer();
            Logger.Value("renderer.SwapBuffer()", sw.ElapsedMilliseconds);

            sw.Restart();
            renderer.Update();
            Logger.Value("renderer.Update()", sw.ElapsedMilliseconds);
        }
Esempio n. 6
0
        public void Start()
        {
            Setup();

            var sw = Stopwatch.StartNew();

            model = ModelFactory.CreateTestObject();
            //model = ModelFactory.CreateFromFile("bunny.ply", 1000);
            model.FillColor = Color.Gray.ToArgb();
            model.LineColor = Color.Red.ToArgb();
            model.CalculateColors();

            //model = ModelFactory.CreateFromFile(@"C:\Users\Ruud\Desktop\Armadillo2.ply", 5);
            //model = ModelFactory.CreateFromFile(@"g:\Data\Projects\3D\3dconverter\models\horseasc.ply", 1000);
            //model = ModelFactory.CreateFromFile(@"g:\Data\Projects\3D\3dconverter\models\ateneav.ply", 0.1);
            //model = ModelFactory.CreateFromFile(@"g:\Data\Projects\3D\3dconverter\models\pots.ply", 1);
            //model = ModelFactory.CreateFromFile(@"g:\Data\Projects\3D\3dconverter\models\balls.ply", 1);
            Logger.Value("model load", sw.ElapsedMilliseconds);

            timerUpdate.Enabled = true;
        }