/// <summary>
 /// Visits the specified renderer to collect data if required by the current Visitor derivate.
 /// </summary>
 /// <param name="renderer">The renderer.</param>
 public virtual void Visit(Renderer renderer)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderRenderer" /> class. Needs to be provided with a Renderer Component.
 /// </summary>
 /// <param name="renderer">The renderer.</param>
 public RenderRenderer(Renderer renderer)
 {
     _renderer = renderer;
     //_uColor = null;
 }
 /// <summary>
 /// Init is called upon creation of an ActionCode Object and utilizes the access to a SceneEntitie's transform and renderer objects.
 /// </summary>
 /// <param name="entity">The owner entity of this component.</param>
 public void Init(SceneEntity entity)
 {
     SceneEntity = entity;
     transform = SceneEntity.transform;
     renderer = SceneEntity.renderer;
 }
        /// <summary>
        /// Stores the renderer in internal stack.
        /// </summary>
        /// <param name="Renderer">The renderer.</param>
        private void StoreRenderer(Renderer Renderer)
        {
            _hasRenderer.Pop();

            _RendererStack.Push(Renderer);
            _hasRenderer.Push(true);
            if (HasRenderingTriple())
            {
                AddRenderJob(_mtxModelViewStack.Peek(), _meshStack.Peek(), _RendererStack.Peek());
            }
        }
 /// <summary>
 /// Visits the specified <see cref="Renderer"/> to collect data if required by the current Visitor derivate.
 /// </summary>
 /// <param name="renderer">The renderer.</param>
 public override void Visit(Renderer renderer)
 {
     if(renderer.mesh != null && renderer.material != null)
     {
         StoreMesh(renderer.mesh);
         StoreRenderer(renderer);
     }
 }
 /// <summary>
 /// Adds the render job that consists of Matrix, Renderer and Mesh to the rendering queue.
 /// </summary>
 /// <param name="matrix">The matrix.</param>
 /// <param name="mesh">The mesh.</param>
 /// <param name="renderer">The renderer.</param>
 public void AddRenderJob(float4x4 matrix, Mesh mesh, Renderer renderer)
 {
     //Console.WriteLine("_meshstack"+_meshStack.Count+"_viewstack"+_mtxModelViewStack.Count+"_renderstack"+_RendererStack.Count);
     //Console.WriteLine("_hasTransform+"+_hasTransform.Count+"_hasMesh+"+_hasMesh.Count+"_hasRenderer"+_hasRenderer.Count);
     RenderMatrix renderMatrix = new RenderMatrix(matrix);
     _queue.AddRenderJob(renderMatrix);
     RenderRenderer renderRenderer = new RenderRenderer(renderer);
     _queue.AddRenderJob(renderRenderer);
     RenderMesh renderMesh = new RenderMesh(mesh);
     _queue.AddRenderJob(renderMesh);
     //Debug.WriteLine("Transforms: "+_hasTransform.Count+" Renderers: "+_hasRenderer.Count+" Meshes: "+_hasMesh.Count);
 }