public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings) { if (this.FEnabled[0]) { if (this.FPassLayerIn.IsConnected) { var hint = settings.RenderHint; settings.RenderHint = eRenderHint.ApplyOnly; for (int i = 0; i < this.FPassLayerIn.SliceCount; i++) { this.FPassLayerIn[i][context].Render(this.FPassLayerIn.PluginIO, context, settings); } settings.RenderHint = hint; } if (this.FLayerIn.IsConnected) { 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); } } } }
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 DisconnectPin(IPluginIO pin) { if (pin == this.FInRuntime.PluginIO) { this.FInvalidateConnect = true; } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FInvalidate) { for (int i = 0; i < FTextureOutput.SliceCount; i++) { if (this.FTextureOutput[i].Contains(context)) { this.FTextureOutput[i].Dispose(context); } try { int p = unchecked((int) this.FPointer[i]); IntPtr share = new IntPtr(p); Texture2D tex = context.Device.OpenSharedResource<Texture2D>(share); ShaderResourceView srv = new ShaderResourceView(context.Device, tex); DX11Texture2D resource = DX11Texture2D.FromTextureAndSRV(context, tex, srv); this.FTextureOutput[i][context] = resource; this.FValid[i] = true; } catch (Exception) { this.FValid[i] = false; } } this.FInvalidate = false; } }
public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings) { if (this.FLayerIn.IsConnected) { bool allow = false; for (int i = 0; i < this.FViewPortIndex.SliceCount;i++) { if (this.FViewPortIndex[i] < 0) { allow = true; } else if (this.FViewPortIndex[i] % settings.ViewportCount == settings.ViewportIndex) { allow = true; } } if (allow) { 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) { Device device = context.Device; if (invalidate) { for (int i = 0; i < this.FOutGeom.SliceCount; i++) { if (this.FInEnabled[i]) { DX11IndexedGeometry v = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy(); DX11PerVertexIndexedDrawer drawer = new DX11PerVertexIndexedDrawer(); v.AssignDrawer(drawer); this.FOutGeom[i][context] = v; } else { this.FOutGeom[i][context] = this.FInGeom[i][context]; } } } }
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; }
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) { foreach (var processor in FProcessor) { processor.UpdateTexture(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; } } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.FOutBuffer[0] != null) { this.FOutBuffer[0].Dispose(context); } }
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) { 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; } }
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); } } } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { for (int i = 0; i < this.FOutput.SliceCount; i++) { this.FOutput[i].Dispose(context); } }
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; } }
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 Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings) { IDX11Geometry g = settings.Geometry; if (this.FEnabled[0]) { if (this.FLayerIn.PluginIO.IsConnected) { IDX11Geometry geom = settings.Geometry; settings.Geometry = null; if (settings.BackBuffer is IDX11Buffer) { IDX11Buffer buffer = settings.BackBuffer as IDX11Buffer; if (buffer.Buffer.Description.OptionFlags.HasFlag(ResourceOptionFlags.DrawIndirect)) { this.dispatcher.DispatchBuffer = buffer.Buffer; this.dispatcher.Offet = this.FInOffset[0]; settings.Geometry = this.geometry; } } this.FLayerIn[0][context].Render(this.FLayerIn.PluginIO, context, settings); settings.Geometry = geom; } } settings.Geometry = g; }
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 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); } } } }
public void DisconnectPin(IPluginIO pin) { if (pin == this.FWorld.PluginIO) { this.OnWorldDiconnected(); } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { foreach (var processor in FProcessor) { processor.DestroyTexture(context); } }
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) { 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); } } }
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); }
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; } } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.FOutBody.SliceCount > 0) { this.FOutBody[0].Dispose(context); } }
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]; } } } }
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 Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings) { if (this.FEnabled[0]) { bool bck = settings.PreserveShaderStages; settings.PreserveShaderStages = true; if (this.FLayerIn.IsConnected) { for (int i = 0; i < this.FLayerIn.SliceCount; i++) { this.FLayerIn[i][context].Render(this.FLayerIn.PluginIO, context, settings); } } settings.PreserveShaderStages = bck; } 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 DisconnectPin(IPluginIO Pin) { //reset the cached reference to the upstream interface when the NodeInput is being disconnected if (Pin == FPinInConnection) { FConnectionObject = null; } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.settings.ContainsKey(context)) { this.OnDestroy(context); this.settings.Remove(context); } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.FOutLinkBuffer[0] != null || this.FOutOffsetBuffer[0] != null) { this.FOutLinkBuffer[0].Dispose(context); this.FOutOffsetBuffer[0].Dispose(context); } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (!this.FOutLayer[0].Contains(context)) { this.FOutLayer[0][context] = new DX11Layer(); this.FOutLayer[0][context].Render = this.Render; } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.deviceshaderdata.ContainsKey(context)) { this.deviceshaderdata[context].Dispose(); this.deviceshaderdata.Remove(context); } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (!this.FOutput[0].Contains(context)) { this.BuildBuffer(context, KinectRuntime.SKELETON_INDICES, this.FOutput); this.BuildBuffer(context, KinectRuntime.SKELETON_ARMS, this.FOutArmsGeom); this.BuildBuffer(context, KinectRuntime.SKELETON_LEGS, this.FOutLegsGeom); } }
public DX11OutputPin(DX11Node parentnode, IPin hdePin, IPluginIO pluginIO) : base(parentnode, hdePin, pluginIO) { this.ChildrenPins = new List <DX11InputPin>(); this.ParentNode.OutputPins.Add(this); INodeOut nodeout = (INodeOut)this.PluginIO; this.isFeedBackPin = nodeout.AllowFeedback; }
public Pin(IIOFactory factory, IPluginIO pluginIO, BufferedIOStream <T> stream) : base(stream) { FFactory = factory; FPluginIO = pluginIO; FFactory.Connected += HandleConnected; FFactory.Disconnected += HandleDisconnected; }
public void Update(IPluginIO pin, DX11RenderContext context) { Device device = context.Device; if (this.updateddevices.Contains(context)) { return; } int samplecount = Convert.ToInt32(FInAASamplesPerPixel[0].Name); SampleDescription sd = new SampleDescription(samplecount, 0); if (this.FResized || this.FInvalidateSwapChain || this.FOutBackBuffer[0][context] == null) { this.FOutBackBuffer[0].Dispose(context); List <SampleDescription> sds = context.GetMultisampleFormatInfo(Format.R8G8B8A8_UNorm); int maxlevels = sds[sds.Count - 1].Count; if (sd.Count > maxlevels) { logger.Log(LogType.Warning, "Multisample count too high for this format, reverted to: " + maxlevels); sd.Count = maxlevels; } this.FOutBackBuffer[0][context] = new DX11SwapChain(context, this.Handle, Format.R8G8B8A8_UNorm, sd, 60, this.FInBufferCount[0]); #if DEBUG this.FOutBackBuffer[0][context].Resource.DebugName = "BackBuffer"; #endif this.depthmanager.NeedReset = true; } DX11SwapChain sc = this.FOutBackBuffer[0][context]; if (this.FResized) { //if (!sc.IsFullScreen) //{ // sc.Resize(); // } //this.FInvalidateSwapChain = true; } if (!this.renderers.ContainsKey(context)) { this.renderers.Add(context, new DX11GraphicsRenderer(this.FHost, context)); } this.depthmanager.Update(context, sc.Width, sc.Height, sd); this.updateddevices.Add(context); }
public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings) { 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 ConnectPin(IPluginIO Pin) { //cache a reference to the upstream interface when the NodeInput pin is being connected if (Pin == FPinInConnection) { object usI; FPinInConnection.GetUpstreamInterface(out usI); FConnectionObject = usI as AbstractDbConnection <D>; } }
public void Destroy(IPluginIO pin, FeralTic.DX11.DX11RenderContext context, bool force) { for (int i = 0; i < this.FTextureOut.SliceCount; i++) { if (this.FTextureOut[i] != null) { this.FTextureOut[i].Dispose(context); } } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FInvalidate || !this.FOutput[0].Contains(context)) { int count = this.ffixed ? this.FCount.IOObject[0] : this.FInData.SliceCount; if (this.FOutput[0].Contains(context)) { if (this.FOutput[0][context].ElementCount != count) { this.FOutput[0].Dispose(context); } } if (!this.FOutput[0].Contains(context)) { if (count > 0) { this.FOutput[0][context] = new DX11DynamicStructuredBuffer <T>(context, count); this.FValid[0] = true; } else { this.FValid[0] = false; return; } } DX11DynamicStructuredBuffer <T> b = this.FOutput[0][context]; if (this.tempbuffer.Length != count) { Array.Resize <T>(ref this.tempbuffer, count); } //If fixed or if size is the same, we can do a direct copy bool needconvert = ((this.ffixed && count != this.FInData.SliceCount)) || this.NeedConvert; try { if (needconvert) { this.WriteArray(count); b.WriteData(this.tempbuffer); } else { b.WriteData(this.FInData.Stream.Buffer, 0, this.FInData.SliceCount); } } catch (Exception ex) { } } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FInvalidate || this.FEmpty) { for (int i = 0; i < this.scenes.Count; i++) { if (scenes[i] != null) { AssimpScene scene = scenes[i]; for (int j = 0; j < scene.MeshCount; j++) { AssimpMesh assimpmesh = scene.Meshes[j]; DataStream vS = assimpmesh.Vertices; vS.Position = 0; List <int> inds = assimpmesh.Indices; if (inds.Count > 0 && assimpmesh.VerticesCount > 0) { var vertices = new SlimDX.Direct3D11.Buffer(context.Device, vS, new BufferDescription() { BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None, SizeInBytes = (int)vS.Length, Usage = ResourceUsage.Default }); var indexstream = new DataStream(inds.Count * 4, true, true); indexstream.WriteRange(inds.ToArray()); indexstream.Position = 0; DX11IndexedGeometry geom = new DX11IndexedGeometry(context); geom.VertexBuffer = vertices; geom.IndexBuffer = new DX11IndexBuffer(context, indexstream, false, true); geom.InputLayout = assimpmesh.GetInputElements().ToArray(); geom.Topology = PrimitiveTopology.TriangleList; geom.VerticesCount = assimpmesh.VerticesCount; geom.VertexSize = assimpmesh.CalculateVertexSize(); geom.HasBoundingBox = true; geom.BoundingBox = assimpmesh.BoundingBox; this.FOutGeom[i][j][context] = geom; } } } } this.FEmpty = false; this.FInvalidate = false; } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { //if (this.FDepthManager != null) { this.FDepthManager.Dispose(); } if (this.renderers.ContainsKey(context)) { this.renderers.Remove(context); } this.FOutBackBuffer[0].Dispose(context); }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FInvalidate || !this.FOutput[0].Data.ContainsKey(context)) { for (int i = 0; i < this.FOutput.SliceCount; i++) { if (this.FOutput[i].Contains(context)) { this.FOutput[i].Dispose(context); } } for (int i = 0; i < this.FOutput.SliceCount; i++) { Pos4Norm3Tex2Vertex[] vertices = this.FVertex[i]; int[] indices = this.FIndices[i]; DataStream ds = new DataStream(vertices.Length * Pos4Norm3Tex2Vertex.VertexSize, true, true); ds.Position = 0; ds.WriteRange(vertices); ds.Position = 0; var vbuffer = new SlimDX.Direct3D11.Buffer(context.Device, ds, new BufferDescription() { BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None, SizeInBytes = (int)ds.Length, Usage = ResourceUsage.Default }); ds.Dispose(); var indexstream = new DataStream(indices.Length * 4, true, true); indexstream.WriteRange(indices); indexstream.Position = 0; DX11IndexedGeometry geom = new DX11IndexedGeometry(context); geom.VertexBuffer = vbuffer; geom.IndexBuffer = new DX11IndexBuffer(context, indexstream, false, true); geom.InputLayout = Pos4Norm3Tex2Vertex.Layout; geom.Topology = PrimitiveTopology.TriangleList; geom.VerticesCount = vertices.Length; geom.VertexSize = Pos4Norm3Tex2Vertex.VertexSize; geom.HasBoundingBox = false; this.FOutput[i][context] = geom; } } this.FInvalidate = false; }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.FOutNodes.SliceCount > 0) { if (this.FOutNodes[0] != null) { this.FOutNodes[0].Dispose(context); this.FOutNodes[0] = null; } } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FInvalidate || !this.FOutput[0].Data.ContainsKey(context)) { for (int i = 0; i < oldSpreadMax; i++) { DX11IndexedGeometry geom = this.GetGeom(context, i); this.FOutput[i][context] = geom; } } }
public void Update(IPluginIO pin, DX11RenderContext context) { Device device = context.Device; if (this.updateddevices.Contains(context)) { return; } SampleDescription sd = new SampleDescription(1, 0); if (this.FResized || this.FInvalidateSwapChain || this.swapchain == null) { if (this.swapchain != null) { this.swapchain.Dispose(); } this.swapchain = new DX11SwapChain(context, this.form.Handle, Format.R8G8B8A8_UNorm, sd, this.FInRate[0]); } if (this.renderer == null) { this.renderer = new DX11GraphicsRenderer(this.FHost, context); } this.updateddevices.Add(context); if (this.FInFullScreen[0] != this.swapchain.IsFullScreen) { if (this.FInFullScreen[0]) { this.prevx = this.form.Width; this.prevy = this.form.Height; /*Screen screen = Screen.FromControl(this.form);*/ this.form.FormBorderStyle = FormBorderStyle.None; this.form.Width = Convert.ToInt32(this.FInRes[0].X); this.form.Height = Convert.ToInt32(this.FInRes[0].Y); this.swapchain.Resize(); this.swapchain.SetFullScreen(true); this.setfull = false; } else { this.swapchain.SetFullScreen(false); this.form.FormBorderStyle = FormBorderStyle.Fixed3D; this.form.Width = this.prevx; this.form.Height = this.prevy; this.swapchain.Resize(); } } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FTextureInput.PluginIO.IsConnected) { this.FTextureOutput[0][context] = this.FTextureInput[0][context].Stencil; } else { this.FTextureOutput[0].Data.Remove(context); } }
public InputBinSpreadStream(IIOFactory ioFactory, InputAttribute attribute, bool checkIfChanged, Func <IIOContainer <IInStream <int> > > binSizeIOContainerFactory) { // Don't do this, as spread max won't get computed for this pin // attribute.AutoValidate = false; attribute.CheckIfChanged = checkIfChanged; FDataContainer = ioFactory.CreateIOContainer <IInStream <T> >(attribute, false); FBinSizeContainer = binSizeIOContainerFactory(); FDataStream = FDataContainer.IOObject; FBinSizeStream = FBinSizeContainer.IOObject; FDataIO = FDataContainer.GetPluginIO(); }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.renderers.ContainsKey(context)) { this.renderers.Remove(context); } this.depthmanager.Destroy(context); this.OnDestroy(context, force); }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (force || !this.FInKeep[0]) { if (this.pools.ContainsKey(context)) { this.pools[context].Dispose(); this.pools.Remove(context); } } }
public void Destroy(IPluginIO pin, DX11RenderContext context, bool force) { if (this.FOutGeom[0] != null) { this.FOutGeom[0].Dispose(context); } if (this.FOutBuffer[0] != null) { this.FOutBuffer[0].Dispose(context); } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.lasttexture != null) { this.FTextureOutput[0][context] = this.lasttexture; } else { this.FTextureOutput[0].Dispose(context); } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (this.FTextureOutput.SliceCount == 0 || !FTexIn.IsConnected || !FTexIn[0].Contains(context)) { return; } if (FTexIn.IsConnected) { ArrayCount = FTexIn[0][context].ElemCnt; for (int i = 0; i < numSlicesOut; i++) { int slice = VMath.Zmod(FIndex[i], ArrayCount); Texture2DDescription descIn; Texture2DDescription descOut; if (this.FTextureOutput[i].Contains(context)) { descIn = FTexIn[0][context].Resource.Description; descOut = this.FTextureOutput[i][context].Resource.Description; if (/*FIndex.IsChanged ||*/ descIn.Format != descOut.Format || descIn.Width != descOut.Width || descIn.Height != descOut.Height) { //this.logger.Log(LogType.Message, "init slice " + i); InitTexture(context, i, descIn); } } else { //InitTexture(context, i, descIn); this.FTextureOutput[i][context] = new DX11Texture2D(); } descIn = this.FTexIn[0][context].Resource.Description; if (this.FTextureOutput[i][context].Resource == null) { //this.logger.Log(LogType.Message, "init slice " + i); InitTexture(context, i, descIn); } SlimDX.Direct3D11.Resource source = this.FTexIn[0][context].Resource; SlimDX.Direct3D11.Resource destination = this.FTextureOutput[i][context].Resource; int sourceSubres = SlimDX.Direct3D11.Texture2D.CalculateSubresourceIndex(0, slice, descIn.MipLevels); int destinationSubres = SlimDX.Direct3D11.Texture2D.CalculateSubresourceIndex(0, 0, 1); //this.logger.Log(LogType.Message, "get slice " + slice + " into " + i); context.CurrentDeviceContext.CopySubresourceRegion(source, sourceSubres, destination, destinationSubres, 0, 0, 0); } } }
public void Render(IPluginIO pin, DX11RenderContext context, DX11RenderSettings settings) { if (this.FLayerIn.PluginIO.IsConnected) { bool current = settings.ResetCounter; settings.ResetCounter = this.FInReset[0]; this.FLayerIn[0][context].Render(this.FLayerIn.PluginIO, context, settings); settings.ResetCounter = current; } }
public void Update(IPluginIO pin, DX11RenderContext context) { if (!this.swapchain.Contains(context)) { this.swapchain[context] = new DX11SwapChain(context, this.Handle, SlimDX.DXGI.Format.R8G8B8A8_UNorm, new SampleDescription(1, 0)); } if (this.resized) { this.swapchain[context].Resize(); } }
public unsafe void Update(IPluginIO pin, DX11RenderContext context) { if (this.FInvalidate || !this.FTextureOutput[0].Contains(context)) { SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.R32G32B32A32_Float; Texture2DDescription desc; if (this.FTextureOutput[0].Contains(context)) { desc = this.FTextureOutput[0][context].Resource.Description; if (desc.Width != this.FInWidth[0] || desc.Height != this.FInHeight[0] || desc.Format != fmt) { this.FTextureOutput[0].Dispose(context); this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.FInWidth[0], this.FInHeight[0], fmt); } } else { this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.FInWidth[0], this.FInHeight[0], fmt); } desc = this.FTextureOutput[0][context].Resource.Description; if (data.Length != desc.Width * desc.Height) { data = new Color4[desc.Width * desc.Height]; } for (int i = 0; i < data.Length; i++) { data[i] = this.FInData[i]; } var t = this.FTextureOutput[0][context]; fixed(Color4 *cp = &data[0]) { IntPtr ptr = new IntPtr(cp); if (t.GetRowPitch() == desc.Width * 16) { t.WriteData(ptr, desc.Width * desc.Height * 16); } else { t.WriteDataPitch(ptr, desc.Width * desc.Height * 16, 16); } } this.FInvalidate = false; } }