public MovingGridFluid( Device device, UnorderedAccessView outputBuffer) { _device = device; _outputBuffer = outputBuffer; MarkupList = new List <MarkupTag>() { new MarkupTag("GridReadSlot", _readBufferSlot), new MarkupTag("GridWriteSlot", _writeBufferSlot), new MarkupTag("VelocityGridReadSlot", _velReadBufferSlot), new MarkupTag("VelocityGridWriteSlot", _velWriteBufferSlot), new MarkupTag("Resolution", _resolution), new MarkupTag("ObsPos", 64.0f) }; var pressureTextureA = new Texture3DAndViews(device, SlimDX.DXGI.Format.R32G32B32A32_Float, _resolution, _resolution, _resolution); var pressureTextureB = new Texture3DAndViews(device, SlimDX.DXGI.Format.R32G32B32A32_Float, _resolution, _resolution, _resolution); _massPosBuffers = new FlipFlop <Texture3DAndViews>(pressureTextureA, pressureTextureB); var velTextureA = new Texture3DAndViews(device, SlimDX.DXGI.Format.R32G32B32A32_Float, _resolution, _resolution, _resolution); var velTextureB = new Texture3DAndViews(device, SlimDX.DXGI.Format.R32G32B32A32_Float, _resolution, _resolution, _resolution); _velocityBuffers = new FlipFlop <Texture3DAndViews>(velTextureA, velTextureB); var generatedFilename = GenerateTempFile( "MovingGridFluid/MovingGridFluid.hlsl", MarkupList.Concat( OutputShader.MarkupList)); _outputShader = new OutputShader( generatedFilename, device, _resolution, outputBuffer, _massPosBuffers, _velocityBuffers, _velReadBufferSlot, _readBufferSlot, _writeBufferSlot); _updateFluidShader = new UpdateFluidShader( generatedFilename, device, _massPosBuffers, _readBufferSlot, _writeBufferSlot, _resolution, _velocityBuffers, _velReadBufferSlot, _velWriteBufferSlot); _remeshingShader = new RemeshingShader( generatedFilename, device, _massPosBuffers, _readBufferSlot, _writeBufferSlot, _resolution, _velocityBuffers, _velReadBufferSlot, _velWriteBufferSlot); _initialiseShader = new InitialiseFluidShader( generatedFilename, device, _massPosBuffers, _readBufferSlot, _writeBufferSlot, _resolution, _velocityBuffers, _velReadBufferSlot, _velWriteBufferSlot); _initialiseShader.Dispatch(); _velocityBuffers.Tick(); _massPosBuffers.Tick(); _initialiseShader.Dispatch(); }
public GridFluidSim(Device device, UnorderedAccessView outputBuffer) { MarkupList = new List <MarkupTag>() { new MarkupTag("GridReadSlot", _readBufferSlot), new MarkupTag("GridWriteSlot", _writeBufferSlot), new MarkupTag("InkReadSlot", _inkReadBufferSlot), new MarkupTag("InkWriteSlot", _inkWriteBufferSlot), new MarkupTag("Resolution", _resolution) }; var generatedFilename = GenerateTempFile( "GridFluid/GridFluid.hlsl", MarkupList.Concat( OutputShader.MarkupList)); var pressureTextureA = new Texture3DAndViews(device, SlimDX.DXGI.Format.R32G32B32A32_Float, _resolution, _resolution, _resolution); var pressureTextureB = new Texture3DAndViews(device, SlimDX.DXGI.Format.R32G32B32A32_Float, _resolution, _resolution, _resolution); _massVelBuffers = new FlipFlop <Texture3DAndViews>(pressureTextureA, pressureTextureB); var inkTextureA = new Texture3DAndViews(device, SlimDX.DXGI.Format.R8G8B8A8_SNorm, _resolution, _resolution, _resolution); var inkTextureB = new Texture3DAndViews(device, SlimDX.DXGI.Format.R8G8B8A8_SNorm, _resolution, _resolution, _resolution); _inkBuffers = new FlipFlop <Texture3DAndViews>(inkTextureA, inkTextureB); _outputShader = new OutputShader( generatedFilename, device, _resolution, outputBuffer, _massVelBuffers, _readBufferSlot, _writeBufferSlot, _inkBuffers, _inkReadBufferSlot); _transportShader = new TransportShader( generatedFilename, device, _massVelBuffers, _readBufferSlot, _writeBufferSlot, _inkBuffers, _inkReadBufferSlot, _inkWriteBufferSlot, _resolution); _pressureStep = new PressureShader( generatedFilename, device, _massVelBuffers, _readBufferSlot, _writeBufferSlot, _inkBuffers, _inkWriteBufferSlot, _resolution); }