From 688b5f42e9bfe498d7af7075d4d8f4429867f3a3 Mon Sep 17 00:00:00 2001 From: Miles Macklin Date: Fri, 9 Jun 2017 13:41:15 +1200 Subject: 1.2.0.beta.1 --- demo/d3d11/diffuseRenderD3D11.h | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 demo/d3d11/diffuseRenderD3D11.h (limited to 'demo/d3d11/diffuseRenderD3D11.h') diff --git a/demo/d3d11/diffuseRenderD3D11.h b/demo/d3d11/diffuseRenderD3D11.h new file mode 100644 index 0000000..cf4231e --- /dev/null +++ b/demo/d3d11/diffuseRenderD3D11.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include + +#include "shadowMapD3D11.h" +#include "../include/NvFlex.h" +#include "../d3d/renderParamsD3D.h" +#include "shaders.h" + +#include +using namespace Microsoft::WRL; + +// vertex buffers for diffuse particles +struct DiffuseRenderBuffersD3D11 +{ + DiffuseRenderBuffersD3D11() : + m_positionsBuf(nullptr), + m_velocitiesBuf(nullptr) + { + m_numParticles = 0; + } + + ~DiffuseRenderBuffersD3D11() + { + if (m_numParticles > 0) + { + NvFlexUnregisterD3DBuffer(m_positionsBuf); + NvFlexUnregisterD3DBuffer(m_velocitiesBuf); + } + } + + int m_numParticles; + + ComPtr m_positions; + ComPtr m_velocities; + + NvFlexBuffer* m_positionsBuf; + NvFlexBuffer* m_velocitiesBuf; +}; + +struct DiffuseRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); + + void draw(const DiffuseDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, int numParticles); + + DiffuseRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr m_inputLayout; + + ComPtr m_diffuseVs; + ComPtr m_diffuseGs; + ComPtr m_diffusePs; + + ComPtr m_constantBuffer; + ComPtr m_rasterizerState; + + ComPtr m_blendState; + ComPtr m_depthStencilState; +}; -- cgit v1.2.3