Ejemplo n.º 1
0
 public static RenderTargetRenderer MakeRenderTargetRenderer(string name, RenderTargetSettings settings, int priority)
 {
     if (renderTargetInstances == null)
     {
         renderTargetInstances = new Dictionary <string, RenderTargetRenderer>();
     }
     //check if there is already an instance of this renderer
     if (renderTargetInstances.ContainsKey(name))
     {
         return(renderTargetInstances[name]);
     }
     else
     {
         //there is not a rendertargetrenderer so check to see if there is a rendertarget
         if (Resources.CheckForAsset(name, new RenderTarget2DWrapper().GetType()))
         {
             //make a new rendertargetrenderer with the rendertarget found
             return(new RenderTargetRenderer(priority, name, settings, Resources.GetRenderTarget2D(name)));
         }
         else
         {
             //no rendertarget found so make a new rendertargetrenderer with a new rendertarget with the name specified
             return(new RenderTargetRenderer(priority, name, settings, Resources.LoadRenderTarget2D(name, SceneManager.activeScene, GraphicsHelper.screen.Width, GraphicsHelper.screen.Height, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.DiscardContents, new RenderTargetSettings())));
         }
     }
 }
Ejemplo n.º 2
0
        public RenderTargetBatch(string name, RenderTarget2DWrapper renderTarget, RenderTargetSettings settings)
        {
            callbacks         = new List <DrawCallback>();
            Name              = name;
            this.renderTarget = renderTarget;

            if (settings == null)
            {
                this.settings = new RenderTargetSettings();
            }
            else
            {
                this.settings = settings;
            }
        }
Ejemplo n.º 3
0
        internal RenderTargetRenderer(int priority, string name, RenderTargetSettings settings, RenderTarget2D renderable, RenderTarget2D target = null) : base(name)
        {
            if (target == null)
            {
                target = Resources.GetRenderTarget2D("screen");
            }

            this.target     = target;
            this.renderable = renderable;
            this.priority   = priority;
            this.settings   = settings;

            RenderManager.RegisterDrawCallback(new RenderManager.RenderTargetDrawCallback(Draw), this);

            if (renderTargetInstances == null)
            {
                renderTargetInstances = new Dictionary <string, RenderTargetRenderer>();
            }

            renderTargetInstances.Add(name, this);
        }