Esempio n. 1
0
        /// <summary>
        ///     Walks the scenario and draws all objects with their current state
        /// </summary>
        /// <param name="eye">The viewer camera</param>
        /// <param name="programManager"></param>
        /// <param name="scenario"></param>
        public void DrawScenario(Camera eye, ProgramManager programManager, ScenarioBlock scenario)
        {
            var program = programManager.DebugShader;

            program.Assign( );

            _drawManager.Clear( );
            TraverseScenario(eye, scenario);
            _drawManager.Sort(eye);

            CurrentBucketVao = 0;

            // TODO better batching!
            _drawManager.InstanceManager.BufferInstanceData(InstancesBuffer);
            _drawManager.CreateIndirectDrawCommands(_bucketManager, InstancesBuffer);
            _drawManager.DispatchDraws(InstancesBuffer);
            //foreach ( var shaderIdent in _drawManager.GetShaders( ) )
            //{
            //    var renderPatches = _drawManager.GetOpaqueParts( shaderIdent ).ToArray( );
            //    if ( renderPatches.Length <= 0 )
            //    {
            //        continue;
            //    }
            //    DrawPatchElements( renderPatches, shaderIdent );
            //}
        }
Esempio n. 2
0
        private void Initialize( )
        {
            Console.WriteLine(GL.GetString(StringName.Version));
            Timer          = new Stopwatch( );
            Camera         = new Camera( );
            Manager        = new ScenarioManager();
            ProgramManager = new ProgramManager( );
            Performance    = new Performance( );

            Camera.ViewProjectionMatrixChanged += Camera_ViewProjectionMatrixChanged;
            Camera.ViewMatrixChanged           += Camera_ViewMatrixChanged;
            Camera.Viewport.ViewportChanged    += Viewport_ViewportChanged;

            GL.ClearColor(Color.FromArgb(~Colours.Green.ToArgb( )));
            GL.FrontFace(FrontFaceDirection.Ccw);
            GL.Disable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);
            GL.PointSize(5.0f);
        }