public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;

            if (invalidate)
            {
                for (int i = 0; i < this.FOutGeom.SliceCount; i++)
                {
                    if (this.FInEnabled[i])
                    {

                        IDX11Geometry copy = this.FInGeom[i][context].ShallowCopy();
                        if (copy is DX11IndexedGeometry)
                        {
                            DX11DefaultIndexedDrawer drawer = new DX11DefaultIndexedDrawer();
                            ((DX11IndexedGeometry)copy).AssignDrawer(drawer);
                        }
                        else if (copy is DX11VertexGeometry)
                        {
                            DX11DefaultVertexDrawer drawer = new DX11DefaultVertexDrawer();
                            ((DX11VertexGeometry)copy).AssignDrawer(drawer);
                        }

                        this.FOutGeom[i][context] = copy;

                    }
                    else
                    {
                        this.FOutGeom[i][context] = this.FInGeom[i][context];
                    }

                }
            }
        }
 protected override void BeforeRender(DX11GraphicsRenderer renderer, DX11RenderContext context)
 {
     renderer.EnableDepth = this.FInDepthBuffer[0];
     renderer.DepthStencil = this.depthmanager.GetDepthStencil(context);
     renderer.DepthMode = this.depthmanager.Mode;
     renderer.SetRenderTargets(targets[context]);
 }
示例#3
0
 public void Destroy(IPluginIO pin, DX11RenderContext context, bool force)
 {
     if (this.FOutBuffer[0] != null)
     {
         this.FOutBuffer[0].Dispose(context);
     }
 }
		public void Update(IPluginIO pin, DX11RenderContext context)
		{
			foreach (var processor in FProcessor)
			{
				processor.UpdateTexture(context);
			}
		}
        public void Render(DX11RenderContext context)
        {
            if (!this.FInLayer.IsConnected && this.AllowEmptyLayer == false) { return; }

            if (this.rendereddevices.Contains(context)) { return; }

            if (!this.updateddevices.Contains(context))
            {
                this.Update(null, context);
            }

            if (this.FInEnabled[0])
            {
                DX11RenderSettings rs = this.settings[context];

                this.PreRender(context, rs);

                for (int j = 0; j < this.FInLayer.SliceCount; j++)
                {
                    this.FInLayer[j][context].Render(this.FInLayer.PluginIO, context, rs);
                }

                this.PostRender(context);
            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            for (int i = 0; i < this.FIn.SliceCount; i++)
            {
                IDX11Geometry geom = this.FIn[i][context];

                if (geom is DX11IndexedGeometry)
                {
                    DX11IndexedGeometry g = (DX11IndexedGeometry)geom;
                    this.FOutBuffer[i][context] = g.IndexBuffer;
                    this.FOutValid[i] = true;
                }
                else if (geom is DX11IndexOnlyGeometry)
                {
                    DX11IndexOnlyGeometry g = (DX11IndexOnlyGeometry)geom;
                    this.FOutBuffer[i][context] = g.IndexBuffer;
                    this.FOutValid[i] = true;
                }
                else
                {
                    this.FOutBuffer[i][context] = null;
                    this.FOutValid[i] = false;
                }

            }
        }
        /*[Input("Size",DefaultValues= new double[] { 1,1,1})]
        IDiffSpread<Vector3> FSize;*/
        protected override DX11IndexedGeometry GetGeom(DX11RenderContext context, int slice)
        {
            Tetrahedron settings = new Tetrahedron();
            settings.Size = new Vector3(1, 1, 1);

            return context.Primitives.Tetrahedron(settings);
        }
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                IDX11LayerOrder currentOrder = settings.LayerOrder;
                if (this.FInVal.IsConnected)
                {
                    settings.LayerOrder = this.FInVal[0];
                }

                if (this.FLayerIn.IsConnected)
                {
                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }

                settings.LayerOrder = currentOrder;
            }
            else
            {
                if (this.FLayerIn.IsConnected)
                {
                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }
            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                if (this.FInEnabled[i])
                {
                    if (this.FInVCnt.IsChanged || this.FInICnt.IsChanged)
                    {
                        this.FOutGeom[i].Dispose(context);

                        this.FOutGeom[i][context] = new DX11NullGeometry(context);

                        DX11NullIndirectDrawer ind = new DX11NullIndirectDrawer();
                        ind.Update(context,this.FInVCnt[i],this.FInICnt[i]);
                        this.FOutGeom[i][context].AssignDrawer(ind);

                    }

                    DX11NullIndirectDrawer drawer = (DX11NullIndirectDrawer)this.FOutGeom[i][context].Drawer;

                    if (this.FInI.PluginIO.IsConnected)
                    {
                        drawer.IndirectArgs.CopyInstanceCount(context.CurrentDeviceContext, this.FInI[i][context].UAV);
                    }

                    if (this.FInV.PluginIO.IsConnected)
                    {
                        drawer.IndirectArgs.CopyVertexCount(context.CurrentDeviceContext, this.FInV[i][context].UAV);
                    }

                    //this.FOutGeom[i][context] = geom;
                }
            }
        }
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                List<IDX11ObjectValidator> valids = new List<IDX11ObjectValidator>();
                if (this.FInVal.PluginIO.IsConnected)
                {
                    for (int i = 0; i < this.FInVal.SliceCount; i++)
                    {
                        if (this.FInVal[i].Enabled)
                        {
                            IDX11ObjectValidator v = this.FInVal[i];
                            //v.Reset();
                            v.SetGlobalSettings(settings);

                            valids.Add(v);
                            settings.ObjectValidators.Add(v);
                        }
                    }
                }

                if (this.FLayerIn.PluginIO.IsConnected)
                {
                    this.FLayerIn[0][context].Render(this.FLayerIn.PluginIO, context, settings);
                }

                foreach (IDX11ObjectValidator v in valids)
                {
                    settings.ObjectValidators.Remove(v);
                }

            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            if (this.FInvalidate)
            {
                if (srv != null) { srv.Dispose(); }
                if (tex != null) { tex.Dispose(); }

                try
                {
                    int p = unchecked((int) this.FPointer[0]);
                    tex = context.Device.OpenSharedResource<Texture2D>(new IntPtr(p));
                    srv = new ShaderResourceView(context.Device, tex);

                    DX11Texture2D resource = DX11Texture2D.FromTextureAndSRV(context, tex, srv);

                    this.FTextureOutput[0][context] = resource;

                    this.FValid[0] = true;
                }
                catch (Exception ex)
                {
                    this.FValid[0] = false;
                }

                this.FInvalidate = false;
            }
        }
示例#12
0
        protected override DX11IndexedGeometry GetGeom(DX11RenderContext context, int slice)
        {
            Quad quad = new Quad();
            quad.Size = this.FSize[slice];

            return context.Primitives.QuadCross(quad);
        }
示例#13
0
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                var rect = context.CurrentDeviceContext.Rasterizer.GetScissorRectangles();
                if (this.FLayerIn.IsConnected)
                {

                    context.CurrentDeviceContext.Rasterizer.SetScissorRectangles(this.rectangles);
                    try
                    {
                        for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                        {
                            this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                        }
                    }
                    finally
                    {
                        context.CurrentDeviceContext.Rasterizer.SetScissorRectangles(rect);
                    }
                }
            }
            else
            {
                if (this.FLayerIn.IsConnected)
                {

                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }
            }
        }
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                if (this.FLayerIn.IsConnected)
                {
                    settings.PreferredTechniques.Add(FTechnique[0].Trim().ToLower());

                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }

                    settings.PreferredTechniques.RemoveAt(settings.PreferredTechniques.Count - 1);
                }
            }
            else
            {
                if (this.FLayerIn.IsConnected)
                {
                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }
            }
        }
示例#15
0
 protected void OnEndQuery(DX11RenderContext context)
 {
     if (this.EndQuery != null)
     {
         this.EndQuery(context);
     }
 }
示例#16
0
 protected void OnBeginQuery(DX11RenderContext context)
 {
     if (this.BeginQuery != null)
     {
         this.BeginQuery(context);
     }
 }
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                if (this.FLayerIn.IsConnected)
                {
                    var currentRef = context.CurrentDeviceContext.OutputMerger.BlendFactor;

                    context.CurrentDeviceContext.OutputMerger.BlendFactor = this.FInFactor[0];

                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }

                    context.CurrentDeviceContext.OutputMerger.BlendFactor = currentRef;

                }
            }
            else
            {
                for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                {
                    this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                }
            }
        }
        /*[Input("Size",DefaultValues= new double[] { 1,1,1})]
        IDiffSpread<Vector3> FSize;*/
        protected override DX11IndexedGeometry GetGeom(DX11RenderContext context, int slice)
        {
            Isocahedron iso = new Isocahedron();
            iso.Size = new Vector3(1, 1, 1);

            return context.Primitives.Isocahedron(iso);
        }
示例#19
0
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                if (this.FLayerIn.PluginIO.IsConnected)
                {
                    List<IDX11RenderSemantic> semantics = new List<IDX11RenderSemantic>();
                    if (this.FInSemantics.PluginIO.IsConnected)
                    {
                        semantics.AddRange(this.FInSemantics);
                        settings.CustomSemantics.AddRange(semantics);
                    }

                    List<DX11Resource<IDX11RenderSemantic>> ressemantics = new List<DX11Resource<IDX11RenderSemantic>>();
                    if (this.FInResSemantics.PluginIO.IsConnected)
                    {
                        ressemantics.AddRange(this.FInResSemantics);
                        settings.ResourceSemantics.AddRange(ressemantics);
                    }

                    this.FLayerIn[0][context].Render(this.FLayerIn.PluginIO, context, settings);

                    foreach (IDX11RenderSemantic semantic in semantics)
                    {
                        settings.CustomSemantics.Remove(semantic);
                    }

                    foreach (DX11Resource<IDX11RenderSemantic> rs in ressemantics)
                    {
                        settings.ResourceSemantics.Remove(rs);
                    }

                }
            }
        }
示例#20
0
 public void Destroy(IPluginIO pin, DX11RenderContext context, bool force)
 {
     for (int i = 0; i < this.FOutput.SliceCount; i++)
     {
         this.FOutput[i].Dispose(context);
     }
 }
示例#21
0
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            IDX11Geometry g = settings.Geometry;
            if (this.FEnabled[0])
            {
                if (this.FLayerIn.IsConnected)
                {
                    if (this.FInGeometry.IsConnected)
                    {
                        settings.Geometry = this.FInGeometry[0][context];
                    }

                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }
            }
            else
            {
                if (this.FLayerIn.IsConnected)
                {
                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }
            }
            settings.Geometry = g;
        }
示例#22
0
 public DX11RenderStateStack(DX11RenderContext context)
 {
     this.context = context;
     this.defaultstate = new DX11RenderState();
     stack = new Stack<DX11RenderState>();
     this.defaultstate.Apply(context);
 }
示例#23
0
 public DX11DeviceRenderer(DX11RenderContext context, DX11Graph graph, ILogger logger)
 {
     this.logger = logger;
     this.context = context;
     this.graph = graph;
     this.DoNotDestroy = false;
 }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                DX11VertexGeometry geom = (DX11VertexGeometry)this.FInGeom[i][context].ShallowCopy();

                if (this.FInEnabled[i])
                {

                    if (this.FInGeom.IsChanged || this.FInCnt.IsChanged)
                    {
                        DX11VertexIndirectDrawer ind = new DX11VertexIndirectDrawer();
                        geom.AssignDrawer(ind);

                        ind.Update(context, this.FInCnt[i]);
                    }

                    DX11VertexIndirectDrawer drawer = (DX11VertexIndirectDrawer)geom.Drawer;

                    if (this.FInI.PluginIO.IsConnected)
                    {
                        drawer.IndirectArgs.CopyInstanceCount(context.CurrentDeviceContext, this.FInI[i][context].UAV);
                    }

                    if (this.FInV.PluginIO.IsConnected)
                    {
                        drawer.IndirectArgs.CopyVertexCount(context.CurrentDeviceContext, this.FInV[i][context].UAV);
                    }

                    this.FOutGeom[i][context] = geom;
                }
            }
        }
示例#25
0
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FLayerIn.SliceCount == 0) { return; }

            if (this.FEnabled[0])
            {
                if (this.FLayerIn.IsConnected)
                {
                    Matrix view = settings.View;
                    Matrix projection = settings.Projection;
                    Matrix vp = settings.ViewProjection;
                    bool depthonly = settings.DepthOnly;

                    this.UpdateSettings(settings);

                    for (int i = 0; i < this.FLayerIn.SliceCount;i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }

                    settings.View = view;
                    settings.Projection = projection;
                    settings.ViewProjection = vp;
                    settings.DepthOnly = depthonly;
                }
            }
            else
            {
                for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                {
                    this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                }
            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            if (this.FOutGeom.SliceCount == 0) { return; }

            if (this.dispatchBuffer == null)
            {
                this.dispatchBuffer = new DispatchIndirectBuffer(context);
            }

            if (!this.FOutGeom[0].Contains(context))
            {
                this.indirectDispatch = new DX11NullIndirectDispatcher();
                this.indirectDispatch.IndirectArgs = this.dispatchBuffer;

                DX11NullGeometry nullgeom = new DX11NullGeometry(context);
                nullgeom.AssignDrawer(this.indirectDispatch);

                this.FOutGeom[0][context] = nullgeom;
            }

            var countuav = this.FInArgBuffer[0][context];

            var argBuffer = this.dispatchBuffer.Buffer;

            int argOffset = this.FInArgOffset[0];
            ResourceRegion region = new ResourceRegion(argOffset, 0, 0, argOffset + 12, 1, 1); //Packed xyz value here
            context.CurrentDeviceContext.CopySubresourceRegion(this.FInArgBuffer[0][context].Buffer, 0, region, argBuffer, 0, 0, 0, 0);
        }
示例#27
0
        public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings)
        {
            if (this.FEnabled[0])
            {
                if (this.FLayerIn.IsConnected)
                {
                    bool popstate = false;

                    if (this.FInState.IsConnected)
                    {
                        context.RenderStateStack.Push(this.FInState[0]);
                        popstate = true;
                    }

                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }

                    if (popstate) { context.RenderStateStack.Pop(); }

                }
            }
            else
            {
                if (this.FLayerIn.IsConnected)
                {
                    for (int i = 0; i < this.FLayerIn.SliceCount; i++)
                    {
                        this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings);
                    }
                }
            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            if (this.FInvalidate)
            {
                if (this.FTextureOutput[0].Contains(context))
                {
                    this.FTextureOutput[0].Dispose(context);
                }

                try
                {
                    Texture2D tex = context.Device.OpenSharedResource<Texture2D>((IntPtr)this.FPointer[0]);
                    ShaderResourceView srv = new ShaderResourceView(context.Device, tex);

                    DX11Texture2D resource = DX11Texture2D.FromTextureAndSRV(context, tex, srv);

                    this.FTextureOutput[0][context] = resource;

                    this.FValid[0] = true;
                }
                catch (Exception ex)
                {
                    this.FValid[0] = false;
                }

                this.FInvalidate = false;
            }
        }
示例#29
0
 public void Destroy(IPluginIO pin, DX11RenderContext context, bool force)
 {
     for (int i = 0; i < this.FOutGeom.SliceCount; i++)
     {
         if (this.FOutGeom[i] != null) { this.FOutGeom[i].Dispose(context); }
     }
 }
		public void Destroy(IPluginIO pin, DX11RenderContext context, bool force)
		{
			foreach (var processor in FProcessor)
			{
				processor.DestroyTexture(context);
			}
		}
示例#31
0
 public FileTextureLoadTask(DX11RenderContext context, string path)
     : base(context)
 {
     this.path = path;
 }
 public void Destroy(FeralTic.DX11.DX11RenderContext context, bool force)
 {
     this.FTextureOutput[0].Dispose(context);
 }
示例#33
0
 public FileTexture3dLoadTask(DX11RenderContext context, string path)
     : base(context, path)
 {
 }
示例#34
0
 public DX11RenderTargetPool(DX11RenderContext context)
     : base(context)
 {
 }
示例#35
0
 public FileTexture2dLoadTask(DX11RenderContext context, string path, bool domips)
     : base(context, path)
 {
     this.domips = domips;
 }
示例#36
0
 public DX11VolumeTexturePool(DX11RenderContext context)
     : base(context)
 {
 }
示例#37
0
 public DX11DepthStencilPool(DX11RenderContext context)
     : base(context)
 {
 }
示例#38
0
 public DX11VertexBufferPool(DX11RenderContext context)
     : base(context)
 {
 }
示例#39
0
 public DX11StructuredBufferPool(DX11RenderContext context)
     : base(context)
 {
 }